rubyx/lib/slot_machine/macro/div4.rb

19 lines
594 B
Ruby

module SlotMachine
class Div4 < Macro
def to_risc(compiler)
builder = compiler.builder(compiler.source)
integer_tmp = builder.allocate_int
integer_1 = builder.register( :integer_1 )
integer_self = builder.register( :integer_self )
builder.build do
integer_self = message[:receiver].reduce_int(false)
load_object( 2 , integer_1)
result = integer_self.op :>> , integer_1
integer_tmp[Parfait::Integer.integer_index] << result.result
message[:return_value] << integer_tmp
end
return compiler
end
end
end