first local assignment risc test

comes with casualties
slot_load needs more work
This commit is contained in:
Torsten Ruger
2018-03-17 11:13:44 +05:30
parent 3eef27be76
commit 16c8fcbf66
6 changed files with 54 additions and 32 deletions

View File

@ -4,6 +4,9 @@ module Mom
class Instruction
include Common::List
def to_risc(m)
Risc::Label.new(self.class.name, self.class.name + "_todo")
end
# implement flatten as noop to avoid condition
def flatten( options = {} )
return self

View File

@ -32,11 +32,11 @@ module Mom
@left , @right = left , right
end
def to_risc_load(context)
reg = context.use_reg( @right.ct_type)
def to_risc(compiler)
reg = compiler.use_reg( @right.ct_type)
const = Risc.load_constant(self, @right , reg)
const.set_next Risc.reg_to_slot(self, reg , @left.known_object, @left.slots.first)
context.release_reg(reg)
const << Risc.reg_to_slot(self, reg , @left.known_object, @left.slots.first)
compiler.release_reg(reg)
return const
end