Renaming the armv7.rb LLINT backend to arm.rb
authorrgabor@webkit.org <rgabor@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Mar 2013 09:30:33 +0000 (09:30 +0000)
committerrgabor@webkit.org <rgabor@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Mar 2013 09:30:33 +0000 (09:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=110565

Reviewed by Zoltan Herczeg.

This is the first step of a unified ARM backend for
all ARM 32 bit architectures in LLInt.

* CMakeLists.txt:
* GNUmakefile.list.am:
* JavaScriptCore.gypi:
* LLIntOffsetsExtractor.pro:
* offlineasm/arm.rb: Copied from Source/JavaScriptCore/offlineasm/armv7.rb.
* offlineasm/armv7.rb: Removed.
* offlineasm/backends.rb:
* offlineasm/risc.rb:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@145504 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/CMakeLists.txt
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/GNUmakefile.list.am
Source/JavaScriptCore/JavaScriptCore.gypi
Source/JavaScriptCore/LLIntOffsetsExtractor.pro
Source/JavaScriptCore/offlineasm/arm.rb [moved from Source/JavaScriptCore/offlineasm/armv7.rb with 54% similarity]
Source/JavaScriptCore/offlineasm/backends.rb
Source/JavaScriptCore/offlineasm/risc.rb

index 964b51b..9119120 100644 (file)
@@ -356,7 +356,7 @@ if (ENABLE_LLINT)
     )
 
     set(OFFLINE_ASM
-        offlineasm/armv7.rb
+        offlineasm/arm.rb
         offlineasm/ast.rb
         offlineasm/backends.rb
         offlineasm/cloop.rb
index a3f7e64..a5eb8cc 100644 (file)
@@ -1,3 +1,22 @@
+2013-03-12  Gabor Rapcsanyi  <rgabor@webkit.org>
+
+        Renaming the armv7.rb LLINT backend to arm.rb
+        https://bugs.webkit.org/show_bug.cgi?id=110565
+
+        Reviewed by Zoltan Herczeg.
+
+        This is the first step of a unified ARM backend for
+        all ARM 32 bit architectures in LLInt.
+
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * JavaScriptCore.gypi:
+        * LLIntOffsetsExtractor.pro:
+        * offlineasm/arm.rb: Copied from Source/JavaScriptCore/offlineasm/armv7.rb.
+        * offlineasm/armv7.rb: Removed.
+        * offlineasm/backends.rb:
+        * offlineasm/risc.rb:
+
 2013-03-12  Csaba Osztrogon√°c  <ossy@webkit.org>
 
         REGRESSION(r145482): It broke 33 jsc tests and zillion layout tests on all platform
index 2312154..5686842 100644 (file)
@@ -812,7 +812,7 @@ llint_nosources += \
        Source/JavaScriptCore/llint/LowLevelInterpreter.asm
 
 offlineasm_nosources += \
-       Source/JavaScriptCore/offlineasm/armv7.rb \
+       Source/JavaScriptCore/offlineasm/arm.rb \
        Source/JavaScriptCore/offlineasm/asm.rb \
        Source/JavaScriptCore/offlineasm/ast.rb \
        Source/JavaScriptCore/offlineasm/backends.rb \
index 274a624..b52c9b9 100644 (file)
           'llint/LowLevelInterpreter32_64.asm',
           'llint/LowLevelInterpreter64.asm',
           'llint/LowLevelInterpreter.asm',
-          'offlineasm/armv7.rb',
+          'offlineasm/arm.rb',
           'offlineasm/asm.rb',
           'offlineasm/ast.rb',
           'offlineasm/backends.rb',
index d119bbf..374ef84 100644 (file)
@@ -34,7 +34,7 @@ LLINT_DEPENDENCY = \
     $$PWD/llint/LowLevelInterpreter.asm \
     $$PWD/llint/LowLevelInterpreter32_64.asm \
     $$PWD/llint/LowLevelInterpreter64.asm \
-    $$PWD/offlineasm/armv7.rb \
+    $$PWD/offlineasm/arm.rb \
     $$PWD/offlineasm/ast.rb \
     $$PWD/offlineasm/backends.rb \
     $$PWD/offlineasm/generate_offset_extractor.rb \
similarity index 54%
rename from Source/JavaScriptCore/offlineasm/armv7.rb
rename to Source/JavaScriptCore/offlineasm/arm.rb
index e3f659e..e815636 100644 (file)
@@ -27,39 +27,39 @@ require "opt"
 require "risc"
 
 class Node
-    def armV7Single
-        doubleOperand = armV7Operand
+    def armSingle
+        doubleOperand = armOperand
         raise "Bogus register name #{doubleOperand}" unless doubleOperand =~ /^d/
         "s" + ($~.post_match.to_i * 2).to_s
     end
 end
 
 class SpecialRegister
-    def armV7Operand
+    def armOperand
         @name
     end
 end
 
-ARMv7_EXTRA_GPRS = [SpecialRegister.new("r9"), SpecialRegister.new("r8"), SpecialRegister.new("r3")]
-ARMv7_EXTRA_FPRS = [SpecialRegister.new("d7")]
-ARMv7_SCRATCH_FPR = SpecialRegister.new("d8")
+ARM_EXTRA_GPRS = [SpecialRegister.new("r9"), SpecialRegister.new("r8"), SpecialRegister.new("r3")]
+ARM_EXTRA_FPRS = [SpecialRegister.new("d7")]
+ARM_SCRATCH_FPR = SpecialRegister.new("d8")
 
-def armV7MoveImmediate(value, register)
+def armMoveImmediate(value, register)
     # Currently we only handle the simple cases, and fall back to mov/movt for the complex ones.
     if value >= 0 && value < 256
-        $asm.puts "movw #{register.armV7Operand}, \##{value}"
+        $asm.puts "movw #{register.armOperand}, \##{value}"
     elsif (~value) >= 0 && (~value) < 256
-        $asm.puts "mvn #{register.armV7Operand}, \##{~value}"
+        $asm.puts "mvn #{register.armOperand}, \##{~value}"
     else
-        $asm.puts "movw #{register.armV7Operand}, \##{value & 0xffff}"
+        $asm.puts "movw #{register.armOperand}, \##{value & 0xffff}"
         if (value & 0xffff0000) != 0
-            $asm.puts "movt #{register.armV7Operand}, \##{(value >> 16) & 0xffff}"
+            $asm.puts "movt #{register.armOperand}, \##{(value >> 16) & 0xffff}"
         end
     end
 end
 
 class RegisterID
-    def armV7Operand
+    def armOperand
         case name
         when "t0", "a0", "r0"
             "r0"
@@ -80,13 +80,13 @@ class RegisterID
         when "sp"
             "sp"
         else
-            raise "Bad register #{name} for ARMv7 at #{codeOriginString}"
+            raise "Bad register #{name} for ARM at #{codeOriginString}"
         end
     end
 end
 
 class FPRegisterID
-    def armV7Operand
+    def armOperand
         case name
         when "ft0", "fr"
             "d0"
@@ -101,34 +101,34 @@ class FPRegisterID
         when "ft5"
             "d5"
         else
-            raise "Bad register #{name} for ARMv7 at #{codeOriginString}"
+            raise "Bad register #{name} for ARM at #{codeOriginString}"
         end
     end
 end
 
 class Immediate
-    def armV7Operand
+    def armOperand
         raise "Invalid immediate #{value} at #{codeOriginString}" if value < 0 or value > 255
         "\##{value}"
     end
 end
 
 class Address
-    def armV7Operand
+    def armOperand
         raise "Bad offset at #{codeOriginString}" if offset.value < -0xff or offset.value > 0xfff
-        "[#{base.armV7Operand}, \##{offset.value}]"
+        "[#{base.armOperand}, \##{offset.value}]"
     end
 end
 
 class BaseIndex
-    def armV7Operand
+    def armOperand
         raise "Bad offset at #{codeOriginString}" if offset.value != 0
-        "[#{base.armV7Operand}, #{index.armV7Operand}, lsl \##{scaleShift}]"
+        "[#{base.armOperand}, #{index.armOperand}, lsl \##{scaleShift}]"
     end
 end
 
 class AbsoluteAddress
-    def armV7Operand
+    def armOperand
         raise "Unconverted absolute address at #{codeOriginString}"
     end
 end
@@ -138,19 +138,19 @@ end
 #
 
 class Address
-    def armV7EmitLea(destination)
+    def armEmitLea(destination)
         if destination == base
-            $asm.puts "adds #{destination.armV7Operand}, \##{offset.value}"
+            $asm.puts "adds #{destination.armOperand}, \##{offset.value}"
         else
-            $asm.puts "adds #{destination.armV7Operand}, #{base.armV7Operand}, \##{offset.value}"
+            $asm.puts "adds #{destination.armOperand}, #{base.armOperand}, \##{offset.value}"
         end
     end
 end
 
 class BaseIndex
-    def armV7EmitLea(destination)
+    def armEmitLea(destination)
         raise "Malformed BaseIndex, offset should be zero at #{codeOriginString}" unless offset.value == 0
-        $asm.puts "add.w #{destination.armV7Operand}, #{base.armV7Operand}, #{index.armV7Operand}, lsl \##{scaleShift}"
+        $asm.puts "add.w #{destination.armOperand}, #{base.armOperand}, #{index.armOperand}, lsl \##{scaleShift}"
     end
 end
 
@@ -181,50 +181,50 @@ class Sequence
         result = riscLowerMalformedImmediates(result, 0..0xff)
         result = riscLowerMisplacedAddresses(result)
         result = riscLowerRegisterReuse(result)
-        result = assignRegistersToTemporaries(result, :gpr, ARMv7_EXTRA_GPRS)
-        result = assignRegistersToTemporaries(result, :fpr, ARMv7_EXTRA_FPRS)
+        result = assignRegistersToTemporaries(result, :gpr, ARM_EXTRA_GPRS)
+        result = assignRegistersToTemporaries(result, :fpr, ARM_EXTRA_FPRS)
         return result
     end
 end
 
-def armV7Operands(operands)
-    operands.map{|v| v.armV7Operand}.join(", ")
+def armOperands(operands)
+    operands.map{|v| v.armOperand}.join(", ")
 end
 
-def armV7FlippedOperands(operands)
-    armV7Operands([operands[-1]] + operands[0..-2])
+def armFlippedOperands(operands)
+    armOperands([operands[-1]] + operands[0..-2])
 end
 
-def emitArmV7Compact(opcode2, opcode3, operands)
+def emitArmCompact(opcode2, opcode3, operands)
     if operands.size == 3
-        $asm.puts "#{opcode3} #{armV7FlippedOperands(operands)}"
+        $asm.puts "#{opcode3} #{armFlippedOperands(operands)}"
     else
         raise unless operands.size == 2
         raise unless operands[1].register?
         if operands[0].immediate?
-            $asm.puts "#{opcode3} #{operands[1].armV7Operand}, #{operands[1].armV7Operand}, #{operands[0].armV7Operand}"
+            $asm.puts "#{opcode3} #{operands[1].armOperand}, #{operands[1].armOperand}, #{operands[0].armOperand}"
         else
-            $asm.puts "#{opcode2} #{armV7FlippedOperands(operands)}"
+            $asm.puts "#{opcode2} #{armFlippedOperands(operands)}"
         end
     end
 end
 
-def emitArmV7(opcode, operands)
+def emitArm(opcode, operands)
     if operands.size == 3
-        $asm.puts "#{opcode} #{armV7FlippedOperands(operands)}"
+        $asm.puts "#{opcode} #{armFlippedOperands(operands)}"
     else
         raise unless operands.size == 2
-        $asm.puts "#{opcode} #{operands[1].armV7Operand}, #{operands[1].armV7Operand}, #{operands[0].armV7Operand}"
+        $asm.puts "#{opcode} #{operands[1].armOperand}, #{operands[1].armOperand}, #{operands[0].armOperand}"
     end
 end
 
-def emitArmV7DoubleBranch(branchOpcode, operands)
-    $asm.puts "vcmpe.f64 #{armV7Operands(operands[0..1])}"
+def emitArmDoubleBranch(branchOpcode, operands)
+    $asm.puts "vcmpe.f64 #{armOperands(operands[0..1])}"
     $asm.puts "vmrs apsr_nzcv, fpscr"
     $asm.puts "#{branchOpcode} #{operands[2].asmLabel}"
 end
 
-def emitArmV7Test(operands)
+def emitArmTest(operands)
     value = operands[0]
     case operands.size
     when 2
@@ -236,26 +236,26 @@ def emitArmV7Test(operands)
     end
     
     if mask.immediate? and mask.value == -1
-        $asm.puts "tst #{value.armV7Operand}, #{value.armV7Operand}"
+        $asm.puts "tst #{value.armOperand}, #{value.armOperand}"
     elsif mask.immediate?
-        $asm.puts "tst.w #{value.armV7Operand}, #{mask.armV7Operand}"
+        $asm.puts "tst.w #{value.armOperand}, #{mask.armOperand}"
     else
-        $asm.puts "tst #{value.armV7Operand}, #{mask.armV7Operand}"
+        $asm.puts "tst #{value.armOperand}, #{mask.armOperand}"
     end
 end
 
-def emitArmV7Compare(operands, code)
-    $asm.puts "movs #{operands[2].armV7Operand}, \#0"
-    $asm.puts "cmp #{operands[0].armV7Operand}, #{operands[1].armV7Operand}"
+def emitArmCompare(operands, code)
+    $asm.puts "movs #{operands[2].armOperand}, \#0"
+    $asm.puts "cmp #{operands[0].armOperand}, #{operands[1].armOperand}"
     $asm.puts "it #{code}"
-    $asm.puts "mov#{code} #{operands[2].armV7Operand}, \#1"
+    $asm.puts "mov#{code} #{operands[2].armOperand}, \#1"
 end
 
-def emitArmV7TestSet(operands, code)
-    $asm.puts "movs #{operands[-1].armV7Operand}, \#0"
-    emitArmV7Test(operands)
+def emitArmTestSet(operands, code)
+    $asm.puts "movs #{operands[-1].armOperand}, \#0"
+    emitArmTest(operands)
     $asm.puts "it #{code}"
-    $asm.puts "mov#{code} #{operands[-1].armV7Operand}, \#1"
+    $asm.puts "mov#{code} #{operands[-1].armOperand}, \#1"
 end
 
 class Instruction
@@ -275,241 +275,241 @@ class Instruction
                 raise unless operands[2].register?
                 if operands[0].value == 0 and suffix.empty?
                     unless operands[1] == operands[2]
-                        $asm.puts "mov #{operands[2].armV7Operand}, #{operands[1].armV7Operand}"
+                        $asm.puts "mov #{operands[2].armOperand}, #{operands[1].armOperand}"
                     end
                 else
-                    $asm.puts "adds #{operands[2].armV7Operand}, #{operands[1].armV7Operand}, #{operands[0].armV7Operand}"
+                    $asm.puts "adds #{operands[2].armOperand}, #{operands[1].armOperand}, #{operands[0].armOperand}"
                 end
             elsif operands.size == 3 and operands[0].immediate?
                 raise unless operands[1].register?
                 raise unless operands[2].register?
-                $asm.puts "adds #{armV7FlippedOperands(operands)}"
+                $asm.puts "adds #{armFlippedOperands(operands)}"
             else
                 if operands[0].immediate?
                     unless Immediate.new(nil, 0) == operands[0]
-                        $asm.puts "adds #{armV7FlippedOperands(operands)}"
+                        $asm.puts "adds #{armFlippedOperands(operands)}"
                     end
                 else
-                    $asm.puts "add#{suffix} #{armV7FlippedOperands(operands)}"
+                    $asm.puts "add#{suffix} #{armFlippedOperands(operands)}"
                 end
             end
         when "andi", "andp"
-            emitArmV7Compact("ands", "and", operands)
+            emitArmCompact("ands", "and", operands)
         when "ori", "orp"
-            emitArmV7Compact("orrs", "orr", operands)
+            emitArmCompact("orrs", "orr", operands)
         when "oris"
-            emitArmV7Compact("orrs", "orrs", operands)
+            emitArmCompact("orrs", "orrs", operands)
         when "xori", "xorp"
-            emitArmV7Compact("eors", "eor", operands)
+            emitArmCompact("eors", "eor", operands)
         when "lshifti", "lshiftp"
-            emitArmV7Compact("lsls", "lsls", operands)
+            emitArmCompact("lsls", "lsls", operands)
         when "rshifti", "rshiftp"
-            emitArmV7Compact("asrs", "asrs", operands)
+            emitArmCompact("asrs", "asrs", operands)
         when "urshifti", "urshiftp"
-            emitArmV7Compact("lsrs", "lsrs", operands)
+            emitArmCompact("lsrs", "lsrs", operands)
         when "muli", "mulp"
-            emitArmV7("mul", operands)
+            emitArm("mul", operands)
         when "subi", "subp", "subis"
-            emitArmV7Compact("subs", "subs", operands)
+            emitArmCompact("subs", "subs", operands)
         when "negi", "negp"
-            $asm.puts "rsbs #{operands[0].armV7Operand}, #{operands[0].armV7Operand}, \#0"
+            $asm.puts "rsbs #{operands[0].armOperand}, #{operands[0].armOperand}, \#0"
         when "noti"
-            $asm.puts "mvns #{operands[0].armV7Operand}, #{operands[0].armV7Operand}"
+            $asm.puts "mvns #{operands[0].armOperand}, #{operands[0].armOperand}"
         when "loadi", "loadis", "loadp"
-            $asm.puts "ldr #{armV7FlippedOperands(operands)}"
+            $asm.puts "ldr #{armFlippedOperands(operands)}"
         when "storei", "storep"
-            $asm.puts "str #{armV7Operands(operands)}"
+            $asm.puts "str #{armOperands(operands)}"
         when "loadb"
-            $asm.puts "ldrb #{armV7FlippedOperands(operands)}"
+            $asm.puts "ldrb #{armFlippedOperands(operands)}"
         when "loadbs"
-            $asm.puts "ldrsb.w #{armV7FlippedOperands(operands)}"
+            $asm.puts "ldrsb.w #{armFlippedOperands(operands)}"
         when "storeb"
-            $asm.puts "strb #{armV7Operands(operands)}"
+            $asm.puts "strb #{armOperands(operands)}"
         when "loadh"
-            $asm.puts "ldrh #{armV7FlippedOperands(operands)}"
+            $asm.puts "ldrh #{armFlippedOperands(operands)}"
         when "loadhs"
-            $asm.puts "ldrsh.w #{armV7FlippedOperands(operands)}"
+            $asm.puts "ldrsh.w #{armFlippedOperands(operands)}"
         when "storeh"
-            $asm.puts "strh #{armV7Operands(operands)}"
+            $asm.puts "strh #{armOperands(operands)}"
         when "loadd"
-            $asm.puts "vldr.64 #{armV7FlippedOperands(operands)}"
+            $asm.puts "vldr.64 #{armFlippedOperands(operands)}"
         when "stored"
-            $asm.puts "vstr.64 #{armV7Operands(operands)}"
+            $asm.puts "vstr.64 #{armOperands(operands)}"
         when "addd"
-            emitArmV7("vadd.f64", operands)
+            emitArm("vadd.f64", operands)
         when "divd"
-            emitArmV7("vdiv.f64", operands)
+            emitArm("vdiv.f64", operands)
         when "subd"
-            emitArmV7("vsub.f64", operands)
+            emitArm("vsub.f64", operands)
         when "muld"
-            emitArmV7("vmul.f64", operands)
+            emitArm("vmul.f64", operands)
         when "sqrtd"
-            $asm.puts "vsqrt.f64 #{armV7FlippedOperands(operands)}"
+            $asm.puts "vsqrt.f64 #{armFlippedOperands(operands)}"
         when "ci2d"
-            $asm.puts "vmov #{operands[1].armV7Single}, #{operands[0].armV7Operand}"
-            $asm.puts "vcvt.f64.s32 #{operands[1].armV7Operand}, #{operands[1].armV7Single}"
+            $asm.puts "vmov #{operands[1].armSingle}, #{operands[0].armOperand}"
+            $asm.puts "vcvt.f64.s32 #{operands[1].armOperand}, #{operands[1].armSingle}"
         when "bdeq"
-            emitArmV7DoubleBranch("beq", operands)
+            emitArmDoubleBranch("beq", operands)
         when "bdneq"
-            $asm.puts "vcmpe.f64 #{armV7Operands(operands[0..1])}"
+            $asm.puts "vcmpe.f64 #{armOperands(operands[0..1])}"
             $asm.puts "vmrs apsr_nzcv, fpscr"
             isUnordered = LocalLabel.unique("bdneq")
             $asm.puts "bvs #{LocalLabelReference.new(codeOrigin, isUnordered).asmLabel}"
             $asm.puts "bne #{operands[2].asmLabel}"
-            isUnordered.lower("ARMv7")
+            isUnordered.lower("ARM")
         when "bdgt"
-            emitArmV7DoubleBranch("bgt", operands)
+            emitArmDoubleBranch("bgt", operands)
         when "bdgteq"
-            emitArmV7DoubleBranch("bge", operands)
+            emitArmDoubleBranch("bge", operands)
         when "bdlt"
-            emitArmV7DoubleBranch("bmi", operands)
+            emitArmDoubleBranch("bmi", operands)
         when "bdlteq"
-            emitArmV7DoubleBranch("bls", operands)
+            emitArmDoubleBranch("bls", operands)
         when "bdequn"
-            $asm.puts "vcmpe.f64 #{armV7Operands(operands[0..1])}"
+            $asm.puts "vcmpe.f64 #{armOperands(operands[0..1])}"
             $asm.puts "vmrs apsr_nzcv, fpscr"
             $asm.puts "bvs #{operands[2].asmLabel}"
             $asm.puts "beq #{operands[2].asmLabel}"
         when "bdnequn"
-            emitArmV7DoubleBranch("bne", operands)
+            emitArmDoubleBranch("bne", operands)
         when "bdgtun"
-            emitArmV7DoubleBranch("bhi", operands)
+            emitArmDoubleBranch("bhi", operands)
         when "bdgtequn"
-            emitArmV7DoubleBranch("bpl", operands)
+            emitArmDoubleBranch("bpl", operands)
         when "bdltun"
-            emitArmV7DoubleBranch("blt", operands)
+            emitArmDoubleBranch("blt", operands)
         when "bdltequn"
-            emitArmV7DoubleBranch("ble", operands)
+            emitArmDoubleBranch("ble", operands)
         when "btd2i"
             # FIXME: may be a good idea to just get rid of this instruction, since the interpreter
             # currently does not use it.
-            raise "ARMv7 does not support this opcode yet, #{codeOrigin}"
+            raise "ARM does not support this opcode yet, #{codeOrigin}"
         when "td2i"
-            $asm.puts "vcvt.s32.f64 #{ARMv7_SCRATCH_FPR.armV7Single}, #{operands[0].armV7Operand}"
-            $asm.puts "vmov #{operands[1].armV7Operand}, #{ARMv7_SCRATCH_FPR.armV7Single}"
+            $asm.puts "vcvt.s32.f64 #{ARM_SCRATCH_FPR.armSingle}, #{operands[0].armOperand}"
+            $asm.puts "vmov #{operands[1].armOperand}, #{ARM_SCRATCH_FPR.armSingle}"
         when "bcd2i"
-            $asm.puts "vcvt.s32.f64 #{ARMv7_SCRATCH_FPR.armV7Single}, #{operands[0].armV7Operand}"
-            $asm.puts "vmov #{operands[1].armV7Operand}, #{ARMv7_SCRATCH_FPR.armV7Single}"
-            $asm.puts "vcvt.f64.s32 #{ARMv7_SCRATCH_FPR.armV7Operand}, #{ARMv7_SCRATCH_FPR.armV7Single}"
-            emitArmV7DoubleBranch("bne", [ARMv7_SCRATCH_FPR, operands[0], operands[2]])
-            $asm.puts "tst #{operands[1].armV7Operand}, #{operands[1].armV7Operand}"
+            $asm.puts "vcvt.s32.f64 #{ARM_SCRATCH_FPR.armSingle}, #{operands[0].armOperand}"
+            $asm.puts "vmov #{operands[1].armOperand}, #{ARM_SCRATCH_FPR.armSingle}"
+            $asm.puts "vcvt.f64.s32 #{ARM_SCRATCH_FPR.armOperand}, #{ARM_SCRATCH_FPR.armSingle}"
+            emitArmDoubleBranch("bne", [ARM_SCRATCH_FPR, operands[0], operands[2]])
+            $asm.puts "tst #{operands[1].armOperand}, #{operands[1].armOperand}"
             $asm.puts "beq #{operands[2].asmLabel}"
         when "movdz"
             # FIXME: either support this or remove it.
-            raise "ARMv7 does not support this opcode yet, #{codeOrigin}"
+            raise "ARM does not support this opcode yet, #{codeOrigin}"
         when "pop"
-            $asm.puts "pop #{operands[0].armV7Operand}"
+            $asm.puts "pop #{operands[0].armOperand}"
         when "push"
-            $asm.puts "push #{operands[0].armV7Operand}"
+            $asm.puts "push #{operands[0].armOperand}"
         when "move"
             if operands[0].immediate?
-                armV7MoveImmediate(operands[0].value, operands[1])
+                armMoveImmediate(operands[0].value, operands[1])
             else
-                $asm.puts "mov #{armV7FlippedOperands(operands)}"
+                $asm.puts "mov #{armFlippedOperands(operands)}"
             end
         when "nop"
             $asm.puts "nop"
         when "bieq", "bpeq", "bbeq"
             if Immediate.new(nil, 0) == operands[0]
-                $asm.puts "tst #{operands[1].armV7Operand}, #{operands[1].armV7Operand}"
+                $asm.puts "tst #{operands[1].armOperand}, #{operands[1].armOperand}"
             elsif Immediate.new(nil, 0) == operands[1]
-                $asm.puts "tst #{operands[0].armV7Operand}, #{operands[0].armV7Operand}"
+                $asm.puts "tst #{operands[0].armOperand}, #{operands[0].armOperand}"
             else
-                $asm.puts "cmp #{armV7Operands(operands[0..1])}"
+                $asm.puts "cmp #{armOperands(operands[0..1])}"
             end
             $asm.puts "beq #{operands[2].asmLabel}"
         when "bineq", "bpneq", "bbneq"
             if Immediate.new(nil, 0) == operands[0]
-                $asm.puts "tst #{operands[1].armV7Operand}, #{operands[1].armV7Operand}"
+                $asm.puts "tst #{operands[1].armOperand}, #{operands[1].armOperand}"
             elsif Immediate.new(nil, 0) == operands[1]
-                $asm.puts "tst #{operands[0].armV7Operand}, #{operands[0].armV7Operand}"
+                $asm.puts "tst #{operands[0].armOperand}, #{operands[0].armOperand}"
             else
-                $asm.puts "cmp #{armV7Operands(operands[0..1])}"
+                $asm.puts "cmp #{armOperands(operands[0..1])}"
             end
             $asm.puts "bne #{operands[2].asmLabel}"
         when "bia", "bpa", "bba"
-            $asm.puts "cmp #{armV7Operands(operands[0..1])}"
+            $asm.puts "cmp #{armOperands(operands[0..1])}"
             $asm.puts "bhi #{operands[2].asmLabel}"
         when "biaeq", "bpaeq", "bbaeq"
-            $asm.puts "cmp #{armV7Operands(operands[0..1])}"
+            $asm.puts "cmp #{armOperands(operands[0..1])}"
             $asm.puts "bhs #{operands[2].asmLabel}"
         when "bib", "bpb", "bbb"
-            $asm.puts "cmp #{armV7Operands(operands[0..1])}"
+            $asm.puts "cmp #{armOperands(operands[0..1])}"
             $asm.puts "blo #{operands[2].asmLabel}"
         when "bibeq", "bpbeq", "bbbeq"
-            $asm.puts "cmp #{armV7Operands(operands[0..1])}"
+            $asm.puts "cmp #{armOperands(operands[0..1])}"
             $asm.puts "bls #{operands[2].asmLabel}"
         when "bigt", "bpgt", "bbgt"
-            $asm.puts "cmp #{armV7Operands(operands[0..1])}"
+            $asm.puts "cmp #{armOperands(operands[0..1])}"
             $asm.puts "bgt #{operands[2].asmLabel}"
         when "bigteq", "bpgteq", "bbgteq"
-            $asm.puts "cmp #{armV7Operands(operands[0..1])}"
+            $asm.puts "cmp #{armOperands(operands[0..1])}"
             $asm.puts "bge #{operands[2].asmLabel}"
         when "bilt", "bplt", "bblt"
-            $asm.puts "cmp #{armV7Operands(operands[0..1])}"
+            $asm.puts "cmp #{armOperands(operands[0..1])}"
             $asm.puts "blt #{operands[2].asmLabel}"
         when "bilteq", "bplteq", "bblteq"
-            $asm.puts "cmp #{armV7Operands(operands[0..1])}"
+            $asm.puts "cmp #{armOperands(operands[0..1])}"
             $asm.puts "ble #{operands[2].asmLabel}"
         when "btiz", "btpz", "btbz"
-            emitArmV7Test(operands)
+            emitArmTest(operands)
             $asm.puts "beq #{operands[-1].asmLabel}"
         when "btinz", "btpnz", "btbnz"
-            emitArmV7Test(operands)
+            emitArmTest(operands)
             $asm.puts "bne #{operands[-1].asmLabel}"
         when "btis", "btps", "btbs"
-            emitArmV7Test(operands)
+            emitArmTest(operands)
             $asm.puts "bmi #{operands[-1].asmLabel}"
         when "jmp"
             if operands[0].label?
                 $asm.puts "b #{operands[0].asmLabel}"
             else
-                $asm.puts "mov pc, #{operands[0].armV7Operand}"
+                $asm.puts "mov pc, #{operands[0].armOperand}"
             end
         when "call"
             if operands[0].label?
                 $asm.puts "blx #{operands[0].asmLabel}"
             else
-                $asm.puts "blx #{operands[0].armV7Operand}"
+                $asm.puts "blx #{operands[0].armOperand}"
             end
         when "break"
             $asm.puts "bkpt #0"
         when "ret"
             $asm.puts "bx lr"
         when "cieq", "cpeq", "cbeq"
-            emitArmV7Compare(operands, "eq")
+            emitArmCompare(operands, "eq")
         when "cineq", "cpneq", "cbneq"
-            emitArmV7Compare(operands, "ne")
+            emitArmCompare(operands, "ne")
         when "cia", "cpa", "cba"
-            emitArmV7Compare(operands, "hi")
+            emitArmCompare(operands, "hi")
         when "ciaeq", "cpaeq", "cbaeq"
-            emitArmV7Compare(operands, "hs")
+            emitArmCompare(operands, "hs")
         when "cib", "cpb", "cbb"
-            emitArmV7Compare(operands, "lo")
+            emitArmCompare(operands, "lo")
         when "cibeq", "cpbeq", "cbbeq"
-            emitArmV7Compare(operands, "ls")
+            emitArmCompare(operands, "ls")
         when "cigt", "cpgt", "cbgt"
-            emitArmV7Compare(operands, "gt")
+            emitArmCompare(operands, "gt")
         when "cigteq", "cpgteq", "cbgteq"
-            emitArmV7Compare(operands, "ge")
+            emitArmCompare(operands, "ge")
         when "cilt", "cplt", "cblt"
-            emitArmV7Compare(operands, "lt")
+            emitArmCompare(operands, "lt")
         when "cilteq", "cplteq", "cblteq"
-            emitArmV7Compare(operands, "le")
+            emitArmCompare(operands, "le")
         when "tis", "tbs", "tps"
-            emitArmV7TestSet(operands, "mi")
+            emitArmTestSet(operands, "mi")
         when "tiz", "tbz", "tpz"
-            emitArmV7TestSet(operands, "eq")
+            emitArmTestSet(operands, "eq")
         when "tinz", "tbnz", "tpnz"
-            emitArmV7TestSet(operands, "ne")
+            emitArmTestSet(operands, "ne")
         when "peek"
-            $asm.puts "ldr #{operands[1].armV7Operand}, [sp, \##{operands[0].value * 4}]"
+            $asm.puts "ldr #{operands[1].armOperand}, [sp, \##{operands[0].value * 4}]"
         when "poke"
-            $asm.puts "str #{operands[1].armV7Operand}, [sp, \##{operands[0].value * 4}]"
+            $asm.puts "str #{operands[1].armOperand}, [sp, \##{operands[0].value * 4}]"
         when "fii2d"
-            $asm.puts "vmov #{operands[2].armV7Operand}, #{operands[0].armV7Operand}, #{operands[1].armV7Operand}"
+            $asm.puts "vmov #{operands[2].armOperand}, #{operands[0].armOperand}, #{operands[1].armOperand}"
         when "fd2ii"
-            $asm.puts "vmov #{operands[1].armV7Operand}, #{operands[2].armV7Operand}, #{operands[0].armV7Operand}"
+            $asm.puts "vmov #{operands[1].armOperand}, #{operands[2].armOperand}, #{operands[0].armOperand}"
         when "bo"
             $asm.puts "bvs #{operands[0].asmLabel}"
         when "bs"
@@ -519,10 +519,10 @@ class Instruction
         when "bnz"
             $asm.puts "bne #{operands[0].asmLabel}"
         when "leai", "leap"
-            operands[0].armV7EmitLea(operands[1])
+            operands[0].armEmitLea(operands[1])
         when "smulli"
             raise "Wrong number of arguments to smull in #{self.inspect} at #{codeOriginString}" unless operands.length == 4
-            $asm.puts "smull #{operands[2].armV7Operand}, #{operands[3].armV7Operand}, #{operands[0].armV7Operand}, #{operands[1].armV7Operand}"
+            $asm.puts "smull #{operands[2].armOperand}, #{operands[3].armOperand}, #{operands[0].armOperand}, #{operands[1].armOperand}"
         else
             lowerDefault
         end
index ef9358c..29b414e 100644 (file)
@@ -22,7 +22,7 @@
 # THE POSSIBILITY OF SUCH DAMAGE.
 
 require "config"
-require "armv7"
+require "arm"
 require "ast"
 require "x86"
 require "mips"
index 7408253..5fce9f1 100644 (file)
@@ -172,7 +172,7 @@ end
 #     end
 # }
 #
-# See armv7.rb for a different example, in which we lower all BaseIndex addresses
+# See arm.rb for a different example, in which we lower all BaseIndex addresses
 # that have non-zero offset, all Address addresses that have large offsets, and
 # all other addresses (like AbsoluteAddress).
 #