2014-08-26 11:05:49 +02:00
|
|
|
module Register
|
|
|
|
class ReturnImplementation
|
|
|
|
def run block
|
|
|
|
block.codes.dup.each do |code|
|
|
|
|
next unless code.is_a? Virtual::MethodReturn
|
2014-08-26 15:12:20 +02:00
|
|
|
to = RegisterReference.new(:r0)
|
|
|
|
tmp = RegisterReference.new(:r5)
|
|
|
|
pc = RegisterReference.new(:pc)
|
|
|
|
move1 = RegisterMachine.instance.ldr( to , tmp , 3 ) #TODO 3 == return reg, needs constant / layout
|
|
|
|
move2 = RegisterMachine.instance.ldr( pc , tmp )
|
|
|
|
block.replace(code , [move1,move2] )
|
2014-08-26 11:05:49 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
Virtual::BootSpace.space.add_pass_after ReturnImplementation , CallImplementation
|
|
|
|
end
|