Fix div10 without method_missing

but reanimate infer_type to auto create the needed regsiters
also some helpers
This commit is contained in:
2020-03-04 12:39:52 +02:00
parent 9a5e0f15cd
commit 9c5d17a3bb
6 changed files with 47 additions and 20 deletions

View File

@ -32,18 +32,21 @@ module Risc
end
end
end
def self.load_constant( source , constant )
def self.load_constant( source , constant , register = nil)
value = constant
case constant
when Parfait::Object
type = constant.get_type
when Label
type = constant.address.get_type
else
type = constant.ct_type
value = constant.value
unless register
case constant
when Parfait::Object
type = constant.get_type
when Label
type = constant.address.get_type
else
type = constant.ct_type
value = constant.value
end
register = RegisterValue.new( "id_#{value.object_id}".to_sym , type )
end
register = RegisterValue.new( "id_#{value.object_id}".to_sym , type )
LoadConstant.new( source , constant , register )
end
end