fixing register order in some instructions
and their use Arm is confusing as it has result as first arg we use forward logic, i.e. from -> to
This commit is contained in:
parent
add79e5157
commit
97b4c469f8
@ -4,7 +4,9 @@ module Arm
|
||||
def run block
|
||||
block.codes.dup.each do |code|
|
||||
next unless code.is_a? Register::GetSlot
|
||||
load = ArmMachine.ldr( code.register , code.array , code.index )
|
||||
# times 4 because arm works in bytes, but vm in words
|
||||
# + 1 because of the type word
|
||||
load = ArmMachine.ldr( code.register , code.array , 4 * (code.index + 1) )
|
||||
block.replace(code , load )
|
||||
end
|
||||
end
|
||||
|
@ -4,7 +4,9 @@ module Arm
|
||||
def run block
|
||||
block.codes.dup.each do |code|
|
||||
next unless code.is_a? Register::SetSlot
|
||||
store = ArmMachine.str( code.register , code.array , code.index )
|
||||
# times 4 because arm works in bytes, but vm in words
|
||||
# + 1 because of the type word
|
||||
store = ArmMachine.str( code.register , code.array , 4 * (code.index + 1) )
|
||||
block.replace(code , store )
|
||||
end
|
||||
end
|
||||
|
@ -4,7 +4,9 @@ module Arm
|
||||
def run block
|
||||
block.codes.dup.each do |code|
|
||||
next unless code.is_a? Register::RegisterTransfer
|
||||
move = ArmMachine.mov( code.from , code.to )
|
||||
# Register machine convention is from => to
|
||||
# But arm has the receiver/result as the first
|
||||
move = ArmMachine.mov( code.to , code.from)
|
||||
block.replace(code , move )
|
||||
end
|
||||
end
|
||||
|
@ -62,7 +62,7 @@ module Builtin
|
||||
# get the sys return out of the way
|
||||
return_tmp = Register::RegisterReference.tmp_reg
|
||||
# load the space into the base register
|
||||
function.info.add_code Register::RegisterTransfer.new( Virtual::Slot::MESSAGE_REGISTER , return_tmp )
|
||||
function.info.add_code Register::RegisterTransfer.new( return_tmp , Virtual::Slot::MESSAGE_REGISTER )
|
||||
slot = Virtual::Slot
|
||||
# find the stored message
|
||||
ind = Parfait::Space.object_space.get_layout().index_of( :syscall_message )
|
||||
|
@ -8,8 +8,14 @@ module Register
|
||||
# Get/Set Slot move data around in vm objects, but transfer moves the objects (in the machine)
|
||||
#
|
||||
# Also it is used for moving temorary data
|
||||
#
|
||||
|
||||
class RegisterTransfer < Instruction
|
||||
# initialize with from and to registers.
|
||||
# First argument from
|
||||
# second arguemnt to
|
||||
#
|
||||
# Note: this may be reversed from some assembler notations (also arm)
|
||||
def initialize from , to
|
||||
@from = wrap_register(from)
|
||||
@to = wrap_register(to)
|
||||
|
@ -41,7 +41,7 @@ module Register
|
||||
# load the frame/message from space by index
|
||||
new_codes << GetSlot.new( space_tmp , 5 , frame_tmp )
|
||||
# save the frame in real frame register
|
||||
new_codes << RegisterTransfer.new( RegisterReference.frame_reg , frame_tmp )
|
||||
new_codes << RegisterTransfer.new( frame_tmp , RegisterReference.frame_reg )
|
||||
# get the next_frame
|
||||
new_codes << GetSlot.new( frame_tmp , 2 , frame_tmp) # 2 index of next_frame
|
||||
# save next frame into space
|
||||
|
Loading…
Reference in New Issue
Block a user