LLVM  9.0.0svn
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 
15 #include "llvm/MC/MCInstPrinter.h"
16 
17 namespace llvm {
18 
20 public:
22  const MCInstrInfo &MII, const MCRegisterInfo &MRI)
23  : MCInstPrinter(MAI, MII, MRI) {}
24 
25  //Autogenerated by tblgen
26  void printInstruction(const MCInst *MI, const MCSubtargetInfo &STI,
27  raw_ostream &O);
28  static const char *getRegisterName(unsigned RegNo);
29 
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);
34 
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,
45  const MCSubtargetInfo &STI, 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 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,
55  raw_ostream &O);
56  void printOffsetS13(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
57  raw_ostream &O);
58 
59  void printOffset0(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
60  raw_ostream &O);
61  void printOffset1(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
62  raw_ostream &O);
63  void printSMRDOffset8(const MCInst *MI, unsigned OpNo,
64  const MCSubtargetInfo &STI, raw_ostream &O);
65  void printSMRDOffset20(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,
70  raw_ostream &O);
71  void printDLC(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
72  raw_ostream &O);
73  void printGLC(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
74  raw_ostream &O);
75  void printSLC(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
76  raw_ostream &O);
77  void printTFE(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
78  raw_ostream &O);
79  void printDMask(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
80  raw_ostream &O);
81  void printDim(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
82  raw_ostream &O);
83  void printUNorm(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
84  raw_ostream &O);
85  void printDA(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
86  raw_ostream &O);
87  void printR128A16(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
88  raw_ostream &O);
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 
100  void printRegOperand(unsigned RegNo, raw_ostream &O);
101  void printVOPDst(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
102  raw_ostream &O);
103  void printVINTRPDst(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
104  raw_ostream &O);
105  void printImmediate16(uint32_t Imm, const MCSubtargetInfo &STI,
106  raw_ostream &O);
107  void printImmediateV216(uint32_t Imm, const MCSubtargetInfo &STI,
108  raw_ostream &O);
109  void printImmediate32(uint32_t Imm, const MCSubtargetInfo &STI,
110  raw_ostream &O);
111  void printImmediate64(uint64_t Imm, const MCSubtargetInfo &STI,
112  raw_ostream &O);
113  void printOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
114  raw_ostream &O);
115  void printOperandAndFPInputMods(const MCInst *MI, unsigned OpNo,
116  const MCSubtargetInfo &STI, raw_ostream &O);
117  void printOperandAndIntInputMods(const MCInst *MI, unsigned OpNo,
118  const MCSubtargetInfo &STI, raw_ostream &O);
119  void printDPP8(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
120  raw_ostream &O);
121  void printDPPCtrl(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
122  raw_ostream &O);
123  void printRowMask(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
124  raw_ostream &O);
125  void printBankMask(const MCInst *MI, unsigned OpNo,
126  const MCSubtargetInfo &STI, raw_ostream &O);
127  void printBoundCtrl(const MCInst *MI, unsigned OpNo,
128  const MCSubtargetInfo &STI, raw_ostream &O);
129  void printFI(const MCInst *MI, unsigned OpNo,
130  const MCSubtargetInfo &STI, raw_ostream &O);
131  void printSDWASel(const MCInst *MI, unsigned OpNo, raw_ostream &O);
132  void printSDWADstSel(const MCInst *MI, unsigned OpNo,
133  const MCSubtargetInfo &STI, raw_ostream &O);
134  void printSDWASrc0Sel(const MCInst *MI, unsigned OpNo,
135  const MCSubtargetInfo &STI, raw_ostream &O);
136  void printSDWASrc1Sel(const MCInst *MI, unsigned OpNo,
137  const MCSubtargetInfo &STI, raw_ostream &O);
138  void printSDWADstUnused(const MCInst *MI, unsigned OpNo,
139  const MCSubtargetInfo &STI, raw_ostream &O);
140  void printPackedModifier(const MCInst *MI, StringRef Name, unsigned Mod,
141  raw_ostream &O);
142  void printOpSel(const MCInst *MI, unsigned OpNo,
143  const MCSubtargetInfo &STI, raw_ostream &O);
144  void printOpSelHi(const MCInst *MI, unsigned OpNo,
145  const MCSubtargetInfo &STI, raw_ostream &O);
146  void printNegLo(const MCInst *MI, unsigned OpNo,
147  const MCSubtargetInfo &STI, raw_ostream &O);
148  void printNegHi(const MCInst *MI, unsigned OpNo,
149  const MCSubtargetInfo &STI, raw_ostream &O);
150  void printInterpSlot(const MCInst *MI, unsigned OpNo,
151  const MCSubtargetInfo &STI, raw_ostream &O);
152  void printInterpAttr(const MCInst *MI, unsigned OpNo,
153  const MCSubtargetInfo &STI, raw_ostream &O);
154  void printInterpAttrChan(const MCInst *MI, unsigned OpNo,
155  const MCSubtargetInfo &STI, raw_ostream &O);
156 
157  void printVGPRIndexMode(const MCInst *MI, unsigned OpNo,
158  const MCSubtargetInfo &STI, raw_ostream &O);
159  void printMemOperand(const MCInst *MI, unsigned OpNo,
160  const MCSubtargetInfo &STI, raw_ostream &O);
161  void printDefaultVccOperand(unsigned OpNo, const MCSubtargetInfo &STI,
162  raw_ostream &O);
163 
164 
165  template <unsigned N>
166  void printExpSrcN(const MCInst *MI, unsigned OpNo,
167  const MCSubtargetInfo &STI, raw_ostream &O);
168  void printExpSrc0(const MCInst *MI, unsigned OpNo,
169  const MCSubtargetInfo &STI, raw_ostream &O);
170  void printExpSrc1(const MCInst *MI, unsigned OpNo,
171  const MCSubtargetInfo &STI, raw_ostream &O);
172  void printExpSrc2(const MCInst *MI, unsigned OpNo,
173  const MCSubtargetInfo &STI, raw_ostream &O);
174  void printExpSrc3(const MCInst *MI, unsigned OpNo,
175  const MCSubtargetInfo &STI, raw_ostream &O);
176  void printExpTgt(const MCInst *MI, unsigned OpNo,
177  const MCSubtargetInfo &STI, raw_ostream &O);
178 
179 public:
180  static void printIfSet(const MCInst *MI, unsigned OpNo, raw_ostream &O,
182  static void printIfSet(const MCInst *MI, unsigned OpNo, raw_ostream &O,
183  char Asm);
184 protected:
185  void printAbs(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
186  raw_ostream &O);
187  void printHigh(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
188  raw_ostream &O);
189  void printClamp(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
190  raw_ostream &O);
191  void printClampSI(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
192  raw_ostream &O);
193  void printOModSI(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
194  raw_ostream &O);
195  void printLiteral(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
196  raw_ostream &O);
197  void printLast(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
198  raw_ostream &O);
199  void printNeg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
200  raw_ostream &O);
201  void printOMOD(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
202  raw_ostream &O);
203  void printRel(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
204  raw_ostream &O);
205  void printUpdateExecMask(const MCInst *MI, unsigned OpNo,
206  const MCSubtargetInfo &STI, raw_ostream &O);
207  void printUpdatePred(const MCInst *MI, unsigned OpNo,
208  const MCSubtargetInfo &STI, raw_ostream &O);
209  void printWrite(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
210  raw_ostream &O);
211  void printBankSwizzle(const MCInst *MI, unsigned OpNo,
212  const MCSubtargetInfo &STI, raw_ostream &O);
213  void printRSel(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
214  raw_ostream &O);
215  void printCT(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
216  raw_ostream &O);
217  void printKCache(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
218  raw_ostream &O);
219  void printSendMsg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
220  raw_ostream &O);
221  void printSwizzle(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
222  raw_ostream &O);
223  void printWaitFlag(const MCInst *MI, unsigned OpNo,
224  const MCSubtargetInfo &STI, raw_ostream &O);
225  void printHwreg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
226  raw_ostream &O);
227  void printEndpgm(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
228  raw_ostream &O);
229 };
230 
232 public:
234  const MCRegisterInfo &MRI)
235  : MCInstPrinter(MAI, MII, MRI) {}
236 
237  void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot,
238  const MCSubtargetInfo &STI) override;
239  void printInstruction(const MCInst *MI, raw_ostream &O);
240  static const char *getRegisterName(unsigned RegNo);
241 
242  void printAbs(const MCInst *MI, unsigned OpNo, raw_ostream &O);
243  void printBankSwizzle(const MCInst *MI, unsigned OpNo, raw_ostream &O);
244  void printClamp(const MCInst *MI, unsigned OpNo, raw_ostream &O);
245  void printCT(const MCInst *MI, unsigned OpNo, raw_ostream &O);
246  void printKCache(const MCInst *MI, unsigned OpNo, raw_ostream &O);
247  void printLast(const MCInst *MI, unsigned OpNo, raw_ostream &O);
248  void printLiteral(const MCInst *MI, unsigned OpNo, raw_ostream &O);
249  void printMemOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
250  void printNeg(const MCInst *MI, unsigned OpNo, raw_ostream &O);
251  void printOMOD(const MCInst *MI, unsigned OpNo, raw_ostream &O);
252  void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
253  void printRel(const MCInst *MI, unsigned OpNo, raw_ostream &O);
254  void printRSel(const MCInst *MI, unsigned OpNo, raw_ostream &O);
255  void printUpdateExecMask(const MCInst *MI, unsigned OpNo, raw_ostream &O);
256  void printUpdatePred(const MCInst *MI, unsigned OpNo, raw_ostream &O);
257  void printWrite(const MCInst *MI, unsigned OpNo, raw_ostream &O);
258 };
259 
260 } // End namespace llvm
261 
262 #endif
This class represents lattice values for constants.
Definition: AllocatorList.h:23
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
static void printIfSet(const MCInst *MI, unsigned OpNo, raw_ostream &O, StringRef Asm, StringRef Default="")
void printWaitFlag(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printAbs(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
static void printRegOperand(unsigned RegNo, raw_ostream &O, const MCRegisterInfo &MRI)
void printEndpgm(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 printClamp(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
AMDGPUInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
static const char * getRegisterName(unsigned RegNo)
void printUpdateExecMask(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printCT(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:158
void printBankSwizzle(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
void printWrite(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printHwreg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:23
void printLiteral(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printClampSI(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
R600InstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
void printUpdatePred(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printNeg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printRSel(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
The access may modify the value stored in memory.
void printSwizzle(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printInstruction(const MCInst *MI, const MCSubtargetInfo &STI, raw_ostream &O)
const MCAsmInfo & MAI
Definition: MCInstPrinter.h:45
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:39
void printOMOD(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 printInst(const MCInst *MI, raw_ostream &O, StringRef Annot, const MCSubtargetInfo &STI) override
Print the specified MCInst to the specified raw_ostream.
Generic base class for all target subtargets.
const MCInstrInfo & MII
Definition: MCInstPrinter.h:46
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:45
void printHigh(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
IRTranslator LLVM IR MI
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48
void printLast(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 printSendMsg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
const MCRegisterInfo & MRI
Definition: MCInstPrinter.h:47