1 //===-- AMDGPUInstPrinter.h - AMDGPU MC Inst -> ASM interface ---*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
10 //===----------------------------------------------------------------------===//
12 #ifndef LLVM_LIB_TARGET_AMDGPU_MCTARGETDESC_AMDGPUINSTPRINTER_H
13 #define LLVM_LIB_TARGET_AMDGPU_MCTARGETDESC_AMDGPUINSTPRINTER_H
15 #include "llvm/MC/MCInstPrinter.h"
19 class AMDGPUInstPrinter
: public MCInstPrinter
{
21 AMDGPUInstPrinter(const MCAsmInfo
&MAI
,
22 const MCInstrInfo
&MII
, const MCRegisterInfo
&MRI
)
23 : MCInstPrinter(MAI
, MII
, MRI
) {}
25 //Autogenerated by tblgen
26 void printRegName(raw_ostream
&OS
, unsigned RegNo
) const override
;
27 std::pair
<const char *, uint64_t> getMnemonic(const MCInst
*MI
) override
;
28 void printInstruction(const MCInst
*MI
, uint64_t Address
,
29 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
30 static const char *getRegisterName(unsigned RegNo
);
32 void printInst(const MCInst
*MI
, uint64_t Address
, StringRef Annot
,
33 const MCSubtargetInfo
&STI
, raw_ostream
&O
) override
;
34 static void printRegOperand(unsigned RegNo
, raw_ostream
&O
,
35 const MCRegisterInfo
&MRI
);
38 void printU4ImmOperand(const MCInst
*MI
, unsigned OpNo
,
39 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
40 void printU8ImmOperand(const MCInst
*MI
, unsigned OpNo
, 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
,
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 printMBUFOffset(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
54 void printOffset(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
56 void printFlatOffset(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
59 void printOffset0(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
61 void printOffset1(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
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 printSMRDLiteralOffset(const MCInst
*MI
, unsigned OpNo
,
68 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
69 void printGDS(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
71 void printCPol(const MCInst
*MI
, unsigned OpNo
,
72 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
73 void printSWZ(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
75 void printTFE(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
77 void printDMask(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
79 void printDim(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
81 void printUNorm(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
83 void printDA(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
85 void printR128A16(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
87 void printGFX10A16(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
89 void printLWE(const MCInst
*MI
, unsigned OpNo
,
90 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
91 void printD16(const MCInst
*MI
, unsigned OpNo
,
92 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
93 void printExpCompr(const MCInst
*MI
, unsigned OpNo
,
94 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
95 void printExpVM(const MCInst
*MI
, unsigned OpNo
,
96 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
97 void printFORMAT(const MCInst
*MI
, unsigned OpNo
,
98 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
99 void printSymbolicFormat(const MCInst
*MI
,
100 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
102 void printRegOperand(unsigned RegNo
, raw_ostream
&O
);
103 void printVOPDst(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
105 void printVINTRPDst(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
107 void printImmediateInt16(uint32_t Imm
, const MCSubtargetInfo
&STI
,
109 void printImmediate16(uint32_t Imm
, const MCSubtargetInfo
&STI
,
111 void printImmediateV216(uint32_t Imm
, const MCSubtargetInfo
&STI
,
113 void printImmediate32(uint32_t Imm
, const MCSubtargetInfo
&STI
,
115 void printImmediate64(uint64_t Imm
, const MCSubtargetInfo
&STI
,
117 void printOperand(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
119 void printOperand(const MCInst
*MI
, uint64_t /*Address*/, unsigned OpNum
,
120 const MCSubtargetInfo
&STI
, raw_ostream
&O
) {
121 printOperand(MI
, OpNum
, STI
, O
);
123 void printOperandAndFPInputMods(const MCInst
*MI
, unsigned OpNo
,
124 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
125 void printOperandAndIntInputMods(const MCInst
*MI
, unsigned OpNo
,
126 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
127 void printDPP8(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
129 void printDPPCtrl(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
131 void printRowMask(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
133 void printBankMask(const MCInst
*MI
, unsigned OpNo
,
134 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
135 void printBoundCtrl(const MCInst
*MI
, unsigned OpNo
,
136 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
137 void printFI(const MCInst
*MI
, unsigned OpNo
,
138 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
139 void printSDWASel(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
140 void printSDWADstSel(const MCInst
*MI
, unsigned OpNo
,
141 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
142 void printSDWASrc0Sel(const MCInst
*MI
, unsigned OpNo
,
143 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
144 void printSDWASrc1Sel(const MCInst
*MI
, unsigned OpNo
,
145 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
146 void printSDWADstUnused(const MCInst
*MI
, unsigned OpNo
,
147 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
148 void printPackedModifier(const MCInst
*MI
, StringRef Name
, unsigned Mod
,
150 void printOpSel(const MCInst
*MI
, unsigned OpNo
,
151 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
152 void printOpSelHi(const MCInst
*MI
, unsigned OpNo
,
153 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
154 void printNegLo(const MCInst
*MI
, unsigned OpNo
,
155 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
156 void printNegHi(const MCInst
*MI
, unsigned OpNo
,
157 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
158 void printInterpSlot(const MCInst
*MI
, unsigned OpNo
,
159 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
160 void printInterpAttr(const MCInst
*MI
, unsigned OpNo
,
161 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
162 void printInterpAttrChan(const MCInst
*MI
, unsigned OpNo
,
163 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
165 void printVGPRIndexMode(const MCInst
*MI
, unsigned OpNo
,
166 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
167 void printMemOperand(const MCInst
*MI
, unsigned OpNo
,
168 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
169 void printBLGP(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
171 void printCBSZ(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
173 void printABID(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
175 void printDefaultVccOperand(unsigned OpNo
, const MCSubtargetInfo
&STI
,
178 void printExpSrcN(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
179 raw_ostream
&O
, unsigned N
);
180 void printExpSrc0(const MCInst
*MI
, unsigned OpNo
,
181 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
182 void printExpSrc1(const MCInst
*MI
, unsigned OpNo
,
183 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
184 void printExpSrc2(const MCInst
*MI
, unsigned OpNo
,
185 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
186 void printExpSrc3(const MCInst
*MI
, unsigned OpNo
,
187 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
188 void printExpTgt(const MCInst
*MI
, unsigned OpNo
,
189 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
192 static void printIfSet(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
,
193 StringRef Asm
, StringRef Default
= "");
194 static void printIfSet(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
,
197 void printAbs(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
199 void printHigh(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
201 void printClamp(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
203 void printClampSI(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
205 void printOModSI(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
207 void printLiteral(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
209 void printLast(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
211 void printNeg(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
213 void printOMOD(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
215 void printRel(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
217 void printUpdateExecMask(const MCInst
*MI
, unsigned OpNo
,
218 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
219 void printUpdatePred(const MCInst
*MI
, unsigned OpNo
,
220 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
221 void printWrite(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
223 void printBankSwizzle(const MCInst
*MI
, unsigned OpNo
,
224 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
225 void printRSel(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
227 void printCT(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
229 void printKCache(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
231 void printSendMsg(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
233 void printSwizzle(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
235 void printWaitFlag(const MCInst
*MI
, unsigned OpNo
,
236 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
237 void printHwreg(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
239 void printEndpgm(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
243 class R600InstPrinter
: public MCInstPrinter
{
245 R600InstPrinter(const MCAsmInfo
&MAI
, const MCInstrInfo
&MII
,
246 const MCRegisterInfo
&MRI
)
247 : MCInstPrinter(MAI
, MII
, MRI
) {}
249 void printInst(const MCInst
*MI
, uint64_t Address
, StringRef Annot
,
250 const MCSubtargetInfo
&STI
, raw_ostream
&O
) override
;
251 std::pair
<const char *, uint64_t> getMnemonic(const MCInst
*MI
) override
;
252 void printInstruction(const MCInst
*MI
, uint64_t Address
, raw_ostream
&O
);
253 static const char *getRegisterName(unsigned RegNo
);
255 void printAbs(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
256 void printBankSwizzle(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
257 void printClamp(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
258 void printCT(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
259 void printKCache(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
260 void printLast(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
261 void printLiteral(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
262 void printMemOperand(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
263 void printNeg(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
264 void printOMOD(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
265 void printOperand(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
266 void printRel(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
267 void printRSel(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
268 void printUpdateExecMask(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
269 void printUpdatePred(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
270 void printWrite(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
273 } // End namespace llvm