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 &&
44 AMDGPU::DepCtr::decodeFieldVaVdst(MI.getOperand(0).getImm()) == 0)
45 return true;
46 return false;
47 }
48
49 static bool instructionWaitsForSGPRWrites(const MachineInstr &MI) {
50 // These instruction types wait for VA_SDST==0 before issuing.
52 return true;
53
55 for (auto &Op : MI.operands()) {
56 if (Op.isReg())
57 return true;
58 }
59 }
60 return false;
61 }
62
63 // Types of delay that can be encoded in an s_delay_alu instruction.
64 enum DelayType { VALU, TRANS, SALU, OTHER };
65
66 // Get the delay type for a MachineInstr.
67 DelayType getDelayType(const MachineInstr &MI) {
68 // Non-F64 TRANS instructions use a separate delay type.
70 !AMDGPU::isDPMACCInstruction(MI.getOpcode()))
71 return TRANS;
72 // WMMA XDL ops are treated the same as TRANS.
73 if (ST->hasGFX1250Insts() && SII->isXDLWMMA(MI))
74 return TRANS;
75 if (SIInstrInfo::isVALU(MI, /*AllowLDSDMA=*/true))
76 return VALU;
78 return SALU;
79 return OTHER;
80 }
81
82 // Information about the last instruction(s) that wrote to a particular
83 // regunit. In straight-line code there will only be one such instruction, but
84 // when control flow converges we merge the delay information from each path
85 // to represent the union of the worst-case delays of each type.
86 struct DelayInfo {
87 // One larger than the maximum number of (non-TRANS) VALU instructions we
88 // can encode in an s_delay_alu instruction.
89 static constexpr unsigned VALU_MAX = 5;
90
91 // One larger than the maximum number of TRANS instructions we can encode in
92 // an s_delay_alu instruction.
93 static constexpr unsigned TRANS_MAX = 4;
94
95 // One larger than the maximum number of SALU cycles we can encode in an
96 // s_delay_alu instruction.
97 static constexpr unsigned SALU_CYCLES_MAX = 4;
98
99 // If it was written by a (non-TRANS) VALU, remember how many clock cycles
100 // are left until it completes, and how many other (non-TRANS) VALU we have
101 // seen since it was issued.
102 uint8_t VALUCycles = 0;
103 uint8_t VALUNum = VALU_MAX;
104
105 // If it was written by a TRANS, remember how many clock cycles are left
106 // until it completes, and how many other TRANS we have seen since it was
107 // issued.
108 uint8_t TRANSCycles = 0;
109 uint8_t TRANSNum = TRANS_MAX;
110 // Also remember how many other (non-TRANS) VALU we have seen since it was
111 // issued. When an instruction depends on both a prior TRANS and a prior
112 // non-TRANS VALU, this is used to decide whether to encode a wait for just
113 // one or both of them.
114 uint8_t TRANSNumVALU = VALU_MAX;
115
116 // If it was written by an SALU, remember how many clock cycles are left
117 // until it completes.
118 uint8_t SALUCycles = 0;
119
120 DelayInfo() = default;
121
122 DelayInfo(DelayType Type, unsigned Cycles) {
123 switch (Type) {
124 default:
125 llvm_unreachable("unexpected type");
126 case VALU:
127 VALUCycles = Cycles;
128 VALUNum = 0;
129 break;
130 case TRANS:
131 TRANSCycles = Cycles;
132 TRANSNum = 0;
133 TRANSNumVALU = 0;
134 break;
135 case SALU:
136 // Guard against pseudo-instructions like SI_CALL which are marked as
137 // SALU but with a very high latency.
138 SALUCycles = std::min(Cycles, SALU_CYCLES_MAX);
139 break;
140 }
141 }
142
143 bool operator==(const DelayInfo &RHS) const {
144 return VALUCycles == RHS.VALUCycles && VALUNum == RHS.VALUNum &&
145 TRANSCycles == RHS.TRANSCycles && TRANSNum == RHS.TRANSNum &&
146 TRANSNumVALU == RHS.TRANSNumVALU && SALUCycles == RHS.SALUCycles;
147 }
148
149 bool operator!=(const DelayInfo &RHS) const { return !(*this == RHS); }
150
151 // Merge another DelayInfo into this one, to represent the union of the
152 // worst-case delays of each type.
153 void merge(const DelayInfo &RHS) {
154 VALUCycles = std::max(VALUCycles, RHS.VALUCycles);
155 VALUNum = std::min(VALUNum, RHS.VALUNum);
156 TRANSCycles = std::max(TRANSCycles, RHS.TRANSCycles);
157 TRANSNum = std::min(TRANSNum, RHS.TRANSNum);
158 TRANSNumVALU = std::min(TRANSNumVALU, RHS.TRANSNumVALU);
159 SALUCycles = std::max(SALUCycles, RHS.SALUCycles);
160 }
161
162 // Update this DelayInfo after issuing an instruction of the specified type.
163 // Cycles is the number of cycles it takes to issue the instruction. Return
164 // true if there is no longer any useful delay info.
165 bool advance(DelayType Type, unsigned Cycles) {
166 bool Erase = true;
167
168 VALUNum += (Type == VALU);
169 if (VALUNum >= VALU_MAX || VALUCycles <= Cycles) {
170 // Forget about the VALU instruction. It was too far back or has
171 // definitely completed by now.
172 VALUNum = VALU_MAX;
173 VALUCycles = 0;
174 } else {
175 VALUCycles -= Cycles;
176 Erase = false;
177 }
178
179 TRANSNum += (Type == TRANS);
180 TRANSNumVALU += (Type == VALU);
181 if (TRANSNum >= TRANS_MAX || TRANSCycles <= Cycles) {
182 // Forget about any TRANS instruction. It was too far back or has
183 // definitely completed by now.
184 TRANSNum = TRANS_MAX;
185 TRANSNumVALU = VALU_MAX;
186 TRANSCycles = 0;
187 } else {
188 TRANSCycles -= Cycles;
189 Erase = false;
190 }
191
192 if (SALUCycles <= Cycles) {
193 // Forget about any SALU instruction. It has definitely completed by
194 // now.
195 SALUCycles = 0;
196 } else {
197 SALUCycles -= Cycles;
198 Erase = false;
199 }
200
201 return Erase;
202 }
203
204#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
205 void dump() const {
206 if (VALUCycles)
207 dbgs() << " VALUCycles=" << (int)VALUCycles;
208 if (VALUNum < VALU_MAX)
209 dbgs() << " VALUNum=" << (int)VALUNum;
210 if (TRANSCycles)
211 dbgs() << " TRANSCycles=" << (int)TRANSCycles;
212 if (TRANSNum < TRANS_MAX)
213 dbgs() << " TRANSNum=" << (int)TRANSNum;
214 if (TRANSNumVALU < VALU_MAX)
215 dbgs() << " TRANSNumVALU=" << (int)TRANSNumVALU;
216 if (SALUCycles)
217 dbgs() << " SALUCycles=" << (int)SALUCycles;
218 }
219#endif
220 };
221
222 // A map from regunits to the delay info for that regunit.
223 struct DelayState : DenseMap<MCRegUnit, DelayInfo> {
224 // Merge another DelayState into this one by merging the delay info for each
225 // regunit.
226 void merge(const DelayState &RHS) {
227 for (const auto &KV : RHS) {
228 iterator It;
229 bool Inserted;
230 std::tie(It, Inserted) = insert(KV);
231 if (!Inserted)
232 It->second.merge(KV.second);
233 }
234 }
235
236 // Advance the delay info for each regunit, erasing any that are no longer
237 // useful.
238 void advance(DelayType Type, unsigned Cycles) {
239 remove_if([&](auto &P) { return P.second.advance(Type, Cycles); });
240 }
241
242 void advanceByVALUNum(unsigned VALUNum) {
243 remove_if([&](auto &P) {
244 return P.second.VALUNum >= VALUNum && P.second.VALUCycles > 0;
245 });
246 }
247
248#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
249 void dump(const TargetRegisterInfo *TRI) const {
250 if (empty()) {
251 dbgs() << " empty\n";
252 return;
253 }
254
255 // Dump DelayInfo for each RegUnit in numerical order.
257 Order.reserve(size());
258 for (const_iterator I = begin(), E = end(); I != E; ++I)
259 Order.push_back(I);
260 llvm::sort(Order, [](const const_iterator &A, const const_iterator &B) {
261 return A->first < B->first;
262 });
263 for (const_iterator I : Order) {
264 dbgs() << " " << printRegUnit(I->first, TRI);
265 I->second.dump();
266 dbgs() << "\n";
267 }
268 }
269#endif
270 };
271
272 // The saved delay state at the end of each basic block.
274
275 // Emit an s_delay_alu instruction if necessary before MI.
276 MachineInstr *emitDelayAlu(MachineInstr &MI, DelayInfo Delay,
277 MachineInstr *LastDelayAlu) {
278 unsigned Imm = 0;
279
280 // Wait for a TRANS instruction.
281 if (Delay.TRANSNum < DelayInfo::TRANS_MAX)
282 Imm |= 4 + Delay.TRANSNum;
283
284 // Wait for a VALU instruction (if it's more recent than any TRANS
285 // instruction that we're also waiting for).
286 if (Delay.VALUNum < DelayInfo::VALU_MAX &&
287 Delay.VALUNum <= Delay.TRANSNumVALU) {
288 if (Imm & 0xf)
289 Imm |= Delay.VALUNum << 7;
290 else
291 Imm |= Delay.VALUNum;
292 }
293
294 // Wait for an SALU instruction.
295 if (Delay.SALUCycles) {
296 assert(Delay.SALUCycles < DelayInfo::SALU_CYCLES_MAX);
297 if (Imm & 0x780) {
298 // We have already encoded a VALU and a TRANS delay. There's no room in
299 // the encoding for an SALU delay as well, so just drop it.
300 } else if (Imm & 0xf) {
301 Imm |= (Delay.SALUCycles + 8) << 7;
302 } else {
303 Imm |= Delay.SALUCycles + 8;
304 }
305 }
306
307 // Don't emit the s_delay_alu instruction if there's nothing to wait for.
308 if (!Imm)
309 return LastDelayAlu;
310
311 // If we only need to wait for one instruction, try encoding it in the last
312 // s_delay_alu that we emitted.
313 if (!(Imm & 0x780) && LastDelayAlu) {
314 unsigned Skip = 0;
315 for (auto I = MachineBasicBlock::instr_iterator(LastDelayAlu),
317 ++I != E;) {
318 if (I->getOpcode() == AMDGPU::S_SET_VGPR_MSB) {
319 // It is not deterministic whether the skip count counts
320 // S_SET_VGPR_MSB instructions or not, so do not include them in a
321 // skip region.
322 Skip = 6;
323 break;
324 }
325 if (!I->isBundle() && !I->isMetaInstruction())
326 ++Skip;
327 }
328 if (Skip < 6) {
329 MachineOperand &Op = LastDelayAlu->getOperand(0);
330 unsigned LastImm = Op.getImm();
331 assert((LastImm & ~0xf) == 0 &&
332 "Remembered an s_delay_alu with no room for another delay!");
333 LastImm |= Imm << 7 | Skip << 4;
334 Op.setImm(LastImm);
335 return nullptr;
336 }
337 }
338
339 auto &MBB = *MI.getParent();
340 MachineInstr *DelayAlu =
341 BuildMI(MBB, MI, DebugLoc(), SII->get(AMDGPU::S_DELAY_ALU)).addImm(Imm);
342 // Remember the s_delay_alu for next time if there is still room in it to
343 // encode another delay.
344 return (Imm & 0x780) ? nullptr : DelayAlu;
345 }
346
347 bool runOnMachineBasicBlock(MachineBasicBlock &MBB, bool Emit) {
348 DelayState State;
349 for (auto *Pred : MBB.predecessors())
350 State.merge(BlockState[Pred]);
351
352 LLVM_DEBUG(dbgs() << " State at start of " << printMBBReference(MBB)
353 << "\n";
354 State.dump(TRI););
355
356 bool Changed = false;
357 MachineInstr *LastDelayAlu = nullptr;
358
359 // FIXME: 0 is a valid register unit.
360 MCRegUnit LastSGPRFromVALU = static_cast<MCRegUnit>(0);
361
362 // Destination of the preceding WMMA, for C-reuse detection.
363 Register PrevWMMAVDst;
364
365 // Iterate over the contents of bundles, but don't emit any instructions
366 // inside a bundle.
367 for (auto &MI : MBB.instrs()) {
368 if (MI.isBundle() || MI.isMetaInstruction())
369 continue;
370
371 // Ignore some more instructions that do not generate any code.
372 switch (MI.getOpcode()) {
373 case AMDGPU::SI_RETURN_TO_EPILOG:
374 continue;
375 }
376
377 DelayType Type = getDelayType(MI);
378
379 if (instructionWaitsForSGPRWrites(MI)) {
380 auto It = State.find(LastSGPRFromVALU);
381 if (It != State.end()) {
382 DelayInfo Info = It->getSecond();
383 State.advanceByVALUNum(Info.VALUNum);
384 // FIXME: 0 is a valid register unit.
385 LastSGPRFromVALU = static_cast<MCRegUnit>(0);
386 }
387 }
388
389 if (instructionWaitsForVALU(MI)) {
390 // Forget about all outstanding VALU delays.
391 // TODO: This is overkill since it also forgets about SALU delays.
392 State = DelayState();
393 } else if (Type != OTHER) {
394 DelayInfo Delay;
395 // C-reuse: back-to-back WMMAs into the same C register forward the
396 // accumulator in place, so the tied srcC read has no dependency. WMMA
397 // implies GFX11+, so no explicit subtarget check is needed.
398 bool IsWMMACReuse =
399 PrevWMMAVDst.isValid() && (SII->isWMMA(MI) || SII->isSWMMAC(MI));
400 // TODO: Scan implicit uses too?
401 for (const auto &Op : MI.explicit_uses()) {
402 if (Op.isReg()) {
403 // One of the operands of the writelane is also the output operand.
404 // This creates the insertion of redundant delays. Hence, we have to
405 // ignore this operand.
406 if (MI.getOpcode() == AMDGPU::V_WRITELANE_B32 && Op.isTied())
407 continue;
408 // Skip the tied srcC of a C-reuse edge.
409 if (IsWMMACReuse && Op.isTied() && Op.getReg() == PrevWMMAVDst)
410 continue;
411 for (MCRegUnit Unit : TRI->regunits(Op.getReg())) {
412 auto It = State.find(Unit);
413 if (It != State.end()) {
414 Delay.merge(It->second);
415 State.erase(Unit);
416 }
417 }
418 }
419 }
420
421 if (SII->isVALU(MI.getOpcode(), /*AllowLDSDMA=*/true)) {
422 for (const auto &Op : MI.defs()) {
423 Register Reg = Op.getReg();
424 if (AMDGPU::isSGPR(Reg, TRI)) {
425 LastSGPRFromVALU = *TRI->regunits(Reg).begin();
426 break;
427 }
428 }
429 }
430
431 if (Emit && !MI.isBundledWithPred()) {
432 // TODO: For VALU->SALU delays should we use s_delay_alu or s_nop or
433 // just ignore them?
434 LastDelayAlu = emitDelayAlu(MI, Delay, LastDelayAlu);
435 }
436 }
437
438 if (Type != OTHER) {
439 // TODO: Scan implicit defs too?
440 for (const auto &Op : MI.defs()) {
441 unsigned Latency = SchedModel->computeOperandLatency(
442 &MI, Op.getOperandNo(), nullptr, 0);
443 for (MCRegUnit Unit : TRI->regunits(Op.getReg()))
444 State[Unit] = DelayInfo(Type, Latency);
445 }
446 }
447
448 // Advance by the number of cycles it takes to issue this instruction.
449 // TODO: Use a more advanced model that accounts for instructions that
450 // take multiple cycles to issue on a particular pipeline.
451 unsigned Cycles = SIInstrInfo::getNumWaitStates(MI);
452 // TODO: In wave64 mode, double the number of cycles for VALU and VMEM
453 // instructions on the assumption that they will usually have to be issued
454 // twice?
455 State.advance(Type, Cycles);
456
457 // Track the preceding WMMA's dst for C-reuse; reset on anything else.
458 if (SII->isWMMA(MI) || SII->isSWMMAC(MI)) {
459 const MachineOperand *VDst =
460 SII->getNamedOperand(MI, AMDGPU::OpName::vdst);
461 PrevWMMAVDst = VDst ? VDst->getReg() : Register();
462 } else {
463 PrevWMMAVDst = Register();
464 }
465
466 LLVM_DEBUG(dbgs() << " State after " << MI; State.dump(TRI););
467 }
468
469 if (Emit) {
470 assert(State == BlockState[&MBB] &&
471 "Basic block state should not have changed on final pass!");
472 } else if (DelayState &BS = BlockState[&MBB]; State != BS) {
473 BS = std::move(State);
474 Changed = true;
475 }
476 return Changed;
477 }
478
479 bool run(MachineFunction &MF) {
480 LLVM_DEBUG(dbgs() << "AMDGPUInsertDelayAlu running on " << MF.getName()
481 << "\n");
482
483 ST = &MF.getSubtarget<GCNSubtarget>();
484 if (!ST->hasDelayAlu())
485 return false;
486
488
489 if (MFI.getMaxWavesPerEU() == 1)
490 return false;
491
492 SII = ST->getInstrInfo();
493 TRI = ST->getRegisterInfo();
494 SchedModel = &SII->getSchedModel();
495
496 // Calculate the delay state for each basic block, iterating until we reach
497 // a fixed point.
499 for (auto &MBB : reverse(MF))
500 WorkList.insert(&MBB);
501 while (!WorkList.empty()) {
502 auto &MBB = *WorkList.pop_back_val();
503 bool Changed = runOnMachineBasicBlock(MBB, false);
504 if (Changed)
505 WorkList.insert_range(MBB.successors());
506 }
507
508 LLVM_DEBUG(dbgs() << "Final pass over all BBs\n");
509
510 // Make one last pass over all basic blocks to emit s_delay_alu
511 // instructions.
512 bool Changed = false;
513 for (auto &MBB : MF)
514 Changed |= runOnMachineBasicBlock(MBB, true);
515 return Changed;
516 }
517};
518
519class AMDGPUInsertDelayAluLegacy : public MachineFunctionPass {
520public:
521 static char ID;
522
523 AMDGPUInsertDelayAluLegacy() : MachineFunctionPass(ID) {}
524
525 void getAnalysisUsage(AnalysisUsage &AU) const override {
526 AU.setPreservesCFG();
528 }
529
530 bool runOnMachineFunction(MachineFunction &MF) override {
531 if (skipFunction(MF.getFunction()))
532 return false;
533 AMDGPUInsertDelayAlu Impl;
534 return Impl.run(MF);
535 }
536};
537} // namespace
538
542 if (!AMDGPUInsertDelayAlu().run(MF))
543 return PreservedAnalyses::all();
545 PA.preserveSet<CFGAnalyses>();
546 return PA;
547} // end namespace llvm
548
549char AMDGPUInsertDelayAluLegacy::ID = 0;
550
551char &llvm::AMDGPUInsertDelayAluID = AMDGPUInsertDelayAluLegacy::ID;
552
553INITIALIZE_PASS(AMDGPUInsertDelayAluLegacy, DEBUG_TYPE,
554 "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:286
constexpr bool isBuffer(const T &...O)
Definition SIDefines.h:267
constexpr bool isSMRD(const T &...O)
Definition SIDefines.h:271
constexpr bool isMIMG(const T &...O)
Definition SIDefines.h:274
constexpr bool isEXP(const T &...O)
Definition SIDefines.h:283
constexpr bool isDS(const T &...O)
Definition SIDefines.h:289
constexpr bool isSALU(const T &...O)
Definition SIDefines.h:209
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:1669
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:2140
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:407
void sort(IteratorTy Start, IteratorTy End)
Definition STLExtras.h:1636
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:1784
DWARFExpression::Operation Op
LLVM_ABI Printable printMBBReference(const MachineBasicBlock &MBB)
Prints a machine basic block reference.
PreservedAnalyses run(MachineFunction &F, MachineFunctionAnalysisManager &MFAM)