[all-commits] [llvm/llvm-project] 5fad05: [MCInstPrinter] Pass `Address` parameter to MCOI::...
Fangrui Song via All-commits
all-commits at lists.llvm.org
Thu Mar 26 08:21:26 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 5fad05e80dd05ac267c0d5d753a5b95b6201bac9
https://github.com/llvm/llvm-project/commit/5fad05e80dd05ac267c0d5d753a5b95b6201bac9
Author: Fangrui Song <maskray at google.com>
Date: 2020-03-26 (Thu, 26 Mar 2020)
Changed paths:
M llvm/include/llvm/MC/MCInstPrinter.h
M llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
M llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.h
M llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUInstPrinter.h
M llvm/lib/Target/ARC/MCTargetDesc/ARCInstPrinter.h
M llvm/lib/Target/ARM/MCTargetDesc/ARMInstPrinter.h
M llvm/lib/Target/AVR/MCTargetDesc/AVRInstPrinter.h
M llvm/lib/Target/Mips/MCTargetDesc/MipsInstPrinter.h
M llvm/lib/Target/PowerPC/MCTargetDesc/PPCInstPrinter.h
M llvm/lib/Target/SystemZ/MCTargetDesc/SystemZInstPrinter.cpp
M llvm/lib/Target/SystemZ/MCTargetDesc/SystemZInstPrinter.h
M llvm/lib/Target/X86/MCTargetDesc/X86ATTInstPrinter.cpp
M llvm/lib/Target/X86/MCTargetDesc/X86InstPrinterCommon.cpp
M llvm/lib/Target/X86/MCTargetDesc/X86InstPrinterCommon.h
M llvm/tools/llvm-objdump/llvm-objdump.cpp
M llvm/utils/TableGen/AsmWriterInst.cpp
M llvm/utils/TableGen/AsmWriterInst.h
Log Message:
-----------
[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
More information about the All-commits
mailing list