fix operator register usage
which makes inter math work surprise!
This commit is contained in:
parent
bc558d1f0d
commit
7572e27869
3
.gdbinit
Normal file
3
.gdbinit
Normal file
@ -0,0 +1,3 @@
|
||||
set disassemble-next-line on
|
||||
file a.out
|
||||
break *0x10054
|
@ -93,21 +93,22 @@ module Arm
|
||||
def translate_OperatorInstruction( code )
|
||||
left = code.left
|
||||
right = code.right
|
||||
result = code.result
|
||||
case code.operator.to_s
|
||||
when "+"
|
||||
c = ArmMachine.add(left , left , right)
|
||||
c = ArmMachine.add(result , left , right)
|
||||
when "-"
|
||||
c = ArmMachine.sub(left , left , right)
|
||||
c = ArmMachine.sub(result , left , right)
|
||||
when "&"
|
||||
c = ArmMachine.and(left , left , right)
|
||||
c = ArmMachine.and(result , left , right)
|
||||
when "|"
|
||||
c = ArmMachine.orr(left , left , right)
|
||||
c = ArmMachine.orr(result , left , right)
|
||||
when "*"
|
||||
c = ArmMachine.mul(left , right , left) #arm rule about left not being result, lukily commutative
|
||||
c = ArmMachine.mul(result , right , left) #arm rule about left not being result, lukily commutative
|
||||
when ">>"
|
||||
c = ArmMachine.mov(left , left , :shift_asr => right) #arm rule about left not being result, lukily commutative
|
||||
c = ArmMachine.mov(result , left , :shift_asr => right) #arm rule about left not being result, lukily commutative
|
||||
when "<<"
|
||||
c = ArmMachine.mov(left , left , :shift_lsl => right) #arm rule about left not being result, lukily commutative
|
||||
c = ArmMachine.mov(result , left , :shift_lsl => right) #arm rule about left not being result, lukily commutative
|
||||
else
|
||||
raise "unimplemented '#{code.operator}' #{code}"
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user