Torsten Rüger
9a2716280c
Since they were embedded at first (easier copy/paste) they now got own files, like their brethren also mini tests for each instruction , nice start
20 lines
542 B
Ruby
20 lines
542 B
Ruby
module Mom
|
|
module Builtin
|
|
class Div4 < ::Mom::Instruction
|
|
def to_risc(compiler)
|
|
builder = compiler.builder(compiler.source)
|
|
integer_tmp = builder.allocate_int
|
|
builder.build do
|
|
integer_self! << message[:receiver]
|
|
integer_self.reduce_int
|
|
integer_1! << 2
|
|
integer_self.op :>> , integer_1
|
|
integer_tmp[Parfait::Integer.integer_index] << integer_self
|
|
message[:return_value] << integer_tmp
|
|
end
|
|
return compiler
|
|
end
|
|
end
|
|
end
|
|
end
|