Class: CastOff::Compiler::SimpleIR::ParamIR

Inherits:
IR
  • Object
show all
Defined in:
lib/cast_off/compile/ir/param_ir.rb

Instance Attribute Summary collapse

Attributes inherited from IR

#alias, #insn

Instance Method Summary collapse

Methods inherited from IR

#add_sampling_variable, #alive, #alive?, #dispatch_method?, #generate_guard, #get_definition, #get_definition_str, #get_usage, #get_variable, #inlining_target?, #propergate_guard_usage, #sampling_variable, #set_info, #vanish, #vanish?

Methods included from Util

#bug, #dlog, #todo, #vlog

Constructor Details

#initialize(val, insn, cfg) ⇒ ParamIR

Returns a new instance of ParamIR.



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/cast_off/compile/ir/param_ir.rb', line 7

def initialize(val, insn, cfg)
  super(insn, cfg)
  @param_value = val
  @values = [@param_value]
  @variables = []
  @variables_without_result = []
  if @param_value.is_a?(Variable)
    @variables << @param_value
    @variables_without_result << @param_value
  end
  @result_variable = nil
  @need_guard = nil
end

Instance Attribute Details

#param_valueObject (readonly)

Returns the value of attribute param_value.



6
7
8
# File 'lib/cast_off/compile/ir/param_ir.rb', line 6

def param_value
  @param_value
end

#result_variableObject (readonly)

Returns the value of attribute result_variable.



6
7
8
# File 'lib/cast_off/compile/ir/param_ir.rb', line 6

def result_variable
  @result_variable
end

#valuesObject (readonly)

Returns the value of attribute values.



6
7
8
# File 'lib/cast_off/compile/ir/param_ir.rb', line 6

def values
  @values
end

#variablesObject (readonly)

Returns the value of attribute variables.



6
7
8
# File 'lib/cast_off/compile/ir/param_ir.rb', line 6

def variables
  @variables
end

#variables_without_resultObject (readonly)

Returns the value of attribute variables_without_result.



6
7
8
# File 'lib/cast_off/compile/ir/param_ir.rb', line 6

def variables_without_result
  @variables_without_result
end

Instance Method Details

#mark(defs) ⇒ Object



64
65
66
# File 'lib/cast_off/compile/ir/param_ir.rb', line 64

def mark(defs)
  alive? && defs.mark(@param_value)
end

#need_guard(bool) ⇒ Object



51
52
53
# File 'lib/cast_off/compile/ir/param_ir.rb', line 51

def need_guard(bool)
  @need_guard = !!bool
end

#propergate_boxed_value(defs) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/cast_off/compile/ir/param_ir.rb', line 26

def propergate_boxed_value(defs)
  change = false

  # forward
  change |= defs.propergate_boxed_value_forward(@param_value)

  # backward
  change |= defs.propergate_boxed_value_backward(@param_value) if @param_value.boxed?

  change
end

#propergate_exact_class(defs) ⇒ Object

unboxing end ###



39
40
41
# File 'lib/cast_off/compile/ir/param_ir.rb', line 39

def propergate_exact_class(defs)
  defs.exact_class_resolve(@param_value)
end

#resetObject



55
56
57
58
# File 'lib/cast_off/compile/ir/param_ir.rb', line 55

def reset()
  @need_guard = nil
  super()
end

#standard_guard_targetObject



60
61
62
# File 'lib/cast_off/compile/ir/param_ir.rb', line 60

def standard_guard_target()
  need_guard? ? @param_value : nil
end

#to_cObject



43
44
45
# File 'lib/cast_off/compile/ir/param_ir.rb', line 43

def to_c()
  bug()
end

#type_propergation(defs) ⇒ Object



47
48
49
# File 'lib/cast_off/compile/ir/param_ir.rb', line 47

def type_propergation(defs)
  defs.type_resolve(@param_value)
end

#unboxing_preludeObject

unboxing begin ###



22
23
24
# File 'lib/cast_off/compile/ir/param_ir.rb', line 22

def unboxing_prelude()
  # nothing to do
end