LLVM 17.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
16
17namespace llvm {
18class MCInstrDesc;
19
21public:
23 const MCInstrInfo &MII, const MCRegisterInfo &MRI)
24 : MCInstPrinter(MAI, MII, MRI) {}
25
26 // Autogenerated by tblgen
27 std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
29 const MCSubtargetInfo &STI, raw_ostream &O);
30 static const char *getRegisterName(MCRegister Reg);
31
32 void printRegName(raw_ostream &OS, MCRegister Reg) const override;
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
38private:
39 void printU4ImmOperand(const MCInst *MI, unsigned OpNo,
40 const MCSubtargetInfo &STI, raw_ostream &O);
41 void printU16ImmOperand(const MCInst *MI, unsigned OpNo,
42 const MCSubtargetInfo &STI, raw_ostream &O);
43 void printU4ImmDecOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
44 void printU8ImmDecOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
45 void printU16ImmDecOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
46 void printU32ImmOperand(const MCInst *MI, unsigned OpNo,
47 const MCSubtargetInfo &STI, raw_ostream &O);
48 void printNamedBit(const MCInst *MI, unsigned OpNo, raw_ostream &O,
49 StringRef BitName);
50 void printOffen(const MCInst *MI, unsigned OpNo, raw_ostream &O);
51 void printIdxen(const MCInst *MI, unsigned OpNo, raw_ostream &O);
52 void printAddr64(const MCInst *MI, unsigned OpNo, raw_ostream &O);
53 void printOffset(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
54 raw_ostream &O);
55 void printFlatOffset(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
56 raw_ostream &O);
57
58 void printOffset0(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
59 raw_ostream &O);
60 void printOffset1(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
61 raw_ostream &O);
62 void printSMRDOffset8(const MCInst *MI, unsigned OpNo,
63 const MCSubtargetInfo &STI, raw_ostream &O);
64 void printSMEMOffset(const MCInst *MI, unsigned OpNo,
65 const MCSubtargetInfo &STI, raw_ostream &O);
66 void printSMEMOffsetMod(const MCInst *MI, unsigned OpNo,
67 const MCSubtargetInfo &STI, raw_ostream &O);
68 void printSMRDLiteralOffset(const MCInst *MI, unsigned OpNo,
69 const MCSubtargetInfo &STI, raw_ostream &O);
70 void printGDS(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
71 raw_ostream &O);
72 void printCPol(const MCInst *MI, unsigned OpNo,
73 const MCSubtargetInfo &STI, raw_ostream &O);
74 void printSWZ(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
75 raw_ostream &O);
76 void printTFE(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
77 raw_ostream &O);
78 void printDMask(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
79 raw_ostream &O);
80 void printDim(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
81 raw_ostream &O);
82 void printUNorm(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
83 raw_ostream &O);
84 void printDA(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
85 raw_ostream &O);
86 void printR128A16(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
87 raw_ostream &O);
88 void printA16(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
89 raw_ostream &O);
90 void printLWE(const MCInst *MI, unsigned OpNo,
91 const MCSubtargetInfo &STI, raw_ostream &O);
92 void printD16(const MCInst *MI, unsigned OpNo,
93 const MCSubtargetInfo &STI, raw_ostream &O);
94 void printExpCompr(const MCInst *MI, unsigned OpNo,
95 const MCSubtargetInfo &STI, raw_ostream &O);
96 void printExpVM(const MCInst *MI, unsigned OpNo,
97 const MCSubtargetInfo &STI, raw_ostream &O);
98 void printFORMAT(const MCInst *MI, unsigned OpNo,
99 const MCSubtargetInfo &STI, raw_ostream &O);
100 void printSymbolicFormat(const MCInst *MI,
101 const MCSubtargetInfo &STI, raw_ostream &O);
102
103 void printRegOperand(unsigned RegNo, raw_ostream &O);
104 void printVOPDst(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
105 raw_ostream &O);
106 void printVINTRPDst(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
107 raw_ostream &O);
108 void printImmediateInt16(uint32_t Imm, const MCSubtargetInfo &STI,
109 raw_ostream &O);
110 void printImmediate16(uint32_t Imm, const MCSubtargetInfo &STI,
111 raw_ostream &O);
112 void printImmediateV216(uint32_t Imm, const MCSubtargetInfo &STI,
113 raw_ostream &O);
114 void printImmediate32(uint32_t Imm, const MCSubtargetInfo &STI,
115 raw_ostream &O);
116 void printImmediate64(uint64_t Imm, const MCSubtargetInfo &STI,
117 raw_ostream &O);
118 void printOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
119 raw_ostream &O);
120 void printRegularOperand(const MCInst *MI, unsigned OpNo,
121 const MCSubtargetInfo &STI, raw_ostream &O);
122 void printOperand(const MCInst *MI, uint64_t /*Address*/, unsigned OpNum,
123 const MCSubtargetInfo &STI, raw_ostream &O) {
124 printOperand(MI, OpNum, STI, O);
125 }
126 void printOperandAndFPInputMods(const MCInst *MI, unsigned OpNo,
127 const MCSubtargetInfo &STI, raw_ostream &O);
128 void printOperandAndIntInputMods(const MCInst *MI, unsigned OpNo,
129 const MCSubtargetInfo &STI, raw_ostream &O);
130 void printDPP8(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
131 raw_ostream &O);
132 void printDPPCtrl(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
133 raw_ostream &O);
134 void printRowMask(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
135 raw_ostream &O);
136 void printBankMask(const MCInst *MI, unsigned OpNo,
137 const MCSubtargetInfo &STI, raw_ostream &O);
138 void printDppBoundCtrl(const MCInst *MI, unsigned OpNo,
139 const MCSubtargetInfo &STI, raw_ostream &O);
140 void printFI(const MCInst *MI, unsigned OpNo,
141 const MCSubtargetInfo &STI, raw_ostream &O);
142 void printSDWASel(const MCInst *MI, unsigned OpNo, raw_ostream &O);
143 void printSDWADstSel(const MCInst *MI, unsigned OpNo,
144 const MCSubtargetInfo &STI, raw_ostream &O);
145 void printSDWASrc0Sel(const MCInst *MI, unsigned OpNo,
146 const MCSubtargetInfo &STI, raw_ostream &O);
147 void printSDWASrc1Sel(const MCInst *MI, unsigned OpNo,
148 const MCSubtargetInfo &STI, raw_ostream &O);
149 void printSDWADstUnused(const MCInst *MI, unsigned OpNo,
150 const MCSubtargetInfo &STI, raw_ostream &O);
151 void printPackedModifier(const MCInst *MI, StringRef Name, unsigned Mod,
152 raw_ostream &O);
153 void printOpSel(const MCInst *MI, unsigned OpNo,
154 const MCSubtargetInfo &STI, raw_ostream &O);
155 void printOpSelHi(const MCInst *MI, unsigned OpNo,
156 const MCSubtargetInfo &STI, raw_ostream &O);
157 void printNegLo(const MCInst *MI, unsigned OpNo,
158 const MCSubtargetInfo &STI, raw_ostream &O);
159 void printNegHi(const MCInst *MI, unsigned OpNo,
160 const MCSubtargetInfo &STI, raw_ostream &O);
161 void printInterpSlot(const MCInst *MI, unsigned OpNo,
162 const MCSubtargetInfo &STI, raw_ostream &O);
163 void printInterpAttr(const MCInst *MI, unsigned OpNo,
164 const MCSubtargetInfo &STI, raw_ostream &O);
165 void printInterpAttrChan(const MCInst *MI, unsigned OpNo,
166 const MCSubtargetInfo &STI, raw_ostream &O);
167
168 void printVGPRIndexMode(const MCInst *MI, unsigned OpNo,
169 const MCSubtargetInfo &STI, raw_ostream &O);
170 void printMemOperand(const MCInst *MI, unsigned OpNo,
171 const MCSubtargetInfo &STI, raw_ostream &O);
172 void printBLGP(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
173 raw_ostream &O);
174 void printCBSZ(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
175 raw_ostream &O);
176 void printABID(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
177 raw_ostream &O);
178 bool needsImpliedVcc(const MCInstrDesc &Desc, unsigned OpNo) const;
179 void printDefaultVccOperand(bool FirstOperand, const MCSubtargetInfo &STI,
180 raw_ostream &O);
181 void printWaitVDST(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
182 raw_ostream &O);
183 void printWaitEXP(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
184 raw_ostream &O);
185
186 void printExpSrcN(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
187 raw_ostream &O, unsigned N);
188 void printExpSrc0(const MCInst *MI, unsigned OpNo,
189 const MCSubtargetInfo &STI, raw_ostream &O);
190 void printExpSrc1(const MCInst *MI, unsigned OpNo,
191 const MCSubtargetInfo &STI, raw_ostream &O);
192 void printExpSrc2(const MCInst *MI, unsigned OpNo,
193 const MCSubtargetInfo &STI, raw_ostream &O);
194 void printExpSrc3(const MCInst *MI, unsigned OpNo,
195 const MCSubtargetInfo &STI, raw_ostream &O);
196 void printExpTgt(const MCInst *MI, unsigned OpNo,
197 const MCSubtargetInfo &STI, raw_ostream &O);
198
199public:
200 static void printIfSet(const MCInst *MI, unsigned OpNo, raw_ostream &O,
201 StringRef Asm, StringRef Default = "");
202 static void printIfSet(const MCInst *MI, unsigned OpNo, raw_ostream &O,
203 char Asm);
204protected:
205 void printAbs(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
206 raw_ostream &O);
207 void printHigh(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
208 raw_ostream &O);
209 void printClamp(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
210 raw_ostream &O);
211 void printClampSI(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
212 raw_ostream &O);
213 void printOModSI(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
214 raw_ostream &O);
215 void printLiteral(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
216 raw_ostream &O);
217 void printLast(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
218 raw_ostream &O);
219 void printNeg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
220 raw_ostream &O);
221 void printOMOD(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
222 raw_ostream &O);
223 void printRel(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
224 raw_ostream &O);
225 void printUpdateExecMask(const MCInst *MI, unsigned OpNo,
226 const MCSubtargetInfo &STI, raw_ostream &O);
227 void printUpdatePred(const MCInst *MI, unsigned OpNo,
228 const MCSubtargetInfo &STI, raw_ostream &O);
229 void printWrite(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
230 raw_ostream &O);
231 void printBankSwizzle(const MCInst *MI, unsigned OpNo,
232 const MCSubtargetInfo &STI, raw_ostream &O);
233 void printRSel(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
234 raw_ostream &O);
235 void printCT(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
236 raw_ostream &O);
237 void printKCache(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
238 raw_ostream &O);
239 void printSendMsg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
240 raw_ostream &O);
241 void printSwizzle(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
242 raw_ostream &O);
243 void printWaitFlag(const MCInst *MI, unsigned OpNo,
244 const MCSubtargetInfo &STI, raw_ostream &O);
245 void printDepCtr(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
246 raw_ostream &O);
247 void printDelayFlag(const MCInst *MI, unsigned OpNo,
248 const MCSubtargetInfo &STI, raw_ostream &O);
249 void printHwreg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
250 raw_ostream &O);
251 void printEndpgm(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
252 raw_ostream &O);
253};
254
255} // End namespace llvm
256
257#endif
std::string Name
IRTranslator LLVM IR MI
unsigned Reg
raw_pwrite_stream & OS
void printSwizzle(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printClampSI(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printDelayFlag(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printAbs(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printEndpgm(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
static const char * getRegisterName(MCRegister Reg)
AMDGPUInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
static void printIfSet(const MCInst *MI, unsigned OpNo, raw_ostream &O, StringRef Asm, StringRef Default="")
void printBankSwizzle(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printDepCtr(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printLiteral(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printRSel(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printHwreg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printKCache(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printSendMsg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printUpdateExecMask(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printWrite(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printRegName(raw_ostream &OS, MCRegister Reg) const override
Print the assembler register name.
static void printRegOperand(unsigned RegNo, raw_ostream &O, const MCRegisterInfo &MRI)
void printNeg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printWaitFlag(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
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.
void printClamp(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
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...
void printInstruction(const MCInst *MI, uint64_t Address, const MCSubtargetInfo &STI, raw_ostream &O)
void printUpdatePred(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printCT(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printRel(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printLast(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printOModSI(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printOMOD(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printHigh(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:44
const MCInstrInfo & MII
Definition: MCInstPrinter.h:51
const MCRegisterInfo & MRI
Definition: MCInstPrinter.h:52
const MCAsmInfo & MAI
Definition: MCInstPrinter.h:50
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:184
Describe properties that are true of each instruction in the target description file.
Definition: MCInstrDesc.h:198
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:26
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Wrapper class representing physical registers. Should be passed by value.
Definition: MCRegister.h:24
Generic base class for all target subtargets.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ Mod
The access may modify the value stored in memory.
@ Default
The result values are uniform if and only if all operands are uniform.
#define N