lib/furnace/ssa/generic_instruction.rb in furnace-0.4.0.beta.1 vs lib/furnace/ssa/generic_instruction.rb in furnace-0.4.0.beta.2
- old
+ new
@@ -1,14 +1,21 @@
module Furnace
class SSA::GenericInstruction < SSA::Instruction
attr_reader :type
- def initialize(basic_block, type=nil, uses=[], name=basic_block.function.make_name)
- super(basic_block, uses, name)
- self.type = type
+ def initialize(type, operands=[], name=nil)
+ @type = type.to_type
+
+ super(operands, name)
end
def type=(type)
- @type = type.to_type if type
+ @type = type.to_type
+
+ SSA.instrument(self)
end
+
+ def replace_type_with(type, replacement)
+ self.type = self.type.replace_type_with(type, replacement)
+ end
end
-end
\ No newline at end of file
+end