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 printInstruction(const MCInst
*MI
, const MCSubtargetInfo
&STI
,
28 static const char *getRegisterName(unsigned RegNo
);
30 void printInst(const MCInst
*MI
, raw_ostream
&O
, StringRef Annot
,
31 const MCSubtargetInfo
&STI
) override
;
32 static void printRegOperand(unsigned RegNo
, raw_ostream
&O
,
33 const MCRegisterInfo
&MRI
);
36 void printU4ImmOperand(const MCInst
*MI
, unsigned OpNo
,
37 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
38 void printU8ImmOperand(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
39 void printU16ImmOperand(const MCInst
*MI
, unsigned OpNo
,
40 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
41 void printU4ImmDecOperand(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
42 void printU8ImmDecOperand(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
43 void printU16ImmDecOperand(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
44 void printU32ImmOperand(const MCInst
*MI
, unsigned OpNo
,
45 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
46 void printNamedBit(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
,
48 void printOffen(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
49 void printIdxen(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
50 void printAddr64(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
51 void printMBUFOffset(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
52 void printOffset(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
54 void printFlatOffset(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
57 void printOffset0(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
59 void printOffset1(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
61 void printSMRDOffset8(const MCInst
*MI
, unsigned OpNo
,
62 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
63 void printSMRDOffset20(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 printGDS(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
69 void printDLC(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
71 void printGLC(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
73 void printSLC(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 printLWE(const MCInst
*MI
, unsigned OpNo
,
88 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
89 void printD16(const MCInst
*MI
, unsigned OpNo
,
90 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
91 void printExpCompr(const MCInst
*MI
, unsigned OpNo
,
92 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
93 void printExpVM(const MCInst
*MI
, unsigned OpNo
,
94 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
95 void printFORMAT(const MCInst
*MI
, unsigned OpNo
,
96 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
98 void printRegOperand(unsigned RegNo
, raw_ostream
&O
);
99 void printVOPDst(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
101 void printVINTRPDst(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
103 void printImmediate16(uint32_t Imm
, const MCSubtargetInfo
&STI
,
105 void printImmediateV216(uint32_t Imm
, const MCSubtargetInfo
&STI
,
107 void printImmediate32(uint32_t Imm
, const MCSubtargetInfo
&STI
,
109 void printImmediate64(uint64_t Imm
, const MCSubtargetInfo
&STI
,
111 void printOperand(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
113 void printOperandAndFPInputMods(const MCInst
*MI
, unsigned OpNo
,
114 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
115 void printOperandAndIntInputMods(const MCInst
*MI
, unsigned OpNo
,
116 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
117 void printDPP8(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
119 void printDPPCtrl(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
121 void printRowMask(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
123 void printBankMask(const MCInst
*MI
, unsigned OpNo
,
124 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
125 void printBoundCtrl(const MCInst
*MI
, unsigned OpNo
,
126 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
127 void printFI(const MCInst
*MI
, unsigned OpNo
,
128 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
129 void printSDWASel(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
130 void printSDWADstSel(const MCInst
*MI
, unsigned OpNo
,
131 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
132 void printSDWASrc0Sel(const MCInst
*MI
, unsigned OpNo
,
133 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
134 void printSDWASrc1Sel(const MCInst
*MI
, unsigned OpNo
,
135 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
136 void printSDWADstUnused(const MCInst
*MI
, unsigned OpNo
,
137 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
138 void printPackedModifier(const MCInst
*MI
, StringRef Name
, unsigned Mod
,
140 void printOpSel(const MCInst
*MI
, unsigned OpNo
,
141 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
142 void printOpSelHi(const MCInst
*MI
, unsigned OpNo
,
143 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
144 void printNegLo(const MCInst
*MI
, unsigned OpNo
,
145 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
146 void printNegHi(const MCInst
*MI
, unsigned OpNo
,
147 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
148 void printInterpSlot(const MCInst
*MI
, unsigned OpNo
,
149 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
150 void printInterpAttr(const MCInst
*MI
, unsigned OpNo
,
151 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
152 void printInterpAttrChan(const MCInst
*MI
, unsigned OpNo
,
153 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
155 void printVGPRIndexMode(const MCInst
*MI
, unsigned OpNo
,
156 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
157 void printMemOperand(const MCInst
*MI
, unsigned OpNo
,
158 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
159 void printBLGP(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
161 void printCBSZ(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
163 void printABID(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
165 void printDefaultVccOperand(unsigned OpNo
, const MCSubtargetInfo
&STI
,
169 template <unsigned N
>
170 void printExpSrcN(const MCInst
*MI
, unsigned OpNo
,
171 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
172 void printExpSrc0(const MCInst
*MI
, unsigned OpNo
,
173 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
174 void printExpSrc1(const MCInst
*MI
, unsigned OpNo
,
175 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
176 void printExpSrc2(const MCInst
*MI
, unsigned OpNo
,
177 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
178 void printExpSrc3(const MCInst
*MI
, unsigned OpNo
,
179 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
180 void printExpTgt(const MCInst
*MI
, unsigned OpNo
,
181 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
184 static void printIfSet(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
,
185 StringRef Asm
, StringRef Default
= "");
186 static void printIfSet(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
,
189 void printAbs(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
191 void printHigh(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
193 void printClamp(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
195 void printClampSI(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
197 void printOModSI(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
199 void printLiteral(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
201 void printLast(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
203 void printNeg(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
205 void printOMOD(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
207 void printRel(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
209 void printUpdateExecMask(const MCInst
*MI
, unsigned OpNo
,
210 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
211 void printUpdatePred(const MCInst
*MI
, unsigned OpNo
,
212 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
213 void printWrite(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
215 void printBankSwizzle(const MCInst
*MI
, unsigned OpNo
,
216 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
217 void printRSel(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
219 void printCT(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
221 void printKCache(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
223 void printSendMsg(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
225 void printSwizzle(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
227 void printWaitFlag(const MCInst
*MI
, unsigned OpNo
,
228 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
229 void printHwreg(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
231 void printEndpgm(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
235 class R600InstPrinter
: public MCInstPrinter
{
237 R600InstPrinter(const MCAsmInfo
&MAI
, const MCInstrInfo
&MII
,
238 const MCRegisterInfo
&MRI
)
239 : MCInstPrinter(MAI
, MII
, MRI
) {}
241 void printInst(const MCInst
*MI
, raw_ostream
&O
, StringRef Annot
,
242 const MCSubtargetInfo
&STI
) override
;
243 void printInstruction(const MCInst
*MI
, raw_ostream
&O
);
244 static const char *getRegisterName(unsigned RegNo
);
246 void printAbs(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
247 void printBankSwizzle(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
248 void printClamp(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
249 void printCT(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
250 void printKCache(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
251 void printLast(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
252 void printLiteral(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
253 void printMemOperand(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
254 void printNeg(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
255 void printOMOD(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
256 void printOperand(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
257 void printRel(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
258 void printRSel(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
259 void printUpdateExecMask(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
260 void printUpdatePred(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
261 void printWrite(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
264 } // End namespace llvm