LLVM 23.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 "AMDGPU.h"
17#include "AMDGPUAsmPrinter.h"
25#include "llvm/IR/Constants.h"
26#include "llvm/IR/Function.h"
29#include "llvm/MC/MCContext.h"
30#include "llvm/MC/MCExpr.h"
31#include "llvm/MC/MCInst.h"
33#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 MCSymbolRefExpr *Expr = MCSymbolRefExpr::create(Sym, Ctx);
107 MCOp = MCOperand::createExpr(Expr);
108 return true;
109 }
111 MCSymbol *Sym = AP.GetBlockAddressSymbol(MO.getBlockAddress());
112 const MCSymbolRefExpr *Expr =
114 assert(MO.getOffset() == 0);
115 MCOp = MCOperand::createExpr(Expr);
116 return true;
117 }
119 // Regmasks are like implicit defs.
120 return false;
123 MCSymbol *Sym = MO.getMCSymbol();
125 return true;
126 }
127 break;
128 }
129 llvm_unreachable("unknown operand type");
130}
131
132// Lower true16 D16 Pseudo instruction to d16_lo/d16_hi MCInst based on
133// Dst/Data's .l/.h selection
135 MCInst &OutMI) const {
136 unsigned Opcode = MI->getOpcode();
137 const auto *TII = static_cast<const SIInstrInfo*>(ST.getInstrInfo());
138 const SIRegisterInfo &TRI = TII->getRegisterInfo();
139 const auto *Info = AMDGPU::getT16D16Helper(Opcode);
140
141 llvm::AMDGPU::OpName OpName;
142 if (TII->isDS(Opcode)) {
143 if (MI->mayLoad())
144 OpName = llvm::AMDGPU::OpName::vdst;
145 else if (MI->mayStore())
146 OpName = llvm::AMDGPU::OpName::data0;
147 else
148 llvm_unreachable("LDS load or store expected");
149 } else {
150 OpName = AMDGPU::hasNamedOperand(Opcode, llvm::AMDGPU::OpName::vdata)
151 ? llvm::AMDGPU::OpName::vdata
152 : llvm::AMDGPU::OpName::vdst;
153 }
154
155 // select Dst/Data
156 int VDstOrVDataIdx = AMDGPU::getNamedOperandIdx(Opcode, OpName);
157 const MachineOperand &MIVDstOrVData = MI->getOperand(VDstOrVDataIdx);
158
159 // select hi/lo MCInst
160 bool IsHi = AMDGPU::isHi16Reg(MIVDstOrVData.getReg(), TRI);
161 Opcode = IsHi ? Info->HiOp : Info->LoOp;
162
163 int MCOpcode = TII->pseudoToMCOpcode(Opcode);
164 assert(MCOpcode != -1 &&
165 "Pseudo instruction doesn't have a target-specific version");
166 OutMI.setOpcode(MCOpcode);
167
168 // lower operands
169 for (int I = 0, E = MI->getNumExplicitOperands(); I < E; I++) {
170 const MachineOperand &MO = MI->getOperand(I);
171 MCOperand MCOp;
172 if (I == VDstOrVDataIdx)
173 MCOp = MCOperand::createReg(TRI.get32BitRegister(MIVDstOrVData.getReg()));
174 else
175 lowerOperand(MO, MCOp);
176 OutMI.addOperand(MCOp);
177 }
178
179 if (AMDGPU::hasNamedOperand(MCOpcode, AMDGPU::OpName::vdst_in)) {
180 MCOperand MCOp;
181 lowerOperand(MIVDstOrVData, MCOp);
182 OutMI.addOperand(MCOp);
183 }
184}
185
187 MCInst &OutMI) const {
188 unsigned Opcode = MI->getOpcode();
189 const auto *TII = static_cast<const SIInstrInfo *>(ST.getInstrInfo());
190 const SIRegisterInfo &TRI = TII->getRegisterInfo();
191
192 int VDstIdx = AMDGPU::getNamedOperandIdx(Opcode, llvm::AMDGPU::OpName::vdst);
193 const MachineOperand &VDst = MI->getOperand(VDstIdx);
194 bool IsHi = AMDGPU::isHi16Reg(VDst.getReg(), TRI);
195 switch (Opcode) {
196 case AMDGPU::V_FMA_MIX_F16_t16:
197 Opcode = IsHi ? AMDGPU::V_FMA_MIXHI_F16 : AMDGPU::V_FMA_MIXLO_F16;
198 break;
199 case AMDGPU::V_FMA_MIX_BF16_t16:
200 Opcode = IsHi ? AMDGPU::V_FMA_MIXHI_BF16 : AMDGPU::V_FMA_MIXLO_BF16;
201 break;
202 }
203 int MCOpcode = TII->pseudoToMCOpcode(Opcode);
204 assert(MCOpcode != -1 &&
205 "Pseudo instruction doesn't have a target-specific version");
206 OutMI.setOpcode(MCOpcode);
207
208 // lower operands
209 for (int I = 0, E = MI->getNumExplicitOperands(); I < E; I++) {
210 const MachineOperand &MO = MI->getOperand(I);
211 MCOperand MCOp;
212 if (I == VDstIdx)
213 MCOp = MCOperand::createReg(TRI.get32BitRegister(VDst.getReg()));
214 else
215 lowerOperand(MO, MCOp);
216 OutMI.addOperand(MCOp);
217 }
218}
219
220void AMDGPUMCInstLower::lower(const MachineInstr *MI, MCInst &OutMI) const {
221 unsigned Opcode = MI->getOpcode();
222 const auto *TII = static_cast<const SIInstrInfo *>(ST.getInstrInfo());
223
224 // FIXME: Should be able to handle this with lowerPseudoInstExpansion. We
225 // need to select it to the subtarget specific version, and there's no way to
226 // do that with a single pseudo source operation.
227 if (Opcode == AMDGPU::S_SETPC_B64_return)
228 Opcode = AMDGPU::S_SETPC_B64;
229 else if (Opcode == AMDGPU::SI_CALL) {
230 // SI_CALL is just S_SWAPPC_B64 with an additional operand to track the
231 // called function (which we need to remove here).
232 OutMI.setOpcode(TII->pseudoToMCOpcode(AMDGPU::S_SWAPPC_B64));
233 MCOperand Dest, Src;
234 lowerOperand(MI->getOperand(0), Dest);
235 lowerOperand(MI->getOperand(1), Src);
236 OutMI.addOperand(Dest);
237 OutMI.addOperand(Src);
238 return;
239 } else if (Opcode == AMDGPU::SI_TCRETURN ||
240 Opcode == AMDGPU::SI_TCRETURN_GFX ||
241 Opcode == AMDGPU::SI_TCRETURN_CHAIN) {
242 // TODO: How to use branch immediate and avoid register+add?
243 Opcode = AMDGPU::S_SETPC_B64;
244 } else if (AMDGPU::getT16D16Helper(Opcode)) {
245 lowerT16D16Helper(MI, OutMI);
246 return;
247 } else if (Opcode == AMDGPU::V_FMA_MIX_F16_t16 ||
248 Opcode == AMDGPU::V_FMA_MIX_BF16_t16) {
249 lowerT16FmaMixFP16(MI, OutMI);
250 return;
251 }
252
253 int MCOpcode = TII->pseudoToMCOpcode(Opcode);
254 if (MCOpcode == -1) {
255 LLVMContext &C = MI->getMF()->getFunction().getContext();
256 C.emitError("AMDGPUMCInstLower::lower - Pseudo instruction doesn't have "
257 "a target-specific version: " + Twine(MI->getOpcode()));
258 return;
259 }
260
261 OutMI.setOpcode(MCOpcode);
262
263 for (const MachineOperand &MO : MI->explicit_operands()) {
264 MCOperand MCOp;
265 lowerOperand(MO, MCOp);
266 OutMI.addOperand(MCOp);
267 }
268
269 int FIIdx = AMDGPU::getNamedOperandIdx(MCOpcode, AMDGPU::OpName::fi);
270 if (FIIdx >= (int)OutMI.getNumOperands())
272}
273
275 MCOperand &MCOp) const {
276 const GCNSubtarget &STI = MF->getSubtarget<GCNSubtarget>();
277 AMDGPUMCInstLower MCInstLowering(OutContext, STI, *this);
278 return MCInstLowering.lowerOperand(MO, MCOp);
279}
280
282 const Constant *BaseCV,
284
285 // Intercept LDS variables with known addresses
287 if (std::optional<uint32_t> Address =
289 auto *IntTy = Type::getInt32Ty(CV->getContext());
290 return AsmPrinter::lowerConstant(ConstantInt::get(IntTy, *Address),
291 BaseCV, Offset);
292 }
293 }
294
295 if (const MCExpr *E = lowerAddrSpaceCast(CV, OutContext))
296 return E;
297 return AsmPrinter::lowerConstant(CV, BaseCV, Offset);
298}
299
301 const TargetRegisterInfo *TRI,
302 const SIMachineFunctionInfo *MFI,
303 MCStreamer &OS) {
304 // The instruction will only transfer a subset of the registers in the block,
305 // based on the mask that is stored in m0. We could search for the instruction
306 // that sets m0, but most of the time we'll already have the mask stored in
307 // the machine function info. Try to use that. This assumes that we only use
308 // block loads/stores for CSR spills.
309 Register RegBlock =
310 TII->getNamedOperand(*MI, MI->mayLoad() ? AMDGPU::OpName::vdst
311 : AMDGPU::OpName::vdata)
312 ->getReg();
313 Register FirstRegInBlock = TRI->getSubReg(RegBlock, AMDGPU::sub0);
314 uint32_t Mask = MFI->getMaskForVGPRBlockOps(RegBlock);
315
316 if (!Mask)
317 return; // Nothing to report
318
319 SmallString<512> TransferredRegs;
320 for (unsigned I = 0; I < sizeof(Mask) * 8; ++I) {
321 if (Mask & (1 << I)) {
322 (llvm::Twine(" ") + TRI->getRegAsmName(FirstRegInBlock + I))
323 .toVector(TransferredRegs);
324 }
325 }
326
327 OS.emitRawComment(" transferring at most " + TransferredRegs);
328}
329
331 if (MI->isCall())
332 collectCallEdge(*MI);
333
334 // FIXME: Enable feature predicate checks once all the test pass.
335 // AMDGPU_MC::verifyInstructionPredicates(MI->getOpcode(),
336 // getSubtargetInfo().getFeatureBits());
337
338 if (MCInst OutInst; lowerPseudoInstExpansion(MI, OutInst)) {
339 EmitToStreamer(*OutStreamer, OutInst);
340 return;
341 }
342
343 const GCNSubtarget &STI = MF->getSubtarget<GCNSubtarget>();
344 AMDGPUMCInstLower MCInstLowering(OutContext, STI, *this);
345
346 StringRef Err;
347 if (!STI.getInstrInfo()->verifyInstruction(*MI, Err)) {
348 LLVMContext &C = MI->getMF()->getFunction().getContext();
349 C.emitError("Illegal instruction detected: " + Err);
350 MI->print(errs());
351 }
352
353 if (MI->isBundle()) {
354 const MachineBasicBlock *MBB = MI->getParent();
356 while (I != MBB->instr_end() && I->isInsideBundle()) {
358 ++I;
359 }
360 } else {
361 // We don't want these pseudo instructions encoded. They are
362 // placeholder instructions and should only be printed as
363 // comments.
364 if (MI->getOpcode() == AMDGPU::SI_RETURN_TO_EPILOG) {
365 if (isVerbose())
366 OutStreamer->emitRawComment(" return to shader part epilog");
367 return;
368 }
369
370 if (MI->getOpcode() == AMDGPU::WAVE_BARRIER) {
371 if (isVerbose())
372 OutStreamer->emitRawComment(" wave barrier");
373 return;
374 }
375
376 if (MI->getOpcode() == AMDGPU::ASYNCMARK) {
377 if (isVerbose())
378 OutStreamer->emitRawComment(" asyncmark");
379 return;
380 }
381
382 if (MI->getOpcode() == AMDGPU::WAIT_ASYNCMARK) {
383 if (isVerbose()) {
384 OutStreamer->emitRawComment(" wait_asyncmark(" +
385 Twine(MI->getOperand(0).getImm()) + ")");
386 }
387 return;
388 }
389
390 if (MI->getOpcode() == AMDGPU::SCHED_BARRIER) {
391 if (isVerbose()) {
392 std::string HexString;
393 raw_string_ostream HexStream(HexString);
394 HexStream << format_hex(MI->getOperand(0).getImm(), 10, true);
395 OutStreamer->emitRawComment(" sched_barrier mask(" + HexString + ")");
396 }
397 return;
398 }
399
400 if (MI->getOpcode() == AMDGPU::SCHED_GROUP_BARRIER) {
401 if (isVerbose()) {
402 std::string HexString;
403 raw_string_ostream HexStream(HexString);
404 HexStream << format_hex(MI->getOperand(0).getImm(), 10, true);
405 OutStreamer->emitRawComment(
406 " sched_group_barrier mask(" + HexString + ") size(" +
407 Twine(MI->getOperand(1).getImm()) + ") SyncID(" +
408 Twine(MI->getOperand(2).getImm()) + ")");
409 }
410 return;
411 }
412
413 if (MI->getOpcode() == AMDGPU::IGLP_OPT) {
414 if (isVerbose()) {
415 std::string HexString;
416 raw_string_ostream HexStream(HexString);
417 HexStream << format_hex(MI->getOperand(0).getImm(), 10, true);
418 OutStreamer->emitRawComment(" iglp_opt mask(" + HexString + ")");
419 }
420 return;
421 }
422
423 if (MI->getOpcode() == AMDGPU::SI_MASKED_UNREACHABLE) {
424 if (isVerbose())
425 OutStreamer->emitRawComment(" divergent unreachable");
426 return;
427 }
428
429 if (MI->isMetaInstruction()) {
430 if (isVerbose())
431 OutStreamer->emitRawComment(" meta instruction");
432 return;
433 }
434
435 unsigned Opc = MI->getOpcode();
436 if (LLVM_UNLIKELY(Opc == TargetOpcode::STATEPOINT ||
437 Opc == TargetOpcode::STACKMAP ||
438 Opc == TargetOpcode::PATCHPOINT)) {
439 LLVMContext &Ctx = MI->getMF()->getFunction().getContext();
440 Ctx.emitError("unhandled statepoint-like instruction");
441 OutStreamer->emitRawComment("unsupported statepoint/stackmap/patchpoint");
442 return;
443 }
444
445 if (isVerbose())
446 if (STI.getInstrInfo()->isBlockLoadStore(MI->getOpcode()))
448 MF->getInfo<SIMachineFunctionInfo>(),
449 *OutStreamer);
450
451 if (isVerbose() && (MI->getOpcode() == AMDGPU::S_SET_VGPR_MSB ||
452 (MI->getOpcode() == AMDGPU::S_SETREG_IMM32_B32 &&
453 STI.has1024AddressableVGPRs()))) {
454 std::optional<unsigned> V;
455 if (MI->getOpcode() == AMDGPU::S_SETREG_IMM32_B32)
457 STI.hasSetregVGPRMSBFixup());
458 else
459 V = MI->getOperand(0).getImm() & 0xff;
460 if (V.has_value())
461 OutStreamer->AddComment(
462 " msbs: dst=" + Twine(*V >> 6) + " src0=" + Twine(*V & 3) +
463 " src1=" + Twine((*V >> 2) & 3) + " src2=" + Twine((*V >> 4) & 3));
464 }
465
466 MCInst TmpInst;
467 MCInstLowering.lower(MI, TmpInst);
468 EmitToStreamer(*OutStreamer, TmpInst);
469
470 if (DumpCodeInstEmitter) {
471 // Disassemble instruction/operands to text
472 DisasmLines.resize(DisasmLines.size() + 1);
473 std::string &DisasmLine = DisasmLines.back();
474 raw_string_ostream DisasmStream(DisasmLine);
475
476 AMDGPUInstPrinter InstPrinter(TM.getMCAsmInfo(), *STI.getInstrInfo(),
477 *STI.getRegisterInfo());
478 InstPrinter.printInst(&TmpInst, 0, StringRef(), STI, DisasmStream);
479
480 // Disassemble instruction/operands to hex representation.
482 SmallVector<char, 16> CodeBytes;
483
484 DumpCodeInstEmitter->encodeInstruction(
485 TmpInst, CodeBytes, Fixups, MF->getSubtarget<MCSubtargetInfo>());
486 HexLines.resize(HexLines.size() + 1);
487 std::string &HexLine = HexLines.back();
488 raw_string_ostream HexStream(HexLine);
489
490 for (size_t i = 0; i < CodeBytes.size(); i += 4) {
491 unsigned int CodeDWord =
492 support::endian::read32le(CodeBytes.data() + i);
493 HexStream << format("%s%08X", (i > 0 ? " " : ""), CodeDWord);
494 }
495
496 DisasmLineMaxLen = std::max(DisasmLineMaxLen, DisasmLine.size());
497 }
498 }
499}
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
#define LLVM_UNLIKELY(EXPR)
Definition Compiler.h:336
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:343
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:214
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)
@ C
The default llvm calling convention, compatible with C.
Definition CallingConv.h:34
uint32_t read32le(const void *P)
Definition Endian.h:432
This is an optimization pass for GlobalISel generic memory operations.
@ Offset
Definition DWP.cpp:558
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:191
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
Definition Format.h:129
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
static uint16_t getSpecifier(const MCSymbolRefExpr *SRE)