[llvm-commits] [llvm] r166991 - in /llvm/trunk: lib/Target/ARM/ARMInstrThumb.td lib/Target/ARM/ARMInstrThumb2.td lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp lib/Target/ARM/InstPrinter/ARMInstPrinter.h test/MC/ARM/basic-thumb-instructions.s test/MC/Disassembler/ARM/marked-up-thumb.txt test/MC/Disassembler/ARM/thumb-printf.txt test/MC/Disassembler/ARM/thumb-tests.txt test/MC/Disassembler/ARM/thumb1.txt
Jim Grosbach
grosbach at apple.com
Mon Oct 29 18:04:51 PDT 2012
Author: grosbach
Date: Mon Oct 29 20:04:51 2012
New Revision: 166991
URL: http://llvm.org/viewvc/llvm-project?rev=166991&view=rev
Log:
ARM: Better disassembly for pc-relative LDR.
When the operand is a plain immediate rather than a label, print it
as [pc, #imm] like we do for the Thumb2 wide encoding variant.
rdar://12154503
Modified:
llvm/trunk/lib/Target/ARM/ARMInstrThumb.td
llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td
llvm/trunk/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp
llvm/trunk/lib/Target/ARM/InstPrinter/ARMInstPrinter.h
llvm/trunk/test/MC/ARM/basic-thumb-instructions.s
llvm/trunk/test/MC/Disassembler/ARM/marked-up-thumb.txt
llvm/trunk/test/MC/Disassembler/ARM/thumb-printf.txt
llvm/trunk/test/MC/Disassembler/ARM/thumb-tests.txt
llvm/trunk/test/MC/Disassembler/ARM/thumb1.txt
Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb.td?rev=166991&r1=166990&r2=166991&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMInstrThumb.td (original)
+++ llvm/trunk/lib/Target/ARM/ARMInstrThumb.td Mon Oct 29 20:04:51 2012
@@ -223,6 +223,7 @@
def t_addrmode_pc : Operand<i32> {
let EncoderMethod = "getAddrModePCOpValue";
let DecoderMethod = "DecodeThumbAddrModePC";
+ let PrintMethod = "printThumbLdrLabelOperand";
}
//===----------------------------------------------------------------------===//
Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td?rev=166991&r1=166990&r2=166991&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td (original)
+++ llvm/trunk/lib/Target/ARM/ARMInstrThumb2.td Mon Oct 29 20:04:51 2012
@@ -159,7 +159,7 @@
// t2ldrlabel := imm12
def t2ldrlabel : Operand<i32> {
let EncoderMethod = "getAddrModeImm12OpValue";
- let PrintMethod = "printT2LdrLabelOperand";
+ let PrintMethod = "printThumbLdrLabelOperand";
}
def t2ldr_pcrel_imm12_asmoperand : AsmOperandClass {let Name = "MemPCRelImm12";}
Modified: llvm/trunk/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp?rev=166991&r1=166990&r2=166991&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp Mon Oct 29 20:04:51 2012
@@ -283,8 +283,8 @@
}
}
-void ARMInstPrinter::printT2LdrLabelOperand(const MCInst *MI, unsigned OpNum,
- raw_ostream &O) {
+void ARMInstPrinter::printThumbLdrLabelOperand(const MCInst *MI, unsigned OpNum,
+ raw_ostream &O) {
const MCOperand &MO1 = MI->getOperand(OpNum);
if (MO1.isExpr())
O << *MO1.getExpr();
Modified: llvm/trunk/lib/Target/ARM/InstPrinter/ARMInstPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/InstPrinter/ARMInstPrinter.h?rev=166991&r1=166990&r2=166991&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/InstPrinter/ARMInstPrinter.h (original)
+++ llvm/trunk/lib/Target/ARM/InstPrinter/ARMInstPrinter.h Mon Oct 29 20:04:51 2012
@@ -126,7 +126,8 @@
void printRotImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O);
void printPCLabel(const MCInst *MI, unsigned OpNum, raw_ostream &O);
- void printT2LdrLabelOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O);
+ void printThumbLdrLabelOperand(const MCInst *MI, unsigned OpNum,
+ raw_ostream &O);
void printFBits16(const MCInst *MI, unsigned OpNum, raw_ostream &O);
void printFBits32(const MCInst *MI, unsigned OpNum, raw_ostream &O);
void printVectorIndex(const MCInst *MI, unsigned OpNum, raw_ostream &O);
Modified: llvm/trunk/test/MC/ARM/basic-thumb-instructions.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/basic-thumb-instructions.s?rev=166991&r1=166990&r2=166991&view=diff
==============================================================================
--- llvm/trunk/test/MC/ARM/basic-thumb-instructions.s (original)
+++ llvm/trunk/test/MC/ARM/basic-thumb-instructions.s Mon Oct 29 20:04:51 2012
@@ -259,8 +259,8 @@
@ CHECK: ldr r1, _foo @ encoding: [A,0x49]
@ fixup A - offset: 0, value: _foo, kind: fixup_arm_thumb_cp
-@ CHECK: ldr r3, #604 @ encoding: [0x97,0x4b]
-@ CHECK: ldr r3, #368 @ encoding: [0x5c,0x4b]
+@ CHECK: ldr r3, [pc, #604] @ encoding: [0x97,0x4b]
+@ CHECK: ldr r3, [pc, #368] @ encoding: [0x5c,0x4b]
@------------------------------------------------------------------------------
@ LDR (register)
Modified: llvm/trunk/test/MC/Disassembler/ARM/marked-up-thumb.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Disassembler/ARM/marked-up-thumb.txt?rev=166991&r1=166990&r2=166991&view=diff
==============================================================================
--- llvm/trunk/test/MC/Disassembler/ARM/marked-up-thumb.txt (original)
+++ llvm/trunk/test/MC/Disassembler/ARM/marked-up-thumb.txt Mon Oct 29 20:04:51 2012
@@ -1,5 +1,5 @@
# RUN: llvm-mc -triple=thumbv7-apple-darwin -mcpu=cortex-a8 -mdis < %s | FileCheck %s
-# CHECK: ldr <reg:r4>, <imm:#32>
+# CHECK: ldr <reg:r4>, <mem:[pc, <imm:#32>]>
0x08 0x4c
# CHECK: push {<reg:r1>, <reg:r2>, <reg:r7>}
0x86 0xb4
Modified: llvm/trunk/test/MC/Disassembler/ARM/thumb-printf.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Disassembler/ARM/thumb-printf.txt?rev=166991&r1=166990&r2=166991&view=diff
==============================================================================
--- llvm/trunk/test/MC/Disassembler/ARM/thumb-printf.txt (original)
+++ llvm/trunk/test/MC/Disassembler/ARM/thumb-printf.txt Mon Oct 29 20:04:51 2012
@@ -7,17 +7,17 @@
# CHECK-NEXT: add r3, sp, #20
# CHECK-NEXT: ldr r5, [r3], #4
# CHECK-NEXT: str r3, [sp]
-# CHECK-NEXT: ldr r3, #52
+# CHECK-NEXT: ldr r3, [pc, #52]
# CHECK-NEXT: add r3, pc
# CHECK-NEXT: ldr r0, [r3]
# CHECK-NEXT: ldr r4, [r0]
-# CHECK-NEXT: ldr r0, #48
+# CHECK-NEXT: ldr r0, [pc, #48]
# CHECK-NEXT: add r0, pc
# CHECK-NEXT: ldr r0, [r0]
# CHECK-NEXT: ldr r0, [r0]
# CHECK-NEXT: blx #191548
# CHECK-NEXT: cbnz r0, #6
-# CHECK-NEXT: ldr r1, #40
+# CHECK-NEXT: ldr r1, [pc, #40]
# CHECK-NEXT: add r1, pc
# CHECK-NEXT: ldr r1, [r1]
# CHECK-NEXT: b #0
Modified: llvm/trunk/test/MC/Disassembler/ARM/thumb-tests.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Disassembler/ARM/thumb-tests.txt?rev=166991&r1=166990&r2=166991&view=diff
==============================================================================
--- llvm/trunk/test/MC/Disassembler/ARM/thumb-tests.txt (original)
+++ llvm/trunk/test/MC/Disassembler/ARM/thumb-tests.txt Mon Oct 29 20:04:51 2012
@@ -30,7 +30,7 @@
# CHECK: ldm r0!, {r1}
0x02 0xc8
-# CHECK: ldr r5, #432
+# CHECK: ldr r5, [pc, #432]
0x6c 0x4d
# CHECK: str r0, [r3]
Modified: llvm/trunk/test/MC/Disassembler/ARM/thumb1.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Disassembler/ARM/thumb1.txt?rev=166991&r1=166990&r2=166991&view=diff
==============================================================================
--- llvm/trunk/test/MC/Disassembler/ARM/thumb1.txt (original)
+++ llvm/trunk/test/MC/Disassembler/ARM/thumb1.txt Mon Oct 29 20:04:51 2012
@@ -160,6 +160,7 @@
# CHECK: ldr r1, [sp]
# CHECK: ldr r2, [sp, #24]
# CHECK: ldr r3, [sp, #1020]
+# CHECK: ldr r1, [pc, #12]
0x29 0x68
@@ -168,6 +169,7 @@
0x00 0x99
0x06 0x9a
0xff 0x9b
+0x03 0x49
#------------------------------------------------------------------------------
# LDR (register)
More information about the llvm-commits
mailing list