LLVM 18.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 printOffset(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
51 raw_ostream &O);
52 void printFlatOffset(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
53 raw_ostream &O);
54
55 void printOffset0(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
56 raw_ostream &O);
57 void printOffset1(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
58 raw_ostream &O);
59 void printSMRDOffset8(const MCInst *MI, unsigned OpNo,
60 const MCSubtargetInfo &STI, raw_ostream &O);
61 void printSMEMOffset(const MCInst *MI, unsigned OpNo,
62 const MCSubtargetInfo &STI, raw_ostream &O);
63 void printSMEMOffsetMod(const MCInst *MI, unsigned OpNo,
64 const MCSubtargetInfo &STI, raw_ostream &O);
65 void printSMRDLiteralOffset(const MCInst *MI, unsigned OpNo,
66 const MCSubtargetInfo &STI, raw_ostream &O);
67 void printCPol(const MCInst *MI, unsigned OpNo,
68 const MCSubtargetInfo &STI, raw_ostream &O);
69 void printDMask(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
70 raw_ostream &O);
71 void printDim(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
72 raw_ostream &O);
73 void printR128A16(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
74 raw_ostream &O);
75 void printFORMAT(const MCInst *MI, unsigned OpNo,
76 const MCSubtargetInfo &STI, raw_ostream &O);
77 void printSymbolicFormat(const MCInst *MI,
78 const MCSubtargetInfo &STI, raw_ostream &O);
79
80 void printRegOperand(unsigned RegNo, raw_ostream &O);
81 void printVOPDst(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
82 raw_ostream &O);
83 void printVINTRPDst(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
84 raw_ostream &O);
85 void printImmediateInt16(uint32_t Imm, const MCSubtargetInfo &STI,
86 raw_ostream &O);
87 void printImmediate16(uint32_t Imm, const MCSubtargetInfo &STI,
88 raw_ostream &O);
89 void printImmediateV216(uint32_t Imm, const MCSubtargetInfo &STI,
90 raw_ostream &O);
91 void printImmediate32(uint32_t Imm, const MCSubtargetInfo &STI,
92 raw_ostream &O);
93 void printImmediate64(uint64_t Imm, const MCSubtargetInfo &STI,
94 raw_ostream &O);
95 void printOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
96 raw_ostream &O);
97 void printRegularOperand(const MCInst *MI, unsigned OpNo,
98 const MCSubtargetInfo &STI, raw_ostream &O);
99 void printOperand(const MCInst *MI, uint64_t /*Address*/, unsigned OpNum,
100 const MCSubtargetInfo &STI, raw_ostream &O) {
101 printOperand(MI, OpNum, STI, O);
102 }
103 void printOperandAndFPInputMods(const MCInst *MI, unsigned OpNo,
104 const MCSubtargetInfo &STI, raw_ostream &O);
105 void printOperandAndIntInputMods(const MCInst *MI, unsigned OpNo,
106 const MCSubtargetInfo &STI, raw_ostream &O);
107 void printDPP8(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
108 raw_ostream &O);
109 void printDPPCtrl(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
110 raw_ostream &O);
111 void printDppRowMask(const MCInst *MI, unsigned OpNo,
112 const MCSubtargetInfo &STI, raw_ostream &O);
113 void printDppBankMask(const MCInst *MI, unsigned OpNo,
114 const MCSubtargetInfo &STI, raw_ostream &O);
115 void printDppBoundCtrl(const MCInst *MI, unsigned OpNo,
116 const MCSubtargetInfo &STI, raw_ostream &O);
117 void printDppFI(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
118 raw_ostream &O);
119 void printSDWASel(const MCInst *MI, unsigned OpNo, raw_ostream &O);
120 void printSDWADstSel(const MCInst *MI, unsigned OpNo,
121 const MCSubtargetInfo &STI, raw_ostream &O);
122 void printSDWASrc0Sel(const MCInst *MI, unsigned OpNo,
123 const MCSubtargetInfo &STI, raw_ostream &O);
124 void printSDWASrc1Sel(const MCInst *MI, unsigned OpNo,
125 const MCSubtargetInfo &STI, raw_ostream &O);
126 void printSDWADstUnused(const MCInst *MI, unsigned OpNo,
127 const MCSubtargetInfo &STI, raw_ostream &O);
128 void printPackedModifier(const MCInst *MI, StringRef Name, unsigned Mod,
129 raw_ostream &O);
130 void printOpSel(const MCInst *MI, unsigned OpNo,
131 const MCSubtargetInfo &STI, raw_ostream &O);
132 void printOpSelHi(const MCInst *MI, unsigned OpNo,
133 const MCSubtargetInfo &STI, raw_ostream &O);
134 void printNegLo(const MCInst *MI, unsigned OpNo,
135 const MCSubtargetInfo &STI, raw_ostream &O);
136 void printNegHi(const MCInst *MI, unsigned OpNo,
137 const MCSubtargetInfo &STI, raw_ostream &O);
138 void printInterpSlot(const MCInst *MI, unsigned OpNo,
139 const MCSubtargetInfo &STI, raw_ostream &O);
140 void printInterpAttr(const MCInst *MI, unsigned OpNo,
141 const MCSubtargetInfo &STI, raw_ostream &O);
142 void printInterpAttrChan(const MCInst *MI, unsigned OpNo,
143 const MCSubtargetInfo &STI, raw_ostream &O);
144
145 void printGPRIdxMode(const MCInst *MI, unsigned OpNo,
146 const MCSubtargetInfo &STI, raw_ostream &O);
147 void printMemOperand(const MCInst *MI, unsigned OpNo,
148 const MCSubtargetInfo &STI, raw_ostream &O);
149 void printBLGP(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
150 raw_ostream &O);
151 void printCBSZ(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
152 raw_ostream &O);
153 void printABID(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
154 raw_ostream &O);
155 bool needsImpliedVcc(const MCInstrDesc &Desc, unsigned OpNo) const;
156 void printDefaultVccOperand(bool FirstOperand, const MCSubtargetInfo &STI,
157 raw_ostream &O);
158 void printWaitVDST(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
159 raw_ostream &O);
160 void printWaitEXP(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
161 raw_ostream &O);
162
163 void printExpSrcN(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
164 raw_ostream &O, unsigned N);
165 void printExpSrc0(const MCInst *MI, unsigned OpNo,
166 const MCSubtargetInfo &STI, raw_ostream &O);
167 void printExpSrc1(const MCInst *MI, unsigned OpNo,
168 const MCSubtargetInfo &STI, raw_ostream &O);
169 void printExpSrc2(const MCInst *MI, unsigned OpNo,
170 const MCSubtargetInfo &STI, raw_ostream &O);
171 void printExpSrc3(const MCInst *MI, unsigned OpNo,
172 const MCSubtargetInfo &STI, raw_ostream &O);
173 void printExpTgt(const MCInst *MI, unsigned OpNo,
174 const MCSubtargetInfo &STI, raw_ostream &O);
175
176public:
177 static void printIfSet(const MCInst *MI, unsigned OpNo, raw_ostream &O,
178 StringRef Asm, StringRef Default = "");
179 static void printIfSet(const MCInst *MI, unsigned OpNo, raw_ostream &O,
180 char Asm);
181protected:
182 void printAbs(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
183 raw_ostream &O);
184 void printClamp(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
185 raw_ostream &O);
186 void printOModSI(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
187 raw_ostream &O);
188 void printLiteral(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
189 raw_ostream &O);
190 void printLast(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
191 raw_ostream &O);
192 void printNeg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
193 raw_ostream &O);
194 void printOMOD(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
195 raw_ostream &O);
196 void printRel(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
197 raw_ostream &O);
198 void printUpdateExecMask(const MCInst *MI, unsigned OpNo,
199 const MCSubtargetInfo &STI, raw_ostream &O);
200 void printUpdatePred(const MCInst *MI, unsigned OpNo,
201 const MCSubtargetInfo &STI, raw_ostream &O);
202 void printWrite(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
203 raw_ostream &O);
204 void printBankSwizzle(const MCInst *MI, unsigned OpNo,
205 const MCSubtargetInfo &STI, raw_ostream &O);
206 void printRSel(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
207 raw_ostream &O);
208 void printCT(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
209 raw_ostream &O);
210 void printKCache(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
211 raw_ostream &O);
212 void printSendMsg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
213 raw_ostream &O);
214 void printSwizzle(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
215 raw_ostream &O);
216 void printSWaitCnt(const MCInst *MI, unsigned OpNo,
217 const MCSubtargetInfo &STI, raw_ostream &O);
218 void printDepCtr(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
219 raw_ostream &O);
220 void printSDelayALU(const MCInst *MI, unsigned OpNo,
221 const MCSubtargetInfo &STI, raw_ostream &O);
222 void printHwreg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
223 raw_ostream &O);
224 void printEndpgm(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
225 raw_ostream &O);
226};
227
228} // End namespace llvm
229
230#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 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 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 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:56
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:45
const MCInstrInfo & MII
Definition: MCInstPrinter.h:52
const MCRegisterInfo & MRI
Definition: MCInstPrinter.h:53
const MCAsmInfo & MAI
Definition: MCInstPrinter.h:51
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:33
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
Description of the encoding of one expression Op.