Revert r354244 "[DAGCombiner] Eliminate dead stores to stack."
[llvm-complete.git] / lib / Target / AMDGPU / InstPrinter / AMDGPUInstPrinter.h
blobe0c44399d494c1f8167bed3203d5dee6e4efa80d
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 //===----------------------------------------------------------------------===//
12 #ifndef LLVM_LIB_TARGET_AMDGPU_INSTPRINTER_AMDGPUINSTPRINTER_H
13 #define LLVM_LIB_TARGET_AMDGPU_INSTPRINTER_AMDGPUINSTPRINTER_H
15 #include "llvm/MC/MCInstPrinter.h"
17 namespace llvm {
19 class AMDGPUInstPrinter : public MCInstPrinter {
20 public:
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,
27 raw_ostream &O);
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);
35 private:
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,
48 StringRef BitName);
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,
54 raw_ostream &O);
55 void printOffsetS13(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
56 raw_ostream &O);
58 void printOffset0(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
59 raw_ostream &O);
60 void printOffset1(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
61 raw_ostream &O);
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,
69 raw_ostream &O);
70 void printGLC(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
71 raw_ostream &O);
72 void printSLC(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
73 raw_ostream &O);
74 void printTFE(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
75 raw_ostream &O);
76 void printDMask(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
77 raw_ostream &O);
78 void printUNorm(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
79 raw_ostream &O);
80 void printDA(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
81 raw_ostream &O);
82 void printR128A16(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
83 raw_ostream &O);
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,
97 raw_ostream &O);
98 void printVINTRPDst(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
99 raw_ostream &O);
100 void printImmediate16(uint32_t Imm, const MCSubtargetInfo &STI,
101 raw_ostream &O);
102 void printImmediateV216(uint32_t Imm, const MCSubtargetInfo &STI,
103 raw_ostream &O);
104 void printImmediate32(uint32_t Imm, const MCSubtargetInfo &STI,
105 raw_ostream &O);
106 void printImmediate64(uint64_t Imm, const MCSubtargetInfo &STI,
107 raw_ostream &O);
108 void printOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
109 raw_ostream &O);
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,
115 raw_ostream &O);
116 void printRowMask(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
117 raw_ostream &O);
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,
132 raw_ostream &O);
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);
168 public:
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,
172 char Asm);
173 protected:
174 void printAbs(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
175 raw_ostream &O);
176 void printHigh(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
177 raw_ostream &O);
178 void printClamp(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
179 raw_ostream &O);
180 void printClampSI(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
181 raw_ostream &O);
182 void printOModSI(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
183 raw_ostream &O);
184 void printLiteral(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
185 raw_ostream &O);
186 void printLast(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
187 raw_ostream &O);
188 void printNeg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
189 raw_ostream &O);
190 void printOMOD(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
191 raw_ostream &O);
192 void printRel(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
193 raw_ostream &O);
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,
199 raw_ostream &O);
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,
203 raw_ostream &O);
204 void printCT(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
205 raw_ostream &O);
206 void printKCache(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
207 raw_ostream &O);
208 void printSendMsg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
209 raw_ostream &O);
210 void printSwizzle(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
211 raw_ostream &O);
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,
215 raw_ostream &O);
218 class R600InstPrinter : public MCInstPrinter {
219 public:
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
249 #endif