add function_return helper to risc_value
create a function_return from within builder
This commit is contained in:
parent
c9d8f750e5
commit
595e032edf
@ -6,7 +6,7 @@ module Mom
|
||||
# MessageSetup does Setup before a call can be made, acquiring and filling the message
|
||||
# basically.Only after MessageSetup is the next_message safe to use.
|
||||
#
|
||||
# The space keeps a linked list of Messages, from which we take and currenty also return.
|
||||
# The Space keeps a linked list of Messages, from which we take and currenty also return.
|
||||
#
|
||||
# Message setup set the name to the called method's name, and also set the arg and local
|
||||
# types on the new message, currently for debugging but later for dynamic checking
|
||||
|
@ -134,6 +134,14 @@ module Risc
|
||||
op
|
||||
end
|
||||
|
||||
# generate a Function return instruction
|
||||
# using the register as the parameter where the return address is passed
|
||||
def function_return
|
||||
ret = Risc::FunctionReturn.new("return", self)
|
||||
builder.add_code(ret) if builder
|
||||
ret
|
||||
end
|
||||
|
||||
# just capture the values in an intermediary object (RValue)
|
||||
# The RValue then gets used in a RegToSlot ot SlotToReg, where
|
||||
# the values are unpacked to call Risc.reg_to_slot or Risc.slot_to_reg
|
||||
|
@ -41,6 +41,11 @@ module Risc
|
||||
assert_equal :next_message , message.index
|
||||
assert_equal @r0 , message.register
|
||||
end
|
||||
def test_return
|
||||
ret = @r0.function_return
|
||||
assert_equal FunctionReturn , ret.class
|
||||
assert_equal @r0 , ret.register
|
||||
end
|
||||
def test_slot_to_reg
|
||||
instr = @r0 << @r1[:next_message]
|
||||
assert_equal SlotToReg , instr.class
|
||||
|
Loading…
x
Reference in New Issue
Block a user