[PATCH] D76574: [MCInstPrinter] Pass `Address` parameter to MCOI::OPERAND_PCREL typed operands
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 22 15:01:38 PDT 2020
MaskRay created this revision.
MaskRay added reviewers: craig.topper, grimar, jhenderson, rnk.
Herald added subscribers: llvm-commits, danielkiss, kerbowa, Jim, atanasyan, jrtc27, kbarton, hiraditya, kristof.beyls, nhaehnle, jvesely, nemanjai, sdardis, dylanmckay, arsenm.
Herald added a project: LLVM.
Follow-up of D72172 <https://reviews.llvm.org/D72172> and D72180 <https://reviews.llvm.org/D72180>
// Current llvm-objdump -d output
aarch64: bl #$imm
ppc: bl .+$imm
x86: callq $imm
// Ideal output (GNU objdump -d, also many users' preference)
aarch64: bl $target
ppc: bl $target
x86: callq $target
This patch passes `uint64_t Address` to print methods of PC-relative
operands so that `*InstPrinter::print{Operand,PCRelImm,...}` can customize the output.
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"`.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D76574
Files:
llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.h
llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUInstPrinter.h
llvm/lib/Target/ARC/MCTargetDesc/ARCInstPrinter.h
llvm/lib/Target/ARM/MCTargetDesc/ARMInstPrinter.h
llvm/lib/Target/AVR/MCTargetDesc/AVRInstPrinter.h
llvm/lib/Target/Mips/MCTargetDesc/MipsInstPrinter.h
llvm/lib/Target/PowerPC/MCTargetDesc/PPCInstPrinter.h
llvm/lib/Target/SystemZ/MCTargetDesc/SystemZInstPrinter.cpp
llvm/lib/Target/SystemZ/MCTargetDesc/SystemZInstPrinter.h
llvm/lib/Target/X86/MCTargetDesc/X86ATTInstPrinter.cpp
llvm/lib/Target/X86/MCTargetDesc/X86InstPrinterCommon.cpp
llvm/lib/Target/X86/MCTargetDesc/X86InstPrinterCommon.h
llvm/utils/TableGen/AsmWriterInst.cpp
llvm/utils/TableGen/AsmWriterInst.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76574.251919.patch
Type: text/x-patch
Size: 14457 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200322/411d7c13/attachment-0001.bin>
More information about the llvm-commits
mailing list