mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-12 14:17:59 +00:00
[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:
parent
afc05c9eb7
commit
b23379e537
@ -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;
|
||||
}
|
||||
|
||||
|
11
test/MC/Mips/hex-immediates.s
Normal file
11
test/MC/Mips/hex-immediates.s
Normal 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
|
Loading…
Reference in New Issue
Block a user