diff options
author | Fangrui Song <maskray@google.com> | 2020-03-22 12:32:27 -0700 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2020-03-26 08:21:15 -0700 |
commit | 5fad05e80dd05ac267c0d5d753a5b95b6201bac9 (patch) | |
tree | 431d363dcad6d1aaa9e4e94c3706f2ae8b9f4ca1 /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | b9943d68d3c7b354f40a618ece2bf7906688b057 (diff) | |
download | llvm-5fad05e80dd05ac267c0d5d753a5b95b6201bac9.zip llvm-5fad05e80dd05ac267c0d5d753a5b95b6201bac9.tar.gz llvm-5fad05e80dd05ac267c0d5d753a5b95b6201bac9.tar.bz2 |
[MCInstPrinter] Pass `Address` parameter to MCOI::OPERAND_PCREL typed operands. NFC
Follow-up of D72172 and D72180
This patch passes `uint64_t Address` to print methods of PC-relative
operands so that subsequent target specific patches can change
`*InstPrinter::print{Operand,PCRelImm,...}` to customize the output.
Add MCInstPrinter::PrintBranchImmAsAddress which is set to true by
llvm-objdump.
```
// Current llvm-objdump -d output
aarch64: 20000: bl #0
ppc: 20000: bl .+4
x86: 20000: callq 0
// Ideal output
aarch64: 20000: bl 0x20000
ppc: 20000: bl 0x20004
x86: 20000: callq 0x20005
// GNU objdump -d. The lack of 0x is not ideal because the result cannot be re-assembled
aarch64: 20000: bl 20000
ppc: 20000: bl 0x20004
x86: 20000: callq 20005
```
In `lib/Target/X86/X86GenAsmWriter1.inc` (generated by `llvm-tblgen -gen-asm-writer`):
```
case 12:
// CALL64pcrel32, CALLpcrel16, CALLpcrel32, EH_SjLj_Setup, JCXZ, JECXZ, J...
- printPCRelImm(MI, 0, O);
+ printPCRelImm(MI, Address, 0, O);
return;
```
Some targets have 2 `printOperand` overloads, one without `Address` and
one with `Address`. They should annotate derived `Operand` properly with
`let OperandType = "OPERAND_PCREL"`.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D76574
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions