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"
32#include "llvm/Support/Endian.h"
34#include "llvm/Support/Format.h"
35#include <algorithm>
36
37using namespace llvm;
38
39#include "AMDGPUGenMCPseudoLowering.inc"
40
42 const TargetSubtargetInfo &st,
43 const AsmPrinter &ap):
44 Ctx(ctx), ST(st), AP(ap) { }
45
71
73 MCOperand &MCOp) const {
74 switch (MO.getType()) {
75 default:
76 break;
78 MCOp = MCOperand::createImm(MO.getImm());
79 return true;
82 return true;
86 return true;
88 const GlobalValue *GV = MO.getGlobal();
89 SmallString<128> SymbolName;
90 AP.getNameWithPrefix(SymbolName, GV);
91 MCSymbol *Sym = Ctx.getOrCreateSymbol(SymbolName);
92 const MCExpr *Expr =
94 int64_t Offset = MO.getOffset();
95 if (Offset != 0) {
96 Expr = MCBinaryExpr::createAdd(Expr,
98 }
99 MCOp = MCOperand::createExpr(Expr);
100 return true;
101 }
103 MCSymbol *Sym = Ctx.getOrCreateSymbol(StringRef(MO.getSymbolName()));
104 const MCExpr *Expr =
106 MCOp = MCOperand::createExpr(Expr);
107 return true;
108 }
110 MCSymbol *Sym = AP.GetBlockAddressSymbol(MO.getBlockAddress());
111 const MCSymbolRefExpr *Expr =
113 assert(MO.getOffset() == 0);
114 MCOp = MCOperand::createExpr(Expr);
115 return true;
116 }
118 // Regmasks are like implicit defs.
119 return false;
122 MCSymbol *Sym = MO.getMCSymbol();
124 return true;
125 }
126 break;
127 }
128 llvm_unreachable("unknown operand type");
129}
130
131// Lower true16 D16 Pseudo instruction to d16_lo/d16_hi MCInst based on
132// Dst/Data's .l/.h selection
134 MCInst &OutMI) const {
135 unsigned Opcode = MI->getOpcode();
136 const auto *TII = static_cast<const SIInstrInfo*>(ST.getInstrInfo());
137 const SIRegisterInfo &TRI = TII->getRegisterInfo();
138 const auto *Info = AMDGPU::getT16D16Helper(Opcode);
139
140 llvm::AMDGPU::OpName OpName;
141 if (TII->isDS(Opcode)) {
142 if (MI->mayLoad())
143 OpName = llvm::AMDGPU::OpName::vdst;
144 else if (MI->mayStore())
145 OpName = llvm::AMDGPU::OpName::data0;
146 else
147 llvm_unreachable("LDS load or store expected");
148 } else {
149 OpName = AMDGPU::hasNamedOperand(Opcode, llvm::AMDGPU::OpName::vdata)
150 ? llvm::AMDGPU::OpName::vdata
151 : llvm::AMDGPU::OpName::vdst;
152 }
153
154 // select Dst/Data
155 int VDstOrVDataIdx = AMDGPU::getNamedOperandIdx(Opcode, OpName);
156 const MachineOperand &MIVDstOrVData = MI->getOperand(VDstOrVDataIdx);
157
158 // select hi/lo MCInst
159 bool IsHi = AMDGPU::isHi16Reg(MIVDstOrVData.getReg(), TRI);
160 Opcode = IsHi ? Info->HiOp : Info->LoOp;
161
162 int MCOpcode = TII->pseudoToMCOpcode(Opcode);
163 assert(MCOpcode != -1 &&
164 "Pseudo instruction doesn't have a target-specific version");
165 OutMI.setOpcode(MCOpcode);
166
167 // lower operands
168 for (int I = 0, E = MI->getNumExplicitOperands(); I < E; I++) {
169 const MachineOperand &MO = MI->getOperand(I);
170 MCOperand MCOp;
171 if (I == VDstOrVDataIdx)
172 MCOp = MCOperand::createReg(TRI.get32BitRegister(MIVDstOrVData.getReg()));
173 else
174 lowerOperand(MO, MCOp);
175 OutMI.addOperand(MCOp);
176 }
177
178 if (AMDGPU::hasNamedOperand(MCOpcode, AMDGPU::OpName::vdst_in)) {
179 MCOperand MCOp;
180 lowerOperand(MIVDstOrVData, MCOp);
181 OutMI.addOperand(MCOp);
182 }
183}
184
186 MCInst &OutMI) const {
187 unsigned Opcode = MI->getOpcode();
188 const auto *TII = static_cast<const SIInstrInfo *>(ST.getInstrInfo());
189 const SIRegisterInfo &TRI = TII->getRegisterInfo();
190
191 int VDstIdx = AMDGPU::getNamedOperandIdx(Opcode, llvm::AMDGPU::OpName::vdst);
192 const MachineOperand &VDst = MI->getOperand(VDstIdx);
193 bool IsHi = AMDGPU::isHi16Reg(VDst.getReg(), TRI);
194 switch (Opcode) {
195 case AMDGPU::V_FMA_MIX_F16_t16:
196 Opcode = IsHi ? AMDGPU::V_FMA_MIXHI_F16 : AMDGPU::V_FMA_MIXLO_F16;
197 break;
198 case AMDGPU::V_FMA_MIX_BF16_t16:
199 Opcode = IsHi ? AMDGPU::V_FMA_MIXHI_BF16 : AMDGPU::V_FMA_MIXLO_BF16;
200 break;
201 }
202 int MCOpcode = TII->pseudoToMCOpcode(Opcode);
203 assert(MCOpcode != -1 &&
204 "Pseudo instruction doesn't have a target-specific version");
205 OutMI.setOpcode(MCOpcode);
206
207 // lower operands
208 for (int I = 0, E = MI->getNumExplicitOperands(); I < E; I++) {
209 const MachineOperand &MO = MI->getOperand(I);
210 MCOperand MCOp;
211 if (I == VDstIdx)
212 MCOp = MCOperand::createReg(TRI.get32BitRegister(VDst.getReg()));
213 else
214 lowerOperand(MO, MCOp);
215 OutMI.addOperand(MCOp);
216 }
217}
218
219void AMDGPUMCInstLower::lower(const MachineInstr *MI, MCInst &OutMI) const {
220 unsigned Opcode = MI->getOpcode();
221 const auto *TII = static_cast<const SIInstrInfo *>(ST.getInstrInfo());
222
223 // FIXME: Should be able to handle this with lowerPseudoInstExpansion. We
224 // need to select it to the subtarget specific version, and there's no way to
225 // do that with a single pseudo source operation.
226 if (Opcode == AMDGPU::S_SETPC_B64_return)
227 Opcode = AMDGPU::S_SETPC_B64;
228 else if (Opcode == AMDGPU::SI_CALL) {
229 // SI_CALL is just S_SWAPPC_B64 with an additional operand to track the
230 // called function (which we need to remove here).
231 OutMI.setOpcode(TII->pseudoToMCOpcode(AMDGPU::S_SWAPPC_B64));
232 MCOperand Dest, Src;
233 lowerOperand(MI->getOperand(0), Dest);
234 lowerOperand(MI->getOperand(1), Src);
235 OutMI.addOperand(Dest);
236 OutMI.addOperand(Src);
237 return;
238 } else if (Opcode == AMDGPU::SI_TCRETURN ||
239 Opcode == AMDGPU::SI_TCRETURN_GFX ||
240 Opcode == AMDGPU::SI_TCRETURN_CHAIN) {
241 // TODO: How to use branch immediate and avoid register+add?
242 Opcode = AMDGPU::S_SETPC_B64;
243 } else if (AMDGPU::getT16D16Helper(Opcode)) {
244 lowerT16D16Helper(MI, OutMI);
245 return;
246 } else if (Opcode == AMDGPU::V_FMA_MIX_F16_t16 ||
247 Opcode == AMDGPU::V_FMA_MIX_BF16_t16) {
248 lowerT16FmaMixFP16(MI, OutMI);
249 return;
250 }
251
252 int MCOpcode = TII->pseudoToMCOpcode(Opcode);
253 if (MCOpcode == -1) {
254 LLVMContext &C = MI->getMF()->getFunction().getContext();
255 C.emitError("AMDGPUMCInstLower::lower - Pseudo instruction doesn't have "
256 "a target-specific version: " + Twine(MI->getOpcode()));
257 return;
258 }
259
260 OutMI.setOpcode(MCOpcode);
261
262 for (const MachineOperand &MO : MI->explicit_operands()) {
263 MCOperand MCOp;
264 lowerOperand(MO, MCOp);
265 OutMI.addOperand(MCOp);
266 }
267
268 int FIIdx = AMDGPU::getNamedOperandIdx(MCOpcode, AMDGPU::OpName::fi);
269 if (FIIdx >= (int)OutMI.getNumOperands())
271}
272
274 MCOperand &MCOp) const {
275 const GCNSubtarget &STI = MF->getSubtarget<GCNSubtarget>();
276 AMDGPUMCInstLower MCInstLowering(OutContext, STI, *this);
277 return MCInstLowering.lowerOperand(MO, MCOp);
278}
279
281 const Constant *BaseCV,
282 uint64_t Offset) {
283
284 // Intercept LDS variables with known addresses
286 if (std::optional<uint32_t> Address =
288 auto *IntTy = Type::getInt32Ty(CV->getContext());
289 return AsmPrinter::lowerConstant(ConstantInt::get(IntTy, *Address),
290 BaseCV, Offset);
291 }
292 }
293
294 if (const MCExpr *E = lowerAddrSpaceCast(CV, OutContext))
295 return E;
296 return AsmPrinter::lowerConstant(CV, BaseCV, Offset);
297}
298
300 const TargetRegisterInfo *TRI,
301 const SIMachineFunctionInfo *MFI,
302 MCStreamer &OS) {
303 // The instruction will only transfer a subset of the registers in the block,
304 // based on the mask that is stored in m0. We could search for the instruction
305 // that sets m0, but most of the time we'll already have the mask stored in
306 // the machine function info. Try to use that. This assumes that we only use
307 // block loads/stores for CSR spills.
308 Register RegBlock =
309 TII->getNamedOperand(*MI, MI->mayLoad() ? AMDGPU::OpName::vdst
310 : AMDGPU::OpName::vdata)
311 ->getReg();
312 Register FirstRegInBlock = TRI->getSubReg(RegBlock, AMDGPU::sub0);
313 uint32_t Mask = MFI->getMaskForVGPRBlockOps(RegBlock);
314
315 if (!Mask)
316 return; // Nothing to report
317
318 SmallString<512> TransferredRegs;
319 for (unsigned I = 0; I < sizeof(Mask) * 8; ++I) {
320 if (Mask & (1 << I)) {
321 (llvm::Twine(" ") + TRI->getRegAsmName(FirstRegInBlock + I))
322 .toVector(TransferredRegs);
323 }
324 }
325
326 OS.emitRawComment(" transferring at most " + TransferredRegs);
327}
328
330 if (MI->isCall())
331 collectCallEdge(*MI);
332
333 // FIXME: Enable feature predicate checks once all the test pass.
334 // AMDGPU_MC::verifyInstructionPredicates(MI->getOpcode(),
335 // getSubtargetInfo().getFeatureBits());
336
337 if (MCInst OutInst; lowerPseudoInstExpansion(MI, OutInst)) {
338 EmitToStreamer(*OutStreamer, OutInst);
339 return;
340 }
341
342 const GCNSubtarget &STI = MF->getSubtarget<GCNSubtarget>();
343 AMDGPUMCInstLower MCInstLowering(OutContext, STI, *this);
344
345 StringRef Err;
346 if (!STI.getInstrInfo()->verifyInstruction(*MI, Err)) {
347 LLVMContext &C = MI->getMF()->getFunction().getContext();
348 C.emitError("Illegal instruction detected: " + Err);
349 MI->print(errs());
350 }
351
352 if (MI->isBundle()) {
353 const MachineBasicBlock *MBB = MI->getParent();
355 while (I != MBB->instr_end() && I->isInsideBundle()) {
357 ++I;
358 }
359 } else {
360 // We don't want these pseudo instructions encoded. They are
361 // placeholder instructions and should only be printed as
362 // comments.
363 if (MI->getOpcode() == AMDGPU::SI_RETURN_TO_EPILOG) {
364 if (isVerbose())
365 OutStreamer->emitRawComment(" return to shader part epilog");
366 return;
367 }
368
369 if (MI->getOpcode() == AMDGPU::WAVE_BARRIER) {
370 if (isVerbose())
371 OutStreamer->emitRawComment(" wave barrier");
372 return;
373 }
374
375 if (MI->getOpcode() == AMDGPU::ASYNCMARK) {
376 if (isVerbose())
377 OutStreamer->emitRawComment(" asyncmark");
378 return;
379 }
380
381 if (MI->getOpcode() == AMDGPU::WAIT_ASYNCMARK) {
382 if (isVerbose()) {
383 OutStreamer->emitRawComment(" wait_asyncmark(" +
384 Twine(MI->getOperand(0).getImm()) + ")");
385 }
386 return;
387 }
388
389 if (MI->getOpcode() == AMDGPU::SCHED_BARRIER) {
390 if (isVerbose()) {
391 std::string HexString;
392 raw_string_ostream HexStream(HexString);
393 HexStream << format_hex(MI->getOperand(0).getImm(), 10, true);
394 OutStreamer->emitRawComment(" sched_barrier mask(" + HexString + ")");
395 }
396 return;
397 }
398
399 if (MI->getOpcode() == AMDGPU::SCHED_GROUP_BARRIER) {
400 if (isVerbose()) {
401 std::string HexString;
402 raw_string_ostream HexStream(HexString);
403 HexStream << format_hex(MI->getOperand(0).getImm(), 10, true);
404 OutStreamer->emitRawComment(
405 " sched_group_barrier mask(" + HexString + ") size(" +
406 Twine(MI->getOperand(1).getImm()) + ") SyncID(" +
407 Twine(MI->getOperand(2).getImm()) + ")");
408 }
409 return;
410 }
411
412 if (MI->getOpcode() == AMDGPU::IGLP_OPT) {
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(" iglp_opt mask(" + HexString + ")");
418 }
419 return;
420 }
421
422 if (MI->getOpcode() == AMDGPU::SI_MASKED_UNREACHABLE) {
423 if (isVerbose())
424 OutStreamer->emitRawComment(" divergent unreachable");
425 return;
426 }
427
428 if (MI->isMetaInstruction()) {
429 if (isVerbose())
430 OutStreamer->emitRawComment(" meta instruction");
431 return;
432 }
433
434 unsigned Opc = MI->getOpcode();
435 if (LLVM_UNLIKELY(Opc == TargetOpcode::STATEPOINT ||
436 Opc == TargetOpcode::STACKMAP ||
437 Opc == TargetOpcode::PATCHPOINT)) {
438 LLVMContext &Ctx = MI->getMF()->getFunction().getContext();
439 Ctx.emitError("unhandled statepoint-like instruction");
440 OutStreamer->emitRawComment("unsupported statepoint/stackmap/patchpoint");
441 return;
442 }
443
444 if (isVerbose())
445 if (STI.getInstrInfo()->isBlockLoadStore(MI->getOpcode()))
447 MF->getInfo<SIMachineFunctionInfo>(),
448 *OutStreamer);
449
450 if (isVerbose() && (MI->getOpcode() == AMDGPU::S_SET_VGPR_MSB ||
451 (MI->getOpcode() == AMDGPU::S_SETREG_IMM32_B32 &&
452 STI.has1024AddressableVGPRs()))) {
453 std::optional<unsigned> V;
454 if (MI->getOpcode() == AMDGPU::S_SETREG_IMM32_B32)
456 STI.hasSetregVGPRMSBFixup());
457 else
458 V = MI->getOperand(0).getImm() & 0xff;
459 if (V.has_value())
460 OutStreamer->AddComment(
461 " msbs: dst=" + Twine(*V >> 6) + " src0=" + Twine(*V & 3) +
462 " src1=" + Twine((*V >> 2) & 3) + " src2=" + Twine((*V >> 4) & 3));
463 }
464
465 MCInst TmpInst;
466 MCInstLowering.lower(MI, TmpInst);
467 EmitToStreamer(*OutStreamer, TmpInst);
468
469 if (DumpCodeInstEmitter) {
470 // Disassemble instruction/operands to text
471 DisasmLines.resize(DisasmLines.size() + 1);
472 std::string &DisasmLine = DisasmLines.back();
473 raw_string_ostream DisasmStream(DisasmLine);
474
475 AMDGPUInstPrinter InstPrinter(TM.getMCAsmInfo(), *STI.getInstrInfo(),
476 *STI.getRegisterInfo());
477 InstPrinter.printInst(&TmpInst, 0, StringRef(), STI, DisasmStream);
478
479 // Disassemble instruction/operands to hex representation.
481 SmallVector<char, 16> CodeBytes;
482
483 DumpCodeInstEmitter->encodeInstruction(
484 TmpInst, CodeBytes, Fixups, MF->getSubtarget<MCSubtargetInfo>());
485 HexLines.resize(HexLines.size() + 1);
486 std::string &HexLine = HexLines.back();
487 raw_string_ostream HexStream(HexLine);
488
489 for (size_t i = 0; i < CodeBytes.size(); i += 4) {
490 unsigned int CodeDWord =
491 support::endian::read32le(CodeBytes.data() + i);
492 HexStream << format("%s%08X", (i > 0 ? " " : ""), CodeDWord);
493 }
494
495 DisasmLineMaxLen = std::max(DisasmLineMaxLen, DisasmLine.size());
496 }
497 }
498}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
AMDGPU Assembly printer class.
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:344
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 > getLDSAbsoluteAddress(const GlobalValue &GV)
This class is intended to be used as a driving class for all asm writers.
Definition AsmPrinter.h:91
void EmitToStreamer(MCStreamer &S, const MCInst &Inst)
TargetMachine & TM
Target machine description.
Definition AsmPrinter.h:94
MachineFunction * MF
The current machine function.
Definition AsmPrinter.h:109
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:101
std::unique_ptr< MCStreamer > OutStreamer
This is the MCStreamer object for the file we are generating.
Definition AsmPrinter.h:106
bool isVerbose() const
Return true if assembly output should contain comments.
Definition AsmPrinter.h:310
This is an important base class in LLVM.
Definition Constant.h:43
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:68
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:309
LLVMContext & getContext() const
All values hold a context through their type.
Definition Value.h:258
A raw_ostream that writes to an std::string.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
MCRegister getMCReg(MCRegister Reg, const MCSubtargetInfo &STI)
If Reg is a pseudo reg, return the correct hardware register given STI otherwise return Reg.
static std::optional< unsigned > convertSetRegImmToVgprMSBs(unsigned Imm, unsigned Simm16, bool HasSetregVGPRMSBFixup)
bool isHi16Reg(MCRegister Reg, const MCRegisterInfo &MRI)
LLVM_READONLY bool hasNamedOperand(uint64_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)