dead code removal
This commit is contained in:
parent
6f9955a726
commit
b2579a2b82
@ -21,20 +21,20 @@ module Arm
|
|||||||
@is_load = opcode.to_s[0] == "l" ? 1 : 0 #L (load) flag
|
@is_load = opcode.to_s[0] == "l" ? 1 : 0 #L (load) flag
|
||||||
end
|
end
|
||||||
|
|
||||||
def assemble(io)
|
#str / ldr are _serious instructions. With BIG possibilities not half are implemented
|
||||||
# don't overwrite instance variables, to make assembly repeatable
|
# don't overwrite instance variables, to make assembly repeatable
|
||||||
|
#TODO better test, this operand integer (register) does not work.
|
||||||
|
def assemble(io)
|
||||||
rn , operand , add_offset , arg = @rn , @operand , @add_offset , @left
|
rn , operand , add_offset , arg = @rn , @operand , @add_offset , @left
|
||||||
arg = arg.symbol if( arg.is_a? ::Register::RegisterValue )
|
arg = arg.symbol if( arg.is_a? ::Register::RegisterValue )
|
||||||
#str / ldr are _serious instructions. With BIG possibilities not half are implemented
|
|
||||||
is_reg = arg.is_a?(::Register::RegisterValue)
|
is_reg = arg.is_a?(::Register::RegisterValue)
|
||||||
if( arg.is_a?(Symbol) and not is_reg)
|
if( arg.is_a?(Symbol) and not is_reg)
|
||||||
is_reg = (arg.to_s[0] == "r")
|
is_reg = (arg.to_s[0] == "r")
|
||||||
end
|
end
|
||||||
if (is_reg ) #symbol is register
|
raise "invalid operand argument #{arg.inspect} #{inspect}" unless (is_reg )
|
||||||
rn = arg
|
rn = arg
|
||||||
if @right
|
if @right
|
||||||
operand = @right
|
operand = @right
|
||||||
#TODO better test, this operand integer (register) does not work. but sleep first
|
|
||||||
operand = operand.symbol if operand.is_a? ::Register::RegisterValue
|
operand = operand.symbol if operand.is_a? ::Register::RegisterValue
|
||||||
unless( operand.is_a? Symbol) #TODO test/check/understand
|
unless( operand.is_a? Symbol) #TODO test/check/understand
|
||||||
add_offset = (operand < 0) ? 0 : 1
|
add_offset = (operand < 0) ? 0 : 1
|
||||||
@ -42,16 +42,7 @@ module Arm
|
|||||||
raise "offset too large (max 4095) #{arg} #{inspect}" if (@operand.abs > 4095)
|
raise "offset too large (max 4095) #{arg} #{inspect}" if (@operand.abs > 4095)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elsif (arg.is_a?(Parfait::Object) or arg.is_a? Symbol ) #use pc relative
|
|
||||||
rn = :pc
|
|
||||||
operand = arg.position - self.position - 8 #stringtable is after code
|
|
||||||
add_offset = 1
|
|
||||||
if (operand.abs > 4095)
|
|
||||||
raise "reference offset too large/small (4095<#{operand}) #{arg} #{inspect}"
|
|
||||||
end
|
|
||||||
else
|
|
||||||
raise "invalid operand argument #{arg.inspect} #{inspect}"
|
|
||||||
end
|
|
||||||
#not sure about these 2 constants. They produce the correct output for str r0 , r1
|
#not sure about these 2 constants. They produce the correct output for str r0 , r1
|
||||||
# but i can't help thinking that that is because they are not used in that instruction and
|
# but i can't help thinking that that is because they are not used in that instruction and
|
||||||
# so it doesn't matter. Will see
|
# so it doesn't matter. Will see
|
||||||
|
Loading…
Reference in New Issue
Block a user