LLVM 24.0.0git
AMDGPUMCInstLower.cpp
Go to the documentation of this file.
1//===- AMDGPUMCInstLower.cpp - Lower AMDGPU MachineInstr to an MCInst -----===//
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/// Code to lower AMDGPU MachineInstrs to their corresponding MCInst.
11//
12//===----------------------------------------------------------------------===//
13//
14
15#include "AMDGPUMCInstLower.h"
16#include "AMDGPUAsmPrinter.h"
23#include "llvm/IR/Constants.h"
24#include "llvm/IR/Function.h"
27#include "llvm/MC/MCContext.h"
28#include "llvm/MC/MCExpr.h"
29#include "llvm/MC/MCInst.h"
31#include "llvm/MC/MCStreamer.h"
34#include "llvm/Support/Endian.h"
36#include "llvm/Support/Format.h"
37#include <algorithm>
38
39using namespace llvm;
40
41#include "AMDGPUGenMCPseudoLowering.inc"
42
44 const TargetSubtargetInfo &st,
45 const AsmPrinter &ap):
46 Ctx(ctx), ST(st), AP(ap) { }
47
73
75 MCOperand &MCOp) const {
76 switch (MO.getType()) {
77 default:
78 break;
80 MCOp = MCOperand::createImm(MO.getImm());
81 return true;
84 return true;
88 return true;
90 const GlobalValue *GV = MO.getGlobal();
91 SmallString<128> SymbolName;
92 AP.getNameWithPrefix(SymbolName, GV);
93 MCSymbol *Sym = Ctx.getOrCreateSymbol(SymbolName);
94 const MCExpr *Expr =
96 int64_t Offset = MO.getOffset();
97 if (Offset != 0) {
98 Expr = MCBinaryExpr::createAdd(Expr,
100 }
101 MCOp = MCOperand::createExpr(Expr);
102 return true;
103 }
105 MCSymbol *Sym = Ctx.getOrCreateSymbol(StringRef(MO.getSymbolName()));
106 const MCExpr *Expr =
108 MCOp = MCOperand::createExpr(Expr);
109 return true;
110 }
112 MCSymbol *Sym = AP.GetBlockAddressSymbol(MO.getBlockAddress());
113 const MCSymbolRefExpr *Expr =
115 assert(MO.getOffset() == 0);
116 MCOp = MCOperand::createExpr(Expr);
117 return true;
118 }
120 // Regmasks are like implicit defs.
121 return false;
124 MCSymbol *Sym = MO.getMCSymbol();
126 return true;
127 }
128 break;
129 }
130 llvm_unreachable("unknown operand type");
131}
132
133// Lower true16 D16 Pseudo instruction to d16_lo/d16_hi MCInst based on
134// Dst/Data's .l/.h selection
136 MCInst &OutMI) const {
137 unsigned Opcode = MI->getOpcode();
138 const auto *TII = static_cast<const SIInstrInfo*>(ST.getInstrInfo());
139 const SIRegisterInfo &TRI = TII->getRegisterInfo();
140 const auto *Info = AMDGPU::getT16D16Helper(Opcode);
141
142 llvm::AMDGPU::OpName OpName;
143 if (TII->isDS(Opcode)) {
144 if (MI->mayLoad())
145 OpName = llvm::AMDGPU::OpName::vdst;
146 else if (MI->mayStore())
147 OpName = llvm::AMDGPU::OpName::data0;
148 else
149 llvm_unreachable("LDS load or store expected");
150 } else {
151 OpName = AMDGPU::hasNamedOperand(Opcode, llvm::AMDGPU::OpName::vdata)
152 ? llvm::AMDGPU::OpName::vdata
153 : llvm::AMDGPU::OpName::vdst;
154 }
155
156 // select Dst/Data
157 int VDstOrVDataIdx = AMDGPU::getNamedOperandIdx(Opcode, OpName);
158 const MachineOperand &MIVDstOrVData = MI->getOperand(VDstOrVDataIdx);
159
160 // select hi/lo MCInst
161 bool IsHi = AMDGPU::isHi16Reg(MIVDstOrVData.getReg(), TRI);
162 Opcode = IsHi ? Info->HiOp : Info->LoOp;
163
164 int MCOpcode = TII->pseudoToMCOpcode(Opcode);
165 assert(MCOpcode != -1 &&
166 "Pseudo instruction doesn't have a target-specific version");
167 OutMI.setOpcode(MCOpcode);
168
169 // lower operands
170 for (int I = 0, E = MI->getNumExplicitOperands(); I < E; I++) {
171 const MachineOperand &MO = MI->getOperand(I);
172 MCOperand MCOp;
173 if (I == VDstOrVDataIdx)
174 MCOp = MCOperand::createReg(TRI.get32BitRegister(MIVDstOrVData.getReg()));
175 else
176 lowerOperand(MO, MCOp);
177 OutMI.addOperand(MCOp);
178 }
179
180 if (AMDGPU::hasNamedOperand(MCOpcode, AMDGPU::OpName::vdst_in)) {
181 MCOperand MCOp;
182 lowerOperand(MIVDstOrVData, MCOp);
183 OutMI.addOperand(MCOp);
184 }
185}
186
188 MCInst &OutMI) const {
189 unsigned Opcode = MI->getOpcode();
190 const auto *TII = static_cast<const SIInstrInfo *>(ST.getInstrInfo());
191 const SIRegisterInfo &TRI = TII->getRegisterInfo();
192
193 int VDstIdx = AMDGPU::getNamedOperandIdx(Opcode, llvm::AMDGPU::OpName::vdst);
194 const MachineOperand &VDst = MI->getOperand(VDstIdx);
195 bool IsHi = AMDGPU::isHi16Reg(VDst.getReg(), TRI);
196 switch (Opcode) {
197 case AMDGPU::V_FMA_MIX_F16_t16:
198 Opcode = IsHi ? AMDGPU::V_FMA_MIXHI_F16 : AMDGPU::V_FMA_MIXLO_F16;
199 break;
200 case AMDGPU::V_FMA_MIX_BF16_t16:
201 Opcode = IsHi ? AMDGPU::V_FMA_MIXHI_BF16 : AMDGPU::V_FMA_MIXLO_BF16;
202 break;
203 }
204 int MCOpcode = TII->pseudoToMCOpcode(Opcode);
205 assert(MCOpcode != -1 &&
206 "Pseudo instruction doesn't have a target-specific version");
207 OutMI.setOpcode(MCOpcode);
208
209 // lower operands
210 for (int I = 0, E = MI->getNumExplicitOperands(); I < E; I++) {
211 const MachineOperand &MO = MI->getOperand(I);
212 MCOperand MCOp;
213 if (I == VDstIdx)
214 MCOp = MCOperand::createReg(TRI.get32BitRegister(VDst.getReg()));
215 else
216 lowerOperand(MO, MCOp);
217 OutMI.addOperand(MCOp);
218 }
219}
220
221void AMDGPUMCInstLower::lower(const MachineInstr *MI, MCInst &OutMI) const {
222 unsigned Opcode = MI->getOpcode();
223 const auto *TII = static_cast<const SIInstrInfo *>(ST.getInstrInfo());
224
225 // FIXME: Should be able to handle this with lowerPseudoInstExpansion. We
226 // need to select it to the subtarget specific version, and there's no way to
227 // do that with a single pseudo source operation.
228 if (Opcode == AMDGPU::S_SETPC_B64_return)
229 Opcode = AMDGPU::S_SETPC_B64;
230 else if (Opcode == AMDGPU::SI_CALL) {
231 // SI_CALL is just S_SWAPPC_B64 with an additional operand to track the
232 // called function (which we need to remove here).
233 OutMI.setOpcode(TII->pseudoToMCOpcode(AMDGPU::S_SWAPPC_B64));
234 MCOperand Dest, Src;
235 lowerOperand(MI->getOperand(0), Dest);
236 lowerOperand(MI->getOperand(1), Src);
237 OutMI.addOperand(Dest);
238 OutMI.addOperand(Src);
239 return;
240 } else if (Opcode == AMDGPU::SI_TCRETURN ||
241 Opcode == AMDGPU::SI_TCRETURN_GFX ||
242 Opcode == AMDGPU::SI_TCRETURN_CHAIN) {
243 // TODO: How to use branch immediate and avoid register+add?
244 Opcode = AMDGPU::S_SETPC_B64;
245 } else if (AMDGPU::getT16D16Helper(Opcode)) {
246 lowerT16D16Helper(MI, OutMI);
247 return;
248 } else if (Opcode == AMDGPU::V_FMA_MIX_F16_t16 ||
249 Opcode == AMDGPU::V_FMA_MIX_BF16_t16) {
250 lowerT16FmaMixFP16(MI, OutMI);
251 return;
252 }
253
254 int MCOpcode = TII->pseudoToMCOpcode(Opcode);
255 if (MCOpcode == -1) {
256 LLVMContext &C = MI->getMF()->getFunction().getContext();
257 C.emitError("AMDGPUMCInstLower::lower - Pseudo instruction doesn't have "
258 "a target-specific version: " + Twine(MI->getOpcode()));
259 return;
260 }
261
262 OutMI.setOpcode(MCOpcode);
263
264 for (const MachineOperand &MO : MI->explicit_operands()) {
265 MCOperand MCOp;
266 lowerOperand(MO, MCOp);
267 OutMI.addOperand(MCOp);
268 }
269
270 int FIIdx = AMDGPU::getNamedOperandIdx(MCOpcode, AMDGPU::OpName::fi);
271 if (FIIdx >= (int)OutMI.getNumOperands())
273}
274
276 MCOperand &MCOp) const {
277 const GCNSubtarget &STI = MF->getSubtarget<GCNSubtarget>();
278 AMDGPUMCInstLower MCInstLowering(OutContext, STI, *this);
279 return MCInstLowering.lowerOperand(MO, MCOp);
280}
281
283 const Constant *BaseCV,
284 uint64_t Offset) {
285
286 // Intercept LDS variables with known addresses
288 if (std::optional<uint32_t> Address =
291 auto *IntTy = Type::getInt32Ty(CV->getContext());
292 return AsmPrinter::lowerConstant(ConstantInt::get(IntTy, *Address),
293 BaseCV, Offset);
294 }
295 }
296
297 if (const MCExpr *E = lowerAddrSpaceCast(CV, OutContext))
298 return E;
299 return AsmPrinter::lowerConstant(CV, BaseCV, Offset);
300}
301
303 const TargetRegisterInfo *TRI,
304 const SIMachineFunctionInfo *MFI,
305 MCStreamer &OS) {
306 // The instruction will only transfer a subset of the registers in the block,
307 // based on the mask that is stored in m0. We could search for the instruction
308 // that sets m0, but most of the time we'll already have the mask stored in
309 // the machine function info. Try to use that. This assumes that we only use
310 // block loads/stores for CSR spills.
311 Register RegBlock =
312 TII->getNamedOperand(*MI, MI->mayLoad() ? AMDGPU::OpName::vdst
313 : AMDGPU::OpName::vdata)
314 ->getReg();
315 Register FirstRegInBlock = TRI->getSubReg(RegBlock, AMDGPU::sub0);
316 uint32_t Mask = MFI->getMaskForVGPRBlockOps(RegBlock);
317
318 if (!Mask)
319 return; // Nothing to report
320
321 SmallString<512> TransferredRegs;
322 for (unsigned I = 0; I < sizeof(Mask) * 8; ++I) {
323 if (Mask & (1 << I)) {
324 (llvm::Twine(" ") + TRI->getRegAsmName(FirstRegInBlock + I))
325 .toVector(TransferredRegs);
326 }
327 }
328
329 OS.emitRawComment(" transferring at most " + TransferredRegs);
330}
331
333 if (MI->isCall())
334 collectCallEdge(*MI);
335
336 // FIXME: Enable feature predicate checks once all the test pass.
337 // AMDGPU_MC::verifyInstructionPredicates(MI->getOpcode(),
338 // getSubtargetInfo().getFeatureBits());
339
340 if (MCInst OutInst; lowerPseudoInstExpansion(MI, OutInst)) {
341 EmitToStreamer(*OutStreamer, OutInst);
342 return;
343 }
344
345 const GCNSubtarget &STI = MF->getSubtarget<GCNSubtarget>();
346 AMDGPUMCInstLower MCInstLowering(OutContext, STI, *this);
347
348 StringRef Err;
349 if (!STI.getInstrInfo()->verifyInstruction(*MI, Err)) {
350 LLVMContext &C = MI->getMF()->getFunction().getContext();
351 C.emitError("Illegal instruction detected: " + Err);
352 MI->print(errs());
353 }
354
355 if (MI->isBundle()) {
356 const MachineBasicBlock *MBB = MI->getParent();
358 while (I != MBB->instr_end() && I->isInsideBundle()) {
360 ++I;
361 }
362 } else {
363 // We don't want these pseudo instructions encoded. They are
364 // placeholder instructions and should only be printed as
365 // comments.
366 if (MI->getOpcode() == AMDGPU::SI_RETURN_TO_EPILOG) {
367 if (isVerbose())
368 OutStreamer->emitRawComment(" return to shader part epilog");
369 return;
370 }
371
372 if (MI->getOpcode() == AMDGPU::WAVE_BARRIER) {
373 if (isVerbose())
374 OutStreamer->emitRawComment(" wave barrier");
375 return;
376 }
377
378 if (MI->getOpcode() == AMDGPU::ASYNCMARK) {
379 if (isVerbose()) {
380 std::string Comment;
381 raw_string_ostream OS(Comment);
382 OS << " asyncmark(stages="
383 << AMDGPU::asyncStagesFromMaskOperand(MI->getOperand(0).getImm())
384 << ')';
385 OutStreamer->emitRawComment(Comment);
386 }
387 return;
388 }
389
390 if (MI->getOpcode() == AMDGPU::WAIT_ASYNCMARK) {
391 if (isVerbose()) {
392 std::string Comment;
393 raw_string_ostream OS(Comment);
394 OS << " wait_asyncmark(" << MI->getOperand(0).getImm() << ", stages="
395 << AMDGPU::asyncStagesFromMaskOperand(MI->getOperand(1).getImm())
396 << ')';
397 OutStreamer->emitRawComment(Comment);
398 }
399 return;
400 }
401
402 if (MI->getOpcode() == AMDGPU::SCHED_BARRIER) {
403 if (isVerbose()) {
404 std::string HexString;
405 raw_string_ostream HexStream(HexString);
406 HexStream << format_hex(MI->getOperand(0).getImm(), 10, true);
407 OutStreamer->emitRawComment(" sched_barrier mask(" + HexString + ")");
408 }
409 return;
410 }
411
412 if (MI->getOpcode() == AMDGPU::SCHED_GROUP_BARRIER) {
413 if (isVerbose()) {
414 std::string HexString;
415 raw_string_ostream HexStream(HexString);
416 HexStream << format_hex(MI->getOperand(0).getImm(), 10, true);
417 OutStreamer->emitRawComment(
418 " sched_group_barrier mask(" + HexString + ") size(" +
419 Twine(MI->getOperand(1).getImm()) + ") SyncID(" +
420 Twine(MI->getOperand(2).getImm()) + ")");
421 }
422 return;
423 }
424
425 if (MI->getOpcode() == AMDGPU::IGLP_OPT) {
426 if (isVerbose()) {
427 std::string HexString;
428 raw_string_ostream HexStream(HexString);
429 HexStream << format_hex(MI->getOperand(0).getImm(), 10, true);
430 OutStreamer->emitRawComment(" iglp_opt mask(" + HexString + ")");
431 }
432 return;
433 }
434
435 if (MI->getOpcode() == AMDGPU::SI_MASKED_UNREACHABLE) {
436 if (isVerbose())
437 OutStreamer->emitRawComment(" divergent unreachable");
438 return;
439 }
440
441 if (MI->isMetaInstruction()) {
442 if (isVerbose())
443 OutStreamer->emitRawComment(" meta instruction");
444 return;
445 }
446
447 unsigned Opc = MI->getOpcode();
448 if (LLVM_UNLIKELY(Opc == TargetOpcode::STATEPOINT ||
449 Opc == TargetOpcode::STACKMAP ||
450 Opc == TargetOpcode::PATCHPOINT)) {
451 LLVMContext &Ctx = MI->getMF()->getFunction().getContext();
452 Ctx.emitError("unhandled statepoint-like instruction");
453 OutStreamer->emitRawComment("unsupported statepoint/stackmap/patchpoint");
454 return;
455 }
456
457 if (isVerbose())
458 if (STI.getInstrInfo()->isBlockLoadStore(MI->getOpcode()))
460 MF->getInfo<SIMachineFunctionInfo>(),
461 *OutStreamer);
462
463 if (isVerbose() && (MI->getOpcode() == AMDGPU::S_SET_VGPR_MSB ||
464 (MI->getOpcode() == AMDGPU::S_SETREG_IMM32_B32 &&
465 STI.hasVGPRMSBs()))) {
466 std::optional<unsigned> V;
467 if (MI->getOpcode() == AMDGPU::S_SETREG_IMM32_B32)
469 STI.hasSetregVGPRMSBFixup());
470 else
471 V = MI->getOperand(0).getImm() & 0xff;
472 if (V.has_value())
473 OutStreamer->AddComment(
474 " msbs: dst=" + Twine(*V >> 6) + " src0=" + Twine(*V & 3) +
475 " src1=" + Twine((*V >> 2) & 3) + " src2=" + Twine((*V >> 4) & 3));
476 }
477
478 MCInst TmpInst;
479 MCInstLowering.lower(MI, TmpInst);
480 EmitToStreamer(*OutStreamer, TmpInst);
481
482 if (DumpCodeInstEmitter) {
483 // Disassemble instruction/operands to text
484 DisasmLines.resize(DisasmLines.size() + 1);
485 std::string &DisasmLine = DisasmLines.back();
486 raw_string_ostream DisasmStream(DisasmLine);
487
488 AMDGPUInstPrinter InstPrinter(TM.getMCAsmInfo(), *STI.getInstrInfo(),
489 *STI.getRegisterInfo());
490 InstPrinter.printInst(&TmpInst, 0, StringRef(), STI, DisasmStream);
491
492 // Disassemble instruction/operands to hex representation.
494 SmallVector<char, 16> CodeBytes;
495
496 DumpCodeInstEmitter->encodeInstruction(
497 TmpInst, CodeBytes, Fixups, MF->getSubtarget<MCSubtargetInfo>());
498 HexLines.resize(HexLines.size() + 1);
499 std::string &HexLine = HexLines.back();
500 raw_string_ostream HexStream(HexLine);
501
502 for (size_t i = 0; i < CodeBytes.size(); i += 4) {
503 unsigned int CodeDWord =
504 support::endian::read32le(CodeBytes.data() + i);
505 HexStream << format("%s%08X", (i > 0 ? " " : ""), CodeDWord);
506 }
507
508 DisasmLineMaxLen = std::max(DisasmLineMaxLen, DisasmLine.size());
509 }
510 }
511}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
AMDGPU address space definition.
AMDGPU Assembly printer class.
Shared AMDGPU asyncmark stage definitions.
static void emitVGPRBlockComment(const MachineInstr *MI, const SIInstrInfo *TII, const TargetRegisterInfo *TRI, const SIMachineFunctionInfo *MFI, MCStreamer &OS)
Header of lower AMDGPU MachineInstrs to their corresponding MCInst.
Provides AMDGPU specific target descriptions.
MachineBasicBlock & MBB
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
#define LLVM_UNLIKELY(EXPR)
Definition Compiler.h:348
This file contains the declarations for the subclasses of Constant, which represent the different fla...
const HexagonInstrInfo * TII
IRTranslator LLVM IR MI
#define I(x, y, z)
Definition MD5.cpp:57
Register const TargetRegisterInfo * TRI
static SDValue lowerAddrSpaceCast(SDValue Op, SelectionDAG &DAG)
std::vector< std::string > DisasmLines
std::vector< std::string > HexLines
bool lowerOperand(const MachineOperand &MO, MCOperand &MCOp) const
Wrapper for MCInstLowering.lowerOperand() for the tblgen'erated pseudo lowering.
bool lowerPseudoInstExpansion(const MachineInstr *MI, MCInst &Inst)
tblgen'erated driver function for lowering simple MI->MC pseudo instructions.
const MCExpr * lowerConstant(const Constant *CV, const Constant *BaseCV, uint64_t Offset) override
Lower the specified LLVM Constant to an MCExpr.
void emitInstruction(const MachineInstr *MI) override
Implemented in AMDGPUMCInstLower.cpp.
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 lowerT16FmaMixFP16(const MachineInstr *MI, MCInst &OutMI) const
bool lowerOperand(const MachineOperand &MO, MCOperand &MCOp) const
void lowerT16D16Helper(const MachineInstr *MI, MCInst &OutMI) const
AMDGPUMCInstLower(MCContext &ctx, const TargetSubtargetInfo &ST, const AsmPrinter &AP)
void lower(const MachineInstr *MI, MCInst &OutMI) const
Lower a MachineInstr to an MCInst.
static std::optional< uint32_t > get32BitAbsoluteAddress(const GlobalValue &GV, unsigned AS)
This class is intended to be used as a driving class for all asm writers.
Definition AsmPrinter.h:95
void EmitToStreamer(MCStreamer &S, const MCInst &Inst)
TargetMachine & TM
Target machine description.
Definition AsmPrinter.h:98
MachineFunction * MF
The current machine function.
Definition AsmPrinter.h:113
virtual const MCExpr * lowerConstant(const Constant *CV, const Constant *BaseCV=nullptr, uint64_t Offset=0)
Lower the specified LLVM Constant to an MCExpr.
MCContext & OutContext
This is the context for the output file that we are streaming.
Definition AsmPrinter.h:105
std::unique_ptr< MCStreamer > OutStreamer
This is the MCStreamer object for the file we are generating.
Definition AsmPrinter.h:110
bool isVerbose() const
Return true if assembly output should contain comments.
Definition AsmPrinter.h:335
This is an important base class in LLVM.
Definition Constant.h:44
const SIInstrInfo * getInstrInfo() const override
const SIRegisterInfo * getRegisterInfo() const override
This is an important class for using LLVM in a threaded context.
Definition LLVMContext.h:76
static const MCBinaryExpr * createAdd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx, SMLoc Loc=SMLoc())
Definition MCExpr.h:342
static LLVM_ABI const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false, unsigned SizeInBytes=0)
Definition MCExpr.cpp:212
Context object for machine code objects.
Definition MCContext.h:83
Base class for the full range of assembler expressions which are needed for parsing.
Definition MCExpr.h:34
Instances of this class represent a single low-level machine instruction.
Definition MCInst.h:188
unsigned getNumOperands() const
Definition MCInst.h:212
void addOperand(const MCOperand Op)
Definition MCInst.h:215
void setOpcode(unsigned Op)
Definition MCInst.h:201
Instances of this class represent operands of the MCInst class.
Definition MCInst.h:40
static MCOperand createExpr(const MCExpr *Val)
Definition MCInst.h:166
static MCOperand createReg(MCRegister Reg)
Definition MCInst.h:138
static MCOperand createImm(int64_t Val)
Definition MCInst.h:145
Streaming machine code generation interface.
Definition MCStreamer.h:222
virtual void emitRawComment(const Twine &T, bool TabPrefix=true)
Print T and prefix it with the comment string (normally #) and optionally a tab.
Generic base class for all target subtargets.
Represent a reference to a symbol from inside an expression.
Definition MCExpr.h:190
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx, SMLoc Loc=SMLoc())
Definition MCExpr.h:213
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition MCSymbol.h:42
const MCExpr * getVariableValue() const
Get the expression of the variable symbol.
Definition MCSymbol.h:270
LLVM_ABI MCSymbol * getSymbol() const
Return the MCSymbol for this basic block.
Instructions::const_iterator const_instr_iterator
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
const GlobalValue * getGlobal() const
int64_t getImm() const
MachineBasicBlock * getMBB() const
const BlockAddress * getBlockAddress() const
unsigned getTargetFlags() const
MachineOperandType getType() const
getType - Returns the MachineOperandType for this operand.
const char * getSymbolName() const
Register getReg() const
getReg - Returns the register number.
MCSymbol * getMCSymbol() const
@ MO_Immediate
Immediate operand.
@ MO_MCSymbol
MCSymbol reference (for debug/eh info)
@ MO_GlobalAddress
Address of a global value.
@ MO_RegisterMask
Mask of preserved registers.
@ MO_BlockAddress
Address of a basic block.
@ MO_MachineBasicBlock
MachineBasicBlock reference.
@ MO_Register
Register operand.
@ MO_ExternalSymbol
Name of external global symbol.
int64_t getOffset() const
Return the offset from the symbol in this operand.
Wrapper class representing virtual and physical registers.
Definition Register.h:20
bool verifyInstruction(const MachineInstr &MI, StringRef &ErrInfo) const override
static bool isBlockLoadStore(uint32_t Opcode)
This class keeps track of the SPI_SP_INPUT_ADDR config register, which tells the hardware which inter...
uint32_t getMaskForVGPRBlockOps(Register RegisterBlock) const
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition SmallString.h:26
pointer data()
Return a pointer to the vector's buffer, even if empty().
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
TargetSubtargetInfo - Generic base class for all target subtargets.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition Twine.h:82
static LLVM_ABI IntegerType * getInt32Ty(LLVMContext &C)
Definition Type.cpp:299
LLVMContext & getContext() const
All values hold a context through their type.
Definition Value.h:260
A raw_ostream that writes to an std::string.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ LOCAL_ADDRESS
Address space for local memory.
MCRegister getMCReg(MCRegister Reg, const MCSubtargetInfo &STI)
If Reg is a pseudo reg, return the correct hardware register given STI otherwise return Reg.
constexpr AsyncStages asyncStagesFromMaskOperand(int64_t Mask)
bool isHi16Reg(MCRegister Reg, const MCRegisterInfo &MRI)
static std::optional< unsigned > convertSetRegImmToVgprMSBs(uint64_t Imm, uint64_t Simm16, bool HasSetregVGPRMSBFixup)
LLVM_READONLY bool hasNamedOperand(uint32_t Opcode, OpName NamedIdx)
uint32_t read32le(const void *P)
Definition Endian.h:412
This is an optimization pass for GlobalISel generic memory operations.
@ Offset
Definition DWP.cpp:577
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:643
FormattedNumber format_hex(uint64_t N, unsigned Width, bool Upper=false)
format_hex - Output N as a fixed width hexadecimal.
Definition Format.h:164
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
Definition Format.h:102
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
static uint16_t getSpecifier(const MCSymbolRefExpr *SRE)