[llvm] r210701 - ARM: honor hex immediate formatting for ldr/str i12offsets.

James Molloy mankeyrabbit at gmail.com
Wed Jun 11 14:15:16 PDT 2014


Hi Jim,

ldr.w r8, [sp, #0180] @ when printing decimal immediates

Is this a pasto? The leading zero seems very confusing (octal?)

Cheers,

James

-----Original Message-----
From: "Jim Grosbach" <grosbach at apple.com>
Sent: ‎11/‎06/‎2014 21:39
To: "llvm-commits at cs.uiuc.edu" <llvm-commits at cs.uiuc.edu>
Subject: [llvm] r210701 - ARM: honor hex immediate formatting for ldr/str i12offsets.

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


_______________________________________________
llvm-commits mailing list
llvm-commits at cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140611/02f87170/attachment.html>


More information about the llvm-commits mailing list