[PATCH] D18195: [mips] Use `formatImm` call to print immediate value in the `MipsInstPrinter`

Simon Atanasyan via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 17 03:48:34 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL263704: [mips] Use `formatImm` call to print immediate value in the `MipsInstPrinter` (authored by atanasyan).

Changed prior to commit:
  http://reviews.llvm.org/D18195?vs=50763&id=50920#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D18195

Files:
  llvm/trunk/lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp
  llvm/trunk/test/MC/Mips/hex-immediates.s

Index: llvm/trunk/test/MC/Mips/hex-immediates.s
===================================================================
--- llvm/trunk/test/MC/Mips/hex-immediates.s
+++ llvm/trunk/test/MC/Mips/hex-immediates.s
@@ -0,0 +1,11 @@
+# RUN: llvm-mc -filetype=obj %s -triple=mips-unknown-linux \
+# RUN:   | llvm-objdump -d --print-imm-hex - | FileCheck %s
+
+# CHECK: jal   0x20
+# CHECK: addiu $sp, $sp, -0x20
+# CHECK: sw    $2,  0x10($fp)
+
+jal     32
+addiu   $sp, $sp, -32
+sw      $2, 16($fp)
+lui     $2, 2
Index: llvm/trunk/lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp
===================================================================
--- llvm/trunk/lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp
+++ llvm/trunk/lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp
@@ -195,7 +195,7 @@
   }
 
   if (Op.isImm()) {
-    O << Op.getImm();
+    O << formatImm(Op.getImm());
     return;
   }
 
@@ -211,7 +211,7 @@
     Imm -= Offset;
     Imm &= (1 << Bits) - 1;
     Imm += Offset;
-    O << Imm;
+    O << formatImm(Imm);
     return;
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18195.50920.patch
Type: text/x-patch
Size: 1040 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160317/c041d6c7/attachment.bin>


More information about the llvm-commits mailing list