LLVM 24.0.0git
AMDGPUInsertDelayAlu.cpp
Go to the documentation of this file.
1//===- AMDGPUInsertDelayAlu.cpp - Insert s_delay_alu instructions ---------===//
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/// Insert s_delay_alu instructions to avoid stalls on GFX11+.
11//
12//===----------------------------------------------------------------------===//
13
14#include "AMDGPU.h"
15#include "GCNSubtarget.h"
16#include "SIInstrInfo.h"
18
19using namespace llvm;
20
21#define DEBUG_TYPE "amdgpu-insert-delay-alu"
22
23namespace {
24
25class AMDGPUInsertDelayAlu {
26public:
27 const GCNSubtarget *ST;
28 const SIInstrInfo *SII;
30
31 const TargetSchedModel *SchedModel;
32
33 // Return true if MI waits for all outstanding VALU instructions to complete.
34 static bool instructionWaitsForVALU(const MachineInstr &MI) {
35 // These instruction types wait for VA_VDST==0 before issuing.
39 return true;
40 if (MI.getOpcode() == AMDGPU::S_SENDMSG_RTN_B32 ||
41 MI.getOpcode() == AMDGPU::S_SENDMSG_RTN_B64)
42 return true;
43 if (MI.getOpcode() == AMDGPU::S_WAITCNT_DEPCTR &&
45 static_cast<unsigned>(MI.getOperand(0).getImm())) == 0)
46 return true;
47 return false;
48 }
49
50 static bool instructionWaitsForSGPRWrites(const MachineInstr &MI) {
51 // These instruction types wait for VA_SDST==0 before issuing.
53 return true;
54
56 for (auto &Op : MI.operands()) {
57 if (Op.isReg())
58 return true;
59 }
60 }
61 return false;
62 }
63
64 // Types of delay that can be encoded in an s_delay_alu instruction.
65 enum DelayType { VALU, TRANS, SALU, OTHER };
66
67 // Get the delay type for a MachineInstr.
68 DelayType getDelayType(const MachineInstr &MI, bool AllowLDSDMA) {
69 // Non-F64 TRANS instructions use a separate delay type.
71 !AMDGPU::isDPMACCInstruction(MI.getOpcode()))
72 return TRANS;
73 // WMMA XDL ops are treated the same as TRANS.
74 if (ST->hasGFX1250Insts() && SII->isXDLWMMA(MI))
75 return TRANS;
76 if (SIInstrInfo::isVALU(MI, AllowLDSDMA))
77 return VALU;
79 return SALU;
80 return OTHER;
81 }
82
83 // Information about the last instruction(s) that wrote to a particular
84 // regunit. In straight-line code there will only be one such instruction, but
85 // when control flow converges we merge the delay information from each path
86 // to represent the union of the worst-case delays of each type.
87 struct DelayInfo {
88 // One larger than the maximum number of (non-TRANS) VALU instructions we
89 // can encode in an s_delay_alu instruction.
90 static constexpr unsigned VALU_MAX = 5;
91
92 // One larger than the maximum number of TRANS instructions we can encode in
93 // an s_delay_alu instruction.
94 static constexpr unsigned TRANS_MAX = 4;
95
96 // One larger than the maximum number of SALU cycles we can encode in an
97 // s_delay_alu instruction.
98 static constexpr unsigned SALU_CYCLES_MAX = 4;
99
100 // If it was written by a (non-TRANS) VALU, remember how many clock cycles
101 // are left until it completes, and how many other (non-TRANS) VALU we have
102 // seen since it was issued.
103 uint8_t VALUCycles = 0;
104 uint8_t VALUNum = VALU_MAX;
105
106 // If it was written by a TRANS, remember how many clock cycles are left
107 // until it completes, and how many other TRANS we have seen since it was
108 // issued.
109 uint8_t TRANSCycles = 0;
110 uint8_t TRANSNum = TRANS_MAX;
111 // Also remember how many other (non-TRANS) VALU we have seen since it was
112 // issued. When an instruction depends on both a prior TRANS and a prior
113 // non-TRANS VALU, this is used to decide whether to encode a wait for just
114 // one or both of them.
115 uint8_t TRANSNumVALU = VALU_MAX;
116
117 // If it was written by an SALU, remember how many clock cycles are left
118 // until it completes.
119 uint8_t SALUCycles = 0;
120
121 DelayInfo() = default;
122
123 DelayInfo(DelayType Type, unsigned Cycles) {
124 switch (Type) {
125 default:
126 llvm_unreachable("unexpected type");
127 case VALU:
128 VALUCycles = static_cast<uint8_t>(Cycles);
129 VALUNum = 0;
130 break;
131 case TRANS:
132 TRANSCycles = static_cast<uint8_t>(Cycles);
133 TRANSNum = 0;
134 TRANSNumVALU = 0;
135 break;
136 case SALU:
137 // Guard against pseudo-instructions like SI_CALL which are marked as
138 // SALU but with a very high latency.
139 SALUCycles = static_cast<uint8_t>(std::min(Cycles, SALU_CYCLES_MAX));
140 break;
141 }
142 }
143
144 bool operator==(const DelayInfo &RHS) const {
145 return VALUCycles == RHS.VALUCycles && VALUNum == RHS.VALUNum &&
146 TRANSCycles == RHS.TRANSCycles && TRANSNum == RHS.TRANSNum &&
147 TRANSNumVALU == RHS.TRANSNumVALU && SALUCycles == RHS.SALUCycles;
148 }
149
150 bool operator!=(const DelayInfo &RHS) const { return !(*this == RHS); }
151
152 // Merge another DelayInfo into this one, to represent the union of the
153 // worst-case delays of each type.
154 void merge(const DelayInfo &RHS) {
155 VALUCycles = std::max(VALUCycles, RHS.VALUCycles);
156 VALUNum = std::min(VALUNum, RHS.VALUNum);
157 TRANSCycles = std::max(TRANSCycles, RHS.TRANSCycles);
158 TRANSNum = std::min(TRANSNum, RHS.TRANSNum);
159 TRANSNumVALU = std::min(TRANSNumVALU, RHS.TRANSNumVALU);
160 SALUCycles = std::max(SALUCycles, RHS.SALUCycles);
161 }
162
163 // Update this DelayInfo after issuing an instruction of the specified type.
164 // Cycles is the number of cycles it takes to issue the instruction. Return
165 // true if there is no longer any useful delay info.
166 bool advance(DelayType Type, unsigned Cycles) {
167 bool Erase = true;
168
169 VALUNum += (Type == VALU);
170 if (VALUNum >= VALU_MAX || VALUCycles <= Cycles) {
171 // Forget about the VALU instruction. It was too far back or has
172 // definitely completed by now.
173 VALUNum = VALU_MAX;
174 VALUCycles = 0;
175 } else {
176 VALUCycles -= static_cast<uint8_t>(Cycles);
177 Erase = false;
178 }
179
180 TRANSNum += (Type == TRANS);
181 TRANSNumVALU += (Type == VALU);
182 if (TRANSNum >= TRANS_MAX || TRANSCycles <= Cycles) {
183 // Forget about any TRANS instruction. It was too far back or has
184 // definitely completed by now.
185 TRANSNum = TRANS_MAX;
186 TRANSNumVALU = VALU_MAX;
187 TRANSCycles = 0;
188 } else {
189 TRANSCycles -= static_cast<uint8_t>(Cycles);
190 Erase = false;
191 }
192
193 if (SALUCycles <= Cycles) {
194 // Forget about any SALU instruction. It has definitely completed by
195 // now.
196 SALUCycles = 0;
197 } else {
198 SALUCycles -= static_cast<uint8_t>(Cycles);
199 Erase = false;
200 }
201
202 return Erase;
203 }
204
205#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
206 void dump() const {
207 if (VALUCycles)
208 dbgs() << " VALUCycles=" << (int)VALUCycles;
209 if (VALUNum < VALU_MAX)
210 dbgs() << " VALUNum=" << (int)VALUNum;
211 if (TRANSCycles)
212 dbgs() << " TRANSCycles=" << (int)TRANSCycles;
213 if (TRANSNum < TRANS_MAX)
214 dbgs() << " TRANSNum=" << (int)TRANSNum;
215 if (TRANSNumVALU < VALU_MAX)
216 dbgs() << " TRANSNumVALU=" << (int)TRANSNumVALU;
217 if (SALUCycles)
218 dbgs() << " SALUCycles=" << (int)SALUCycles;
219 }
220#endif
221 };
222
223 // A map from regunits to the delay info for that regunit.
224 struct DelayState : DenseMap<MCRegUnit, DelayInfo> {
225 // Merge another DelayState into this one by merging the delay info for each
226 // regunit.
227 void merge(const DelayState &RHS) {
228 for (const auto &KV : RHS) {
229 iterator It;
230 bool Inserted;
231 std::tie(It, Inserted) = insert(KV);
232 if (!Inserted)
233 It->second.merge(KV.second);
234 }
235 }
236
237 // Advance the delay info for each regunit, erasing any that are no longer
238 // useful.
239 void advance(DelayType Type, unsigned Cycles) {
240 remove_if([&](auto &P) { return P.second.advance(Type, Cycles); });
241 }
242
243 void advanceByVALUNum(unsigned VALUNum) {
244 remove_if([&](auto &P) {
245 return P.second.VALUNum >= VALUNum && P.second.VALUCycles > 0;
246 });
247 }
248
249#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
250 void dump(const TargetRegisterInfo *TRI) const {
251 if (empty()) {
252 dbgs() << " empty\n";
253 return;
254 }
255
256 // Dump DelayInfo for each RegUnit in numerical order.
258 Order.reserve(size());
259 for (const_iterator I = begin(), E = end(); I != E; ++I)
260 Order.push_back(I);
261 llvm::sort(Order, [](const const_iterator &A, const const_iterator &B) {
262 return A->first < B->first;
263 });
264 for (const_iterator I : Order) {
265 dbgs() << " " << printRegUnit(I->first, TRI);
266 I->second.dump();
267 dbgs() << "\n";
268 }
269 }
270#endif
271 };
272
273 // The saved delay state at the end of each basic block.
275
276 // Emit an s_delay_alu instruction if necessary before MI.
277 MachineInstr *emitDelayAlu(MachineInstr &MI, DelayInfo Delay,
278 MachineInstr *LastDelayAlu) {
279 unsigned Imm = 0;
280
281 // Wait for a TRANS instruction.
282 if (Delay.TRANSNum < DelayInfo::TRANS_MAX)
283 Imm |= 4 + Delay.TRANSNum;
284
285 // Wait for a VALU instruction (if it's more recent than any TRANS
286 // instruction that we're also waiting for).
287 if (Delay.VALUNum < DelayInfo::VALU_MAX &&
288 Delay.VALUNum <= Delay.TRANSNumVALU) {
289 if (Imm & 0xf)
290 Imm |= Delay.VALUNum << 7;
291 else
292 Imm |= Delay.VALUNum;
293 }
294
295 // Wait for an SALU instruction.
296 if (Delay.SALUCycles) {
297 assert(Delay.SALUCycles < DelayInfo::SALU_CYCLES_MAX);
298 if (Imm & 0x780) {
299 // We have already encoded a VALU and a TRANS delay. There's no room in
300 // the encoding for an SALU delay as well, so just drop it.
301 } else if (Imm & 0xf) {
302 Imm |= (Delay.SALUCycles + 8) << 7;
303 } else {
304 Imm |= Delay.SALUCycles + 8;
305 }
306 }
307
308 // Don't emit the s_delay_alu instruction if there's nothing to wait for.
309 if (!Imm)
310 return LastDelayAlu;
311
312 // If we only need to wait for one instruction, try encoding it in the last
313 // s_delay_alu that we emitted.
314 if (!(Imm & 0x780) && LastDelayAlu) {
315 unsigned Skip = 0;
316 for (auto I = MachineBasicBlock::instr_iterator(LastDelayAlu),
318 ++I != E;) {
319 if (I->getOpcode() == AMDGPU::S_SET_VGPR_MSB) {
320 // It is not deterministic whether the skip count counts
321 // S_SET_VGPR_MSB instructions or not, so do not include them in a
322 // skip region.
323 Skip = 6;
324 break;
325 }
326 if (!I->isBundle() && !I->isMetaInstruction())
327 ++Skip;
328 }
329 if (Skip < 6) {
330 MachineOperand &Op = LastDelayAlu->getOperand(0);
331 unsigned LastImm = static_cast<unsigned>(Op.getImm());
332 assert((LastImm & ~0xf) == 0 &&
333 "Remembered an s_delay_alu with no room for another delay!");
334 LastImm |= Imm << 7 | Skip << 4;
335 Op.setImm(LastImm);
336 return nullptr;
337 }
338 }
339
340 auto &MBB = *MI.getParent();
341 MachineInstr *DelayAlu =
342 BuildMI(MBB, MI, DebugLoc(), SII->get(AMDGPU::S_DELAY_ALU)).addImm(Imm);
343 // Remember the s_delay_alu for next time if there is still room in it to
344 // encode another delay.
345 return (Imm & 0x780) ? nullptr : DelayAlu;
346 }
347
348 bool runOnMachineBasicBlock(MachineBasicBlock &MBB, bool Emit) {
349 DelayState State;
350 for (auto *Pred : MBB.predecessors())
351 State.merge(BlockState[Pred]);
352
353 LLVM_DEBUG(dbgs() << " State at start of " << printMBBReference(MBB)
354 << "\n";
355 State.dump(TRI););
356
357 bool Changed = false;
358 MachineInstr *LastDelayAlu = nullptr;
359
360 // FIXME: 0 is a valid register unit.
361 MCRegUnit LastSGPRFromVALU = static_cast<MCRegUnit>(0);
362
363 // Destination of the preceding WMMA, for C-reuse detection.
364 Register PrevWMMAVDst;
365
366 // Iterate over the contents of bundles, but don't emit any instructions
367 // inside a bundle.
368 for (auto &MI : MBB.instrs()) {
369 if (MI.isBundle() || MI.isMetaInstruction())
370 continue;
371
372 // Ignore some more instructions that do not generate any code.
373 switch (MI.getOpcode()) {
374 case AMDGPU::SI_RETURN_TO_EPILOG:
375 continue;
376 }
377
378 // LDSDMA is VALU-tagged but only behaves like VALU for operand-use delay
379 // checks (e.g. v_readfirstlane -> tensor_load_to_lds). It must not
380 // publish or advance VALU delay state on its defs.
381 DelayType ProducerType = getDelayType(MI, /*AllowLDSDMA=*/false);
382 DelayType ConsumerType = getDelayType(MI, /*AllowLDSDMA=*/true);
383
384 if (instructionWaitsForSGPRWrites(MI)) {
385 auto It = State.find(LastSGPRFromVALU);
386 if (It != State.end()) {
387 DelayInfo Info = It->getSecond();
388 State.advanceByVALUNum(Info.VALUNum);
389 // FIXME: 0 is a valid register unit.
390 LastSGPRFromVALU = static_cast<MCRegUnit>(0);
391 }
392 }
393
394 if (instructionWaitsForVALU(MI)) {
395 // Forget about all outstanding VALU delays.
396 // TODO: This is overkill since it also forgets about SALU delays.
397 State = DelayState();
398 } else if (ConsumerType != OTHER) {
399 DelayInfo Delay;
400 // C-reuse: back-to-back WMMAs into the same C register forward the
401 // accumulator in place, so the tied srcC read has no dependency. WMMA
402 // implies GFX11+, so no explicit subtarget check is needed.
403 bool IsWMMACReuse =
404 PrevWMMAVDst.isValid() && (SII->isWMMA(MI) || SII->isSWMMAC(MI));
405 // TODO: Scan implicit uses too?
406 for (const auto &Op : MI.explicit_uses()) {
407 if (Op.isReg()) {
408 // One of the operands of the writelane is also the output operand.
409 // This creates the insertion of redundant delays. Hence, we have to
410 // ignore this operand.
411 if (MI.getOpcode() == AMDGPU::V_WRITELANE_B32 && Op.isTied())
412 continue;
413 // Skip the tied srcC of a C-reuse edge.
414 if (IsWMMACReuse && Op.isTied() && Op.getReg() == PrevWMMAVDst)
415 continue;
416 for (MCRegUnit Unit : TRI->regunits(Op.getReg())) {
417 auto It = State.find(Unit);
418 if (It != State.end()) {
419 Delay.merge(It->second);
420 State.erase(Unit);
421 }
422 }
423 }
424 }
425
426 if (ProducerType == VALU) {
427 for (const auto &Op : MI.defs()) {
428 Register Reg = Op.getReg();
429 if (AMDGPU::isSGPR(Reg, TRI)) {
430 LastSGPRFromVALU = *TRI->regunits(Reg).begin();
431 break;
432 }
433 }
434 }
435
436 if (Emit && !MI.isBundledWithPred()) {
437 // TODO: For VALU->SALU delays should we use s_delay_alu or s_nop or
438 // just ignore them?
439 LastDelayAlu = emitDelayAlu(MI, Delay, LastDelayAlu);
440 }
441 }
442
443 if (ProducerType != OTHER) {
444 // TODO: Scan implicit defs too?
445 for (const auto &Op : MI.defs()) {
446 unsigned Latency = SchedModel->computeOperandLatency(
447 &MI, Op.getOperandNo(), nullptr, 0);
448 for (MCRegUnit Unit : TRI->regunits(Op.getReg()))
449 State[Unit] = DelayInfo(ProducerType, Latency);
450 }
451 }
452
453 // Advance by the number of cycles it takes to issue this instruction.
454 // TODO: Use a more advanced model that accounts for instructions that
455 // take multiple cycles to issue on a particular pipeline.
456 unsigned Cycles = SIInstrInfo::getNumWaitStates(MI);
457 // TODO: In wave64 mode, double the number of cycles for VALU and VMEM
458 // instructions on the assumption that they will usually have to be issued
459 // twice?
460 State.advance(ProducerType, Cycles);
461
462 // Track the preceding WMMA's dst for C-reuse; reset on anything else.
463 if (SII->isWMMA(MI) || SII->isSWMMAC(MI)) {
464 const MachineOperand *VDst =
465 SII->getNamedOperand(MI, AMDGPU::OpName::vdst);
466 PrevWMMAVDst = VDst ? VDst->getReg() : Register();
467 } else {
468 PrevWMMAVDst = Register();
469 }
470
471 LLVM_DEBUG(dbgs() << " State after " << MI; State.dump(TRI););
472 }
473
474 if (Emit) {
475 assert(State == BlockState[&MBB] &&
476 "Basic block state should not have changed on final pass!");
477 } else if (DelayState &BS = BlockState[&MBB]; State != BS) {
478 BS = std::move(State);
479 Changed = true;
480 }
481 return Changed;
482 }
483
484 bool run(MachineFunction &MF) {
485 LLVM_DEBUG(dbgs() << "AMDGPUInsertDelayAlu running on " << MF.getName()
486 << "\n");
487
488 ST = &MF.getSubtarget<GCNSubtarget>();
489 if (!ST->hasDelayAlu())
490 return false;
491
493
494 if (MFI.getMaxWavesPerEU() == 1)
495 return false;
496
497 SII = ST->getInstrInfo();
498 TRI = ST->getRegisterInfo();
499 SchedModel = &SII->getSchedModel();
500
501 // Calculate the delay state for each basic block, iterating until we reach
502 // a fixed point.
504 for (auto &MBB : reverse(MF))
505 WorkList.insert(&MBB);
506 while (!WorkList.empty()) {
507 auto &MBB = *WorkList.pop_back_val();
508 bool Changed = runOnMachineBasicBlock(MBB, false);
509 if (Changed)
510 WorkList.insert_range(MBB.successors());
511 }
512
513 LLVM_DEBUG(dbgs() << "Final pass over all BBs\n");
514
515 // Make one last pass over all basic blocks to emit s_delay_alu
516 // instructions.
517 bool Changed = false;
518 for (auto &MBB : MF)
519 Changed |= runOnMachineBasicBlock(MBB, true);
520 return Changed;
521 }
522};
523
524class AMDGPUInsertDelayAluLegacy : public MachineFunctionPass {
525public:
526 static char ID;
527
528 AMDGPUInsertDelayAluLegacy() : MachineFunctionPass(ID) {}
529
530 void getAnalysisUsage(AnalysisUsage &AU) const override {
531 AU.setPreservesCFG();
533 }
534
535 bool runOnMachineFunction(MachineFunction &MF) override {
536 if (skipFunction(MF.getFunction()))
537 return false;
538 AMDGPUInsertDelayAlu Impl;
539 return Impl.run(MF);
540 }
541};
542} // namespace
543
547 if (!AMDGPUInsertDelayAlu().run(MF))
548 return PreservedAnalyses::all();
550 PA.preserveSet<CFGAnalyses>();
551 return PA;
552} // end namespace llvm
553
554char AMDGPUInsertDelayAluLegacy::ID = 0;
555
556char &llvm::AMDGPUInsertDelayAluID = AMDGPUInsertDelayAluLegacy::ID;
557
558INITIALIZE_PASS(AMDGPUInsertDelayAluLegacy, DEBUG_TYPE,
559 "AMDGPU Insert Delay ALU", false, false)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
unsigned Imm
MachineBasicBlock & MBB
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
AMD GCN specific subclass of TargetSubtarget.
#define DEBUG_TYPE
IRTranslator LLVM IR MI
static LoopDeletionResult merge(LoopDeletionResult A, LoopDeletionResult B)
#define I(x, y, z)
Definition MD5.cpp:57
Register Reg
Register const TargetRegisterInfo * TRI
Promote Memory to Register
Definition Mem2Reg.cpp:110
#define P(N)
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
Definition PassSupport.h:56
Interface definition for SIInstrInfo.
#define LLVM_DEBUG(...)
Definition Debug.h:119
Value * RHS
Represent the analysis usage information of a pass.
LLVM_ABI void setPreservesCFG()
This function should be called by the pass, iff they do not:
Definition Pass.cpp:278
Represents analyses that only rely on functions' control flow.
Definition Analysis.h:73
Instructions::iterator instr_iterator
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
Function & getFunction()
Return the LLVM function that this machine code represents.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
Representation of each machine instruction.
const MachineOperand & getOperand(unsigned i) const
MachineOperand class - Representation of each machine instruction operand.
Register getReg() const
getReg - Returns the register number.
A set of analyses that are preserved following a run of a transformation pass.
Definition Analysis.h:112
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Definition Analysis.h:118
Wrapper class representing virtual and physical registers.
Definition Register.h:20
constexpr bool isValid() const
Definition Register.h:112
bool isXDLWMMA(const MachineInstr &MI) const
static bool isSALU(const MachineInstr &MI)
static bool isSWMMAC(const MachineInstr &MI)
const TargetSchedModel & getSchedModel() const
static bool isVALU(const MachineInstr &MI, bool AllowLDSDMA)
static bool isTRANS(const MachineInstr &MI)
static unsigned getNumWaitStates(const MachineInstr &MI)
Return the number of wait states that result from executing this instruction.
static bool isWMMA(const MachineInstr &MI)
LLVM_READONLY MachineOperand * getNamedOperand(MachineInstr &MI, AMDGPU::OpName OperandName) const
Returns the operand named Op.
This class keeps track of the SPI_SP_INPUT_ADDR config register, which tells the hardware which inter...
A vector that has set insertion semantics.
Definition SetVector.h:57
void insert_range(Range &&R)
Definition SetVector.h:182
bool empty() const
Determine if the SetVector is empty or not.
Definition SetVector.h:100
bool insert(const value_type &X)
Insert a new element into the SetVector.
Definition SetVector.h:157
value_type pop_back_val()
Definition SetVector.h:285
void reserve(size_type N)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Provide an instruction scheduling machine model to CodeGen passes.
LLVM_ABI unsigned computeOperandLatency(const MachineInstr *DefMI, unsigned DefOperIdx, const MachineInstr *UseMI, unsigned UseOperIdx) const
Compute operand latency based on the available machine model.
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:46
Changed
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
unsigned decodeFieldVaVdst(unsigned Encoded)
bool isSGPR(MCRegister Reg, const MCRegisterInfo *TRI)
Is Reg - scalar register.
bool isDPMACCInstruction(unsigned Opc)
constexpr bool isFLAT(const T &...O)
Definition SIDefines.h:283
constexpr bool isBuffer(const T &...O)
Definition SIDefines.h:264
constexpr bool isSMRD(const T &...O)
Definition SIDefines.h:268
constexpr bool isMIMG(const T &...O)
Definition SIDefines.h:271
constexpr bool isEXP(const T &...O)
Definition SIDefines.h:280
constexpr bool isDS(const T &...O)
Definition SIDefines.h:286
constexpr bool isSALU(const T &...O)
Definition SIDefines.h:206
This is an optimization pass for GlobalISel generic memory operations.
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
Definition STLExtras.h:1685
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
bool operator!=(uint64_t V1, const APInt &V2)
Definition APInt.h:2139
LLVM_ABI Printable printRegUnit(MCRegUnit Unit, const TargetRegisterInfo *TRI)
Create Printable object to print register units on a raw_ostream.
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
bool operator==(const AddressRangeValuePair &LHS, const AddressRangeValuePair &RHS)
LLVM_ABI PreservedAnalyses getMachineFunctionPassPreservedAnalyses()
Returns the minimum set of Analyses that all machine function passes must preserve.
auto reverse(ContainerTy &&C)
Definition STLExtras.h:408
void sort(IteratorTy Start, IteratorTy End)
Definition STLExtras.h:1652
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition Debug.cpp:209
char & AMDGPUInsertDelayAluID
auto remove_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::remove_if which take ranges instead of having to pass begin/end explicitly.
Definition STLExtras.h:1800
DWARFExpression::Operation Op
LLVM_ABI Printable printMBBReference(const MachineBasicBlock &MBB)
Prints a machine basic block reference.
PreservedAnalyses run(MachineFunction &F, MachineFunctionAnalysisManager &MFAM)