while compiles. jo
This commit is contained in:
@ -26,10 +26,15 @@ module Arm
|
||||
end
|
||||
|
||||
def integer_load block , left , right
|
||||
reg = "r#{left.register}".to_sym
|
||||
block.add_code mov( :left => reg , :right => right )
|
||||
block.add_code mov( :left => left , :right => right )
|
||||
left
|
||||
end
|
||||
|
||||
def integer_move block , left , right
|
||||
block.add_code mov( :left => left , :right => right )
|
||||
left
|
||||
end
|
||||
|
||||
def string_load block , str_lit , reg
|
||||
block.add_code add( :left => "r#{reg}".to_sym , :extra => str_lit ) #right is pc, implicit
|
||||
#second arg is a hack to get the stringlength without coding
|
||||
|
@ -13,7 +13,6 @@ module Ast
|
||||
call = Vm::CallSite.new( name , params , function)
|
||||
call.load_args into
|
||||
call.do_call into
|
||||
call
|
||||
end
|
||||
|
||||
def inspect
|
||||
|
@ -16,8 +16,7 @@ module Vm
|
||||
if arg.is_a? IntegerConstant
|
||||
Vm::Integer.new(index).load into , arg
|
||||
else
|
||||
raise "no #{arg.inspect}" if arg.register != index
|
||||
#arg.load( into , index )
|
||||
arg.move( into , index ) if arg.register != index
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -73,6 +73,11 @@ module Vm
|
||||
def load block , right
|
||||
CMachine.instance.integer_load block , self , right
|
||||
end
|
||||
|
||||
def move block , right
|
||||
CMachine.instance.integer_move block , self , right
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
require_relative "constants"
|
Reference in New Issue
Block a user