LLVM  16.0.0git
AMDGPUInstPrinter.h
Go to the documentation of this file.
1 //===-- AMDGPUInstPrinter.h - AMDGPU MC Inst -> ASM interface ---*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 /// \file
10 //===----------------------------------------------------------------------===//
11 
12 #ifndef LLVM_LIB_TARGET_AMDGPU_MCTARGETDESC_AMDGPUINSTPRINTER_H
13 #define LLVM_LIB_TARGET_AMDGPU_MCTARGETDESC_AMDGPUINSTPRINTER_H
14 
15 #include "llvm/MC/MCInstPrinter.h"
16 
17 namespace llvm {
18 class MCInstrDesc;
19 
21 public:
23  const MCInstrInfo &MII, const MCRegisterInfo &MRI)
24  : MCInstPrinter(MAI, MII, MRI) {}
25 
26  //Autogenerated by tblgen
27  void printRegName(raw_ostream &OS, unsigned RegNo) const override;
28  std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
29  void printInstruction(const MCInst *MI, uint64_t Address,
30  const MCSubtargetInfo &STI, raw_ostream &O);
31  static const char *getRegisterName(unsigned RegNo);
32 
33  void printInst(const MCInst *MI, uint64_t Address, StringRef Annot,
34  const MCSubtargetInfo &STI, raw_ostream &O) override;
35  static void printRegOperand(unsigned RegNo, raw_ostream &O,
36  const MCRegisterInfo &MRI);
37 
38 private:
39  void printU4ImmOperand(const MCInst *MI, unsigned OpNo,
40  const MCSubtargetInfo &STI, raw_ostream &O);
41  void printU8ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
42  void printU16ImmOperand(const MCInst *MI, unsigned OpNo,
43  const MCSubtargetInfo &STI, raw_ostream &O);
44  void printU4ImmDecOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
45  void printU8ImmDecOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
46  void printU16ImmDecOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
47  void printU32ImmOperand(const MCInst *MI, unsigned OpNo,
48  const MCSubtargetInfo &STI, raw_ostream &O);
49  void printNamedBit(const MCInst *MI, unsigned OpNo, raw_ostream &O,
50  StringRef BitName);
51  void printOffen(const MCInst *MI, unsigned OpNo, raw_ostream &O);
52  void printIdxen(const MCInst *MI, unsigned OpNo, raw_ostream &O);
53  void printAddr64(const MCInst *MI, unsigned OpNo, raw_ostream &O);
54  void printOffset(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
55  raw_ostream &O);
56  void printFlatOffset(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
57  raw_ostream &O);
58 
59  void printOffset0(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
60  raw_ostream &O);
61  void printOffset1(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
62  raw_ostream &O);
63  void printSMRDOffset8(const MCInst *MI, unsigned OpNo,
64  const MCSubtargetInfo &STI, raw_ostream &O);
65  void printSMEMOffset(const MCInst *MI, unsigned OpNo,
66  const MCSubtargetInfo &STI, raw_ostream &O);
67  void printSMEMOffsetMod(const MCInst *MI, unsigned OpNo,
68  const MCSubtargetInfo &STI, raw_ostream &O);
69  void printSMRDLiteralOffset(const MCInst *MI, unsigned OpNo,
70  const MCSubtargetInfo &STI, raw_ostream &O);
71  void printGDS(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
72  raw_ostream &O);
73  void printCPol(const MCInst *MI, unsigned OpNo,
74  const MCSubtargetInfo &STI, raw_ostream &O);
75  void printSWZ(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
76  raw_ostream &O);
77  void printTFE(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
78  raw_ostream &O);
79  void printDMask(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
80  raw_ostream &O);
81  void printDim(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
82  raw_ostream &O);
83  void printUNorm(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
84  raw_ostream &O);
85  void printDA(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
86  raw_ostream &O);
87  void printR128A16(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
88  raw_ostream &O);
89  void printGFX10A16(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
90  raw_ostream &O);
91  void printLWE(const MCInst *MI, unsigned OpNo,
92  const MCSubtargetInfo &STI, raw_ostream &O);
93  void printD16(const MCInst *MI, unsigned OpNo,
94  const MCSubtargetInfo &STI, raw_ostream &O);
95  void printExpCompr(const MCInst *MI, unsigned OpNo,
96  const MCSubtargetInfo &STI, raw_ostream &O);
97  void printExpVM(const MCInst *MI, unsigned OpNo,
98  const MCSubtargetInfo &STI, raw_ostream &O);
99  void printFORMAT(const MCInst *MI, unsigned OpNo,
100  const MCSubtargetInfo &STI, raw_ostream &O);
101  void printSymbolicFormat(const MCInst *MI,
102  const MCSubtargetInfo &STI, raw_ostream &O);
103 
104  void printRegOperand(unsigned RegNo, raw_ostream &O);
105  void printVOPDst(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
106  raw_ostream &O);
107  void printVINTRPDst(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
108  raw_ostream &O);
109  void printImmediateInt16(uint32_t Imm, const MCSubtargetInfo &STI,
110  raw_ostream &O);
111  void printImmediate16(uint32_t Imm, const MCSubtargetInfo &STI,
112  raw_ostream &O);
113  void printImmediateV216(uint32_t Imm, const MCSubtargetInfo &STI,
114  raw_ostream &O);
115  void printImmediate32(uint32_t Imm, const MCSubtargetInfo &STI,
116  raw_ostream &O);
117  void printImmediate64(uint64_t Imm, const MCSubtargetInfo &STI,
118  raw_ostream &O);
119  void printOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
120  raw_ostream &O);
121  void printRegularOperand(const MCInst *MI, unsigned OpNo,
122  const MCSubtargetInfo &STI, raw_ostream &O);
123  void printOperand(const MCInst *MI, uint64_t /*Address*/, unsigned OpNum,
124  const MCSubtargetInfo &STI, raw_ostream &O) {
125  printOperand(MI, OpNum, STI, O);
126  }
127  void printOperandAndFPInputMods(const MCInst *MI, unsigned OpNo,
128  const MCSubtargetInfo &STI, raw_ostream &O);
129  void printOperandAndIntInputMods(const MCInst *MI, unsigned OpNo,
130  const MCSubtargetInfo &STI, raw_ostream &O);
131  void printDPP8(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
132  raw_ostream &O);
133  void printDPPCtrl(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
134  raw_ostream &O);
135  void printRowMask(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
136  raw_ostream &O);
137  void printBankMask(const MCInst *MI, unsigned OpNo,
138  const MCSubtargetInfo &STI, raw_ostream &O);
139  void printBoundCtrl(const MCInst *MI, unsigned OpNo,
140  const MCSubtargetInfo &STI, raw_ostream &O);
141  void printFI(const MCInst *MI, unsigned OpNo,
142  const MCSubtargetInfo &STI, raw_ostream &O);
143  void printSDWASel(const MCInst *MI, unsigned OpNo, raw_ostream &O);
144  void printSDWADstSel(const MCInst *MI, unsigned OpNo,
145  const MCSubtargetInfo &STI, raw_ostream &O);
146  void printSDWASrc0Sel(const MCInst *MI, unsigned OpNo,
147  const MCSubtargetInfo &STI, raw_ostream &O);
148  void printSDWASrc1Sel(const MCInst *MI, unsigned OpNo,
149  const MCSubtargetInfo &STI, raw_ostream &O);
150  void printSDWADstUnused(const MCInst *MI, unsigned OpNo,
151  const MCSubtargetInfo &STI, raw_ostream &O);
152  void printPackedModifier(const MCInst *MI, StringRef Name, unsigned Mod,
153  raw_ostream &O);
154  void printOpSel(const MCInst *MI, unsigned OpNo,
155  const MCSubtargetInfo &STI, raw_ostream &O);
156  void printOpSelHi(const MCInst *MI, unsigned OpNo,
157  const MCSubtargetInfo &STI, raw_ostream &O);
158  void printNegLo(const MCInst *MI, unsigned OpNo,
159  const MCSubtargetInfo &STI, raw_ostream &O);
160  void printNegHi(const MCInst *MI, unsigned OpNo,
161  const MCSubtargetInfo &STI, raw_ostream &O);
162  void printInterpSlot(const MCInst *MI, unsigned OpNo,
163  const MCSubtargetInfo &STI, raw_ostream &O);
164  void printInterpAttr(const MCInst *MI, unsigned OpNo,
165  const MCSubtargetInfo &STI, raw_ostream &O);
166  void printInterpAttrChan(const MCInst *MI, unsigned OpNo,
167  const MCSubtargetInfo &STI, raw_ostream &O);
168 
169  void printVGPRIndexMode(const MCInst *MI, unsigned OpNo,
170  const MCSubtargetInfo &STI, raw_ostream &O);
171  void printMemOperand(const MCInst *MI, unsigned OpNo,
172  const MCSubtargetInfo &STI, raw_ostream &O);
173  void printBLGP(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
174  raw_ostream &O);
175  void printCBSZ(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
176  raw_ostream &O);
177  void printABID(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
178  raw_ostream &O);
179  bool needsImpliedVcc(const MCInstrDesc &Desc, unsigned OpNo) const;
180  void printDefaultVccOperand(bool FirstOperand, const MCSubtargetInfo &STI,
181  raw_ostream &O);
182  void printWaitVDST(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
183  raw_ostream &O);
184  void printWaitEXP(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
185  raw_ostream &O);
186 
187  void printExpSrcN(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
188  raw_ostream &O, unsigned N);
189  void printExpSrc0(const MCInst *MI, unsigned OpNo,
190  const MCSubtargetInfo &STI, raw_ostream &O);
191  void printExpSrc1(const MCInst *MI, unsigned OpNo,
192  const MCSubtargetInfo &STI, raw_ostream &O);
193  void printExpSrc2(const MCInst *MI, unsigned OpNo,
194  const MCSubtargetInfo &STI, raw_ostream &O);
195  void printExpSrc3(const MCInst *MI, unsigned OpNo,
196  const MCSubtargetInfo &STI, raw_ostream &O);
197  void printExpTgt(const MCInst *MI, unsigned OpNo,
198  const MCSubtargetInfo &STI, raw_ostream &O);
199 
200 public:
201  static void printIfSet(const MCInst *MI, unsigned OpNo, raw_ostream &O,
202  StringRef Asm, StringRef Default = "");
203  static void printIfSet(const MCInst *MI, unsigned OpNo, raw_ostream &O,
204  char Asm);
205 protected:
206  void printAbs(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
207  raw_ostream &O);
208  void printHigh(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
209  raw_ostream &O);
210  void printClamp(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
211  raw_ostream &O);
212  void printClampSI(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
213  raw_ostream &O);
214  void printOModSI(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
215  raw_ostream &O);
216  void printLiteral(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
217  raw_ostream &O);
218  void printLast(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
219  raw_ostream &O);
220  void printNeg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
221  raw_ostream &O);
222  void printOMOD(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
223  raw_ostream &O);
224  void printRel(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
225  raw_ostream &O);
226  void printUpdateExecMask(const MCInst *MI, unsigned OpNo,
227  const MCSubtargetInfo &STI, raw_ostream &O);
228  void printUpdatePred(const MCInst *MI, unsigned OpNo,
229  const MCSubtargetInfo &STI, raw_ostream &O);
230  void printWrite(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
231  raw_ostream &O);
232  void printBankSwizzle(const MCInst *MI, unsigned OpNo,
233  const MCSubtargetInfo &STI, raw_ostream &O);
234  void printRSel(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
235  raw_ostream &O);
236  void printCT(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
237  raw_ostream &O);
238  void printKCache(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
239  raw_ostream &O);
240  void printSendMsg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
241  raw_ostream &O);
242  void printSwizzle(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
243  raw_ostream &O);
244  void printWaitFlag(const MCInst *MI, unsigned OpNo,
245  const MCSubtargetInfo &STI, raw_ostream &O);
246  void printDepCtr(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
247  raw_ostream &O);
248  void printDelayFlag(const MCInst *MI, unsigned OpNo,
249  const MCSubtargetInfo &STI, raw_ostream &O);
250  void printHwreg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
251  raw_ostream &O);
252  void printEndpgm(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
253  raw_ostream &O);
254 };
255 
256 } // End namespace llvm
257 
258 #endif
llvm::AMDGPUInstPrinter::printClamp
void printClamp(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
llvm::MCInstPrinter::MII
const MCInstrInfo & MII
Definition: MCInstPrinter.h:50
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:108
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::AMDGPUInstPrinter::printInstruction
void printInstruction(const MCInst *MI, uint64_t Address, const MCSubtargetInfo &STI, raw_ostream &O)
llvm::AMDGPUInstPrinter::printUpdateExecMask
void printUpdateExecMask(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
llvm::MCAsmInfo
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
llvm::AMDGPUInstPrinter::printWaitFlag
void printWaitFlag(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
Definition: AMDGPUInstPrinter.cpp:1489
llvm::AMDGPUInstPrinter::printAbs
void printAbs(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
llvm::AMDGPUInstPrinter::printOModSI
void printOModSI(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
Definition: AMDGPUInstPrinter.cpp:1340
llvm::AMDGPUInstPrinter::printLiteral
void printLiteral(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
llvm::MCInst
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:184
llvm::AMDGPUInstPrinter::printHigh
void printHigh(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
Definition: AMDGPUInstPrinter.cpp:1328
llvm::MCInstPrinter::MRI
const MCRegisterInfo & MRI
Definition: MCInstPrinter.h:51
llvm::AMDGPUInstPrinter::printSendMsg
void printSendMsg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
Definition: AMDGPUInstPrinter.cpp:1352
llvm::AMDGPUInstPrinter
Definition: AMDGPUInstPrinter.h:20
llvm::AMDGPUInstPrinter::printKCache
void printKCache(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
llvm::AMDGPUInstPrinter::printUpdatePred
void printUpdatePred(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
llvm::AMDGPUInstPrinter::getMnemonic
std::pair< const char *, uint64_t > getMnemonic(const MCInst *MI) override
Returns a pair containing the mnemonic for MI and the number of bits left for further processing by p...
llvm::AMDGPUInstPrinter::printRegName
void printRegName(raw_ostream &OS, unsigned RegNo) const override
Print the assembler register name.
Definition: AMDGPUInstPrinter.cpp:33
llvm::AMDGPUInstPrinter::printNeg
void printNeg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
llvm::AMDGPUInstPrinter::printClampSI
void printClampSI(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
Definition: AMDGPUInstPrinter.cpp:1334
llvm::AMDGPUInstPrinter::printLast
void printLast(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
MCInstPrinter.h
llvm::AMDGPUInstPrinter::printSwizzle
void printSwizzle(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
Definition: AMDGPUInstPrinter.cpp:1416
llvm::AMDGPUInstPrinter::printIfSet
static void printIfSet(const MCInst *MI, unsigned OpNo, raw_ostream &O, StringRef Asm, StringRef Default="")
Definition: AMDGPUInstPrinter.cpp:1308
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:264
uint64_t
llvm::MCInstPrinter
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:43
llvm::AMDGPUInstPrinter::printEndpgm
void printEndpgm(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
Definition: AMDGPUInstPrinter.cpp:1617
llvm::AMDGPUInstPrinter::printDepCtr
void printDepCtr(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
Definition: AMDGPUInstPrinter.cpp:1524
llvm::AMDGPUInstPrinter::printRel
void printRel(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
llvm::AMDGPUInstPrinter::AMDGPUInstPrinter
AMDGPUInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
Definition: AMDGPUInstPrinter.h:22
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
llvm::AMDGPUInstPrinter::getRegisterName
static const char * getRegisterName(unsigned RegNo)
uint32_t
llvm::MCRegisterInfo
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Definition: MCRegisterInfo.h:135
llvm::AMDGPUInstPrinter::printBankSwizzle
void printBankSwizzle(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
llvm::MCInstrInfo
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:26
llvm::AMDGPUInstPrinter::printRSel
void printRSel(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
llvm::AMDGPUInstPrinter::printHwreg
void printHwreg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
Definition: AMDGPUInstPrinter.cpp:1594
llvm::AMDGPUInstPrinter::printInst
void printInst(const MCInst *MI, uint64_t Address, StringRef Annot, const MCSubtargetInfo &STI, raw_ostream &O) override
Print the specified MCInst to the specified raw_ostream.
Definition: AMDGPUInstPrinter.cpp:49
llvm::RISCVMatInt::Imm
@ Imm
Definition: RISCVMatInt.h:23
llvm::MCInstPrinter::MAI
const MCAsmInfo & MAI
Definition: MCInstPrinter.h:49
N
#define N
llvm::AMDGPUInstPrinter::printDelayFlag
void printDelayFlag(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
Definition: AMDGPUInstPrinter.cpp:1551
llvm::AMDGPUInstPrinter::printCT
void printCT(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
llvm::HexStyle::Asm
@ Asm
0ffh
Definition: MCInstPrinter.h:34
llvm::AMDGPUInstPrinter::printOMOD
void printOMOD(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
llvm::MCSubtargetInfo
Generic base class for all target subtargets.
Definition: MCSubtargetInfo.h:77
llvm::AMDGPUInstPrinter::printWrite
void printWrite(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
llvm::AMDGPUInstPrinter::printRegOperand
static void printRegOperand(unsigned RegNo, raw_ostream &O, const MCRegisterInfo &MRI)
Definition: AMDGPUInstPrinter.cpp:342