[AVRInstPrinter] printOperand: support llvm-objdump --print-imm-hex

Differential Revision: https://reviews.llvm.org/D83634
This commit is contained in:
Fangrui Song 2020-07-12 08:14:52 -07:00
parent 032810f589
commit be9f363704
2 changed files with 8 additions and 1 deletions

View File

@ -131,7 +131,7 @@ void AVRInstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
O << getPrettyRegisterName(Op.getReg(), MRI);
}
} else if (Op.isImm()) {
O << Op.getImm();
O << formatImm(Op.getImm());
} else {
assert(Op.isExpr() && "Unknown operand kind in printOperand");
O << *Op.getExpr();

View File

@ -0,0 +1,7 @@
; RUN: llvm-mc -filetype=obj -triple=avr %s -o %t
; RUN: llvm-objdump -d %t | FileCheck %s --check-prefix=DEC
; RUN: llvm-objdump -d --print-imm-hex %t | FileCheck %s --check-prefix=HEX
; DEC: ldi r24, 66
; HEX: ldi r24, 0x42
ldi r24, 0x42