[llvm] r263704 - [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:43:37 PDT 2016
Author: atanasyan
Date: Thu Mar 17 05:43:36 2016
New Revision: 263704
URL: http://llvm.org/viewvc/llvm-project?rev=263704&view=rev
Log:
[mips] Use `formatImm` call to print immediate value in the `MipsInstPrinter`
That allows, for example, to print hex-formatted immediates using
llvm-objdump --print-imm-hex command line option.
Differential Revision: http://reviews.llvm.org/D18195
Added:
llvm/trunk/test/MC/Mips/hex-immediates.s
Modified:
llvm/trunk/lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp
Modified: llvm/trunk/lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp?rev=263704&r1=263703&r2=263704&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp (original)
+++ llvm/trunk/lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp Thu Mar 17 05:43:36 2016
@@ -195,7 +195,7 @@ void MipsInstPrinter::printOperand(const
}
if (Op.isImm()) {
- O << Op.getImm();
+ O << formatImm(Op.getImm());
return;
}
@@ -211,7 +211,7 @@ void MipsInstPrinter::printUImm(const MC
Imm -= Offset;
Imm &= (1 << Bits) - 1;
Imm += Offset;
- O << Imm;
+ O << formatImm(Imm);
return;
}
Added: llvm/trunk/test/MC/Mips/hex-immediates.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/hex-immediates.s?rev=263704&view=auto
==============================================================================
--- llvm/trunk/test/MC/Mips/hex-immediates.s (added)
+++ llvm/trunk/test/MC/Mips/hex-immediates.s Thu Mar 17 05:43:36 2016
@@ -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
More information about the llvm-commits
mailing list