create a reduce_int on RegisterSlot
that just passes through to RegisterValue by calling to_reg
This commit is contained in:
parent
17a1121408
commit
2656bfacb2
@ -62,6 +62,13 @@ module Risc
|
||||
slot_to_reg.register
|
||||
end
|
||||
|
||||
# just pass the call through. That is we create the register (call to_reg)
|
||||
# and call reduce_int on the result
|
||||
# Just so the dsl code can be a bit shorter / less cluttered
|
||||
def reduce_int(bool)
|
||||
to_reg.reduce_int(bool)
|
||||
end
|
||||
|
||||
# similar to above (<< which produces reg_to_slot), this produces reg_to_byte
|
||||
# from itself (the slot) and the register given
|
||||
def <=( reg )
|
||||
|
@ -17,8 +17,8 @@ module SlotMachine
|
||||
merge_label = Risc.label("merge" , "merge_label_#{object_id}")
|
||||
result = Risc::RegisterValue.new(:result , :Object)
|
||||
builder.build do
|
||||
left = message[:receiver].to_reg.reduce_int(false) #false == hack
|
||||
right = message[:arg1].to_reg.reduce_int(false)
|
||||
left = message[:receiver].reduce_int(false) #false == hack
|
||||
right = message[:arg1].reduce_int(false)
|
||||
|
||||
if(operator.to_s.start_with?('<') )
|
||||
right.op :- , left
|
||||
|
@ -8,7 +8,7 @@ module SlotMachine
|
||||
integer_reg = builder.register( :integer_reg )
|
||||
integer_const = builder.register( :integer_const )
|
||||
builder.build do
|
||||
integer_self = message[:receiver].to_reg.reduce_int(false)
|
||||
integer_self = message[:receiver].reduce_int(false)
|
||||
transfer( integer_self , integer_1)
|
||||
transfer( integer_self , integer_reg)
|
||||
|
||||
|
@ -6,7 +6,7 @@ module SlotMachine
|
||||
integer_1 = builder.register( :integer_1 )
|
||||
integer_self = builder.register( :integer_self )
|
||||
builder.build do
|
||||
integer_self = message[:receiver].to_reg.reduce_int(false)
|
||||
integer_self = message[:receiver].reduce_int(false)
|
||||
load_object( 2 , integer_1)
|
||||
integer_self.op :>> , integer_1
|
||||
integer_tmp[Parfait::Integer.integer_index] << integer_self
|
||||
|
@ -5,7 +5,7 @@ module SlotMachine
|
||||
integer_tmp = builder.allocate_int
|
||||
builder.build do
|
||||
object = message[:receiver].to_reg
|
||||
integer = message[:arg1].to_reg.reduce_int(false)
|
||||
integer = message[:arg1].reduce_int(false)
|
||||
object <= object[integer]
|
||||
integer_tmp[Parfait::Integer.integer_index] << object
|
||||
message[:return_value] << integer_tmp
|
||||
|
@ -2,7 +2,7 @@ module SlotMachine
|
||||
class GetInternalWord < Macro
|
||||
def to_risc(compiler)
|
||||
compiler.builder(compiler.source).build do
|
||||
integer = message[:arg1].to_reg.reduce_int(false)
|
||||
integer = message[:arg1].reduce_int(false)
|
||||
message[:return_value] << message[:receiver][integer]
|
||||
end
|
||||
end
|
||||
|
@ -11,8 +11,8 @@ module SlotMachine
|
||||
integer_tmp = builder.allocate_int
|
||||
operator = @operator # make accessible in block
|
||||
builder.build do
|
||||
integer = message[:receiver].to_reg.reduce_int(false)
|
||||
integer_reg = message[:arg1].to_reg.reduce_int(false)
|
||||
integer = message[:receiver].reduce_int(false)
|
||||
integer_reg = message[:arg1].reduce_int(false)
|
||||
integer.op operator , integer_reg
|
||||
integer_tmp[Parfait::Integer.integer_index] << integer
|
||||
message[:return_value] << integer_tmp
|
||||
|
Loading…
Reference in New Issue
Block a user