move assembly from visitor into objects, part one

This commit is contained in:
Torsten Ruger
2014-09-16 16:06:56 +03:00
parent 914d8af8c6
commit 45977ecc01
9 changed files with 121 additions and 148 deletions

View File

@ -17,11 +17,6 @@ module Arm
@is_load = opcode.to_s[0] == "l" ? 1 : 0 #L (load) flag
end
# arm intructions are pretty sensible, and always 4 bytes (thumb not supported)
def length
4
end
def assemble(io , assembler )
# don't overwrite instance variables, to make assembly repeatable
rn = @rn

View File

@ -28,7 +28,7 @@ module Arm
def is_simple
right = @from
if right.is_a?(Virtual::ObjectConstant)
r_pos = assembler.position_for(right)
r_pos = 5 #assembler.position_for(right)
# do pc relative addressing with the difference to the instuction
# 8 is for the funny pipeline adjustment (ie pc pointing to fetch and not execute)
right = Virtual::IntegerConstant.new( r_pos - self.position - 8 )

View File

@ -5,11 +5,6 @@ module Arm
class StackInstruction < Register::StackInstruction
include Arm::Constants
# arm intrucioons are pretty sensible, and always 4 bytes (thumb not supported)
def length
4
end
def initialize(first , attributes)
super(first , attributes)
@attributes[:update_status] = 0 if @attributes[:update_status] == nil