[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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263704 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Simon Atanasyan 2016-03-17 10:43:36 +00:00
parent afc05c9eb7
commit b23379e537
2 changed files with 13 additions and 2 deletions

View File

@ -195,7 +195,7 @@ void MipsInstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
}
if (Op.isImm()) {
O << Op.getImm();
O << formatImm(Op.getImm());
return;
}
@ -211,7 +211,7 @@ void MipsInstPrinter::printUImm(const MCInst *MI, int opNum, raw_ostream &O) {
Imm -= Offset;
Imm &= (1 << Bits) - 1;
Imm += Offset;
O << Imm;
O << formatImm(Imm);
return;
}

View File

@ -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