LLVM 20.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
16
17namespace llvm {
18class MCInstrDesc;
19
21public:
23 const MCInstrInfo &MII, const MCRegisterInfo &MRI)
24 : MCInstPrinter(MAI, MII, MRI) {}
25
26 // Autogenerated by tblgen
27 std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
29 const MCSubtargetInfo &STI, raw_ostream &O);
30 static const char *getRegisterName(MCRegister Reg);
31
32 void printRegName(raw_ostream &OS, MCRegister Reg) const override;
33 void printInst(const MCInst *MI, uint64_t Address, StringRef Annot,
34 const MCSubtargetInfo &STI, raw_ostream &O) override;
35 static void printRegOperand(unsigned RegNo, raw_ostream &O,
36 const MCRegisterInfo &MRI);
37
38private:
39 void printU16ImmOperand(const MCInst *MI, unsigned OpNo,
40 const MCSubtargetInfo &STI, raw_ostream &O);
41 void printU16ImmDecOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
42 void printU32ImmOperand(const MCInst *MI, unsigned OpNo,
43 const MCSubtargetInfo &STI, raw_ostream &O);
44 void printNamedBit(const MCInst *MI, unsigned OpNo, raw_ostream &O,
45 StringRef BitName);
46 void printOffset(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
47 raw_ostream &O);
48 void printFlatOffset(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
49 raw_ostream &O);
50
51 void printSMRDOffset8(const MCInst *MI, unsigned OpNo,
52 const MCSubtargetInfo &STI, raw_ostream &O);
53 void printSMEMOffset(const MCInst *MI, unsigned OpNo,
54 const MCSubtargetInfo &STI, raw_ostream &O);
55 void printSMRDLiteralOffset(const MCInst *MI, unsigned OpNo,
56 const MCSubtargetInfo &STI, raw_ostream &O);
57 void printCPol(const MCInst *MI, unsigned OpNo,
58 const MCSubtargetInfo &STI, raw_ostream &O);
59 void printTH(const MCInst *MI, int64_t TH, int64_t Scope, raw_ostream &O);
60 void printScope(int64_t Scope, raw_ostream &O);
61 void printDim(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
62 raw_ostream &O);
63 void printR128A16(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
64 raw_ostream &O);
65 void printFORMAT(const MCInst *MI, unsigned OpNo,
66 const MCSubtargetInfo &STI, raw_ostream &O);
67 void printSymbolicFormat(const MCInst *MI,
68 const MCSubtargetInfo &STI, raw_ostream &O);
69
70 void printRegOperand(unsigned RegNo, raw_ostream &O);
71 void printVOPDst(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
72 raw_ostream &O);
73 void printVINTRPDst(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
74 raw_ostream &O);
75 void printImmediateInt16(uint32_t Imm, const MCSubtargetInfo &STI,
76 raw_ostream &O);
77 void printImmediateBF16(uint32_t Imm, const MCSubtargetInfo &STI,
78 raw_ostream &O);
79 void printImmediateF16(uint32_t Imm, const MCSubtargetInfo &STI,
80 raw_ostream &O);
81 void printImmediateV216(uint32_t Imm, uint8_t OpType,
82 const MCSubtargetInfo &STI, raw_ostream &O);
83 bool printImmediateFloat32(uint32_t Imm, const MCSubtargetInfo &STI,
84 raw_ostream &O);
85 void printImmediate32(uint32_t Imm, const MCSubtargetInfo &STI,
86 raw_ostream &O);
87 void printImmediate64(uint64_t Imm, const MCSubtargetInfo &STI,
88 raw_ostream &O, bool IsFP);
89 void printOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
90 raw_ostream &O);
91 void printRegularOperand(const MCInst *MI, unsigned OpNo,
92 const MCSubtargetInfo &STI, raw_ostream &O);
93 void printOperand(const MCInst *MI, uint64_t /*Address*/, unsigned OpNum,
94 const MCSubtargetInfo &STI, raw_ostream &O) {
95 printOperand(MI, OpNum, STI, O);
96 }
97 void printOperandAndFPInputMods(const MCInst *MI, unsigned OpNo,
98 const MCSubtargetInfo &STI, raw_ostream &O);
99 void printOperandAndIntInputMods(const MCInst *MI, unsigned OpNo,
100 const MCSubtargetInfo &STI, raw_ostream &O);
101 void printDPP8(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
102 raw_ostream &O);
103 void printDPPCtrl(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
104 raw_ostream &O);
105 void printDppBoundCtrl(const MCInst *MI, unsigned OpNo,
106 const MCSubtargetInfo &STI, raw_ostream &O);
107 void printDppFI(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
108 raw_ostream &O);
109 void printSDWASel(const MCInst *MI, unsigned OpNo, raw_ostream &O);
110 void printSDWADstSel(const MCInst *MI, unsigned OpNo,
111 const MCSubtargetInfo &STI, raw_ostream &O);
112 void printSDWASrc0Sel(const MCInst *MI, unsigned OpNo,
113 const MCSubtargetInfo &STI, raw_ostream &O);
114 void printSDWASrc1Sel(const MCInst *MI, unsigned OpNo,
115 const MCSubtargetInfo &STI, raw_ostream &O);
116 void printSDWADstUnused(const MCInst *MI, unsigned OpNo,
117 const MCSubtargetInfo &STI, raw_ostream &O);
118 void printPackedModifier(const MCInst *MI, StringRef Name, unsigned Mod,
119 raw_ostream &O);
120 void printOpSel(const MCInst *MI, unsigned OpNo,
121 const MCSubtargetInfo &STI, raw_ostream &O);
122 void printOpSelHi(const MCInst *MI, unsigned OpNo,
123 const MCSubtargetInfo &STI, raw_ostream &O);
124 void printNegLo(const MCInst *MI, unsigned OpNo,
125 const MCSubtargetInfo &STI, raw_ostream &O);
126 void printNegHi(const MCInst *MI, unsigned OpNo,
127 const MCSubtargetInfo &STI, raw_ostream &O);
128 void printIndexKey8bit(const MCInst *MI, unsigned OpNo,
129 const MCSubtargetInfo &STI, raw_ostream &O);
130 void printIndexKey16bit(const MCInst *MI, unsigned OpNo,
131 const MCSubtargetInfo &STI, raw_ostream &O);
132 void printInterpSlot(const MCInst *MI, unsigned OpNo,
133 const MCSubtargetInfo &STI, raw_ostream &O);
134 void printInterpAttr(const MCInst *MI, unsigned OpNo,
135 const MCSubtargetInfo &STI, raw_ostream &O);
136 void printInterpAttrChan(const MCInst *MI, unsigned OpNo,
137 const MCSubtargetInfo &STI, raw_ostream &O);
138
139 void printGPRIdxMode(const MCInst *MI, unsigned OpNo,
140 const MCSubtargetInfo &STI, raw_ostream &O);
141 void printMemOperand(const MCInst *MI, unsigned OpNo,
142 const MCSubtargetInfo &STI, raw_ostream &O);
143 void printBLGP(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
144 raw_ostream &O);
145 bool needsImpliedVcc(const MCInstrDesc &Desc, unsigned OpNo) const;
146 void printDefaultVccOperand(bool FirstOperand, const MCSubtargetInfo &STI,
147 raw_ostream &O);
148
149 void printExpSrcN(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
150 raw_ostream &O, unsigned N);
151 void printExpSrc0(const MCInst *MI, unsigned OpNo,
152 const MCSubtargetInfo &STI, raw_ostream &O);
153 void printExpSrc1(const MCInst *MI, unsigned OpNo,
154 const MCSubtargetInfo &STI, raw_ostream &O);
155 void printExpSrc2(const MCInst *MI, unsigned OpNo,
156 const MCSubtargetInfo &STI, raw_ostream &O);
157 void printExpSrc3(const MCInst *MI, unsigned OpNo,
158 const MCSubtargetInfo &STI, raw_ostream &O);
159 void printExpTgt(const MCInst *MI, unsigned OpNo,
160 const MCSubtargetInfo &STI, raw_ostream &O);
161 void printNamedInt(const MCInst *MI, unsigned OpNo,
162 const MCSubtargetInfo &STI, raw_ostream &O,
163 StringRef Prefix, bool PrintInHex, bool AlwaysPrint);
164
165public:
166 static void printIfSet(const MCInst *MI, unsigned OpNo, raw_ostream &O,
167 StringRef Asm, StringRef Default = "");
168 static void printIfSet(const MCInst *MI, unsigned OpNo, raw_ostream &O,
169 char Asm);
170protected:
171 void printAbs(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
172 raw_ostream &O);
173 void printClamp(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
174 raw_ostream &O);
175 void printOModSI(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
176 raw_ostream &O);
177 void printLiteral(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
178 raw_ostream &O);
179 void printLast(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
180 raw_ostream &O);
181 void printNeg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
182 raw_ostream &O);
183 void printOMOD(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
184 raw_ostream &O);
185 void printRel(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
186 raw_ostream &O);
187 void printUpdateExecMask(const MCInst *MI, unsigned OpNo,
188 const MCSubtargetInfo &STI, raw_ostream &O);
189 void printUpdatePred(const MCInst *MI, unsigned OpNo,
190 const MCSubtargetInfo &STI, raw_ostream &O);
191 void printWrite(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
192 raw_ostream &O);
193 void printBankSwizzle(const MCInst *MI, unsigned OpNo,
194 const MCSubtargetInfo &STI, raw_ostream &O);
195 void printRSel(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
196 raw_ostream &O);
197 void printCT(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
198 raw_ostream &O);
199 void printKCache(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
200 raw_ostream &O);
201 void printSendMsg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
202 raw_ostream &O);
203 void printSwizzle(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
204 raw_ostream &O);
205 void printSWaitCnt(const MCInst *MI, unsigned OpNo,
206 const MCSubtargetInfo &STI, raw_ostream &O);
207 void printDepCtr(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
208 raw_ostream &O);
209 void printSDelayALU(const MCInst *MI, unsigned OpNo,
210 const MCSubtargetInfo &STI, raw_ostream &O);
211 void printHwreg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
212 raw_ostream &O);
213 void printEndpgm(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
214 raw_ostream &O);
215};
216
217} // End namespace llvm
218
219#endif
std::string Name
IRTranslator LLVM IR MI
unsigned Reg
raw_pwrite_stream & OS
void printSwizzle(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printAbs(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printEndpgm(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
static const char * getRegisterName(MCRegister Reg)
AMDGPUInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
static void printIfSet(const MCInst *MI, unsigned OpNo, raw_ostream &O, StringRef Asm, StringRef Default="")
void printBankSwizzle(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printDepCtr(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printLiteral(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printRSel(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printHwreg(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 printSendMsg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printUpdateExecMask(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printWrite(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printRegName(raw_ostream &OS, MCRegister Reg) const override
Print the assembler register name.
static void printRegOperand(unsigned RegNo, raw_ostream &O, const MCRegisterInfo &MRI)
void printNeg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
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.
void printClamp(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
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...
void printInstruction(const MCInst *MI, uint64_t Address, const MCSubtargetInfo &STI, raw_ostream &O)
void printUpdatePred(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printSWaitCnt(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printCT(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 printLast(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 printSDelayALU(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printOMOD(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:45
const MCInstrInfo & MII
Definition: MCInstPrinter.h:52
const MCRegisterInfo & MRI
Definition: MCInstPrinter.h:53
const MCAsmInfo & MAI
Definition: MCInstPrinter.h:51
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:184
Describe properties that are true of each instruction in the target description file.
Definition: MCInstrDesc.h:198
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:26
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Wrapper class representing physical registers. Should be passed by value.
Definition: MCRegister.h:33
Generic base class for all target subtargets.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ Mod
The access may modify the value stored in memory.
@ Default
The result values are uniform if and only if all operands are uniform.
#define N
Description of the encoding of one expression Op.