LLVM  15.0.0git
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 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);
31 
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);
36 
37 private:
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,
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 printOffset(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
54  raw_ostream &O);
55  void printFlatOffset(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
56  raw_ostream &O);
57 
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 printSMEMOffset(const MCInst *MI, unsigned OpNo,
65  const MCSubtargetInfo &STI, raw_ostream &O);
66  void printSMEMOffsetMod(const MCInst *MI, unsigned OpNo,
67  const MCSubtargetInfo &STI, raw_ostream &O);
68  void printSMRDLiteralOffset(const MCInst *MI, unsigned OpNo,
69  const MCSubtargetInfo &STI, raw_ostream &O);
70  void printGDS(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
71  raw_ostream &O);
72  void printCPol(const MCInst *MI, unsigned OpNo,
73  const MCSubtargetInfo &STI, raw_ostream &O);
74  void printSWZ(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
75  raw_ostream &O);
76  void printTFE(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
77  raw_ostream &O);
78  void printDMask(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
79  raw_ostream &O);
80  void printDim(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
81  raw_ostream &O);
82  void printUNorm(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
83  raw_ostream &O);
84  void printDA(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
85  raw_ostream &O);
86  void printR128A16(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
87  raw_ostream &O);
88  void printGFX10A16(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
89  raw_ostream &O);
90  void printLWE(const MCInst *MI, unsigned OpNo,
91  const MCSubtargetInfo &STI, raw_ostream &O);
92  void printD16(const MCInst *MI, unsigned OpNo,
93  const MCSubtargetInfo &STI, raw_ostream &O);
94  void printExpCompr(const MCInst *MI, unsigned OpNo,
95  const MCSubtargetInfo &STI, raw_ostream &O);
96  void printExpVM(const MCInst *MI, unsigned OpNo,
97  const MCSubtargetInfo &STI, raw_ostream &O);
98  void printFORMAT(const MCInst *MI, unsigned OpNo,
99  const MCSubtargetInfo &STI, raw_ostream &O);
100  void printSymbolicFormat(const MCInst *MI,
101  const MCSubtargetInfo &STI, raw_ostream &O);
102 
103  void printRegOperand(unsigned RegNo, raw_ostream &O);
104  void printVOPDst(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
105  raw_ostream &O);
106  void printVINTRPDst(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
107  raw_ostream &O);
108  void printImmediateInt16(uint32_t Imm, const MCSubtargetInfo &STI,
109  raw_ostream &O);
110  void printImmediate16(uint32_t Imm, const MCSubtargetInfo &STI,
111  raw_ostream &O);
112  void printImmediateV216(uint32_t Imm, const MCSubtargetInfo &STI,
113  raw_ostream &O);
114  void printImmediate32(uint32_t Imm, const MCSubtargetInfo &STI,
115  raw_ostream &O);
116  void printImmediate64(uint64_t Imm, const MCSubtargetInfo &STI,
117  raw_ostream &O);
118  void printOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
119  raw_ostream &O);
120  void printOperand(const MCInst *MI, uint64_t /*Address*/, unsigned OpNum,
121  const MCSubtargetInfo &STI, raw_ostream &O) {
122  printOperand(MI, OpNum, STI, O);
123  }
124  void printOperandAndFPInputMods(const MCInst *MI, unsigned OpNo,
125  const MCSubtargetInfo &STI, raw_ostream &O);
126  void printOperandAndIntInputMods(const MCInst *MI, unsigned OpNo,
127  const MCSubtargetInfo &STI, raw_ostream &O);
128  void printDPP8(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
129  raw_ostream &O);
130  void printDPPCtrl(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
131  raw_ostream &O);
132  void printRowMask(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
133  raw_ostream &O);
134  void printBankMask(const MCInst *MI, unsigned OpNo,
135  const MCSubtargetInfo &STI, raw_ostream &O);
136  void printBoundCtrl(const MCInst *MI, unsigned OpNo,
137  const MCSubtargetInfo &STI, raw_ostream &O);
138  void printFI(const MCInst *MI, unsigned OpNo,
139  const MCSubtargetInfo &STI, raw_ostream &O);
140  void printSDWASel(const MCInst *MI, unsigned OpNo, raw_ostream &O);
141  void printSDWADstSel(const MCInst *MI, unsigned OpNo,
142  const MCSubtargetInfo &STI, raw_ostream &O);
143  void printSDWASrc0Sel(const MCInst *MI, unsigned OpNo,
144  const MCSubtargetInfo &STI, raw_ostream &O);
145  void printSDWASrc1Sel(const MCInst *MI, unsigned OpNo,
146  const MCSubtargetInfo &STI, raw_ostream &O);
147  void printSDWADstUnused(const MCInst *MI, unsigned OpNo,
148  const MCSubtargetInfo &STI, raw_ostream &O);
149  void printPackedModifier(const MCInst *MI, StringRef Name, unsigned Mod,
150  raw_ostream &O);
151  void printOpSel(const MCInst *MI, unsigned OpNo,
152  const MCSubtargetInfo &STI, raw_ostream &O);
153  void printOpSelHi(const MCInst *MI, unsigned OpNo,
154  const MCSubtargetInfo &STI, raw_ostream &O);
155  void printNegLo(const MCInst *MI, unsigned OpNo,
156  const MCSubtargetInfo &STI, raw_ostream &O);
157  void printNegHi(const MCInst *MI, unsigned OpNo,
158  const MCSubtargetInfo &STI, raw_ostream &O);
159  void printInterpSlot(const MCInst *MI, unsigned OpNo,
160  const MCSubtargetInfo &STI, raw_ostream &O);
161  void printInterpAttr(const MCInst *MI, unsigned OpNo,
162  const MCSubtargetInfo &STI, raw_ostream &O);
163  void printInterpAttrChan(const MCInst *MI, unsigned OpNo,
164  const MCSubtargetInfo &STI, raw_ostream &O);
165 
166  void printVGPRIndexMode(const MCInst *MI, unsigned OpNo,
167  const MCSubtargetInfo &STI, raw_ostream &O);
168  void printMemOperand(const MCInst *MI, unsigned OpNo,
169  const MCSubtargetInfo &STI, raw_ostream &O);
170  void printBLGP(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
171  raw_ostream &O);
172  void printCBSZ(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
173  raw_ostream &O);
174  void printABID(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
175  raw_ostream &O);
176  void printDefaultVccOperand(unsigned OpNo, const MCSubtargetInfo &STI,
177  raw_ostream &O);
178  void printWaitVDST(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
179  raw_ostream &O);
180 
181  void printExpSrcN(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
182  raw_ostream &O, unsigned N);
183  void printExpSrc0(const MCInst *MI, unsigned OpNo,
184  const MCSubtargetInfo &STI, raw_ostream &O);
185  void printExpSrc1(const MCInst *MI, unsigned OpNo,
186  const MCSubtargetInfo &STI, raw_ostream &O);
187  void printExpSrc2(const MCInst *MI, unsigned OpNo,
188  const MCSubtargetInfo &STI, raw_ostream &O);
189  void printExpSrc3(const MCInst *MI, unsigned OpNo,
190  const MCSubtargetInfo &STI, raw_ostream &O);
191  void printExpTgt(const MCInst *MI, unsigned OpNo,
192  const MCSubtargetInfo &STI, raw_ostream &O);
193 
194 public:
195  static void printIfSet(const MCInst *MI, unsigned OpNo, raw_ostream &O,
196  StringRef Asm, StringRef Default = "");
197  static void printIfSet(const MCInst *MI, unsigned OpNo, raw_ostream &O,
198  char Asm);
199 protected:
200  void printAbs(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
201  raw_ostream &O);
202  void printHigh(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
203  raw_ostream &O);
204  void printClamp(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
205  raw_ostream &O);
206  void printClampSI(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
207  raw_ostream &O);
208  void printOModSI(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
209  raw_ostream &O);
210  void printLiteral(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
211  raw_ostream &O);
212  void printLast(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
213  raw_ostream &O);
214  void printNeg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
215  raw_ostream &O);
216  void printOMOD(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
217  raw_ostream &O);
218  void printRel(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
219  raw_ostream &O);
220  void printUpdateExecMask(const MCInst *MI, unsigned OpNo,
221  const MCSubtargetInfo &STI, raw_ostream &O);
222  void printUpdatePred(const MCInst *MI, unsigned OpNo,
223  const MCSubtargetInfo &STI, raw_ostream &O);
224  void printWrite(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
225  raw_ostream &O);
226  void printBankSwizzle(const MCInst *MI, unsigned OpNo,
227  const MCSubtargetInfo &STI, raw_ostream &O);
228  void printRSel(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
229  raw_ostream &O);
230  void printCT(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
231  raw_ostream &O);
232  void printKCache(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
233  raw_ostream &O);
234  void printSendMsg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
235  raw_ostream &O);
236  void printSwizzle(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
237  raw_ostream &O);
238  void printWaitFlag(const MCInst *MI, unsigned OpNo,
239  const MCSubtargetInfo &STI, raw_ostream &O);
240  void printDepCtr(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
241  raw_ostream &O);
242  void printDelayFlag(const MCInst *MI, unsigned OpNo,
243  const MCSubtargetInfo &STI, raw_ostream &O);
244  void printHwreg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
245  raw_ostream &O);
246  void printEndpgm(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
247  raw_ostream &O);
248 };
249 
250 } // End namespace llvm
251 
252 #endif
llvm::AMDGPUInstPrinter::printClamp
void printClamp(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
llvm::MCInstPrinter::MII
const MCInstrInfo & MII
Definition: MCInstPrinter.h:50
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:104
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::AMDGPUInstPrinter::printInstruction
void printInstruction(const MCInst *MI, uint64_t Address, const MCSubtargetInfo &STI, raw_ostream &O)
llvm::AMDGPUInstPrinter::printUpdateExecMask
void printUpdateExecMask(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
llvm::MCAsmInfo
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
llvm::AMDGPUInstPrinter::printWaitFlag
void printWaitFlag(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
Definition: AMDGPUInstPrinter.cpp:1415
llvm::AMDGPUInstPrinter::printAbs
void printAbs(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
llvm::AMDGPUInstPrinter::printOModSI
void printOModSI(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
Definition: AMDGPUInstPrinter.cpp:1266
llvm::AMDGPUInstPrinter::printLiteral
void printLiteral(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
llvm::MCInst
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:184
llvm::AMDGPUInstPrinter::printHigh
void printHigh(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
Definition: AMDGPUInstPrinter.cpp:1254
llvm::MCInstPrinter::MRI
const MCRegisterInfo & MRI
Definition: MCInstPrinter.h:51
llvm::AMDGPUInstPrinter::printSendMsg
void printSendMsg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
Definition: AMDGPUInstPrinter.cpp:1278
llvm::AMDGPUInstPrinter
Definition: AMDGPUInstPrinter.h:19
llvm::AMDGPUInstPrinter::printKCache
void printKCache(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
llvm::AMDGPUInstPrinter::printUpdatePred
void printUpdatePred(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
llvm::AMDGPUInstPrinter::getMnemonic
std::pair< const char *, uint64_t > getMnemonic(const MCInst *MI) override
Returns a pair containing the mnemonic for MI and the number of bits left for further processing by p...
llvm::AMDGPUInstPrinter::printRegName
void printRegName(raw_ostream &OS, unsigned RegNo) const override
Print the assembler register name.
Definition: AMDGPUInstPrinter.cpp:33
llvm::AMDGPUInstPrinter::printNeg
void printNeg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:54
llvm::AMDGPUInstPrinter::printClampSI
void printClampSI(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
Definition: AMDGPUInstPrinter.cpp:1260
llvm::AMDGPUInstPrinter::printLast
void printLast(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
MCInstPrinter.h
llvm::AMDGPUInstPrinter::printSwizzle
void printSwizzle(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
Definition: AMDGPUInstPrinter.cpp:1342
llvm::AMDGPUInstPrinter::printIfSet
static void printIfSet(const MCInst *MI, unsigned OpNo, raw_ostream &O, StringRef Asm, StringRef Default="")
Definition: AMDGPUInstPrinter.cpp:1234
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:239
uint64_t
llvm::MCInstPrinter
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:43
llvm::AMDGPUInstPrinter::printEndpgm
void printEndpgm(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
Definition: AMDGPUInstPrinter.cpp:1543
llvm::AMDGPUInstPrinter::printDepCtr
void printDepCtr(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
Definition: AMDGPUInstPrinter.cpp:1450
llvm::AMDGPUInstPrinter::printRel
void printRel(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
llvm::AMDGPUInstPrinter::AMDGPUInstPrinter
AMDGPUInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
Definition: AMDGPUInstPrinter.h:21
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::AMDGPUInstPrinter::getRegisterName
static const char * getRegisterName(unsigned RegNo)
uint32_t
llvm::MCRegisterInfo
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Definition: MCRegisterInfo.h:135
llvm::AMDGPUInstPrinter::printBankSwizzle
void printBankSwizzle(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
llvm::MCInstrInfo
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:26
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:50
llvm::AMDGPUInstPrinter::printRSel
void printRSel(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
llvm::AMDGPUInstPrinter::printHwreg
void printHwreg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
Definition: AMDGPUInstPrinter.cpp:1520
llvm::AMDGPUInstPrinter::printInst
void printInst(const MCInst *MI, uint64_t Address, StringRef Annot, const MCSubtargetInfo &STI, raw_ostream &O) override
Print the specified MCInst to the specified raw_ostream.
Definition: AMDGPUInstPrinter.cpp:49
llvm::MCInstPrinter::MAI
const MCAsmInfo & MAI
Definition: MCInstPrinter.h:49
N
#define N
llvm::AMDGPUInstPrinter::printDelayFlag
void printDelayFlag(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
Definition: AMDGPUInstPrinter.cpp:1477
llvm::AMDGPUInstPrinter::printCT
void printCT(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
llvm::HexStyle::Asm
@ Asm
0ffh
Definition: MCInstPrinter.h:34
llvm::AMDGPUInstPrinter::printOMOD
void printOMOD(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
llvm::MCSubtargetInfo
Generic base class for all target subtargets.
Definition: MCSubtargetInfo.h:76
llvm::AMDGPUInstPrinter::printWrite
void printWrite(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
llvm::AMDGPUInstPrinter::printRegOperand
static void printRegOperand(unsigned RegNo, raw_ostream &O, const MCRegisterInfo &MRI)
Definition: AMDGPUInstPrinter.cpp:342