ADR was added with the wrong encoding for inst{24-21}, and the ARM decoder was fooled.
authorJohnny Chen <johnny.chen@apple.com>
Thu, 24 Mar 2011 20:42:48 +0000 (20:42 +0000)
committerJohnny Chen <johnny.chen@apple.com>
Thu, 24 Mar 2011 20:42:48 +0000 (20:42 +0000)
Set the encoding bits to {0,?,?,0}, not 0.  Plus delegate the disassembly of ADR to
the more generic ADDri/SUBri instructions, and add a test case for that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128234 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMInstrInfo.td
test/MC/Disassembler/ARM/arm-tests.txt
utils/TableGen/ARMDecoderEmitter.cpp

index 9d09a65da4110b072e8447aab5e72a28cd48a0b4..cc4fcfc3c89a8219c2350e7b213e908d5c7d167a 100644 (file)
@@ -1253,7 +1253,7 @@ let neverHasSideEffects = 1, isReMaterializable = 1 in
 // The 'adr' mnemonic encodes differently if the label is before or after
 // the instruction. The {24-21} opcode bits are set by the fixup, as we don't
 // know until then which form of the instruction will be used.
-def ADR : AI1<0, (outs GPR:$Rd), (ins adrlabel:$label),
+def ADR : AI1<{0,?,?,0}, (outs GPR:$Rd), (ins adrlabel:$label),
                  MiscFrm, IIC_iALUi, "adr", "\t$Rd, #$label", []> {
   bits<4> Rd;
   bits<12> label;
index 93d6a03005b05581aec46699cbcefdd8274c1652..16e6981382ea4fac41ebc327f21f7936cf302f85 100644 (file)
@@ -1,5 +1,8 @@
 # RUN: llvm-mc --disassemble %s -triple=arm-apple-darwin9 | FileCheck %s
 
+# CHECK:       addpl   r4, pc, #19, 8
+0x4c 0x45 0x8f 0x52
+
 # CHECK:       b       #0
 0x00 0x00 0x00 0xea
 
index 09243e116b3b2f32d43b2bfdb0edf128b6a61ec7..b174fa961add9a3aa290191d19e244e308716e70 100644 (file)
@@ -1584,6 +1584,10 @@ ARMDEBackend::populateInstruction(const CodeGenInstruction &CGI,
         Name == "MOVr_TC")
       return false;
 
+    // Delegate ADR disassembly to the more generic ADDri/SUBri instructions.
+    if (Name == "ADR")
+      return false;
+
     //
     // The following special cases are for conflict resolutions.
     //