llvm-project/llvm/lib/Target/AMDGPU/MCTargetDesc
Fangrui Song 5fad05e80d [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
2020-03-26 08:21:15 -07:00
..
AMDGPUAsmBackend.cpp [MC] Minor cleanup to MCFixup::Kind handling. NFC. 2019-08-23 01:00:55 +00:00
AMDGPUELFObjectWriter.cpp [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
AMDGPUELFStreamer.cpp
AMDGPUELFStreamer.h
AMDGPUFixupKinds.h
AMDGPUInstPrinter.cpp [AMDGPU] Add Scratch Wave Offset to Scratch Buffer Descriptor in entry functions 2020-03-19 15:35:16 -04:00
AMDGPUInstPrinter.h [MCInstPrinter] Pass `Address` parameter to MCOI::OPERAND_PCREL typed operands. NFC 2020-03-26 08:21:15 -07:00
AMDGPUMCAsmInfo.cpp [AMDGPU] Print DWARF register numbers in AMDGPUInstPrinter 2020-03-17 19:42:10 -04:00
AMDGPUMCAsmInfo.h [Mips] Use appropriate private label prefix based on Mips ABI 2019-10-23 12:24:35 +02:00
AMDGPUMCCodeEmitter.cpp
AMDGPUMCCodeEmitter.h [AMDGPU] gfx908 mAI instructions, MC part 2019-07-09 21:43:09 +00:00
AMDGPUMCTargetDesc.cpp Implement wave32 DWARF register mapping 2020-03-23 10:24:16 -04:00
AMDGPUMCTargetDesc.h Implement wave32 DWARF register mapping 2020-03-23 10:24:16 -04:00
AMDGPUTargetStreamer.cpp [MC] Add MCStreamer::emitInt{8,16,32,64} 2020-02-29 09:40:21 -08:00
AMDGPUTargetStreamer.h AMDGPU/MC: Add .amdgpu_lds directive 2019-06-25 11:51:35 +00:00
CMakeLists.txt [cmake] Explicitly mark libraries defined in lib/ as "Component Libraries" 2019-11-21 10:48:08 -08:00
LLVMBuild.txt [AMDGPU] Move InstPrinter files to MCTargetDesc. NFC 2019-05-11 00:03:35 +00:00
R600MCCodeEmitter.cpp
R600MCTargetDesc.cpp
SIMCCodeEmitter.cpp [AMDGPU] Remove AMDGPURegisterInfo 2020-02-11 11:13:38 -08:00