LLVM 24.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:
25
26 // Autogenerated by tblgen
27 std::pair<const char *, uint64_t>
28 getMnemonic(const MCInst &MI) const override;
30 const MCSubtargetInfo &STI, raw_ostream &O);
31 static const char *getRegisterName(MCRegister Reg);
32
33 void printRegName(raw_ostream &OS, MCRegister Reg) override;
34 void printInst(const MCInst *MI, uint64_t Address, StringRef Annot,
35 const MCSubtargetInfo &STI, raw_ostream &O) override;
37 const MCRegisterInfo &MRI);
38 void printRegOperand(MCRegister Reg, unsigned Opc, unsigned OpNo,
39 raw_ostream &O, const MCRegisterInfo &MRI);
40
41private:
42 void printU16ImmOperand(const MCInst *MI, unsigned OpNo,
43 const MCSubtargetInfo &STI, raw_ostream &O);
44 void printU16ImmDecOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
45 void printU32ImmOperand(const MCInst *MI, unsigned OpNo,
46 const MCSubtargetInfo &STI, raw_ostream &O);
47 void printFP64ImmOperand(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 printOffset(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
52 raw_ostream &O);
53 void printFlatOffset(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
54 raw_ostream &O);
55
56 void printSMRDOffset8(const MCInst *MI, unsigned OpNo,
57 const MCSubtargetInfo &STI, raw_ostream &O);
58 void printSMEMOffset(const MCInst *MI, unsigned OpNo,
59 const MCSubtargetInfo &STI, raw_ostream &O);
60 void printSMRDLiteralOffset(const MCInst *MI, unsigned OpNo,
61 const MCSubtargetInfo &STI, raw_ostream &O);
62 void printCPol(const MCInst *MI, unsigned OpNo,
63 const MCSubtargetInfo &STI, raw_ostream &O);
64 void printTH(const MCInst *MI, int64_t TH, int64_t Scope, raw_ostream &O);
65 void printScope(int64_t Scope, raw_ostream &O);
66 void printDim(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
67 raw_ostream &O);
68 void printR128A16(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
69 raw_ostream &O);
70 void printFORMAT(const MCInst *MI, unsigned OpNo,
71 const MCSubtargetInfo &STI, raw_ostream &O);
72 void printSymbolicFormat(const MCInst *MI,
73 const MCSubtargetInfo &STI, raw_ostream &O);
74 void printRsrcReg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
75 raw_ostream &O);
76
78 void printVOPDst(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
79 raw_ostream &O);
80 void printVINTRPDst(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
81 raw_ostream &O);
82 void printAVLdSt32Align2RegOp(const MCInst *MI, unsigned OpNo,
83 const MCSubtargetInfo &STI, raw_ostream &O);
84
85 void printImmediateInt16(uint32_t Imm, const MCSubtargetInfo &STI,
86 raw_ostream &O);
87 void printImmediateBF16(uint32_t Imm, const MCSubtargetInfo &STI,
88 raw_ostream &O);
89 void printImmediateF16(uint32_t Imm, const MCSubtargetInfo &STI,
90 raw_ostream &O);
91 void printImmediateV216(uint32_t Imm, uint8_t OpType,
92 const MCSubtargetInfo &STI, raw_ostream &O);
93 bool printImmediateFloat32(uint32_t Imm, const MCSubtargetInfo &STI,
94 raw_ostream &O);
95 void printImmediate32(uint32_t Imm, const MCSubtargetInfo &STI,
96 raw_ostream &O);
97 void printImmediate64(uint64_t Imm, const MCSubtargetInfo &STI,
98 raw_ostream &O, bool IsFP);
99 void printLiteral64(uint64_t Imm, raw_ostream &O, bool IsFP);
100 void printOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
101 raw_ostream &O);
102 void printRegularOperand(const MCInst *MI, unsigned OpNo,
103 const MCSubtargetInfo &STI, raw_ostream &O);
104 void printOperand(const MCInst *MI, uint64_t /*Address*/, unsigned OpNum,
105 const MCSubtargetInfo &STI, raw_ostream &O) {
106 printOperand(MI, OpNum, STI, O);
107 }
108 void printOperandAndFPInputMods(const MCInst *MI, unsigned OpNo,
109 const MCSubtargetInfo &STI, raw_ostream &O);
110 void printOperandAndIntInputMods(const MCInst *MI, unsigned OpNo,
111 const MCSubtargetInfo &STI, raw_ostream &O);
112 void printDPP8(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
113 raw_ostream &O);
114 void printDPPCtrl(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
115 raw_ostream &O);
116 void printDppBoundCtrl(const MCInst *MI, unsigned OpNo,
117 const MCSubtargetInfo &STI, raw_ostream &O);
118 void printDppFI(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
119 raw_ostream &O);
120 void printSDWASel(const MCInst *MI, unsigned OpNo, raw_ostream &O);
121 void printSDWADstSel(const MCInst *MI, unsigned OpNo,
122 const MCSubtargetInfo &STI, raw_ostream &O);
123 void printSDWASrc0Sel(const MCInst *MI, unsigned OpNo,
124 const MCSubtargetInfo &STI, raw_ostream &O);
125 void printSDWASrc1Sel(const MCInst *MI, unsigned OpNo,
126 const MCSubtargetInfo &STI, raw_ostream &O);
127 void printSDWADstUnused(const MCInst *MI, unsigned OpNo,
128 const MCSubtargetInfo &STI, raw_ostream &O);
129 void printPackedModifier(const MCInst *MI, StringRef Name, unsigned Mod,
130 raw_ostream &O);
131 void printOpSel(const MCInst *MI, unsigned OpNo,
132 const MCSubtargetInfo &STI, raw_ostream &O);
133 void printOpSelHi(const MCInst *MI, unsigned OpNo,
134 const MCSubtargetInfo &STI, raw_ostream &O);
135 void printNegLo(const MCInst *MI, unsigned OpNo,
136 const MCSubtargetInfo &STI, raw_ostream &O);
137 void printNegHi(const MCInst *MI, unsigned OpNo,
138 const MCSubtargetInfo &STI, raw_ostream &O);
139 void printIndexKey8bit(const MCInst *MI, unsigned OpNo,
140 const MCSubtargetInfo &STI, raw_ostream &O);
141 void printIndexKey16bit(const MCInst *MI, unsigned OpNo,
142 const MCSubtargetInfo &STI, raw_ostream &O);
143 void printIndexKey32bit(const MCInst *MI, unsigned OpNo,
144 const MCSubtargetInfo &STI, raw_ostream &O);
145 void printMatrixFMT(const MCInst *MI, unsigned OpNo,
146 const MCSubtargetInfo &STI, raw_ostream &O, char AorB);
147 void printMatrixAFMT(const MCInst *MI, unsigned OpNo,
148 const MCSubtargetInfo &STI, raw_ostream &O);
149 void printMatrixBFMT(const MCInst *MI, unsigned OpNo,
150 const MCSubtargetInfo &STI, raw_ostream &O);
151 void printMatrixScale(const MCInst *MI, unsigned OpNo,
152 const MCSubtargetInfo &STI, raw_ostream &O, char AorB);
153 void printMatrixAScale(const MCInst *MI, unsigned OpNo,
154 const MCSubtargetInfo &STI, raw_ostream &O);
155 void printMatrixBScale(const MCInst *MI, unsigned OpNo,
156 const MCSubtargetInfo &STI, raw_ostream &O);
157 void printMatrixScaleFmt(const MCInst *MI, unsigned OpNo,
158 const MCSubtargetInfo &STI, raw_ostream &O,
159 char AorB);
160 void printMatrixAScaleFmt(const MCInst *MI, unsigned OpNo,
161 const MCSubtargetInfo &STI, raw_ostream &O);
162 void printMatrixBScaleFmt(const MCInst *MI, unsigned OpNo,
163 const MCSubtargetInfo &STI, raw_ostream &O);
164 void printInterpSlot(const MCInst *MI, unsigned OpNo,
165 const MCSubtargetInfo &STI, raw_ostream &O);
166 void printInterpAttr(const MCInst *MI, unsigned OpNo,
167 const MCSubtargetInfo &STI, raw_ostream &O);
168 void printInterpAttrChan(const MCInst *MI, unsigned OpNo,
169 const MCSubtargetInfo &STI, raw_ostream &O);
170
171 void printGPRIdxMode(const MCInst *MI, unsigned OpNo,
172 const MCSubtargetInfo &STI, raw_ostream &O);
173 void printMemOperand(const MCInst *MI, unsigned OpNo,
174 const MCSubtargetInfo &STI, raw_ostream &O);
175 void printBLGP(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
176 raw_ostream &O);
177 bool needsImpliedVcc(const MCInstrDesc &Desc, unsigned OpNo) const;
178 void printDefaultVccOperand(bool FirstOperand, const MCSubtargetInfo &STI,
179 raw_ostream &O);
180
181 void printExpSrcN(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
182 raw_ostream &O, unsigned N);
183 void printExpSrc0(const MCInst *MI, unsigned OpNo,
184 const MCSubtargetInfo &STI, raw_ostream &O);
185 void printExpSrc1(const MCInst *MI, unsigned OpNo,
186 const MCSubtargetInfo &STI, raw_ostream &O);
187 void printExpSrc2(const MCInst *MI, unsigned OpNo,
188 const MCSubtargetInfo &STI, raw_ostream &O);
189 void printExpSrc3(const MCInst *MI, unsigned OpNo,
190 const MCSubtargetInfo &STI, raw_ostream &O);
191 void printExpTgt(const MCInst *MI, unsigned OpNo,
192 const MCSubtargetInfo &STI, raw_ostream &O);
193 void printNamedInt(const MCInst *MI, unsigned OpNo,
194 const MCSubtargetInfo &STI, raw_ostream &O,
195 StringRef Prefix, bool PrintInHex, bool AlwaysPrint);
196
197 void printScaleSel(const MCInst *MI, unsigned OpNo,
198 const MCSubtargetInfo &STI, raw_ostream &O);
199 void printBitOp3(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
200 raw_ostream &O);
201
202public:
203 static void printIfSet(const MCInst *MI, unsigned OpNo, raw_ostream &O,
204 StringRef Asm, StringRef Default = "");
205 static void printIfSet(const MCInst *MI, unsigned OpNo, raw_ostream &O,
206 char Asm);
207
208protected:
209 void printOModSI(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
210 raw_ostream &O);
211 void printLiteral(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
212 raw_ostream &O);
213 void printLast(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
214 raw_ostream &O);
215 void printNeg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
216 raw_ostream &O);
217 void printOMOD(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
218 raw_ostream &O);
219 void printRel(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
220 raw_ostream &O);
221 void printUpdateExecMask(const MCInst *MI, unsigned OpNo,
222 const MCSubtargetInfo &STI, raw_ostream &O);
223 void printUpdatePred(const MCInst *MI, unsigned OpNo,
224 const MCSubtargetInfo &STI, raw_ostream &O);
225 void printWrite(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
226 raw_ostream &O);
227 void printBankSwizzle(const MCInst *MI, unsigned OpNo,
228 const MCSubtargetInfo &STI, raw_ostream &O);
229 void printRSel(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
230 raw_ostream &O);
231 void printCT(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
232 raw_ostream &O);
233 void printKCache(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
234 raw_ostream &O);
235 void printSendMsg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
236 raw_ostream &O);
237 void printWaitEvent(const MCInst *MI, unsigned OpNo,
238 const MCSubtargetInfo &STI, raw_ostream &O);
239 void printSwizzle(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
240 raw_ostream &O);
241 void printSWaitCnt(const MCInst *MI, unsigned OpNo,
242 const MCSubtargetInfo &STI, raw_ostream &O);
243 void printDepCtr(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
244 raw_ostream &O);
245 void printSDelayALU(const MCInst *MI, unsigned OpNo,
246 const MCSubtargetInfo &STI, raw_ostream &O);
247 void printHwreg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
248 raw_ostream &O);
249 void printEndpgm(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
250 raw_ostream &O);
251};
252
253} // End namespace llvm
254
255#endif
unsigned Imm
unsigned uint64_t
IRTranslator LLVM IR MI
Register Reg
static void printMemOperand(raw_ostream &OS, const MachineMemOperand &MMO, const MachineFunction *MF, const Module *M, const MachineFrameInfo *MFI, const TargetInstrInfo *TII, LLVMContext &Ctx)
void printSwizzle(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printWaitEvent(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)
std::pair< const char *, uint64_t > getMnemonic(const MCInst &MI) const override
Returns a pair containing the mnemonic for MI and the number of bits left for further processing by p...
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)
static void printRegOperand(MCRegister Reg, raw_ostream &O, const MCRegisterInfo &MRI)
void printRegName(raw_ostream &OS, MCRegister Reg) override
Print the assembler register name.
void printNeg(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 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 printSWaitCnt(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 printSDelayALU(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printOMOD(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:67
const MCInstrInfo & MII
const MCRegisterInfo & MRI
const MCAsmInfo & MAI
MCInstPrinter(const MCAsmInfo &mai, const MCInstrInfo &mii, const MCRegisterInfo &mri)
Instances of this class represent a single low-level machine instruction.
Definition MCInst.h:188
Describe properties that are true of each instruction in the target description file.
Interface to description of machine instruction set.
Definition MCInstrInfo.h:27
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:41
Generic base class for all target subtargets.
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
This is an optimization pass for GlobalISel generic memory operations.
Op::Description Desc
@ Mod
The access may modify the value stored in memory.
Definition ModRef.h:34
@ Default
The result value is uniform if and only if all operands are uniform.
Definition Uniformity.h:20
#define N