slightly better return implementation

This commit is contained in:
Torsten Ruger 2014-08-26 16:12:20 +03:00
parent dd0674c7dd
commit 714cd2a5d6

View File

@ -3,8 +3,12 @@ module Register
def run block
block.codes.dup.each do |code|
next unless code.is_a? Virtual::MethodReturn
# call = RegisterMachine.instance.call( code.method )
block.replace(code , [] )
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] )
end
end
end