This commit is contained in:
Torsten Ruger 2014-05-19 11:28:37 +03:00
parent 59952f8503
commit c56b7cdf09
4 changed files with 5 additions and 4 deletions

View File

@ -46,6 +46,7 @@ module Arm
raise "Not CallSite #{call.inspect}" unless call.is_a? Vm::CallSite raise "Not CallSite #{call.inspect}" unless call.is_a? Vm::CallSite
raise "Not linked #{call.inspect}" unless call.function raise "Not linked #{call.inspect}" unless call.function
into << call( call.function ) into << call( call.function )
raise "No return type for #{call.function.name}" unless call.function.return_type
call.function.return_type call.function.return_type
end end

View File

@ -22,8 +22,8 @@ module Arm
} }
#return the bit patter that the cpu uses for the current instruction @attributes[:opcode] #return the bit patter that the cpu uses for the current instruction @attributes[:opcode]
def op_bit_code def op_bit_code
bit_code = OPCODES[@attributes[:opcode]] bit_code = OPCODES[opcode]
bit_code or raise "no code found for #{@attributes[:opcode].inspect}" bit_code or raise "no code found for #{opcode} #{inspect}"
end end
#codition codes can be applied to many instructions and thus save branches #codition codes can be applied to many instructions and thus save branches

View File

@ -3,7 +3,7 @@ module Arm
class LogicInstruction < Vm::LogicInstruction class LogicInstruction < Vm::LogicInstruction
include Arm::Constants include Arm::Constants
def initialize(result , left , right , attributes) def initialize(result , left , right , attributes = {})
super(result ,left , right , attributes) super(result ,left , right , attributes)
@attributes[:update_status] = 0 if @attributes[:update_status] == nil @attributes[:update_status] = 0 if @attributes[:update_status] == nil
@attributes[:condition_code] = :al if @attributes[:condition_code] == nil @attributes[:condition_code] = :al if @attributes[:condition_code] == nil

View File

@ -27,7 +27,7 @@ module Arm
right = Vm::IntegerConstant.new( right.position - self.position - 8 ) right = Vm::IntegerConstant.new( right.position - self.position - 8 )
@rn = :pc @rn = :pc
end end
if( right.is_a? Fixnum ) #HACK to not have to change the code just now if( right.is_a? Fixnum )
right = Vm::IntegerConstant.new( right ) right = Vm::IntegerConstant.new( right )
end end
if (right.is_a?(Vm::IntegerConstant)) if (right.is_a?(Vm::IntegerConstant))