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_INSTPRINTER_AMDGPUINSTPRINTER_H
13 #define LLVM_LIB_TARGET_AMDGPU_INSTPRINTER_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 printS13ImmDecOperand(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 printNamedBit(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
,
49 void printOffen(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
50 void printIdxen(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
51 void printAddr64(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
52 void printMBUFOffset(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
53 void printOffset(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
55 void printOffsetS13(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
58 void printOffset0(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
60 void printOffset1(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
62 void printSMRDOffset8(const MCInst
*MI
, unsigned OpNo
,
63 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
64 void printSMRDOffset20(const MCInst
*MI
, unsigned OpNo
,
65 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
66 void printSMRDLiteralOffset(const MCInst
*MI
, unsigned OpNo
,
67 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
68 void printGDS(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
70 void printGLC(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
72 void printSLC(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
74 void printTFE(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
76 void printDMask(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
78 void printUNorm(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
80 void printDA(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
82 void printR128A16(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
84 void printLWE(const MCInst
*MI
, unsigned OpNo
,
85 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
86 void printD16(const MCInst
*MI
, unsigned OpNo
,
87 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
88 void printExpCompr(const MCInst
*MI
, unsigned OpNo
,
89 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
90 void printExpVM(const MCInst
*MI
, unsigned OpNo
,
91 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
92 void printFORMAT(const MCInst
*MI
, unsigned OpNo
,
93 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
95 void printRegOperand(unsigned RegNo
, raw_ostream
&O
);
96 void printVOPDst(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
98 void printVINTRPDst(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
100 void printImmediate16(uint32_t Imm
, const MCSubtargetInfo
&STI
,
102 void printImmediateV216(uint32_t Imm
, const MCSubtargetInfo
&STI
,
104 void printImmediate32(uint32_t Imm
, const MCSubtargetInfo
&STI
,
106 void printImmediate64(uint64_t Imm
, const MCSubtargetInfo
&STI
,
108 void printOperand(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
110 void printOperandAndFPInputMods(const MCInst
*MI
, unsigned OpNo
,
111 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
112 void printOperandAndIntInputMods(const MCInst
*MI
, unsigned OpNo
,
113 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
114 void printDPPCtrl(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
116 void printRowMask(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
118 void printBankMask(const MCInst
*MI
, unsigned OpNo
,
119 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
120 void printBoundCtrl(const MCInst
*MI
, unsigned OpNo
,
121 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
122 void printSDWASel(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
123 void printSDWADstSel(const MCInst
*MI
, unsigned OpNo
,
124 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
125 void printSDWASrc0Sel(const MCInst
*MI
, unsigned OpNo
,
126 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
127 void printSDWASrc1Sel(const MCInst
*MI
, unsigned OpNo
,
128 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
129 void printSDWADstUnused(const MCInst
*MI
, unsigned OpNo
,
130 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
131 void printPackedModifier(const MCInst
*MI
, StringRef Name
, unsigned Mod
,
133 void printOpSel(const MCInst
*MI
, unsigned OpNo
,
134 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
135 void printOpSelHi(const MCInst
*MI
, unsigned OpNo
,
136 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
137 void printNegLo(const MCInst
*MI
, unsigned OpNo
,
138 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
139 void printNegHi(const MCInst
*MI
, unsigned OpNo
,
140 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
141 void printInterpSlot(const MCInst
*MI
, unsigned OpNo
,
142 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
143 void printInterpAttr(const MCInst
*MI
, unsigned OpNo
,
144 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
145 void printInterpAttrChan(const MCInst
*MI
, unsigned OpNo
,
146 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
148 void printVGPRIndexMode(const MCInst
*MI
, unsigned OpNo
,
149 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
150 void printMemOperand(const MCInst
*MI
, unsigned OpNo
,
151 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
154 template <unsigned N
>
155 void printExpSrcN(const MCInst
*MI
, unsigned OpNo
,
156 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
157 void printExpSrc0(const MCInst
*MI
, unsigned OpNo
,
158 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
159 void printExpSrc1(const MCInst
*MI
, unsigned OpNo
,
160 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
161 void printExpSrc2(const MCInst
*MI
, unsigned OpNo
,
162 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
163 void printExpSrc3(const MCInst
*MI
, unsigned OpNo
,
164 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
165 void printExpTgt(const MCInst
*MI
, unsigned OpNo
,
166 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
169 static void printIfSet(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
,
170 StringRef Asm
, StringRef Default
= "");
171 static void printIfSet(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
,
174 void printAbs(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
176 void printHigh(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
178 void printClamp(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
180 void printClampSI(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
182 void printOModSI(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
184 void printLiteral(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
186 void printLast(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
188 void printNeg(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
190 void printOMOD(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
192 void printRel(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
194 void printUpdateExecMask(const MCInst
*MI
, unsigned OpNo
,
195 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
196 void printUpdatePred(const MCInst
*MI
, unsigned OpNo
,
197 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
198 void printWrite(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
200 void printBankSwizzle(const MCInst
*MI
, unsigned OpNo
,
201 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
202 void printRSel(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
204 void printCT(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
206 void printKCache(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
208 void printSendMsg(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
210 void printSwizzle(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
212 void printWaitFlag(const MCInst
*MI
, unsigned OpNo
,
213 const MCSubtargetInfo
&STI
, raw_ostream
&O
);
214 void printHwreg(const MCInst
*MI
, unsigned OpNo
, const MCSubtargetInfo
&STI
,
218 class R600InstPrinter
: public MCInstPrinter
{
220 R600InstPrinter(const MCAsmInfo
&MAI
, const MCInstrInfo
&MII
,
221 const MCRegisterInfo
&MRI
)
222 : MCInstPrinter(MAI
, MII
, MRI
) {}
224 void printInst(const MCInst
*MI
, raw_ostream
&O
, StringRef Annot
,
225 const MCSubtargetInfo
&STI
) override
;
226 void printInstruction(const MCInst
*MI
, raw_ostream
&O
);
227 static const char *getRegisterName(unsigned RegNo
);
229 void printAbs(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
230 void printBankSwizzle(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
231 void printClamp(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
232 void printCT(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
233 void printKCache(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
234 void printLast(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
235 void printLiteral(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
236 void printMemOperand(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
237 void printNeg(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
238 void printOMOD(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
239 void printOperand(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
240 void printRel(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
241 void printRSel(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
242 void printUpdateExecMask(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
243 void printUpdatePred(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
244 void printWrite(const MCInst
*MI
, unsigned OpNo
, raw_ostream
&O
);
247 } // End namespace llvm