summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorYonghong Song <yhs@fb.com>2017-12-20 19:39:58 +0000
committerYonghong Song <yhs@fb.com>2017-12-20 19:39:58 +0000
commitfe6f85f7dda79409f1a32930be3ce9ee1ff140ca (patch)
tree36108c9cef50a332c935217ef794601af75e2dc5 /utils
parent86e7a0583d3a22261d25808391c82147f15d25f0 (diff)
bpf: add support for objdump -print-imm-hex
Add support for 'objdump -print-imm-hex' for imm64, operand imm and branch target. If user programs encode immediate values as hex numbers, such an option will make it easy to correlate asm insns with source code. This option also makes it easy to correlate imm values with insn encoding. There is one changed behavior in this patch. In old way, we print the 64bit imm as u64: O << (uint64_t)Op.getImm(); and the new way is: O << formatImm(Op.getImm()); The formatImm is defined in llvm/MC/MCInstPrinter.h as format_object<int64_t> formatImm(int64_t Value) So the new way to print 64bit imm is i64 type. If a 64bit value has the highest bit set, the old way will print the value as a positive value and the new way will print as a negative value. The new way is consistent with x86_64. For the code (see the test program): ... if (a == 0xABCDABCDabcdabcdULL) ... x86_64 objdump, with and without -print-imm-hex, looks like: 48 b8 cd ab cd ab cd ab cd ab movabsq $-6067004223159161907, %rax 48 b8 cd ab cd ab cd ab cd ab movabsq $-0x5432543254325433, %rax Signed-off-by: Yonghong Song <yhs@fb.com> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321215 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
0 files changed, 0 insertions, 0 deletions