must pass registers to slot_to_reg and reg_to_slot

as they are typed, those functions don't resolve on Risc, but the register type
miscother changes from previous commits
This commit is contained in:
Torsten Ruger
2018-07-15 16:30:50 +03:00
parent f31d22d901
commit 3bc85805a4
7 changed files with 27 additions and 28 deletions

View File

@ -14,13 +14,11 @@ module Risc
end
# Produce a RegToSlot instruction.
# From and to are registers or symbols that can be transformed to a register by resolve_to_register
# (which are precisely the symbols :message or :new_message. or a register)
# index resolves with resolve_to_index.
def self.reg_to_slot( source , from_reg , to , index )
from = resolve_to_register from_reg
index = resolve_to_index( to , index)
to = resolve_to_register to
# From and to are registers
# index may be a Symbol in which case is resolves with resolve_index.
def self.reg_to_slot( source , from , to , index )
raise "Not register #{to}" unless RegisterValue.look_like_reg(to)
index = to.resolve_index(index) if index.is_a?(Symbol)
RegToSlot.new( source, from , to , index)
end

View File

@ -14,12 +14,11 @@ module Risc
end
# Produce a SlotToReg instruction.
# Array and to are registers or symbols that can be transformed to a register by resolve_to_register
# index resolves with resolve_to_index.
# Array and to are registers
# index may be a Symbol in which case is resolves with resolve_index.
def self.slot_to_reg( source , array , index , to)
index = resolve_to_index( array , index)
array = resolve_to_register( array )
to = resolve_to_register( to )
raise "Not register #{array}" unless RegisterValue.look_like_reg(array)
index = array.resolve_index(index) if index.is_a?(Symbol)
SlotToReg.new( source , array , index , to)
end
end