LLVM 20.0.0git
SIInstrInfo.h
Go to the documentation of this file.
1//===- SIInstrInfo.h - SI Instruction Info Interface ------------*- C++ -*-===//
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/// Interface definition for SIInstrInfo.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_LIB_TARGET_AMDGPU_SIINSTRINFO_H
15#define LLVM_LIB_TARGET_AMDGPU_SIINSTRINFO_H
16
17#include "AMDGPUMIRFormatter.h"
19#include "SIRegisterInfo.h"
21#include "llvm/ADT/SetVector.h"
24
25#define GET_INSTRINFO_HEADER
26#include "AMDGPUGenInstrInfo.inc"
27
28namespace llvm {
29
30class APInt;
31class GCNSubtarget;
32class LiveVariables;
33class MachineDominatorTree;
34class MachineRegisterInfo;
35class RegScavenger;
36class TargetRegisterClass;
37class ScheduleHazardRecognizer;
38
39constexpr unsigned DefaultMemoryClusterDWordsLimit = 8;
40
41/// Mark the MMO of a uniform load if there are no potentially clobbering stores
42/// on any path from the start of an entry function to this load.
45
46/// Mark the MMO of a load as the last use.
49
50/// Utility to store machine instructions worklist.
52 SIInstrWorklist() = default;
53
54 void insert(MachineInstr *MI);
55
56 MachineInstr *top() const {
57 const auto *iter = InstrList.begin();
58 return *iter;
59 }
60
61 void erase_top() {
62 const auto *iter = InstrList.begin();
63 InstrList.erase(iter);
64 }
65
66 bool empty() const { return InstrList.empty(); }
67
68 void clear() {
69 InstrList.clear();
70 DeferredList.clear();
71 }
72
74
75 SetVector<MachineInstr *> &getDeferredList() { return DeferredList; }
76
77private:
78 /// InstrList contains the MachineInstrs.
80 /// Deferred instructions are specific MachineInstr
81 /// that will be added by insert method.
82 SetVector<MachineInstr *> DeferredList;
83};
84
85class SIInstrInfo final : public AMDGPUGenInstrInfo {
86private:
87 const SIRegisterInfo RI;
88 const GCNSubtarget &ST;
89 TargetSchedModel SchedModel;
90 mutable std::unique_ptr<AMDGPUMIRFormatter> Formatter;
91
92 // The inverse predicate should have the negative value.
93 enum BranchPredicate {
94 INVALID_BR = 0,
95 SCC_TRUE = 1,
96 SCC_FALSE = -1,
97 VCCNZ = 2,
98 VCCZ = -2,
99 EXECNZ = -3,
100 EXECZ = 3
101 };
102
104
105 static unsigned getBranchOpcode(BranchPredicate Cond);
106 static BranchPredicate getBranchPredicate(unsigned Opcode);
107
108public:
111 const MachineOperand &SuperReg,
112 const TargetRegisterClass *SuperRC,
113 unsigned SubIdx,
114 const TargetRegisterClass *SubRC) const;
117 const MachineOperand &SuperReg, const TargetRegisterClass *SuperRC,
118 unsigned SubIdx, const TargetRegisterClass *SubRC) const;
119
120private:
121 void swapOperands(MachineInstr &Inst) const;
122
123 std::pair<bool, MachineBasicBlock *>
124 moveScalarAddSub(SIInstrWorklist &Worklist, MachineInstr &Inst,
125 MachineDominatorTree *MDT = nullptr) const;
126
127 void lowerSelect(SIInstrWorklist &Worklist, MachineInstr &Inst,
128 MachineDominatorTree *MDT = nullptr) const;
129
130 void lowerScalarAbs(SIInstrWorklist &Worklist, MachineInstr &Inst) const;
131
132 void lowerScalarXnor(SIInstrWorklist &Worklist, MachineInstr &Inst) const;
133
134 void splitScalarNotBinop(SIInstrWorklist &Worklist, MachineInstr &Inst,
135 unsigned Opcode) const;
136
137 void splitScalarBinOpN2(SIInstrWorklist &Worklist, MachineInstr &Inst,
138 unsigned Opcode) const;
139
140 void splitScalar64BitUnaryOp(SIInstrWorklist &Worklist, MachineInstr &Inst,
141 unsigned Opcode, bool Swap = false) const;
142
143 void splitScalar64BitBinaryOp(SIInstrWorklist &Worklist, MachineInstr &Inst,
144 unsigned Opcode,
145 MachineDominatorTree *MDT = nullptr) const;
146
147 void splitScalarSMulU64(SIInstrWorklist &Worklist, MachineInstr &Inst,
148 MachineDominatorTree *MDT) const;
149
150 void splitScalarSMulPseudo(SIInstrWorklist &Worklist, MachineInstr &Inst,
151 MachineDominatorTree *MDT) const;
152
153 void splitScalar64BitXnor(SIInstrWorklist &Worklist, MachineInstr &Inst,
154 MachineDominatorTree *MDT = nullptr) const;
155
156 void splitScalar64BitBCNT(SIInstrWorklist &Worklist,
157 MachineInstr &Inst) const;
158 void splitScalar64BitBFE(SIInstrWorklist &Worklist, MachineInstr &Inst) const;
159 void splitScalar64BitCountOp(SIInstrWorklist &Worklist, MachineInstr &Inst,
160 unsigned Opcode,
161 MachineDominatorTree *MDT = nullptr) const;
162 void movePackToVALU(SIInstrWorklist &Worklist, MachineRegisterInfo &MRI,
163 MachineInstr &Inst) const;
164
165 void addUsersToMoveToVALUWorklist(Register Reg, MachineRegisterInfo &MRI,
166 SIInstrWorklist &Worklist) const;
167
168 void addSCCDefUsersToVALUWorklist(MachineOperand &Op,
169 MachineInstr &SCCDefInst,
170 SIInstrWorklist &Worklist,
171 Register NewCond = Register()) const;
172 void addSCCDefsToVALUWorklist(MachineInstr *SCCUseInst,
173 SIInstrWorklist &Worklist) const;
174
175 const TargetRegisterClass *
176 getDestEquivalentVGPRClass(const MachineInstr &Inst) const;
177
178 bool checkInstOffsetsDoNotOverlap(const MachineInstr &MIa,
179 const MachineInstr &MIb) const;
180
181 Register findUsedSGPR(const MachineInstr &MI, int OpIndices[3]) const;
182
183 bool verifyCopy(const MachineInstr &MI, const MachineRegisterInfo &MRI,
184 StringRef &ErrInfo) const;
185
186protected:
187 /// If the specific machine instruction is a instruction that moves/copies
188 /// value from one register to another register return destination and source
189 /// registers as machine operands.
190 std::optional<DestSourcePair>
191 isCopyInstrImpl(const MachineInstr &MI) const override;
192
194 MachineOperand &Src0, unsigned Src0OpName,
195 MachineOperand &Src1, unsigned Src1OpName) const;
196
198 unsigned OpIdx0,
199 unsigned OpIdx1) const override;
200
201public:
203 MO_MASK = 0xf,
204
206 // MO_GOTPCREL -> symbol@GOTPCREL -> R_AMDGPU_GOTPCREL.
208 // MO_GOTPCREL32_LO -> symbol@gotpcrel32@lo -> R_AMDGPU_GOTPCREL32_LO.
211 // MO_GOTPCREL32_HI -> symbol@gotpcrel32@hi -> R_AMDGPU_GOTPCREL32_HI.
213 // MO_REL32_LO -> symbol@rel32@lo -> R_AMDGPU_REL32_LO.
216 // MO_REL32_HI -> symbol@rel32@hi -> R_AMDGPU_REL32_HI.
218
220
223 };
224
225 explicit SIInstrInfo(const GCNSubtarget &ST);
226
228 return RI;
229 }
230
231 const GCNSubtarget &getSubtarget() const {
232 return ST;
233 }
234
235 bool isReallyTriviallyReMaterializable(const MachineInstr &MI) const override;
236
237 bool isIgnorableUse(const MachineOperand &MO) const override;
238
239 bool isSafeToSink(MachineInstr &MI, MachineBasicBlock *SuccToSinkTo,
240 MachineCycleInfo *CI) const override;
241
242 bool areLoadsFromSameBasePtr(SDNode *Load0, SDNode *Load1, int64_t &Offset0,
243 int64_t &Offset1) const override;
244
246 const MachineInstr &LdSt,
248 bool &OffsetIsScalable, LocationSize &Width,
249 const TargetRegisterInfo *TRI) const final;
250
252 int64_t Offset1, bool OffsetIsScalable1,
254 int64_t Offset2, bool OffsetIsScalable2,
255 unsigned ClusterSize,
256 unsigned NumBytes) const override;
257
258 bool shouldScheduleLoadsNear(SDNode *Load0, SDNode *Load1, int64_t Offset0,
259 int64_t Offset1, unsigned NumLoads) const override;
260
262 const DebugLoc &DL, MCRegister DestReg, MCRegister SrcReg,
263 bool KillSrc, bool RenamableDest = false,
264 bool RenamableSrc = false) const override;
265
268 Register DestReg, int64_t Value) const;
269
271 unsigned Size) const;
272
275 Register SrcReg, int Value) const;
276
279 Register SrcReg, int Value) const;
280
283 bool isKill, int FrameIndex,
284 const TargetRegisterClass *RC,
285 const TargetRegisterInfo *TRI,
286 Register VReg) const override;
287
290 int FrameIndex, const TargetRegisterClass *RC,
291 const TargetRegisterInfo *TRI,
292 Register VReg) const override;
293
294 bool expandPostRAPseudo(MachineInstr &MI) const override;
295
297 Register DestReg, unsigned SubIdx,
298 const MachineInstr &Orig,
299 const TargetRegisterInfo &TRI) const override;
300
301 // Splits a V_MOV_B64_DPP_PSEUDO opcode into a pair of v_mov_b32_dpp
302 // instructions. Returns a pair of generated instructions.
303 // Can split either post-RA with physical registers or pre-RA with
304 // virtual registers. In latter case IR needs to be in SSA form and
305 // and a REG_SEQUENCE is produced to define original register.
306 std::pair<MachineInstr*, MachineInstr*>
308
309 // Returns an opcode that can be used to move a value to a \p DstRC
310 // register. If there is no hardware instruction that can store to \p
311 // DstRC, then AMDGPU::COPY is returned.
312 unsigned getMovOpcode(const TargetRegisterClass *DstRC) const;
313
314 const MCInstrDesc &getIndirectRegWriteMovRelPseudo(unsigned VecSize,
315 unsigned EltSize,
316 bool IsSGPR) const;
317
318 const MCInstrDesc &getIndirectGPRIDXPseudo(unsigned VecSize,
319 bool IsIndirectSrc) const;
321 int commuteOpcode(unsigned Opc) const;
322
324 inline int commuteOpcode(const MachineInstr &MI) const {
325 return commuteOpcode(MI.getOpcode());
326 }
327
328 bool findCommutedOpIndices(const MachineInstr &MI, unsigned &SrcOpIdx0,
329 unsigned &SrcOpIdx1) const override;
330
331 bool findCommutedOpIndices(const MCInstrDesc &Desc, unsigned &SrcOpIdx0,
332 unsigned &SrcOpIdx1) const;
333
334 bool isBranchOffsetInRange(unsigned BranchOpc,
335 int64_t BrOffset) const override;
336
337 MachineBasicBlock *getBranchDestBlock(const MachineInstr &MI) const override;
338
339 /// Return whether the block terminate with divergent branch.
340 /// Note this only work before lowering the pseudo control flow instructions.
341 bool hasDivergentBranch(const MachineBasicBlock *MBB) const;
342
344 MachineBasicBlock &NewDestBB,
345 MachineBasicBlock &RestoreBB, const DebugLoc &DL,
346 int64_t BrOffset, RegScavenger *RS) const override;
347
351 MachineBasicBlock *&FBB,
353 bool AllowModify) const;
354
356 MachineBasicBlock *&FBB,
358 bool AllowModify = false) const override;
359
361 int *BytesRemoved = nullptr) const override;
362
365 const DebugLoc &DL,
366 int *BytesAdded = nullptr) const override;
367
369 SmallVectorImpl<MachineOperand> &Cond) const override;
370
373 Register TrueReg, Register FalseReg, int &CondCycles,
374 int &TrueCycles, int &FalseCycles) const override;
375
379 Register TrueReg, Register FalseReg) const override;
380
384 Register TrueReg, Register FalseReg) const;
385
386 bool analyzeCompare(const MachineInstr &MI, Register &SrcReg,
387 Register &SrcReg2, int64_t &CmpMask,
388 int64_t &CmpValue) const override;
389
390 bool optimizeCompareInstr(MachineInstr &CmpInstr, Register SrcReg,
391 Register SrcReg2, int64_t CmpMask, int64_t CmpValue,
392 const MachineRegisterInfo *MRI) const override;
393
394 bool
396 const MachineInstr &MIb) const override;
397
398 static bool isFoldableCopy(const MachineInstr &MI);
399
400 void removeModOperands(MachineInstr &MI) const;
401
403 MachineRegisterInfo *MRI) const final;
404
405 unsigned getMachineCSELookAheadLimit() const override { return 500; }
406
408 LiveIntervals *LIS) const override;
409
411 const MachineBasicBlock *MBB,
412 const MachineFunction &MF) const override;
413
414 static bool isSALU(const MachineInstr &MI) {
415 return MI.getDesc().TSFlags & SIInstrFlags::SALU;
416 }
417
418 bool isSALU(uint16_t Opcode) const {
419 return get(Opcode).TSFlags & SIInstrFlags::SALU;
420 }
421
422 static bool isVALU(const MachineInstr &MI) {
423 return MI.getDesc().TSFlags & SIInstrFlags::VALU;
424 }
425
426 bool isVALU(uint16_t Opcode) const {
427 return get(Opcode).TSFlags & SIInstrFlags::VALU;
428 }
429
430 static bool isImage(const MachineInstr &MI) {
431 return isMIMG(MI) || isVSAMPLE(MI) || isVIMAGE(MI);
432 }
433
434 bool isImage(uint16_t Opcode) const {
435 return isMIMG(Opcode) || isVSAMPLE(Opcode) || isVIMAGE(Opcode);
436 }
437
438 static bool isVMEM(const MachineInstr &MI) {
439 return isMUBUF(MI) || isMTBUF(MI) || isImage(MI);
440 }
441
442 bool isVMEM(uint16_t Opcode) const {
443 return isMUBUF(Opcode) || isMTBUF(Opcode) || isImage(Opcode);
444 }
445
446 static bool isSOP1(const MachineInstr &MI) {
447 return MI.getDesc().TSFlags & SIInstrFlags::SOP1;
448 }
449
450 bool isSOP1(uint16_t Opcode) const {
451 return get(Opcode).TSFlags & SIInstrFlags::SOP1;
452 }
453
454 static bool isSOP2(const MachineInstr &MI) {
455 return MI.getDesc().TSFlags & SIInstrFlags::SOP2;
456 }
457
458 bool isSOP2(uint16_t Opcode) const {
459 return get(Opcode).TSFlags & SIInstrFlags::SOP2;
460 }
461
462 static bool isSOPC(const MachineInstr &MI) {
463 return MI.getDesc().TSFlags & SIInstrFlags::SOPC;
464 }
465
466 bool isSOPC(uint16_t Opcode) const {
467 return get(Opcode).TSFlags & SIInstrFlags::SOPC;
468 }
469
470 static bool isSOPK(const MachineInstr &MI) {
471 return MI.getDesc().TSFlags & SIInstrFlags::SOPK;
472 }
473
474 bool isSOPK(uint16_t Opcode) const {
475 return get(Opcode).TSFlags & SIInstrFlags::SOPK;
476 }
477
478 static bool isSOPP(const MachineInstr &MI) {
479 return MI.getDesc().TSFlags & SIInstrFlags::SOPP;
480 }
481
482 bool isSOPP(uint16_t Opcode) const {
483 return get(Opcode).TSFlags & SIInstrFlags::SOPP;
484 }
485
486 static bool isPacked(const MachineInstr &MI) {
487 return MI.getDesc().TSFlags & SIInstrFlags::IsPacked;
488 }
489
490 bool isPacked(uint16_t Opcode) const {
491 return get(Opcode).TSFlags & SIInstrFlags::IsPacked;
492 }
493
494 static bool isVOP1(const MachineInstr &MI) {
495 return MI.getDesc().TSFlags & SIInstrFlags::VOP1;
496 }
497
498 bool isVOP1(uint16_t Opcode) const {
499 return get(Opcode).TSFlags & SIInstrFlags::VOP1;
500 }
501
502 static bool isVOP2(const MachineInstr &MI) {
503 return MI.getDesc().TSFlags & SIInstrFlags::VOP2;
504 }
505
506 bool isVOP2(uint16_t Opcode) const {
507 return get(Opcode).TSFlags & SIInstrFlags::VOP2;
508 }
509
510 static bool isVOP3(const MachineInstr &MI) {
511 return MI.getDesc().TSFlags & SIInstrFlags::VOP3;
512 }
513
514 bool isVOP3(uint16_t Opcode) const {
515 return get(Opcode).TSFlags & SIInstrFlags::VOP3;
516 }
517
518 static bool isSDWA(const MachineInstr &MI) {
519 return MI.getDesc().TSFlags & SIInstrFlags::SDWA;
520 }
521
522 bool isSDWA(uint16_t Opcode) const {
523 return get(Opcode).TSFlags & SIInstrFlags::SDWA;
524 }
525
526 static bool isVOPC(const MachineInstr &MI) {
527 return MI.getDesc().TSFlags & SIInstrFlags::VOPC;
528 }
529
530 bool isVOPC(uint16_t Opcode) const {
531 return get(Opcode).TSFlags & SIInstrFlags::VOPC;
532 }
533
534 static bool isMUBUF(const MachineInstr &MI) {
535 return MI.getDesc().TSFlags & SIInstrFlags::MUBUF;
536 }
537
538 bool isMUBUF(uint16_t Opcode) const {
539 return get(Opcode).TSFlags & SIInstrFlags::MUBUF;
540 }
541
542 static bool isMTBUF(const MachineInstr &MI) {
543 return MI.getDesc().TSFlags & SIInstrFlags::MTBUF;
544 }
545
546 bool isMTBUF(uint16_t Opcode) const {
547 return get(Opcode).TSFlags & SIInstrFlags::MTBUF;
548 }
549
550 static bool isSMRD(const MachineInstr &MI) {
551 return MI.getDesc().TSFlags & SIInstrFlags::SMRD;
552 }
553
554 bool isSMRD(uint16_t Opcode) const {
555 return get(Opcode).TSFlags & SIInstrFlags::SMRD;
556 }
557
558 bool isBufferSMRD(const MachineInstr &MI) const;
559
560 static bool isDS(const MachineInstr &MI) {
561 return MI.getDesc().TSFlags & SIInstrFlags::DS;
562 }
563
564 bool isDS(uint16_t Opcode) const {
565 return get(Opcode).TSFlags & SIInstrFlags::DS;
566 }
567
568 static bool isLDSDMA(const MachineInstr &MI) {
569 return isVALU(MI) && (isMUBUF(MI) || isFLAT(MI));
570 }
571
572 bool isLDSDMA(uint16_t Opcode) {
573 return isVALU(Opcode) && (isMUBUF(Opcode) || isFLAT(Opcode));
574 }
575
576 static bool isGWS(const MachineInstr &MI) {
577 return MI.getDesc().TSFlags & SIInstrFlags::GWS;
578 }
579
580 bool isGWS(uint16_t Opcode) const {
581 return get(Opcode).TSFlags & SIInstrFlags::GWS;
582 }
583
584 bool isAlwaysGDS(uint16_t Opcode) const;
585
586 static bool isMIMG(const MachineInstr &MI) {
587 return MI.getDesc().TSFlags & SIInstrFlags::MIMG;
588 }
589
590 bool isMIMG(uint16_t Opcode) const {
591 return get(Opcode).TSFlags & SIInstrFlags::MIMG;
592 }
593
594 static bool isVIMAGE(const MachineInstr &MI) {
595 return MI.getDesc().TSFlags & SIInstrFlags::VIMAGE;
596 }
597
598 bool isVIMAGE(uint16_t Opcode) const {
599 return get(Opcode).TSFlags & SIInstrFlags::VIMAGE;
600 }
601
602 static bool isVSAMPLE(const MachineInstr &MI) {
603 return MI.getDesc().TSFlags & SIInstrFlags::VSAMPLE;
604 }
605
606 bool isVSAMPLE(uint16_t Opcode) const {
607 return get(Opcode).TSFlags & SIInstrFlags::VSAMPLE;
608 }
609
610 static bool isGather4(const MachineInstr &MI) {
611 return MI.getDesc().TSFlags & SIInstrFlags::Gather4;
612 }
613
614 bool isGather4(uint16_t Opcode) const {
615 return get(Opcode).TSFlags & SIInstrFlags::Gather4;
616 }
617
618 static bool isFLAT(const MachineInstr &MI) {
619 return MI.getDesc().TSFlags & SIInstrFlags::FLAT;
620 }
621
622 // Is a FLAT encoded instruction which accesses a specific segment,
623 // i.e. global_* or scratch_*.
625 auto Flags = MI.getDesc().TSFlags;
627 }
628
629 bool isSegmentSpecificFLAT(uint16_t Opcode) const {
630 auto Flags = get(Opcode).TSFlags;
632 }
633
634 static bool isFLATGlobal(const MachineInstr &MI) {
635 return MI.getDesc().TSFlags & SIInstrFlags::FlatGlobal;
636 }
637
638 bool isFLATGlobal(uint16_t Opcode) const {
639 return get(Opcode).TSFlags & SIInstrFlags::FlatGlobal;
640 }
641
642 static bool isFLATScratch(const MachineInstr &MI) {
643 return MI.getDesc().TSFlags & SIInstrFlags::FlatScratch;
644 }
645
646 bool isFLATScratch(uint16_t Opcode) const {
647 return get(Opcode).TSFlags & SIInstrFlags::FlatScratch;
648 }
649
650 // Any FLAT encoded instruction, including global_* and scratch_*.
651 bool isFLAT(uint16_t Opcode) const {
652 return get(Opcode).TSFlags & SIInstrFlags::FLAT;
653 }
654
655 static bool isEXP(const MachineInstr &MI) {
656 return MI.getDesc().TSFlags & SIInstrFlags::EXP;
657 }
658
660 if (!isEXP(MI))
661 return false;
662 unsigned Target = MI.getOperand(0).getImm();
665 }
666
667 bool isEXP(uint16_t Opcode) const {
668 return get(Opcode).TSFlags & SIInstrFlags::EXP;
669 }
670
671 static bool isAtomicNoRet(const MachineInstr &MI) {
672 return MI.getDesc().TSFlags & SIInstrFlags::IsAtomicNoRet;
673 }
674
675 bool isAtomicNoRet(uint16_t Opcode) const {
676 return get(Opcode).TSFlags & SIInstrFlags::IsAtomicNoRet;
677 }
678
679 static bool isAtomicRet(const MachineInstr &MI) {
680 return MI.getDesc().TSFlags & SIInstrFlags::IsAtomicRet;
681 }
682
683 bool isAtomicRet(uint16_t Opcode) const {
684 return get(Opcode).TSFlags & SIInstrFlags::IsAtomicRet;
685 }
686
687 static bool isAtomic(const MachineInstr &MI) {
688 return MI.getDesc().TSFlags & (SIInstrFlags::IsAtomicRet |
690 }
691
692 bool isAtomic(uint16_t Opcode) const {
693 return get(Opcode).TSFlags & (SIInstrFlags::IsAtomicRet |
695 }
696
698 return isLDSDMA(MI) && MI.getOpcode() != AMDGPU::BUFFER_STORE_LDS_DWORD;
699 }
700
701 static bool isWQM(const MachineInstr &MI) {
702 return MI.getDesc().TSFlags & SIInstrFlags::WQM;
703 }
704
705 bool isWQM(uint16_t Opcode) const {
706 return get(Opcode).TSFlags & SIInstrFlags::WQM;
707 }
708
709 static bool isDisableWQM(const MachineInstr &MI) {
710 return MI.getDesc().TSFlags & SIInstrFlags::DisableWQM;
711 }
712
713 bool isDisableWQM(uint16_t Opcode) const {
714 return get(Opcode).TSFlags & SIInstrFlags::DisableWQM;
715 }
716
717 // SI_SPILL_S32_TO_VGPR and SI_RESTORE_S32_FROM_VGPR form a special case of
718 // SGPRs spilling to VGPRs which are SGPR spills but from VALU instructions
719 // therefore we need an explicit check for them since just checking if the
720 // Spill bit is set and what instruction type it came from misclassifies
721 // them.
722 static bool isVGPRSpill(const MachineInstr &MI) {
723 return MI.getOpcode() != AMDGPU::SI_SPILL_S32_TO_VGPR &&
724 MI.getOpcode() != AMDGPU::SI_RESTORE_S32_FROM_VGPR &&
725 (isSpill(MI) && isVALU(MI));
726 }
727
728 bool isVGPRSpill(uint16_t Opcode) const {
729 return Opcode != AMDGPU::SI_SPILL_S32_TO_VGPR &&
730 Opcode != AMDGPU::SI_RESTORE_S32_FROM_VGPR &&
731 (isSpill(Opcode) && isVALU(Opcode));
732 }
733
734 static bool isSGPRSpill(const MachineInstr &MI) {
735 return MI.getOpcode() == AMDGPU::SI_SPILL_S32_TO_VGPR ||
736 MI.getOpcode() == AMDGPU::SI_RESTORE_S32_FROM_VGPR ||
737 (isSpill(MI) && isSALU(MI));
738 }
739
740 bool isSGPRSpill(uint16_t Opcode) const {
741 return Opcode == AMDGPU::SI_SPILL_S32_TO_VGPR ||
742 Opcode == AMDGPU::SI_RESTORE_S32_FROM_VGPR ||
743 (isSpill(Opcode) && isSALU(Opcode));
744 }
745
746 bool isSpill(uint16_t Opcode) const {
747 return get(Opcode).TSFlags & SIInstrFlags::Spill;
748 }
749
750 static bool isSpill(const MachineInstr &MI) {
751 return MI.getDesc().TSFlags & SIInstrFlags::Spill;
752 }
753
754 static bool isWWMRegSpillOpcode(uint16_t Opcode) {
755 return Opcode == AMDGPU::SI_SPILL_WWM_V32_SAVE ||
756 Opcode == AMDGPU::SI_SPILL_WWM_AV32_SAVE ||
757 Opcode == AMDGPU::SI_SPILL_WWM_V32_RESTORE ||
758 Opcode == AMDGPU::SI_SPILL_WWM_AV32_RESTORE;
759 }
760
761 static bool isChainCallOpcode(uint64_t Opcode) {
762 return Opcode == AMDGPU::SI_CS_CHAIN_TC_W32 ||
763 Opcode == AMDGPU::SI_CS_CHAIN_TC_W64;
764 }
765
766 static bool isDPP(const MachineInstr &MI) {
767 return MI.getDesc().TSFlags & SIInstrFlags::DPP;
768 }
769
770 bool isDPP(uint16_t Opcode) const {
771 return get(Opcode).TSFlags & SIInstrFlags::DPP;
772 }
773
774 static bool isTRANS(const MachineInstr &MI) {
775 return MI.getDesc().TSFlags & SIInstrFlags::TRANS;
776 }
777
778 bool isTRANS(uint16_t Opcode) const {
779 return get(Opcode).TSFlags & SIInstrFlags::TRANS;
780 }
781
782 static bool isVOP3P(const MachineInstr &MI) {
783 return MI.getDesc().TSFlags & SIInstrFlags::VOP3P;
784 }
785
786 bool isVOP3P(uint16_t Opcode) const {
787 return get(Opcode).TSFlags & SIInstrFlags::VOP3P;
788 }
789
790 static bool isVINTRP(const MachineInstr &MI) {
791 return MI.getDesc().TSFlags & SIInstrFlags::VINTRP;
792 }
793
794 bool isVINTRP(uint16_t Opcode) const {
795 return get(Opcode).TSFlags & SIInstrFlags::VINTRP;
796 }
797
798 static bool isMAI(const MachineInstr &MI) {
799 return MI.getDesc().TSFlags & SIInstrFlags::IsMAI;
800 }
801
802 bool isMAI(uint16_t Opcode) const {
803 return get(Opcode).TSFlags & SIInstrFlags::IsMAI;
804 }
805
806 static bool isMFMA(const MachineInstr &MI) {
807 return isMAI(MI) && MI.getOpcode() != AMDGPU::V_ACCVGPR_WRITE_B32_e64 &&
808 MI.getOpcode() != AMDGPU::V_ACCVGPR_READ_B32_e64;
809 }
810
811 static bool isDOT(const MachineInstr &MI) {
812 return MI.getDesc().TSFlags & SIInstrFlags::IsDOT;
813 }
814
815 static bool isWMMA(const MachineInstr &MI) {
816 return MI.getDesc().TSFlags & SIInstrFlags::IsWMMA;
817 }
818
819 bool isWMMA(uint16_t Opcode) const {
820 return get(Opcode).TSFlags & SIInstrFlags::IsWMMA;
821 }
822
823 static bool isMFMAorWMMA(const MachineInstr &MI) {
824 return isMFMA(MI) || isWMMA(MI) || isSWMMAC(MI);
825 }
826
827 static bool isSWMMAC(const MachineInstr &MI) {
828 return MI.getDesc().TSFlags & SIInstrFlags::IsSWMMAC;
829 }
830
831 bool isSWMMAC(uint16_t Opcode) const {
832 return get(Opcode).TSFlags & SIInstrFlags::IsSWMMAC;
833 }
834
835 bool isDOT(uint16_t Opcode) const {
836 return get(Opcode).TSFlags & SIInstrFlags::IsDOT;
837 }
838
839 static bool isLDSDIR(const MachineInstr &MI) {
840 return MI.getDesc().TSFlags & SIInstrFlags::LDSDIR;
841 }
842
843 bool isLDSDIR(uint16_t Opcode) const {
844 return get(Opcode).TSFlags & SIInstrFlags::LDSDIR;
845 }
846
847 static bool isVINTERP(const MachineInstr &MI) {
848 return MI.getDesc().TSFlags & SIInstrFlags::VINTERP;
849 }
850
851 bool isVINTERP(uint16_t Opcode) const {
852 return get(Opcode).TSFlags & SIInstrFlags::VINTERP;
853 }
854
855 static bool isScalarUnit(const MachineInstr &MI) {
856 return MI.getDesc().TSFlags & (SIInstrFlags::SALU | SIInstrFlags::SMRD);
857 }
858
859 static bool usesVM_CNT(const MachineInstr &MI) {
860 return MI.getDesc().TSFlags & SIInstrFlags::VM_CNT;
861 }
862
863 static bool usesLGKM_CNT(const MachineInstr &MI) {
864 return MI.getDesc().TSFlags & SIInstrFlags::LGKM_CNT;
865 }
866
867 // Most sopk treat the immediate as a signed 16-bit, however some
868 // use it as unsigned.
869 static bool sopkIsZext(unsigned Opcode) {
870 return Opcode == AMDGPU::S_CMPK_EQ_U32 || Opcode == AMDGPU::S_CMPK_LG_U32 ||
871 Opcode == AMDGPU::S_CMPK_GT_U32 || Opcode == AMDGPU::S_CMPK_GE_U32 ||
872 Opcode == AMDGPU::S_CMPK_LT_U32 || Opcode == AMDGPU::S_CMPK_LE_U32 ||
873 Opcode == AMDGPU::S_GETREG_B32;
874 }
875
876 /// \returns true if this is an s_store_dword* instruction. This is more
877 /// specific than isSMEM && mayStore.
878 static bool isScalarStore(const MachineInstr &MI) {
879 return MI.getDesc().TSFlags & SIInstrFlags::SCALAR_STORE;
880 }
881
882 bool isScalarStore(uint16_t Opcode) const {
883 return get(Opcode).TSFlags & SIInstrFlags::SCALAR_STORE;
884 }
885
886 static bool isFixedSize(const MachineInstr &MI) {
887 return MI.getDesc().TSFlags & SIInstrFlags::FIXED_SIZE;
888 }
889
890 bool isFixedSize(uint16_t Opcode) const {
891 return get(Opcode).TSFlags & SIInstrFlags::FIXED_SIZE;
892 }
893
894 static bool hasFPClamp(const MachineInstr &MI) {
895 return MI.getDesc().TSFlags & SIInstrFlags::FPClamp;
896 }
897
898 bool hasFPClamp(uint16_t Opcode) const {
899 return get(Opcode).TSFlags & SIInstrFlags::FPClamp;
900 }
901
902 static bool hasIntClamp(const MachineInstr &MI) {
903 return MI.getDesc().TSFlags & SIInstrFlags::IntClamp;
904 }
905
907 const uint64_t ClampFlags = SIInstrFlags::FPClamp |
911 return MI.getDesc().TSFlags & ClampFlags;
912 }
913
914 static bool usesFPDPRounding(const MachineInstr &MI) {
915 return MI.getDesc().TSFlags & SIInstrFlags::FPDPRounding;
916 }
917
918 bool usesFPDPRounding(uint16_t Opcode) const {
919 return get(Opcode).TSFlags & SIInstrFlags::FPDPRounding;
920 }
921
922 static bool isFPAtomic(const MachineInstr &MI) {
923 return MI.getDesc().TSFlags & SIInstrFlags::FPAtomic;
924 }
925
926 bool isFPAtomic(uint16_t Opcode) const {
927 return get(Opcode).TSFlags & SIInstrFlags::FPAtomic;
928 }
929
930 static bool isNeverUniform(const MachineInstr &MI) {
931 return MI.getDesc().TSFlags & SIInstrFlags::IsNeverUniform;
932 }
933
934 // Check to see if opcode is for a barrier start. Pre gfx12 this is just the
935 // S_BARRIER, but after support for S_BARRIER_SIGNAL* / S_BARRIER_WAIT we want
936 // to check for the barrier start (S_BARRIER_SIGNAL*)
937 bool isBarrierStart(unsigned Opcode) const {
938 return Opcode == AMDGPU::S_BARRIER ||
939 Opcode == AMDGPU::S_BARRIER_SIGNAL_M0 ||
940 Opcode == AMDGPU::S_BARRIER_SIGNAL_ISFIRST_M0 ||
941 Opcode == AMDGPU::S_BARRIER_SIGNAL_IMM ||
942 Opcode == AMDGPU::S_BARRIER_SIGNAL_ISFIRST_IMM;
943 }
944
945 bool isBarrier(unsigned Opcode) const {
946 return isBarrierStart(Opcode) || Opcode == AMDGPU::S_BARRIER_WAIT ||
947 Opcode == AMDGPU::S_BARRIER_INIT_M0 ||
948 Opcode == AMDGPU::S_BARRIER_INIT_IMM ||
949 Opcode == AMDGPU::S_BARRIER_JOIN_IMM ||
950 Opcode == AMDGPU::S_BARRIER_LEAVE ||
951 Opcode == AMDGPU::S_BARRIER_LEAVE_IMM ||
952 Opcode == AMDGPU::DS_GWS_INIT || Opcode == AMDGPU::DS_GWS_BARRIER;
953 }
954
955 static bool isF16PseudoScalarTrans(unsigned Opcode) {
956 return Opcode == AMDGPU::V_S_EXP_F16_e64 ||
957 Opcode == AMDGPU::V_S_LOG_F16_e64 ||
958 Opcode == AMDGPU::V_S_RCP_F16_e64 ||
959 Opcode == AMDGPU::V_S_RSQ_F16_e64 ||
960 Opcode == AMDGPU::V_S_SQRT_F16_e64;
961 }
962
964 return MI.getDesc().TSFlags & SIInstrFlags::TiedSourceNotRead;
965 }
966
967 bool doesNotReadTiedSource(uint16_t Opcode) const {
968 return get(Opcode).TSFlags & SIInstrFlags::TiedSourceNotRead;
969 }
970
971 static unsigned getNonSoftWaitcntOpcode(unsigned Opcode) {
972 switch (Opcode) {
973 case AMDGPU::S_WAITCNT_soft:
974 return AMDGPU::S_WAITCNT;
975 case AMDGPU::S_WAITCNT_VSCNT_soft:
976 return AMDGPU::S_WAITCNT_VSCNT;
977 case AMDGPU::S_WAIT_LOADCNT_soft:
978 return AMDGPU::S_WAIT_LOADCNT;
979 case AMDGPU::S_WAIT_STORECNT_soft:
980 return AMDGPU::S_WAIT_STORECNT;
981 case AMDGPU::S_WAIT_SAMPLECNT_soft:
982 return AMDGPU::S_WAIT_SAMPLECNT;
983 case AMDGPU::S_WAIT_BVHCNT_soft:
984 return AMDGPU::S_WAIT_BVHCNT;
985 case AMDGPU::S_WAIT_DSCNT_soft:
986 return AMDGPU::S_WAIT_DSCNT;
987 case AMDGPU::S_WAIT_KMCNT_soft:
988 return AMDGPU::S_WAIT_KMCNT;
989 default:
990 return Opcode;
991 }
992 }
993
994 bool isWaitcnt(unsigned Opcode) const {
995 switch (getNonSoftWaitcntOpcode(Opcode)) {
996 case AMDGPU::S_WAITCNT:
997 case AMDGPU::S_WAITCNT_VSCNT:
998 case AMDGPU::S_WAITCNT_VMCNT:
999 case AMDGPU::S_WAITCNT_EXPCNT:
1000 case AMDGPU::S_WAITCNT_LGKMCNT:
1001 case AMDGPU::S_WAIT_LOADCNT:
1002 case AMDGPU::S_WAIT_LOADCNT_DSCNT:
1003 case AMDGPU::S_WAIT_STORECNT:
1004 case AMDGPU::S_WAIT_STORECNT_DSCNT:
1005 case AMDGPU::S_WAIT_SAMPLECNT:
1006 case AMDGPU::S_WAIT_BVHCNT:
1007 case AMDGPU::S_WAIT_EXPCNT:
1008 case AMDGPU::S_WAIT_DSCNT:
1009 case AMDGPU::S_WAIT_KMCNT:
1010 case AMDGPU::S_WAIT_IDLE:
1011 return true;
1012 default:
1013 return false;
1014 }
1015 }
1016
1017 bool isVGPRCopy(const MachineInstr &MI) const {
1018 assert(isCopyInstr(MI));
1019 Register Dest = MI.getOperand(0).getReg();
1020 const MachineFunction &MF = *MI.getParent()->getParent();
1021 const MachineRegisterInfo &MRI = MF.getRegInfo();
1022 return !RI.isSGPRReg(MRI, Dest);
1023 }
1024
1025 bool hasVGPRUses(const MachineInstr &MI) const {
1026 const MachineFunction &MF = *MI.getParent()->getParent();
1027 const MachineRegisterInfo &MRI = MF.getRegInfo();
1028 return llvm::any_of(MI.explicit_uses(),
1029 [&MRI, this](const MachineOperand &MO) {
1030 return MO.isReg() && RI.isVGPR(MRI, MO.getReg());});
1031 }
1032
1033 /// Return true if the instruction modifies the mode register.q
1034 static bool modifiesModeRegister(const MachineInstr &MI);
1035
1036 /// This function is used to determine if an instruction can be safely
1037 /// executed under EXEC = 0 without hardware error, indeterminate results,
1038 /// and/or visible effects on future vector execution or outside the shader.
1039 /// Note: as of 2024 the only use of this is SIPreEmitPeephole where it is
1040 /// used in removing branches over short EXEC = 0 sequences.
1041 /// As such it embeds certain assumptions which may not apply to every case
1042 /// of EXEC = 0 execution.
1044
1045 /// Returns true if the instruction could potentially depend on the value of
1046 /// exec. If false, exec dependencies may safely be ignored.
1047 bool mayReadEXEC(const MachineRegisterInfo &MRI, const MachineInstr &MI) const;
1048
1049 bool isInlineConstant(const APInt &Imm) const;
1050
1051 bool isInlineConstant(const APFloat &Imm) const;
1052
1053 // Returns true if this non-register operand definitely does not need to be
1054 // encoded as a 32-bit literal. Note that this function handles all kinds of
1055 // operands, not just immediates.
1056 //
1057 // Some operands like FrameIndexes could resolve to an inline immediate value
1058 // that will not require an additional 4-bytes; this function assumes that it
1059 // will.
1060 bool isInlineConstant(const MachineOperand &MO, uint8_t OperandType) const;
1061
1063 const MCOperandInfo &OpInfo) const {
1064 return isInlineConstant(MO, OpInfo.OperandType);
1065 }
1066
1067 /// \p returns true if \p UseMO is substituted with \p DefMO in \p MI it would
1068 /// be an inline immediate.
1070 const MachineOperand &UseMO,
1071 const MachineOperand &DefMO) const {
1072 assert(UseMO.getParent() == &MI);
1073 int OpIdx = UseMO.getOperandNo();
1074 if (OpIdx >= MI.getDesc().NumOperands)
1075 return false;
1076
1077 return isInlineConstant(DefMO, MI.getDesc().operands()[OpIdx]);
1078 }
1079
1080 /// \p returns true if the operand \p OpIdx in \p MI is a valid inline
1081 /// immediate.
1082 bool isInlineConstant(const MachineInstr &MI, unsigned OpIdx) const {
1083 const MachineOperand &MO = MI.getOperand(OpIdx);
1084 return isInlineConstant(MO, MI.getDesc().operands()[OpIdx].OperandType);
1085 }
1086
1087 bool isInlineConstant(const MachineInstr &MI, unsigned OpIdx,
1088 const MachineOperand &MO) const {
1089 if (OpIdx >= MI.getDesc().NumOperands)
1090 return false;
1091
1092 if (isCopyInstr(MI)) {
1093 unsigned Size = getOpSize(MI, OpIdx);
1094 assert(Size == 8 || Size == 4);
1095
1096 uint8_t OpType = (Size == 8) ?
1098 return isInlineConstant(MO, OpType);
1099 }
1100
1101 return isInlineConstant(MO, MI.getDesc().operands()[OpIdx].OperandType);
1102 }
1103
1104 bool isInlineConstant(const MachineOperand &MO) const {
1105 return isInlineConstant(*MO.getParent(), MO.getOperandNo());
1106 }
1107
1108 bool isImmOperandLegal(const MachineInstr &MI, unsigned OpNo,
1109 const MachineOperand &MO) const;
1110
1111 /// Return true if this 64-bit VALU instruction has a 32-bit encoding.
1112 /// This function will return false if you pass it a 32-bit instruction.
1113 bool hasVALU32BitEncoding(unsigned Opcode) const;
1114
1115 /// Returns true if this operand uses the constant bus.
1117 const MachineOperand &MO,
1118 const MCOperandInfo &OpInfo) const;
1119
1121 int OpIdx) const {
1122 return usesConstantBus(MRI, MI.getOperand(OpIdx),
1123 MI.getDesc().operands()[OpIdx]);
1124 }
1125
1126 /// Return true if this instruction has any modifiers.
1127 /// e.g. src[012]_mod, omod, clamp.
1128 bool hasModifiers(unsigned Opcode) const;
1129
1130 bool hasModifiersSet(const MachineInstr &MI,
1131 unsigned OpName) const;
1132 bool hasAnyModifiersSet(const MachineInstr &MI) const;
1133
1134 bool canShrink(const MachineInstr &MI,
1135 const MachineRegisterInfo &MRI) const;
1136
1138 unsigned NewOpcode) const;
1139
1140 bool verifyInstruction(const MachineInstr &MI,
1141 StringRef &ErrInfo) const override;
1142
1143 unsigned getVALUOp(const MachineInstr &MI) const;
1144
1147 const DebugLoc &DL, Register Reg, bool IsSCCLive,
1148 SlotIndexes *Indexes = nullptr) const;
1149
1152 Register Reg, SlotIndexes *Indexes = nullptr) const;
1153
1154 /// Return the correct register class for \p OpNo. For target-specific
1155 /// instructions, this will return the register class that has been defined
1156 /// in tablegen. For generic instructions, like REG_SEQUENCE it will return
1157 /// the register class of its machine operand.
1158 /// to infer the correct register class base on the other operands.
1160 unsigned OpNo) const;
1161
1162 /// Return the size in bytes of the operand OpNo on the given
1163 // instruction opcode.
1164 unsigned getOpSize(uint16_t Opcode, unsigned OpNo) const {
1165 const MCOperandInfo &OpInfo = get(Opcode).operands()[OpNo];
1166
1167 if (OpInfo.RegClass == -1) {
1168 // If this is an immediate operand, this must be a 32-bit literal.
1170 return 4;
1171 }
1172
1173 return RI.getRegSizeInBits(*RI.getRegClass(OpInfo.RegClass)) / 8;
1174 }
1175
1176 /// This form should usually be preferred since it handles operands
1177 /// with unknown register classes.
1178 unsigned getOpSize(const MachineInstr &MI, unsigned OpNo) const {
1179 const MachineOperand &MO = MI.getOperand(OpNo);
1180 if (MO.isReg()) {
1181 if (unsigned SubReg = MO.getSubReg()) {
1182 return RI.getSubRegIdxSize(SubReg) / 8;
1183 }
1184 }
1185 return RI.getRegSizeInBits(*getOpRegClass(MI, OpNo)) / 8;
1186 }
1187
1188 /// Legalize the \p OpIndex operand of this instruction by inserting
1189 /// a MOV. For example:
1190 /// ADD_I32_e32 VGPR0, 15
1191 /// to
1192 /// MOV VGPR1, 15
1193 /// ADD_I32_e32 VGPR0, VGPR1
1194 ///
1195 /// If the operand being legalized is a register, then a COPY will be used
1196 /// instead of MOV.
1197 void legalizeOpWithMove(MachineInstr &MI, unsigned OpIdx) const;
1198
1199 /// Check if \p MO is a legal operand if it was the \p OpIdx Operand
1200 /// for \p MI.
1201 bool isOperandLegal(const MachineInstr &MI, unsigned OpIdx,
1202 const MachineOperand *MO = nullptr) const;
1203
1204 /// Check if \p MO would be a valid operand for the given operand
1205 /// definition \p OpInfo. Note this does not attempt to validate constant bus
1206 /// restrictions (e.g. literal constant usage).
1208 const MCOperandInfo &OpInfo,
1209 const MachineOperand &MO) const;
1210
1211 /// Check if \p MO (a register operand) is a legal register for the
1212 /// given operand description.
1214 const MCOperandInfo &OpInfo,
1215 const MachineOperand &MO) const;
1216
1217 /// Legalize operands in \p MI by either commuting it or inserting a
1218 /// copy of src1.
1220
1221 /// Fix operands in \p MI to satisfy constant bus requirements.
1223
1224 /// Copy a value from a VGPR (\p SrcReg) to SGPR. The desired register class
1225 /// for the dst register (\p DstRC) can be optionally supplied. This function
1226 /// can only be used when it is know that the value in SrcReg is same across
1227 /// all threads in the wave.
1228 /// \returns The SGPR register that \p SrcReg was copied to.
1231 const TargetRegisterClass *DstRC = nullptr) const;
1232
1235
1238 const TargetRegisterClass *DstRC,
1240 const DebugLoc &DL) const;
1241
1242 /// Legalize all operands in this instruction. This function may create new
1243 /// instructions and control-flow around \p MI. If present, \p MDT is
1244 /// updated.
1245 /// \returns A new basic block that contains \p MI if new blocks were created.
1247 legalizeOperands(MachineInstr &MI, MachineDominatorTree *MDT = nullptr) const;
1248
1249 /// Change SADDR form of a FLAT \p Inst to its VADDR form if saddr operand
1250 /// was moved to VGPR. \returns true if succeeded.
1251 bool moveFlatAddrToVGPR(MachineInstr &Inst) const;
1252
1253 /// Replace the instructions opcode with the equivalent VALU
1254 /// opcode. This function will also move the users of MachineInstruntions
1255 /// in the \p WorkList to the VALU if necessary. If present, \p MDT is
1256 /// updated.
1257 void moveToVALU(SIInstrWorklist &Worklist, MachineDominatorTree *MDT) const;
1258
1260 MachineInstr &Inst) const;
1261
1263 MachineBasicBlock::iterator MI) const override;
1264
1266 unsigned Quantity) const override;
1267
1268 void insertReturn(MachineBasicBlock &MBB) const;
1269
1270 /// Build instructions that simulate the behavior of a `s_trap 2` instructions
1271 /// for hardware (namely, gfx11) that runs in PRIV=1 mode. There, s_trap is
1272 /// interpreted as a nop.
1276 const DebugLoc &DL) const;
1277
1278 /// Return the number of wait states that result from executing this
1279 /// instruction.
1280 static unsigned getNumWaitStates(const MachineInstr &MI);
1281
1282 /// Returns the operand named \p Op. If \p MI does not have an
1283 /// operand named \c Op, this function returns nullptr.
1285 MachineOperand *getNamedOperand(MachineInstr &MI, unsigned OperandName) const;
1286
1289 unsigned OpName) const {
1290 return getNamedOperand(const_cast<MachineInstr &>(MI), OpName);
1291 }
1292
1293 /// Get required immediate operand
1294 int64_t getNamedImmOperand(const MachineInstr &MI, unsigned OpName) const {
1295 int Idx = AMDGPU::getNamedOperandIdx(MI.getOpcode(), OpName);
1296 return MI.getOperand(Idx).getImm();
1297 }
1298
1301
1302 bool isLowLatencyInstruction(const MachineInstr &MI) const;
1303 bool isHighLatencyDef(int Opc) const override;
1304
1305 /// Return the descriptor of the target-specific machine instruction
1306 /// that corresponds to the specified pseudo or native opcode.
1307 const MCInstrDesc &getMCOpcodeFromPseudo(unsigned Opcode) const {
1308 return get(pseudoToMCOpcode(Opcode));
1309 }
1310
1311 unsigned isStackAccess(const MachineInstr &MI, int &FrameIndex) const;
1312 unsigned isSGPRStackAccess(const MachineInstr &MI, int &FrameIndex) const;
1313
1315 int &FrameIndex) const override;
1317 int &FrameIndex) const override;
1318
1319 unsigned getInstBundleSize(const MachineInstr &MI) const;
1320 unsigned getInstSizeInBytes(const MachineInstr &MI) const override;
1321
1322 bool mayAccessFlatAddressSpace(const MachineInstr &MI) const;
1323
1324 std::pair<unsigned, unsigned>
1325 decomposeMachineOperandsTargetFlags(unsigned TF) const override;
1326
1328 getSerializableTargetIndices() const override;
1329
1332
1335
1338 const ScheduleDAG *DAG) const override;
1339
1341 CreateTargetPostRAHazardRecognizer(const MachineFunction &MF) const override;
1342
1345 const ScheduleDAGMI *DAG) const override;
1346
1348 const MachineFunction &MF) const override;
1349
1351 Register Reg = Register()) const override;
1352
1355 const DebugLoc &DL, Register Src,
1356 Register Dst) const override;
1357
1360 const DebugLoc &DL, Register Src,
1361 unsigned SrcSubReg,
1362 Register Dst) const override;
1363
1364 bool isWave32() const;
1365
1366 /// Return a partially built integer add instruction without carry.
1367 /// Caller must add source operands.
1368 /// For pre-GFX9 it will generate unused carry destination operand.
1369 /// TODO: After GFX9 it should return a no-carry operation.
1372 const DebugLoc &DL,
1373 Register DestReg) const;
1374
1377 const DebugLoc &DL,
1378 Register DestReg,
1379 RegScavenger &RS) const;
1380
1381 static bool isKillTerminator(unsigned Opcode);
1382 const MCInstrDesc &getKillTerminatorFromPseudo(unsigned Opcode) const;
1383
1384 bool isLegalMUBUFImmOffset(unsigned Imm) const;
1385
1386 static unsigned getMaxMUBUFImmOffset(const GCNSubtarget &ST);
1387
1388 bool splitMUBUFOffset(uint32_t Imm, uint32_t &SOffset, uint32_t &ImmOffset,
1389 Align Alignment = Align(4)) const;
1390
1391 /// Returns if \p Offset is legal for the subtarget as the offset to a FLAT
1392 /// encoded instruction. If \p Signed, this is for an instruction that
1393 /// interprets the offset as signed.
1394 bool isLegalFLATOffset(int64_t Offset, unsigned AddrSpace,
1395 uint64_t FlatVariant) const;
1396
1397 /// Split \p COffsetVal into {immediate offset field, remainder offset}
1398 /// values.
1399 std::pair<int64_t, int64_t> splitFlatOffset(int64_t COffsetVal,
1400 unsigned AddrSpace,
1401 uint64_t FlatVariant) const;
1402
1403 /// Returns true if negative offsets are allowed for the given \p FlatVariant.
1404 bool allowNegativeFlatOffset(uint64_t FlatVariant) const;
1405
1406 /// \brief Return a target-specific opcode if Opcode is a pseudo instruction.
1407 /// Return -1 if the target-specific opcode for the pseudo instruction does
1408 /// not exist. If Opcode is not a pseudo instruction, this is identity.
1409 int pseudoToMCOpcode(int Opcode) const;
1410
1411 /// \brief Check if this instruction should only be used by assembler.
1412 /// Return true if this opcode should not be used by codegen.
1413 bool isAsmOnlyOpcode(int MCOp) const;
1414
1415 const TargetRegisterClass *getRegClass(const MCInstrDesc &TID, unsigned OpNum,
1416 const TargetRegisterInfo *TRI,
1417 const MachineFunction &MF)
1418 const override;
1419
1420 void fixImplicitOperands(MachineInstr &MI) const;
1421
1425 int FrameIndex,
1426 LiveIntervals *LIS = nullptr,
1427 VirtRegMap *VRM = nullptr) const override;
1428
1429 unsigned getInstrLatency(const InstrItineraryData *ItinData,
1430 const MachineInstr &MI,
1431 unsigned *PredCost = nullptr) const override;
1432
1434 getInstructionUniformity(const MachineInstr &MI) const override final;
1435
1438
1439 const MIRFormatter *getMIRFormatter() const override {
1440 if (!Formatter)
1441 Formatter = std::make_unique<AMDGPUMIRFormatter>();
1442 return Formatter.get();
1443 }
1444
1445 static unsigned getDSShaderTypeValue(const MachineFunction &MF);
1446
1447 const TargetSchedModel &getSchedModel() const { return SchedModel; }
1448
1449 // Enforce operand's \p OpName even alignment if required by target.
1450 // This is used if an operand is a 32 bit register but needs to be aligned
1451 // regardless.
1452 void enforceOperandRCAlignment(MachineInstr &MI, unsigned OpName) const;
1453};
1454
1455/// \brief Returns true if a reg:subreg pair P has a TRC class
1457 const TargetRegisterClass &TRC,
1459 auto *RC = MRI.getRegClass(P.Reg);
1460 if (!P.SubReg)
1461 return RC == &TRC;
1462 auto *TRI = MRI.getTargetRegisterInfo();
1463 return RC == TRI->getMatchingSuperRegClass(RC, &TRC, P.SubReg);
1464}
1465
1466/// \brief Create RegSubRegPair from a register MachineOperand
1467inline
1469 assert(O.isReg());
1470 return TargetInstrInfo::RegSubRegPair(O.getReg(), O.getSubReg());
1471}
1472
1473/// \brief Return the SubReg component from REG_SEQUENCE
1474TargetInstrInfo::RegSubRegPair getRegSequenceSubReg(MachineInstr &MI,
1475 unsigned SubReg);
1476
1477/// \brief Return the defining instruction for a given reg:subreg pair
1478/// skipping copy like instructions and subreg-manipulation pseudos.
1479/// Following another subreg of a reg:subreg isn't supported.
1480MachineInstr *getVRegSubRegDef(const TargetInstrInfo::RegSubRegPair &P,
1481 MachineRegisterInfo &MRI);
1482
1483/// \brief Return false if EXEC is not changed between the def of \p VReg at \p
1484/// DefMI and the use at \p UseMI. Should be run on SSA. Currently does not
1485/// attempt to track between blocks.
1486bool execMayBeModifiedBeforeUse(const MachineRegisterInfo &MRI,
1487 Register VReg,
1488 const MachineInstr &DefMI,
1489 const MachineInstr &UseMI);
1490
1491/// \brief Return false if EXEC is not changed between the def of \p VReg at \p
1492/// DefMI and all its uses. Should be run on SSA. Currently does not attempt to
1493/// track between blocks.
1494bool execMayBeModifiedBeforeAnyUse(const MachineRegisterInfo &MRI,
1495 Register VReg,
1496 const MachineInstr &DefMI);
1497
1498namespace AMDGPU {
1499
1501 int getVOPe64(uint16_t Opcode);
1502
1504 int getVOPe32(uint16_t Opcode);
1505
1507 int getSDWAOp(uint16_t Opcode);
1508
1511
1514
1517
1520
1523
1526
1527 /// Check if \p Opcode is an Addr64 opcode.
1528 ///
1529 /// \returns \p Opcode if it is an Addr64 opcode, otherwise -1.
1532
1534 int getSOPKOp(uint16_t Opcode);
1535
1536 /// \returns SADDR form of a FLAT Global instruction given an \p Opcode
1537 /// of a VADDR form.
1540
1541 /// \returns VADDR form of a FLAT Global instruction given an \p Opcode
1542 /// of a SADDR form.
1545
1548
1549 /// \returns ST form with only immediate offset of a FLAT Scratch instruction
1550 /// given an \p Opcode of an SS (SADDR) form.
1553
1554 /// \returns SV (VADDR) form of a FLAT Scratch instruction given an \p Opcode
1555 /// of an SVS (SADDR + VADDR) form.
1558
1559 /// \returns SS (SADDR) form of a FLAT Scratch instruction given an \p Opcode
1560 /// of an SV (VADDR) form.
1563
1564 /// \returns SV (VADDR) form of a FLAT Scratch instruction given an \p Opcode
1565 /// of an SS (SADDR) form.
1568
1569 /// \returns earlyclobber version of a MAC MFMA is exists.
1572
1573 /// \returns Version of an MFMA instruction which uses AGPRs for srcC and
1574 /// vdst, given an \p Opcode of an MFMA which uses VGPRs for srcC/vdst.
1577
1578 /// \returns v_cmpx version of a v_cmp instruction.
1581
1582 const uint64_t RSRC_DATA_FORMAT = 0xf00000000000LL;
1585 const uint64_t RSRC_TID_ENABLE = UINT64_C(1) << (32 + 23);
1586
1587} // end namespace AMDGPU
1588
1589namespace AMDGPU {
1591 // For sgpr to vgpr spill instructions
1594} // namespace AMDGPU
1595
1596namespace SI {
1597namespace KernelInputOffsets {
1598
1599/// Offsets in bytes from the start of the input buffer
1609 LOCAL_SIZE_Z = 32
1611
1612} // end namespace KernelInputOffsets
1613} // end namespace SI
1614
1615} // end namespace llvm
1616
1617#endif // LLVM_LIB_TARGET_AMDGPU_SIINSTRINFO_H
unsigned SubReg
unsigned const MachineRegisterInfo * MRI
MachineInstrBuilder & UseMI
MachineInstrBuilder MachineInstrBuilder & DefMI
Provides AMDGPU specific target descriptions.
AMDGPU specific overrides of MIRFormatter.
MachineBasicBlock & MBB
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
MachineBasicBlock MachineBasicBlock::iterator MBBI
#define LLVM_READONLY
Definition: Compiler.h:306
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
uint64_t Size
IRTranslator LLVM IR MI
#define I(x, y, z)
Definition: MD5.cpp:58
unsigned const TargetRegisterInfo * TRI
unsigned Reg
uint64_t IntrinsicInst * II
#define P(N)
StandardInstrumentations SI(Mod->getContext(), Debug, VerifyEach)
const SmallVectorImpl< MachineOperand > MachineBasicBlock * TBB
const SmallVectorImpl< MachineOperand > & Cond
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Interface definition for SIRegisterInfo.
This file implements a set that has insertion order iteration characteristics.
Class for arbitrary precision integers.
Definition: APInt.h:78
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
This class represents an Operation in the Expression.
A debug info location.
Definition: DebugLoc.h:33
Itinerary data supplied by a subtarget to be used by a target.
Describe properties that are true of each instruction in the target description file.
Definition: MCInstrDesc.h:198
This holds information about one operand of a machine instruction, indicating the register class for ...
Definition: MCInstrDesc.h:85
uint8_t OperandType
Information about the type of the operand.
Definition: MCInstrDesc.h:97
int16_t RegClass
This specifies the register class enumeration of the operand if the operand is a register.
Definition: MCInstrDesc.h:91
Wrapper class representing physical registers. Should be passed by value.
Definition: MCRegister.h:33
MIRFormater - Interface to format MIR operand based on target.
Definition: MIRFormatter.h:32
DominatorTree Class - Concrete subclass of DominatorTreeBase that is used to compute a normal dominat...
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Representation of each machine instruction.
Definition: MachineInstr.h:69
Flags
Flags values. These may be or'd together.
MachineOperand class - Representation of each machine instruction operand.
unsigned getSubReg() const
unsigned getOperandNo() const
Returns the index of this operand in the instruction that it belongs to.
bool isReg() const
isReg - Tests if this is a MO_Register operand.
MachineInstr * getParent()
getParent - Return the instruction that this operand belongs to.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
Represents one node in the SelectionDAG.
bool isLegalMUBUFImmOffset(unsigned Imm) const
bool isFLATGlobal(uint16_t Opcode) const
Definition: SIInstrInfo.h:638
bool isInlineConstant(const APInt &Imm) const
static bool isMAI(const MachineInstr &MI)
Definition: SIInstrInfo.h:798
void legalizeOperandsVOP3(MachineRegisterInfo &MRI, MachineInstr &MI) const
Fix operands in MI to satisfy constant bus requirements.
static bool isDS(const MachineInstr &MI)
Definition: SIInstrInfo.h:560
static bool isVMEM(const MachineInstr &MI)
Definition: SIInstrInfo.h:438
MachineBasicBlock * legalizeOperands(MachineInstr &MI, MachineDominatorTree *MDT=nullptr) const
Legalize all operands in this instruction.
bool areLoadsFromSameBasePtr(SDNode *Load0, SDNode *Load1, int64_t &Offset0, int64_t &Offset1) const override
static bool isVOP3(const MachineInstr &MI)
Definition: SIInstrInfo.h:510
unsigned getLiveRangeSplitOpcode(Register Reg, const MachineFunction &MF) const override
bool isSMRD(uint16_t Opcode) const
Definition: SIInstrInfo.h:554
bool getMemOperandsWithOffsetWidth(const MachineInstr &LdSt, SmallVectorImpl< const MachineOperand * > &BaseOps, int64_t &Offset, bool &OffsetIsScalable, LocationSize &Width, const TargetRegisterInfo *TRI) const final
unsigned getInstSizeInBytes(const MachineInstr &MI) const override
static bool isNeverUniform(const MachineInstr &MI)
Definition: SIInstrInfo.h:930
unsigned getOpSize(uint16_t Opcode, unsigned OpNo) const
Return the size in bytes of the operand OpNo on the given.
Definition: SIInstrInfo.h:1164
bool isAtomic(uint16_t Opcode) const
Definition: SIInstrInfo.h:692
bool isBasicBlockPrologue(const MachineInstr &MI, Register Reg=Register()) const override
bool isLDSDIR(uint16_t Opcode) const
Definition: SIInstrInfo.h:843
bool isFLATScratch(uint16_t Opcode) const
Definition: SIInstrInfo.h:646
uint64_t getDefaultRsrcDataFormat() const
static bool isSOPP(const MachineInstr &MI)
Definition: SIInstrInfo.h:478
InstructionUniformity getGenericInstructionUniformity(const MachineInstr &MI) const
bool hasVGPRUses(const MachineInstr &MI) const
Definition: SIInstrInfo.h:1025
uint64_t getClampMask(const MachineInstr &MI) const
Definition: SIInstrInfo.h:906
static bool isFLATScratch(const MachineInstr &MI)
Definition: SIInstrInfo.h:642
const MCInstrDesc & getIndirectRegWriteMovRelPseudo(unsigned VecSize, unsigned EltSize, bool IsSGPR) const
static bool isSpill(const MachineInstr &MI)
Definition: SIInstrInfo.h:750
MachineInstrBuilder getAddNoCarry(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, Register DestReg) const
Return a partially built integer add instruction without carry.
bool mayAccessFlatAddressSpace(const MachineInstr &MI) const
bool shouldScheduleLoadsNear(SDNode *Load0, SDNode *Load1, int64_t Offset0, int64_t Offset1, unsigned NumLoads) const override
bool splitMUBUFOffset(uint32_t Imm, uint32_t &SOffset, uint32_t &ImmOffset, Align Alignment=Align(4)) const
ArrayRef< std::pair< unsigned, const char * > > getSerializableDirectMachineOperandTargetFlags() const override
void moveToVALU(SIInstrWorklist &Worklist, MachineDominatorTree *MDT) const
Replace the instructions opcode with the equivalent VALU opcode.
static bool isSMRD(const MachineInstr &MI)
Definition: SIInstrInfo.h:550
void restoreExec(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, const DebugLoc &DL, Register Reg, SlotIndexes *Indexes=nullptr) const
bool isVGPRSpill(uint16_t Opcode) const
Definition: SIInstrInfo.h:728
bool usesConstantBus(const MachineRegisterInfo &MRI, const MachineOperand &MO, const MCOperandInfo &OpInfo) const
Returns true if this operand uses the constant bus.
static unsigned getMaxMUBUFImmOffset(const GCNSubtarget &ST)
Register isStoreToStackSlot(const MachineInstr &MI, int &FrameIndex) const override
void legalizeOperandsFLAT(MachineRegisterInfo &MRI, MachineInstr &MI) const
bool optimizeCompareInstr(MachineInstr &CmpInstr, Register SrcReg, Register SrcReg2, int64_t CmpMask, int64_t CmpValue, const MachineRegisterInfo *MRI) const override
bool isSegmentSpecificFLAT(uint16_t Opcode) const
Definition: SIInstrInfo.h:629
int64_t getNamedImmOperand(const MachineInstr &MI, unsigned OpName) const
Get required immediate operand.
Definition: SIInstrInfo.h:1294
bool usesConstantBus(const MachineRegisterInfo &MRI, const MachineInstr &MI, int OpIdx) const
Definition: SIInstrInfo.h:1120
bool isVSAMPLE(uint16_t Opcode) const
Definition: SIInstrInfo.h:606
bool isPacked(uint16_t Opcode) const
Definition: SIInstrInfo.h:490
static bool isMTBUF(const MachineInstr &MI)
Definition: SIInstrInfo.h:542
const MCInstrDesc & getIndirectGPRIDXPseudo(unsigned VecSize, bool IsIndirectSrc) const
void insertReturn(MachineBasicBlock &MBB) const
static bool isEXP(const MachineInstr &MI)
Definition: SIInstrInfo.h:655
static bool isSALU(const MachineInstr &MI)
Definition: SIInstrInfo.h:414
bool isVIMAGE(uint16_t Opcode) const
Definition: SIInstrInfo.h:598
void legalizeGenericOperand(MachineBasicBlock &InsertMBB, MachineBasicBlock::iterator I, const TargetRegisterClass *DstRC, MachineOperand &Op, MachineRegisterInfo &MRI, const DebugLoc &DL) const
MachineInstr * buildShrunkInst(MachineInstr &MI, unsigned NewOpcode) const
unsigned getInstBundleSize(const MachineInstr &MI) const
static bool isVOP2(const MachineInstr &MI)
Definition: SIInstrInfo.h:502
bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, SmallVectorImpl< MachineOperand > &Cond, bool AllowModify=false) const override
static bool isSDWA(const MachineInstr &MI)
Definition: SIInstrInfo.h:518
bool isSOP1(uint16_t Opcode) const
Definition: SIInstrInfo.h:450
const MCInstrDesc & getKillTerminatorFromPseudo(unsigned Opcode) const
static bool mayWriteLDSThroughDMA(const MachineInstr &MI)
Definition: SIInstrInfo.h:697
void insertNoops(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned Quantity) const override
static bool isVINTRP(const MachineInstr &MI)
Definition: SIInstrInfo.h:790
bool isSWMMAC(uint16_t Opcode) const
Definition: SIInstrInfo.h:831
bool isAtomicRet(uint16_t Opcode) const
Definition: SIInstrInfo.h:683
static bool isGather4(const MachineInstr &MI)
Definition: SIInstrInfo.h:610
static bool isMFMAorWMMA(const MachineInstr &MI)
Definition: SIInstrInfo.h:823
static bool isWQM(const MachineInstr &MI)
Definition: SIInstrInfo.h:701
static bool doesNotReadTiedSource(const MachineInstr &MI)
Definition: SIInstrInfo.h:963
bool isLegalVSrcOperand(const MachineRegisterInfo &MRI, const MCOperandInfo &OpInfo, const MachineOperand &MO) const
Check if MO would be a valid operand for the given operand definition OpInfo.
bool isSOPC(uint16_t Opcode) const
Definition: SIInstrInfo.h:466
static bool isDOT(const MachineInstr &MI)
Definition: SIInstrInfo.h:811
static bool usesFPDPRounding(const MachineInstr &MI)
Definition: SIInstrInfo.h:914
bool isFixedSize(uint16_t Opcode) const
Definition: SIInstrInfo.h:890
bool isImage(uint16_t Opcode) const
Definition: SIInstrInfo.h:434
MachineInstr * createPHISourceCopy(MachineBasicBlock &MBB, MachineBasicBlock::iterator InsPt, const DebugLoc &DL, Register Src, unsigned SrcSubReg, Register Dst) const override
bool isGWS(uint16_t Opcode) const
Definition: SIInstrInfo.h:580
bool isInlineConstant(const MachineOperand &MO) const
Definition: SIInstrInfo.h:1104
bool hasModifiers(unsigned Opcode) const
Return true if this instruction has any modifiers.
bool isVOP3(uint16_t Opcode) const
Definition: SIInstrInfo.h:514
bool shouldClusterMemOps(ArrayRef< const MachineOperand * > BaseOps1, int64_t Offset1, bool OffsetIsScalable1, ArrayRef< const MachineOperand * > BaseOps2, int64_t Offset2, bool OffsetIsScalable2, unsigned ClusterSize, unsigned NumBytes) const override
static bool isSWMMAC(const MachineInstr &MI)
Definition: SIInstrInfo.h:827
ScheduleHazardRecognizer * CreateTargetMIHazardRecognizer(const InstrItineraryData *II, const ScheduleDAGMI *DAG) const override
bool isDOT(uint16_t Opcode) const
Definition: SIInstrInfo.h:835
bool isWave32() const
bool isHighLatencyDef(int Opc) const override
void legalizeOpWithMove(MachineInstr &MI, unsigned OpIdx) const
Legalize the OpIndex operand of this instruction by inserting a MOV.
bool reverseBranchCondition(SmallVectorImpl< MachineOperand > &Cond) const override
static bool isVOPC(const MachineInstr &MI)
Definition: SIInstrInfo.h:526
void removeModOperands(MachineInstr &MI) const
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const DebugLoc &DL, MCRegister DestReg, MCRegister SrcReg, bool KillSrc, bool RenamableDest=false, bool RenamableSrc=false) const override
std::pair< int64_t, int64_t > splitFlatOffset(int64_t COffsetVal, unsigned AddrSpace, uint64_t FlatVariant) const
Split COffsetVal into {immediate offset field, remainder offset} values.
bool isGather4(uint16_t Opcode) const
Definition: SIInstrInfo.h:614
bool isSpill(uint16_t Opcode) const
Definition: SIInstrInfo.h:746
bool isFLAT(uint16_t Opcode) const
Definition: SIInstrInfo.h:651
static bool isVIMAGE(const MachineInstr &MI)
Definition: SIInstrInfo.h:594
static bool isLDSDIR(const MachineInstr &MI)
Definition: SIInstrInfo.h:839
static bool isSOP2(const MachineInstr &MI)
Definition: SIInstrInfo.h:454
static bool isGWS(const MachineInstr &MI)
Definition: SIInstrInfo.h:576
const TargetSchedModel & getSchedModel() const
Definition: SIInstrInfo.h:1447
bool isVOPC(uint16_t Opcode) const
Definition: SIInstrInfo.h:530
bool isInlineConstant(const MachineInstr &MI, const MachineOperand &UseMO, const MachineOperand &DefMO) const
returns true if UseMO is substituted with DefMO in MI it would be an inline immediate.
Definition: SIInstrInfo.h:1069
LLVM_READONLY MachineOperand * getNamedOperand(MachineInstr &MI, unsigned OperandName) const
Returns the operand named Op.
const MIRFormatter * getMIRFormatter() const override
Definition: SIInstrInfo.h:1439
const TargetRegisterClass * getPreferredSelectRegClass(unsigned Size) const
bool isReallyTriviallyReMaterializable(const MachineInstr &MI) const override
bool swapSourceModifiers(MachineInstr &MI, MachineOperand &Src0, unsigned Src0OpName, MachineOperand &Src1, unsigned Src1OpName) const
bool isMAI(uint16_t Opcode) const
Definition: SIInstrInfo.h:802
static bool isFLATGlobal(const MachineInstr &MI)
Definition: SIInstrInfo.h:634
unsigned getMachineCSELookAheadLimit() const override
Definition: SIInstrInfo.h:405
static bool isVSAMPLE(const MachineInstr &MI)
Definition: SIInstrInfo.h:602
static bool isAtomicRet(const MachineInstr &MI)
Definition: SIInstrInfo.h:679
bool isBufferSMRD(const MachineInstr &MI) const
static bool isKillTerminator(unsigned Opcode)
bool findCommutedOpIndices(const MachineInstr &MI, unsigned &SrcOpIdx0, unsigned &SrcOpIdx1) const override
const GCNSubtarget & getSubtarget() const
Definition: SIInstrInfo.h:231
bool isDS(uint16_t Opcode) const
Definition: SIInstrInfo.h:564
void insertScratchExecCopy(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, const DebugLoc &DL, Register Reg, bool IsSCCLive, SlotIndexes *Indexes=nullptr) const
bool isFPAtomic(uint16_t Opcode) const
Definition: SIInstrInfo.h:926
bool hasVALU32BitEncoding(unsigned Opcode) const
Return true if this 64-bit VALU instruction has a 32-bit encoding.
static bool isDisableWQM(const MachineInstr &MI)
Definition: SIInstrInfo.h:709
bool isAtomicNoRet(uint16_t Opcode) const
Definition: SIInstrInfo.h:675
unsigned getMovOpcode(const TargetRegisterClass *DstRC) const
unsigned isSGPRStackAccess(const MachineInstr &MI, int &FrameIndex) const
void reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, Register DestReg, unsigned SubIdx, const MachineInstr &Orig, const TargetRegisterInfo &TRI) const override
unsigned buildExtractSubReg(MachineBasicBlock::iterator MI, MachineRegisterInfo &MRI, const MachineOperand &SuperReg, const TargetRegisterClass *SuperRC, unsigned SubIdx, const TargetRegisterClass *SubRC) const
void legalizeOperandsVOP2(MachineRegisterInfo &MRI, MachineInstr &MI) const
Legalize operands in MI by either commuting it or inserting a copy of src1.
bool foldImmediate(MachineInstr &UseMI, MachineInstr &DefMI, Register Reg, MachineRegisterInfo *MRI) const final
static bool isTRANS(const MachineInstr &MI)
Definition: SIInstrInfo.h:774
static bool isImage(const MachineInstr &MI)
Definition: SIInstrInfo.h:430
static bool isSOPK(const MachineInstr &MI)
Definition: SIInstrInfo.h:470
const TargetRegisterClass * getOpRegClass(const MachineInstr &MI, unsigned OpNo) const
Return the correct register class for OpNo.
MachineBasicBlock * insertSimulatedTrap(MachineRegisterInfo &MRI, MachineBasicBlock &MBB, MachineInstr &MI, const DebugLoc &DL) const
Build instructions that simulate the behavior of a s_trap 2 instructions for hardware (namely,...
static unsigned getNonSoftWaitcntOpcode(unsigned Opcode)
Definition: SIInstrInfo.h:971
bool isInlineConstant(const MachineInstr &MI, unsigned OpIdx) const
returns true if the operand OpIdx in MI is a valid inline immediate.
Definition: SIInstrInfo.h:1082
static unsigned getDSShaderTypeValue(const MachineFunction &MF)
static bool isFoldableCopy(const MachineInstr &MI)
void loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, Register DestReg, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI, Register VReg) const override
bool isImmOperandLegal(const MachineInstr &MI, unsigned OpNo, const MachineOperand &MO) const
bool isIgnorableUse(const MachineOperand &MO) const override
static bool isVINTERP(const MachineInstr &MI)
Definition: SIInstrInfo.h:847
static bool isMUBUF(const MachineInstr &MI)
Definition: SIInstrInfo.h:534
bool expandPostRAPseudo(MachineInstr &MI) const override
bool analyzeCompare(const MachineInstr &MI, Register &SrcReg, Register &SrcReg2, int64_t &CmpMask, int64_t &CmpValue) const override
bool isSALU(uint16_t Opcode) const
Definition: SIInstrInfo.h:418
bool isVOP2(uint16_t Opcode) const
Definition: SIInstrInfo.h:506
static bool hasFPClamp(const MachineInstr &MI)
Definition: SIInstrInfo.h:894
InstructionUniformity getInstructionUniformity(const MachineInstr &MI) const override final
static bool isSegmentSpecificFLAT(const MachineInstr &MI)
Definition: SIInstrInfo.h:624
bool isSDWA(uint16_t Opcode) const
Definition: SIInstrInfo.h:522
unsigned getOpSize(const MachineInstr &MI, unsigned OpNo) const
This form should usually be preferred since it handles operands with unknown register classes.
Definition: SIInstrInfo.h:1178
bool isInlineConstant(const MachineOperand &MO, const MCOperandInfo &OpInfo) const
Definition: SIInstrInfo.h:1062
bool isSOPK(uint16_t Opcode) const
Definition: SIInstrInfo.h:474
static bool isF16PseudoScalarTrans(unsigned Opcode)
Definition: SIInstrInfo.h:955
void insertSelect(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, Register DstReg, ArrayRef< MachineOperand > Cond, Register TrueReg, Register FalseReg) const override
static bool isChainCallOpcode(uint64_t Opcode)
Definition: SIInstrInfo.h:761
static bool isDPP(const MachineInstr &MI)
Definition: SIInstrInfo.h:766
bool analyzeBranchImpl(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, SmallVectorImpl< MachineOperand > &Cond, bool AllowModify) const
static bool isMFMA(const MachineInstr &MI)
Definition: SIInstrInfo.h:806
bool isSGPRSpill(uint16_t Opcode) const
Definition: SIInstrInfo.h:740
bool isLowLatencyInstruction(const MachineInstr &MI) const
static bool isScalarStore(const MachineInstr &MI)
Definition: SIInstrInfo.h:878
bool isTRANS(uint16_t Opcode) const
Definition: SIInstrInfo.h:778
void materializeImmediate(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const DebugLoc &DL, Register DestReg, int64_t Value) const
bool isLDSDMA(uint16_t Opcode)
Definition: SIInstrInfo.h:572
std::optional< DestSourcePair > isCopyInstrImpl(const MachineInstr &MI) const override
If the specific machine instruction is a instruction that moves/copies value from one register to ano...
bool isSOP2(uint16_t Opcode) const
Definition: SIInstrInfo.h:458
bool isVALU(uint16_t Opcode) const
Definition: SIInstrInfo.h:426
bool isVOP1(uint16_t Opcode) const
Definition: SIInstrInfo.h:498
bool isAlwaysGDS(uint16_t Opcode) const
bool isMUBUF(uint16_t Opcode) const
Definition: SIInstrInfo.h:538
static bool isFPAtomic(const MachineInstr &MI)
Definition: SIInstrInfo.h:922
static bool usesLGKM_CNT(const MachineInstr &MI)
Definition: SIInstrInfo.h:863
Register isLoadFromStackSlot(const MachineInstr &MI, int &FrameIndex) const override
void moveToVALUImpl(SIInstrWorklist &Worklist, MachineDominatorTree *MDT, MachineInstr &Inst) const
static bool isPacked(const MachineInstr &MI)
Definition: SIInstrInfo.h:486
bool canShrink(const MachineInstr &MI, const MachineRegisterInfo &MRI) const
bool isAsmOnlyOpcode(int MCOp) const
Check if this instruction should only be used by assembler.
bool isWMMA(uint16_t Opcode) const
Definition: SIInstrInfo.h:819
bool isMTBUF(uint16_t Opcode) const
Definition: SIInstrInfo.h:546
bool isDisableWQM(uint16_t Opcode) const
Definition: SIInstrInfo.h:713
static bool isVGPRSpill(const MachineInstr &MI)
Definition: SIInstrInfo.h:722
ScheduleHazardRecognizer * CreateTargetPostRAHazardRecognizer(const InstrItineraryData *II, const ScheduleDAG *DAG) const override
This is used by the post-RA scheduler (SchedulePostRAList.cpp).
bool isWaitcnt(unsigned Opcode) const
Definition: SIInstrInfo.h:994
bool verifyInstruction(const MachineInstr &MI, StringRef &ErrInfo) const override
bool isLegalFLATOffset(int64_t Offset, unsigned AddrSpace, uint64_t FlatVariant) const
Returns if Offset is legal for the subtarget as the offset to a FLAT encoded instruction.
static bool isWWMRegSpillOpcode(uint16_t Opcode)
Definition: SIInstrInfo.h:754
unsigned getInstrLatency(const InstrItineraryData *ItinData, const MachineInstr &MI, unsigned *PredCost=nullptr) const override
bool isVMEM(uint16_t Opcode) const
Definition: SIInstrInfo.h:442
MachineInstr * foldMemoryOperandImpl(MachineFunction &MF, MachineInstr &MI, ArrayRef< unsigned > Ops, MachineBasicBlock::iterator InsertPt, int FrameIndex, LiveIntervals *LIS=nullptr, VirtRegMap *VRM=nullptr) const override
ArrayRef< std::pair< int, const char * > > getSerializableTargetIndices() const override
bool isVINTRP(uint16_t Opcode) const
Definition: SIInstrInfo.h:794
bool isVGPRCopy(const MachineInstr &MI) const
Definition: SIInstrInfo.h:1017
bool isScalarStore(uint16_t Opcode) const
Definition: SIInstrInfo.h:882
static bool isMIMG(const MachineInstr &MI)
Definition: SIInstrInfo.h:586
MachineOperand buildExtractSubRegOrImm(MachineBasicBlock::iterator MI, MachineRegisterInfo &MRI, const MachineOperand &SuperReg, const TargetRegisterClass *SuperRC, unsigned SubIdx, const TargetRegisterClass *SubRC) const
bool isSchedulingBoundary(const MachineInstr &MI, const MachineBasicBlock *MBB, const MachineFunction &MF) const override
bool isLegalRegOperand(const MachineRegisterInfo &MRI, const MCOperandInfo &OpInfo, const MachineOperand &MO) const
Check if MO (a register operand) is a legal register for the given operand description.
bool allowNegativeFlatOffset(uint64_t FlatVariant) const
Returns true if negative offsets are allowed for the given FlatVariant.
LLVM_READONLY int commuteOpcode(const MachineInstr &MI) const
Definition: SIInstrInfo.h:324
static unsigned getNumWaitStates(const MachineInstr &MI)
Return the number of wait states that result from executing this instruction.
const TargetRegisterClass * getRegClass(const MCInstrDesc &TID, unsigned OpNum, const TargetRegisterInfo *TRI, const MachineFunction &MF) const override
static bool isVOP3P(const MachineInstr &MI)
Definition: SIInstrInfo.h:782
bool isWQM(uint16_t Opcode) const
Definition: SIInstrInfo.h:705
unsigned getVALUOp(const MachineInstr &MI) const
static bool modifiesModeRegister(const MachineInstr &MI)
Return true if the instruction modifies the mode register.q.
Register readlaneVGPRToSGPR(Register SrcReg, MachineInstr &UseMI, MachineRegisterInfo &MRI, const TargetRegisterClass *DstRC=nullptr) const
Copy a value from a VGPR (SrcReg) to SGPR.
bool hasDivergentBranch(const MachineBasicBlock *MBB) const
Return whether the block terminate with divergent branch.
unsigned removeBranch(MachineBasicBlock &MBB, int *BytesRemoved=nullptr) const override
void fixImplicitOperands(MachineInstr &MI) const
bool moveFlatAddrToVGPR(MachineInstr &Inst) const
Change SADDR form of a FLAT Inst to its VADDR form if saddr operand was moved to VGPR.
bool isVOP3P(uint16_t Opcode) const
Definition: SIInstrInfo.h:786
LLVM_READONLY const MachineOperand * getNamedOperand(const MachineInstr &MI, unsigned OpName) const
Definition: SIInstrInfo.h:1288
bool isEXP(uint16_t Opcode) const
Definition: SIInstrInfo.h:667
Register insertNE(MachineBasicBlock *MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, Register SrcReg, int Value) const
MachineBasicBlock * getBranchDestBlock(const MachineInstr &MI) const override
static bool isDualSourceBlendEXP(const MachineInstr &MI)
Definition: SIInstrInfo.h:659
bool hasUnwantedEffectsWhenEXECEmpty(const MachineInstr &MI) const
This function is used to determine if an instruction can be safely executed under EXEC = 0 without ha...
static bool isAtomic(const MachineInstr &MI)
Definition: SIInstrInfo.h:687
bool canInsertSelect(const MachineBasicBlock &MBB, ArrayRef< MachineOperand > Cond, Register DstReg, Register TrueReg, Register FalseReg, int &CondCycles, int &TrueCycles, int &FalseCycles) const override
static bool sopkIsZext(unsigned Opcode)
Definition: SIInstrInfo.h:869
void storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, Register SrcReg, bool isKill, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI, Register VReg) const override
static bool isSGPRSpill(const MachineInstr &MI)
Definition: SIInstrInfo.h:734
static bool isWMMA(const MachineInstr &MI)
Definition: SIInstrInfo.h:815
ArrayRef< std::pair< MachineMemOperand::Flags, const char * > > getSerializableMachineMemOperandTargetFlags() const override
bool isVINTERP(uint16_t Opcode) const
Definition: SIInstrInfo.h:851
MachineInstr * convertToThreeAddress(MachineInstr &MI, LiveVariables *LV, LiveIntervals *LIS) const override
bool mayReadEXEC(const MachineRegisterInfo &MRI, const MachineInstr &MI) const
Returns true if the instruction could potentially depend on the value of exec.
void legalizeOperandsSMRD(MachineRegisterInfo &MRI, MachineInstr &MI) const
bool isBranchOffsetInRange(unsigned BranchOpc, int64_t BrOffset) const override
bool doesNotReadTiedSource(uint16_t Opcode) const
Definition: SIInstrInfo.h:967
unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, ArrayRef< MachineOperand > Cond, const DebugLoc &DL, int *BytesAdded=nullptr) const override
bool isDPP(uint16_t Opcode) const
Definition: SIInstrInfo.h:770
void insertVectorSelect(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, Register DstReg, ArrayRef< MachineOperand > Cond, Register TrueReg, Register FalseReg) const
void insertNoop(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI) const override
std::pair< MachineInstr *, MachineInstr * > expandMovDPP64(MachineInstr &MI) const
Register insertEQ(MachineBasicBlock *MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, Register SrcReg, int Value) const
static bool isSOP1(const MachineInstr &MI)
Definition: SIInstrInfo.h:446
static bool isSOPC(const MachineInstr &MI)
Definition: SIInstrInfo.h:462
static bool isFLAT(const MachineInstr &MI)
Definition: SIInstrInfo.h:618
const SIRegisterInfo & getRegisterInfo() const
Definition: SIInstrInfo.h:227
static bool isVALU(const MachineInstr &MI)
Definition: SIInstrInfo.h:422
bool isBarrier(unsigned Opcode) const
Definition: SIInstrInfo.h:945
MachineInstr * commuteInstructionImpl(MachineInstr &MI, bool NewMI, unsigned OpIdx0, unsigned OpIdx1) const override
void enforceOperandRCAlignment(MachineInstr &MI, unsigned OpName) const
static bool hasIntClamp(const MachineInstr &MI)
Definition: SIInstrInfo.h:902
int pseudoToMCOpcode(int Opcode) const
Return a target-specific opcode if Opcode is a pseudo instruction.
const MCInstrDesc & getMCOpcodeFromPseudo(unsigned Opcode) const
Return the descriptor of the target-specific machine instruction that corresponds to the specified ps...
Definition: SIInstrInfo.h:1307
bool isInlineConstant(const MachineInstr &MI, unsigned OpIdx, const MachineOperand &MO) const
Definition: SIInstrInfo.h:1087
static bool isScalarUnit(const MachineInstr &MI)
Definition: SIInstrInfo.h:855
bool isSOPP(uint16_t Opcode) const
Definition: SIInstrInfo.h:482
bool isMIMG(uint16_t Opcode) const
Definition: SIInstrInfo.h:590
bool hasFPClamp(uint16_t Opcode) const
Definition: SIInstrInfo.h:898
static bool usesVM_CNT(const MachineInstr &MI)
Definition: SIInstrInfo.h:859
bool usesFPDPRounding(uint16_t Opcode) const
Definition: SIInstrInfo.h:918
MachineInstr * createPHIDestinationCopy(MachineBasicBlock &MBB, MachineBasicBlock::iterator InsPt, const DebugLoc &DL, Register Src, Register Dst) const override
bool hasModifiersSet(const MachineInstr &MI, unsigned OpName) const
static bool isFixedSize(const MachineInstr &MI)
Definition: SIInstrInfo.h:886
bool isSafeToSink(MachineInstr &MI, MachineBasicBlock *SuccToSinkTo, MachineCycleInfo *CI) const override
LLVM_READONLY int commuteOpcode(unsigned Opc) const
uint64_t getScratchRsrcWords23() const
std::pair< unsigned, unsigned > decomposeMachineOperandsTargetFlags(unsigned TF) const override
bool areMemAccessesTriviallyDisjoint(const MachineInstr &MIa, const MachineInstr &MIb) const override
bool isOperandLegal(const MachineInstr &MI, unsigned OpIdx, const MachineOperand *MO=nullptr) const
Check if MO is a legal operand if it was the OpIdx Operand for MI.
bool isBarrierStart(unsigned Opcode) const
Definition: SIInstrInfo.h:937
static bool isLDSDMA(const MachineInstr &MI)
Definition: SIInstrInfo.h:568
unsigned isStackAccess(const MachineInstr &MI, int &FrameIndex) const
static bool isAtomicNoRet(const MachineInstr &MI)
Definition: SIInstrInfo.h:671
static bool isVOP1(const MachineInstr &MI)
Definition: SIInstrInfo.h:494
void insertIndirectBranch(MachineBasicBlock &MBB, MachineBasicBlock &NewDestBB, MachineBasicBlock &RestoreBB, const DebugLoc &DL, int64_t BrOffset, RegScavenger *RS) const override
bool hasAnyModifiersSet(const MachineInstr &MI) const
const TargetRegisterClass * getRegClass(unsigned RCID) const
bool isSGPRReg(const MachineRegisterInfo &MRI, Register Reg) const
ScheduleDAGMI is an implementation of ScheduleDAGInstrs that simply schedules machine instructions ac...
HazardRecognizer - This determines whether or not an instruction can be issued this cycle,...
A vector that has set insertion semantics.
Definition: SetVector.h:57
SlotIndexes pass.
Definition: SlotIndexes.h:297
A SetVector that performs no allocations if smaller than a certain size.
Definition: SetVector.h:370
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:573
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:51
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Provide an instruction scheduling machine model to CodeGen passes.
Target - Wrapper for Target specific information.
LLVM Value Representation.
Definition: Value.h:74
const uint64_t RSRC_DATA_FORMAT
Definition: SIInstrInfo.h:1582
LLVM_READONLY int getBasicFromSDWAOp(uint16_t Opcode)
LLVM_READONLY int getGlobalSaddrOp(uint16_t Opcode)
LLVM_READONLY int getSOPKOp(uint16_t Opcode)
LLVM_READONLY int getVOPe32(uint16_t Opcode)
LLVM_READONLY int16_t getNamedOperandIdx(uint16_t Opcode, uint16_t NamedIdx)
LLVM_READONLY int getDPPOp32(uint16_t Opcode)
LLVM_READONLY int getFlatScratchInstSVfromSS(uint16_t Opcode)
LLVM_READONLY int getFlatScratchInstSTfromSS(uint16_t Opcode)
LLVM_READONLY int getGlobalVaddrOp(uint16_t Opcode)
const uint64_t RSRC_ELEMENT_SIZE_SHIFT
Definition: SIInstrInfo.h:1583
LLVM_READONLY int getFlatScratchInstSVfromSVS(uint16_t Opcode)
LLVM_READONLY int getAddr64Inst(uint16_t Opcode)
LLVM_READONLY int getMFMAEarlyClobberOp(uint16_t Opcode)
LLVM_READONLY int getVCMPXOpFromVCMP(uint16_t Opcode)
LLVM_READONLY int getSDWAOp(uint16_t Opcode)
LLVM_READONLY int getMFMASrcCVDstAGPROp(uint16_t Opcode)
const uint64_t RSRC_TID_ENABLE
Definition: SIInstrInfo.h:1585
LLVM_READONLY int getCommuteRev(uint16_t Opcode)
LLVM_READONLY int getDPPOp64(uint16_t Opcode)
LLVM_READONLY int getVOPe64(uint16_t Opcode)
@ OPERAND_REG_IMM_INT64
Definition: SIDefines.h:201
@ OPERAND_REG_IMM_INT32
Operands with register or 32-bit immediate.
Definition: SIDefines.h:200
LLVM_READONLY int getCommuteOrig(uint16_t Opcode)
const uint64_t RSRC_INDEX_STRIDE_SHIFT
Definition: SIInstrInfo.h:1584
LLVM_READONLY int getFlatScratchInstSSfromSV(uint16_t Opcode)
LLVM_READONLY int getVCMPXNoSDstOp(uint16_t Opcode)
LLVM_READONLY int getIfAddr64Inst(uint16_t Opcode)
Check if Opcode is an Addr64 opcode.
@ OPERAND_IMMEDIATE
Definition: MCInstrDesc.h:60
Offsets
Offsets in bytes from the start of the input buffer.
Definition: SIInstrInfo.h:1600
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ Offset
Definition: DWP.cpp:480
TargetInstrInfo::RegSubRegPair getRegSubRegPair(const MachineOperand &O)
Create RegSubRegPair from a register MachineOperand.
Definition: SIInstrInfo.h:1468
bool execMayBeModifiedBeforeUse(const MachineRegisterInfo &MRI, Register VReg, const MachineInstr &DefMI, const MachineInstr &UseMI)
Return false if EXEC is not changed between the def of VReg at DefMI and the use at UseMI.
TargetInstrInfo::RegSubRegPair getRegSequenceSubReg(MachineInstr &MI, unsigned SubReg)
Return the SubReg component from REG_SEQUENCE.
static const MachineMemOperand::Flags MONoClobber
Mark the MMO of a uniform load if there are no potentially clobbering stores on any path from the sta...
Definition: SIInstrInfo.h:43
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1746
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
MachineInstr * getVRegSubRegDef(const TargetInstrInfo::RegSubRegPair &P, MachineRegisterInfo &MRI)
Return the defining instruction for a given reg:subreg pair skipping copy like instructions and subre...
constexpr unsigned DefaultMemoryClusterDWordsLimit
Definition: SIInstrInfo.h:39
static const MachineMemOperand::Flags MOLastUse
Mark the MMO of a load as the last use.
Definition: SIInstrInfo.h:47
bool isOfRegClass(const TargetInstrInfo::RegSubRegPair &P, const TargetRegisterClass &TRC, MachineRegisterInfo &MRI)
Returns true if a reg:subreg pair P has a TRC class.
Definition: SIInstrInfo.h:1456
InstructionUniformity
Enum describing how instructions behave with respect to uniformity and divergence,...
Definition: Uniformity.h:18
bool execMayBeModifiedBeforeAnyUse(const MachineRegisterInfo &MRI, Register VReg, const MachineInstr &DefMI)
Return false if EXEC is not changed between the def of VReg at DefMI and all its uses.
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
Description of the encoding of one expression Op.
Utility to store machine instructions worklist.
Definition: SIInstrInfo.h:51
MachineInstr * top() const
Definition: SIInstrInfo.h:56
bool empty() const
Definition: SIInstrInfo.h:66
bool isDeferred(MachineInstr *MI)
SetVector< MachineInstr * > & getDeferredList()
Definition: SIInstrInfo.h:75
void insert(MachineInstr *MI)
A pair composed of a register and a sub-register index.