introduce constant class and add block to compile signature(wip, work in progress)
This commit is contained in:
@ -30,7 +30,15 @@ module Arm
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def integer_less_or_equal left , right
|
||||
cmp(:left => left , :right => right )
|
||||
end
|
||||
|
||||
def integer_plus left , right
|
||||
add(:left => left , :right => right )
|
||||
end
|
||||
|
||||
def word_load value , reg
|
||||
raise "not a register :#{reg}:" unless reg.class == Symbol
|
||||
mov( :left => reg , :right => value )
|
||||
|
@ -39,11 +39,11 @@ module Arm
|
||||
|
||||
# Add a string to the string table. Strings are global and constant. So only one copy of each
|
||||
# string exists
|
||||
# Internally StringLiterals are created and stored and during assembly written after the blocks
|
||||
# Internally StringConstants are created and stored and during assembly written after the blocks
|
||||
def add_string str
|
||||
code = @string_table[str]
|
||||
return code if code
|
||||
data = Vm::StringLiteral.new(str)
|
||||
data = Vm::StringConstant.new(str)
|
||||
@string_table[str] = data
|
||||
end
|
||||
|
||||
|
@ -22,7 +22,7 @@ module Arm
|
||||
|
||||
#(stays in subclases, while build is overriden to provide different arguments)
|
||||
def do_build(arg)
|
||||
if arg.is_a?(Vm::StringLiteral)
|
||||
if arg.is_a?(Vm::StringConstant)
|
||||
# do pc relative addressing with the difference to the instuction
|
||||
# 8 is for the funny pipeline adjustment (ie oc pointing to fetch and not execute)
|
||||
arg = Arm::NumLiteral.new( arg.position - self.position - 8 )
|
||||
@ -31,7 +31,7 @@ module Arm
|
||||
if( arg.is_a? Fixnum ) #HACK to not have to change the code just now
|
||||
arg = Arm::NumLiteral.new( arg )
|
||||
end
|
||||
if( arg.is_a? Vm::Signed ) #HACK to not have to change the code just now
|
||||
if( arg.is_a? Vm::Integer ) #HACK to not have to change the code just now
|
||||
arg = Arm::NumLiteral.new( arg.value )
|
||||
end
|
||||
if (arg.is_a?(Arm::NumLiteral))
|
||||
|
@ -50,7 +50,7 @@ module Arm
|
||||
raise "reference offset too large/small (max 4095) #{arg} #{inspect}"
|
||||
end
|
||||
end
|
||||
elsif (arg.is_a?(Vm::StringLiteral)) #use pc relative
|
||||
elsif (arg.is_a?(Vm::StringConstant)) #use pc relative
|
||||
@rn = :pc
|
||||
@operand = arg.position - self.position - 8 #stringtable is after code
|
||||
@add_offset = 1
|
||||
|
Reference in New Issue
Block a user