[PATCH] D83634: [AVRInstPrinter] printOperand: support llvm-objdump --print-imm-hex
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 11 17:08:12 PDT 2020
MaskRay updated this revision to Diff 277268.
MaskRay added a comment.
Forgot to add test
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D83634/new/
https://reviews.llvm.org/D83634
Files:
llvm/lib/Target/AVR/MCTargetDesc/AVRInstPrinter.cpp
llvm/test/MC/AVR/hex-immediates.s
Index: llvm/test/MC/AVR/hex-immediates.s
===================================================================
--- /dev/null
+++ llvm/test/MC/AVR/hex-immediates.s
@@ -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
Index: llvm/lib/Target/AVR/MCTargetDesc/AVRInstPrinter.cpp
===================================================================
--- llvm/lib/Target/AVR/MCTargetDesc/AVRInstPrinter.cpp
+++ llvm/lib/Target/AVR/MCTargetDesc/AVRInstPrinter.cpp
@@ -131,7 +131,7 @@
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();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83634.277268.patch
Type: text/x-patch
Size: 936 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200712/02fa955a/attachment-0001.bin>
More information about the llvm-commits
mailing list