2018-07-16 10:46:18 +02:00
|
|
|
module Risc
|
2019-09-15 17:31:10 +02:00
|
|
|
class FakeCallable
|
|
|
|
def self_type
|
|
|
|
Parfait.object_space.types.values.first
|
|
|
|
end
|
|
|
|
end
|
2018-07-16 10:46:18 +02:00
|
|
|
class FakeCompiler
|
2018-08-19 12:06:00 +02:00
|
|
|
attr_reader :instructions
|
|
|
|
def initialize
|
|
|
|
@instructions = []
|
|
|
|
end
|
|
|
|
def add_code(c)
|
|
|
|
@instructions << c
|
|
|
|
end
|
|
|
|
def current
|
|
|
|
@instructions.last
|
|
|
|
end
|
2018-07-16 10:46:18 +02:00
|
|
|
def slot_type(slot,type)
|
|
|
|
type.type_for(slot)
|
|
|
|
end
|
|
|
|
def resolve_type(name)
|
|
|
|
Parfait.object_space.types.values.first
|
|
|
|
end
|
2018-07-17 09:37:33 +02:00
|
|
|
def use_reg(type , extra = {})
|
2018-07-16 10:46:18 +02:00
|
|
|
RegisterValue.new(:r1 , type)
|
|
|
|
end
|
|
|
|
def reset_regs
|
|
|
|
end
|
|
|
|
def add_constant(c)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|