[llvm] r210701 - ARM: honor hex immediate formatting for ldr/str i12 offsets.
Jim Grosbach
grosbach at apple.com
Wed Jun 11 13:26:45 PDT 2014
Author: grosbach
Date: Wed Jun 11 15:26:45 2014
New Revision: 210701
URL: http://llvm.org/viewvc/llvm-project?rev=210701&view=rev
Log:
ARM: honor hex immediate formatting for ldr/str i12 offsets.
Previously we would always print the offset as decimal, regardless of
the formatting requested. Now we use the formatImm() helper so the value
is printed as the client (LLDB in the motivating example) requested.
Before:
ldr.w r8, [sp, #180] @ always
After:
ldr.w r8, [sp, #0xb4] @ when printing hex immediates
ldr.w r8, [sp, #0180] @ when printing decimal immediates
rdar://17237103
Modified:
llvm/trunk/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp
llvm/trunk/test/MC/Disassembler/ARM/hex-immediates.txt
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=210701&r1=210700&r2=210701&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp Wed Jun 11 15:26:45 2014
@@ -1092,13 +1092,13 @@ void ARMInstPrinter::printAddrModeImm12O
if (isSub) {
O << ", "
<< markup("<imm:")
- << "#-" << -OffImm
+ << "#-" << formatImm(-OffImm)
<< markup(">");
}
else if (AlwaysPrintImm0 || OffImm > 0) {
O << ", "
<< markup("<imm:")
- << "#" << OffImm
+ << "#" << formatImm(OffImm)
<< markup(">");
}
O << "]" << markup(">");
Modified: llvm/trunk/test/MC/Disassembler/ARM/hex-immediates.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Disassembler/ARM/hex-immediates.txt?rev=210701&r1=210700&r2=210701&view=diff
==============================================================================
--- llvm/trunk/test/MC/Disassembler/ARM/hex-immediates.txt (original)
+++ llvm/trunk/test/MC/Disassembler/ARM/hex-immediates.txt Wed Jun 11 15:26:45 2014
@@ -3,3 +3,9 @@
0x08 0x4c
# CHECK: sub sp, #0x84
0xa1 0xb0
+# CHECK: ldr r0, [sp, #0xb4]
+0x2d 0x98
+# CHECK: str.w r8, [sp, #0xb4]
+0xcd 0xf8 0xb4 0x80
+# CHECK: ldr.w r8, [sp, #0xb4]
+0xdd 0xf8 0xb4 0x80
More information about the llvm-commits
mailing list