LLVM 17.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
39/// Mark the MMO of a uniform load if there are no potentially clobbering stores
40/// on any path from the start of an entry function to this load.
43
44/// Utility to store machine instructions worklist.
46 SIInstrWorklist() : InstrList() {}
47
48 void insert(MachineInstr *MI);
49
50 MachineInstr *top() const {
51 auto iter = InstrList.begin();
52 return *iter;
53 }
54
55 void erase_top() {
56 auto iter = InstrList.begin();
57 InstrList.erase(iter);
58 }
59
60 bool empty() const { return InstrList.empty(); }
61
62 void clear() {
63 InstrList.clear();
64 DeferredList.clear();
65 }
66
68
69 SetVector<MachineInstr *> &getDeferredList() { return DeferredList; }
70
71private:
72 /// InstrList contains the MachineInstrs.
74 /// Deferred instructions are specific MachineInstr
75 /// that will be added by insert method.
76 SetVector<MachineInstr *> DeferredList;
77};
78
79class SIInstrInfo final : public AMDGPUGenInstrInfo {
80private:
81 const SIRegisterInfo RI;
82 const GCNSubtarget &ST;
83 TargetSchedModel SchedModel;
84 mutable std::unique_ptr<AMDGPUMIRFormatter> Formatter;
85
86 // The inverse predicate should have the negative value.
87 enum BranchPredicate {
88 INVALID_BR = 0,
89 SCC_TRUE = 1,
90 SCC_FALSE = -1,
91 VCCNZ = 2,
92 VCCZ = -2,
93 EXECNZ = -3,
94 EXECZ = 3
95 };
96
98
99 static unsigned getBranchOpcode(BranchPredicate Cond);
100 static BranchPredicate getBranchPredicate(unsigned Opcode);
101
102public:
105 MachineOperand &SuperReg,
106 const TargetRegisterClass *SuperRC,
107 unsigned SubIdx,
108 const TargetRegisterClass *SubRC) const;
111 MachineOperand &SuperReg,
112 const TargetRegisterClass *SuperRC,
113 unsigned SubIdx,
114 const TargetRegisterClass *SubRC) const;
115private:
116 void swapOperands(MachineInstr &Inst) const;
117
118 std::pair<bool, MachineBasicBlock *>
119 moveScalarAddSub(SIInstrWorklist &Worklist, MachineInstr &Inst,
120 MachineDominatorTree *MDT = nullptr) const;
121
122 void lowerSelect(SIInstrWorklist &Worklist, MachineInstr &Inst,
123 MachineDominatorTree *MDT = nullptr) const;
124
125 void lowerScalarAbs(SIInstrWorklist &Worklist, MachineInstr &Inst) const;
126
127 void lowerScalarXnor(SIInstrWorklist &Worklist, MachineInstr &Inst) const;
128
129 void splitScalarNotBinop(SIInstrWorklist &Worklist, MachineInstr &Inst,
130 unsigned Opcode) const;
131
132 void splitScalarBinOpN2(SIInstrWorklist &Worklist, MachineInstr &Inst,
133 unsigned Opcode) const;
134
135 void splitScalar64BitUnaryOp(SIInstrWorklist &Worklist, MachineInstr &Inst,
136 unsigned Opcode, bool Swap = false) const;
137
138 void splitScalar64BitAddSub(SIInstrWorklist &Worklist, MachineInstr &Inst,
139 MachineDominatorTree *MDT = nullptr) const;
140
141 void splitScalar64BitBinaryOp(SIInstrWorklist &Worklist, MachineInstr &Inst,
142 unsigned Opcode,
143 MachineDominatorTree *MDT = nullptr) const;
144
145 void splitScalar64BitXnor(SIInstrWorklist &Worklist, MachineInstr &Inst,
146 MachineDominatorTree *MDT = nullptr) const;
147
148 void splitScalar64BitBCNT(SIInstrWorklist &Worklist,
149 MachineInstr &Inst) const;
150 void splitScalar64BitBFE(SIInstrWorklist &Worklist, MachineInstr &Inst) const;
151 void movePackToVALU(SIInstrWorklist &Worklist, MachineRegisterInfo &MRI,
152 MachineInstr &Inst) const;
153
154 void addUsersToMoveToVALUWorklist(Register Reg, MachineRegisterInfo &MRI,
155 SIInstrWorklist &Worklist) const;
156
157 void addSCCDefUsersToVALUWorklist(MachineOperand &Op,
158 MachineInstr &SCCDefInst,
159 SIInstrWorklist &Worklist,
160 Register NewCond = Register()) const;
161 void addSCCDefsToVALUWorklist(MachineInstr *SCCUseInst,
162 SIInstrWorklist &Worklist) const;
163
164 const TargetRegisterClass *
165 getDestEquivalentVGPRClass(const MachineInstr &Inst) const;
166
167 bool checkInstOffsetsDoNotOverlap(const MachineInstr &MIa,
168 const MachineInstr &MIb) const;
169
170 Register findUsedSGPR(const MachineInstr &MI, int OpIndices[3]) const;
171
172protected:
174 MachineOperand &Src0, unsigned Src0OpName,
175 MachineOperand &Src1, unsigned Src1OpName) const;
176
178 unsigned OpIdx0,
179 unsigned OpIdx1) const override;
180
181public:
183 MO_MASK = 0xf,
184
186 // MO_GOTPCREL -> symbol@GOTPCREL -> R_AMDGPU_GOTPCREL.
188 // MO_GOTPCREL32_LO -> symbol@gotpcrel32@lo -> R_AMDGPU_GOTPCREL32_LO.
191 // MO_GOTPCREL32_HI -> symbol@gotpcrel32@hi -> R_AMDGPU_GOTPCREL32_HI.
193 // MO_REL32_LO -> symbol@rel32@lo -> R_AMDGPU_REL32_LO.
196 // MO_REL32_HI -> symbol@rel32@hi -> R_AMDGPU_REL32_HI.
198
200
203 };
204
205 explicit SIInstrInfo(const GCNSubtarget &ST);
206
208 return RI;
209 }
210
211 const GCNSubtarget &getSubtarget() const {
212 return ST;
213 }
214
215 bool isReallyTriviallyReMaterializable(const MachineInstr &MI) const override;
216
217 bool isIgnorableUse(const MachineOperand &MO) const override;
218
219 bool areLoadsFromSameBasePtr(SDNode *Load0, SDNode *Load1, int64_t &Offset0,
220 int64_t &Offset1) const override;
221
223 const MachineInstr &LdSt,
225 bool &OffsetIsScalable, unsigned &Width,
226 const TargetRegisterInfo *TRI) const final;
227
230 unsigned NumLoads, unsigned NumBytes) const override;
231
232 bool shouldScheduleLoadsNear(SDNode *Load0, SDNode *Load1, int64_t Offset0,
233 int64_t Offset1, unsigned NumLoads) const override;
234
236 const DebugLoc &DL, MCRegister DestReg, MCRegister SrcReg,
237 bool KillSrc) const override;
238
241 Register DestReg, int64_t Value) const;
242
244 unsigned Size) const;
245
248 Register SrcReg, int Value) const;
249
252 Register SrcReg, int Value) const;
253
256 bool isKill, int FrameIndex,
257 const TargetRegisterClass *RC,
258 const TargetRegisterInfo *TRI,
259 Register VReg) const override;
260
263 int FrameIndex, const TargetRegisterClass *RC,
264 const TargetRegisterInfo *TRI,
265 Register VReg) const override;
266
267 bool expandPostRAPseudo(MachineInstr &MI) const override;
268
269 // Splits a V_MOV_B64_DPP_PSEUDO opcode into a pair of v_mov_b32_dpp
270 // instructions. Returns a pair of generated instructions.
271 // Can split either post-RA with physical registers or pre-RA with
272 // virtual registers. In latter case IR needs to be in SSA form and
273 // and a REG_SEQUENCE is produced to define original register.
274 std::pair<MachineInstr*, MachineInstr*>
276
277 // Returns an opcode that can be used to move a value to a \p DstRC
278 // register. If there is no hardware instruction that can store to \p
279 // DstRC, then AMDGPU::COPY is returned.
280 unsigned getMovOpcode(const TargetRegisterClass *DstRC) const;
281
282 const MCInstrDesc &getIndirectRegWriteMovRelPseudo(unsigned VecSize,
283 unsigned EltSize,
284 bool IsSGPR) const;
285
286 const MCInstrDesc &getIndirectGPRIDXPseudo(unsigned VecSize,
287 bool IsIndirectSrc) const;
289 int commuteOpcode(unsigned Opc) const;
290
292 inline int commuteOpcode(const MachineInstr &MI) const {
293 return commuteOpcode(MI.getOpcode());
294 }
295
296 bool findCommutedOpIndices(const MachineInstr &MI, unsigned &SrcOpIdx0,
297 unsigned &SrcOpIdx1) const override;
298
299 bool findCommutedOpIndices(const MCInstrDesc &Desc, unsigned &SrcOpIdx0,
300 unsigned &SrcOpIdx1) const;
301
302 bool isBranchOffsetInRange(unsigned BranchOpc,
303 int64_t BrOffset) const override;
304
305 MachineBasicBlock *getBranchDestBlock(const MachineInstr &MI) const override;
306
307 /// Return whether the block terminate with divergent branch.
308 /// Note this only work before lowering the pseudo control flow instructions.
309 bool hasDivergentBranch(const MachineBasicBlock *MBB) const;
310
312 MachineBasicBlock &NewDestBB,
313 MachineBasicBlock &RestoreBB, const DebugLoc &DL,
314 int64_t BrOffset, RegScavenger *RS) const override;
315
319 MachineBasicBlock *&FBB,
321 bool AllowModify) const;
322
324 MachineBasicBlock *&FBB,
326 bool AllowModify = false) const override;
327
329 int *BytesRemoved = nullptr) const override;
330
333 const DebugLoc &DL,
334 int *BytesAdded = nullptr) const override;
335
337 SmallVectorImpl<MachineOperand> &Cond) const override;
338
341 Register TrueReg, Register FalseReg, int &CondCycles,
342 int &TrueCycles, int &FalseCycles) const override;
343
347 Register TrueReg, Register FalseReg) const override;
348
352 Register TrueReg, Register FalseReg) const;
353
354 bool analyzeCompare(const MachineInstr &MI, Register &SrcReg,
355 Register &SrcReg2, int64_t &CmpMask,
356 int64_t &CmpValue) const override;
357
358 bool optimizeCompareInstr(MachineInstr &CmpInstr, Register SrcReg,
359 Register SrcReg2, int64_t CmpMask, int64_t CmpValue,
360 const MachineRegisterInfo *MRI) const override;
361
362 bool
364 const MachineInstr &MIb) const override;
365
366 static bool isFoldableCopy(const MachineInstr &MI);
367
368 void removeModOperands(MachineInstr &MI) const;
369
371 MachineRegisterInfo *MRI) const final;
372
373 unsigned getMachineCSELookAheadLimit() const override { return 500; }
374
376 LiveIntervals *LIS) const override;
377
379 const MachineBasicBlock *MBB,
380 const MachineFunction &MF) const override;
381
382 static bool isSALU(const MachineInstr &MI) {
383 return MI.getDesc().TSFlags & SIInstrFlags::SALU;
384 }
385
386 bool isSALU(uint16_t Opcode) const {
387 return get(Opcode).TSFlags & SIInstrFlags::SALU;
388 }
389
390 static bool isVALU(const MachineInstr &MI) {
391 return MI.getDesc().TSFlags & SIInstrFlags::VALU;
392 }
393
394 bool isVALU(uint16_t Opcode) const {
395 return get(Opcode).TSFlags & SIInstrFlags::VALU;
396 }
397
398 static bool isVMEM(const MachineInstr &MI) {
399 return isMUBUF(MI) || isMTBUF(MI) || isMIMG(MI);
400 }
401
402 bool isVMEM(uint16_t Opcode) const {
403 return isMUBUF(Opcode) || isMTBUF(Opcode) || isMIMG(Opcode);
404 }
405
406 static bool isSOP1(const MachineInstr &MI) {
407 return MI.getDesc().TSFlags & SIInstrFlags::SOP1;
408 }
409
410 bool isSOP1(uint16_t Opcode) const {
411 return get(Opcode).TSFlags & SIInstrFlags::SOP1;
412 }
413
414 static bool isSOP2(const MachineInstr &MI) {
415 return MI.getDesc().TSFlags & SIInstrFlags::SOP2;
416 }
417
418 bool isSOP2(uint16_t Opcode) const {
419 return get(Opcode).TSFlags & SIInstrFlags::SOP2;
420 }
421
422 static bool isSOPC(const MachineInstr &MI) {
423 return MI.getDesc().TSFlags & SIInstrFlags::SOPC;
424 }
425
426 bool isSOPC(uint16_t Opcode) const {
427 return get(Opcode).TSFlags & SIInstrFlags::SOPC;
428 }
429
430 static bool isSOPK(const MachineInstr &MI) {
431 return MI.getDesc().TSFlags & SIInstrFlags::SOPK;
432 }
433
434 bool isSOPK(uint16_t Opcode) const {
435 return get(Opcode).TSFlags & SIInstrFlags::SOPK;
436 }
437
438 static bool isSOPP(const MachineInstr &MI) {
439 return MI.getDesc().TSFlags & SIInstrFlags::SOPP;
440 }
441
442 bool isSOPP(uint16_t Opcode) const {
443 return get(Opcode).TSFlags & SIInstrFlags::SOPP;
444 }
445
446 static bool isPacked(const MachineInstr &MI) {
447 return MI.getDesc().TSFlags & SIInstrFlags::IsPacked;
448 }
449
450 bool isPacked(uint16_t Opcode) const {
451 return get(Opcode).TSFlags & SIInstrFlags::IsPacked;
452 }
453
454 static bool isVOP1(const MachineInstr &MI) {
455 return MI.getDesc().TSFlags & SIInstrFlags::VOP1;
456 }
457
458 bool isVOP1(uint16_t Opcode) const {
459 return get(Opcode).TSFlags & SIInstrFlags::VOP1;
460 }
461
462 static bool isVOP2(const MachineInstr &MI) {
463 return MI.getDesc().TSFlags & SIInstrFlags::VOP2;
464 }
465
466 bool isVOP2(uint16_t Opcode) const {
467 return get(Opcode).TSFlags & SIInstrFlags::VOP2;
468 }
469
470 static bool isVOP3(const MachineInstr &MI) {
471 return MI.getDesc().TSFlags & SIInstrFlags::VOP3;
472 }
473
474 bool isVOP3(uint16_t Opcode) const {
475 return get(Opcode).TSFlags & SIInstrFlags::VOP3;
476 }
477
478 static bool isSDWA(const MachineInstr &MI) {
479 return MI.getDesc().TSFlags & SIInstrFlags::SDWA;
480 }
481
482 bool isSDWA(uint16_t Opcode) const {
483 return get(Opcode).TSFlags & SIInstrFlags::SDWA;
484 }
485
486 static bool isVOPC(const MachineInstr &MI) {
487 return MI.getDesc().TSFlags & SIInstrFlags::VOPC;
488 }
489
490 bool isVOPC(uint16_t Opcode) const {
491 return get(Opcode).TSFlags & SIInstrFlags::VOPC;
492 }
493
494 static bool isMUBUF(const MachineInstr &MI) {
495 return MI.getDesc().TSFlags & SIInstrFlags::MUBUF;
496 }
497
498 bool isMUBUF(uint16_t Opcode) const {
499 return get(Opcode).TSFlags & SIInstrFlags::MUBUF;
500 }
501
502 static bool isMTBUF(const MachineInstr &MI) {
503 return MI.getDesc().TSFlags & SIInstrFlags::MTBUF;
504 }
505
506 bool isMTBUF(uint16_t Opcode) const {
507 return get(Opcode).TSFlags & SIInstrFlags::MTBUF;
508 }
509
510 static bool isSMRD(const MachineInstr &MI) {
511 return MI.getDesc().TSFlags & SIInstrFlags::SMRD;
512 }
513
514 bool isSMRD(uint16_t Opcode) const {
515 return get(Opcode).TSFlags & SIInstrFlags::SMRD;
516 }
517
518 bool isBufferSMRD(const MachineInstr &MI) const;
519
520 static bool isDS(const MachineInstr &MI) {
521 return MI.getDesc().TSFlags & SIInstrFlags::DS;
522 }
523
524 bool isDS(uint16_t Opcode) const {
525 return get(Opcode).TSFlags & SIInstrFlags::DS;
526 }
527
528 bool isAlwaysGDS(uint16_t Opcode) const;
529
530 static bool isMIMG(const MachineInstr &MI) {
531 return MI.getDesc().TSFlags & SIInstrFlags::MIMG;
532 }
533
534 bool isMIMG(uint16_t Opcode) const {
535 return get(Opcode).TSFlags & SIInstrFlags::MIMG;
536 }
537
538 static bool isGather4(const MachineInstr &MI) {
539 return MI.getDesc().TSFlags & SIInstrFlags::Gather4;
540 }
541
542 bool isGather4(uint16_t Opcode) const {
543 return get(Opcode).TSFlags & SIInstrFlags::Gather4;
544 }
545
546 static bool isFLAT(const MachineInstr &MI) {
547 return MI.getDesc().TSFlags & SIInstrFlags::FLAT;
548 }
549
550 // Is a FLAT encoded instruction which accesses a specific segment,
551 // i.e. global_* or scratch_*.
553 auto Flags = MI.getDesc().TSFlags;
555 }
556
557 bool isSegmentSpecificFLAT(uint16_t Opcode) const {
558 auto Flags = get(Opcode).TSFlags;
560 }
561
562 static bool isFLATGlobal(const MachineInstr &MI) {
563 return MI.getDesc().TSFlags & SIInstrFlags::FlatGlobal;
564 }
565
566 bool isFLATGlobal(uint16_t Opcode) const {
567 return get(Opcode).TSFlags & SIInstrFlags::FlatGlobal;
568 }
569
570 static bool isFLATScratch(const MachineInstr &MI) {
571 return MI.getDesc().TSFlags & SIInstrFlags::FlatScratch;
572 }
573
574 bool isFLATScratch(uint16_t Opcode) const {
575 return get(Opcode).TSFlags & SIInstrFlags::FlatScratch;
576 }
577
578 // Any FLAT encoded instruction, including global_* and scratch_*.
579 bool isFLAT(uint16_t Opcode) const {
580 return get(Opcode).TSFlags & SIInstrFlags::FLAT;
581 }
582
583 static bool isEXP(const MachineInstr &MI) {
584 return MI.getDesc().TSFlags & SIInstrFlags::EXP;
585 }
586
588 if (!isEXP(MI))
589 return false;
590 unsigned Target = MI.getOperand(0).getImm();
593 }
594
595 bool isEXP(uint16_t Opcode) const {
596 return get(Opcode).TSFlags & SIInstrFlags::EXP;
597 }
598
599 static bool isAtomicNoRet(const MachineInstr &MI) {
600 return MI.getDesc().TSFlags & SIInstrFlags::IsAtomicNoRet;
601 }
602
603 bool isAtomicNoRet(uint16_t Opcode) const {
604 return get(Opcode).TSFlags & SIInstrFlags::IsAtomicNoRet;
605 }
606
607 static bool isAtomicRet(const MachineInstr &MI) {
608 return MI.getDesc().TSFlags & SIInstrFlags::IsAtomicRet;
609 }
610
611 bool isAtomicRet(uint16_t Opcode) const {
612 return get(Opcode).TSFlags & SIInstrFlags::IsAtomicRet;
613 }
614
615 static bool isAtomic(const MachineInstr &MI) {
616 return MI.getDesc().TSFlags & (SIInstrFlags::IsAtomicRet |
618 }
619
620 bool isAtomic(uint16_t Opcode) const {
621 return get(Opcode).TSFlags & (SIInstrFlags::IsAtomicRet |
623 }
624
625 static bool isWQM(const MachineInstr &MI) {
626 return MI.getDesc().TSFlags & SIInstrFlags::WQM;
627 }
628
629 bool isWQM(uint16_t Opcode) const {
630 return get(Opcode).TSFlags & SIInstrFlags::WQM;
631 }
632
633 static bool isDisableWQM(const MachineInstr &MI) {
634 return MI.getDesc().TSFlags & SIInstrFlags::DisableWQM;
635 }
636
637 bool isDisableWQM(uint16_t Opcode) const {
638 return get(Opcode).TSFlags & SIInstrFlags::DisableWQM;
639 }
640
641 static bool isVGPRSpill(const MachineInstr &MI) {
642 return MI.getDesc().TSFlags & SIInstrFlags::VGPRSpill;
643 }
644
645 bool isVGPRSpill(uint16_t Opcode) const {
646 return get(Opcode).TSFlags & SIInstrFlags::VGPRSpill;
647 }
648
649 static bool isSGPRSpill(const MachineInstr &MI) {
650 return MI.getDesc().TSFlags & SIInstrFlags::SGPRSpill;
651 }
652
653 bool isSGPRSpill(uint16_t Opcode) const {
654 return get(Opcode).TSFlags & SIInstrFlags::SGPRSpill;
655 }
656
657 static bool isDPP(const MachineInstr &MI) {
658 return MI.getDesc().TSFlags & SIInstrFlags::DPP;
659 }
660
661 bool isDPP(uint16_t Opcode) const {
662 return get(Opcode).TSFlags & SIInstrFlags::DPP;
663 }
664
665 static bool isTRANS(const MachineInstr &MI) {
666 return MI.getDesc().TSFlags & SIInstrFlags::TRANS;
667 }
668
669 bool isTRANS(uint16_t Opcode) const {
670 return get(Opcode).TSFlags & SIInstrFlags::TRANS;
671 }
672
673 static bool isVOP3P(const MachineInstr &MI) {
674 return MI.getDesc().TSFlags & SIInstrFlags::VOP3P;
675 }
676
677 bool isVOP3P(uint16_t Opcode) const {
678 return get(Opcode).TSFlags & SIInstrFlags::VOP3P;
679 }
680
681 static bool isVINTRP(const MachineInstr &MI) {
682 return MI.getDesc().TSFlags & SIInstrFlags::VINTRP;
683 }
684
685 bool isVINTRP(uint16_t Opcode) const {
686 return get(Opcode).TSFlags & SIInstrFlags::VINTRP;
687 }
688
689 static bool isMAI(const MachineInstr &MI) {
690 return MI.getDesc().TSFlags & SIInstrFlags::IsMAI;
691 }
692
693 bool isMAI(uint16_t Opcode) const {
694 return get(Opcode).TSFlags & SIInstrFlags::IsMAI;
695 }
696
697 static bool isMFMA(const MachineInstr &MI) {
698 return isMAI(MI) && MI.getOpcode() != AMDGPU::V_ACCVGPR_WRITE_B32_e64 &&
699 MI.getOpcode() != AMDGPU::V_ACCVGPR_READ_B32_e64;
700 }
701
702 static bool isDOT(const MachineInstr &MI) {
703 return MI.getDesc().TSFlags & SIInstrFlags::IsDOT;
704 }
705
706 static bool isWMMA(const MachineInstr &MI) {
707 return MI.getDesc().TSFlags & SIInstrFlags::IsWMMA;
708 }
709
710 bool isWMMA(uint16_t Opcode) const {
711 return get(Opcode).TSFlags & SIInstrFlags::IsWMMA;
712 }
713
714 static bool isMFMAorWMMA(const MachineInstr &MI) {
715 return isMFMA(MI) || isWMMA(MI);
716 }
717
718 bool isDOT(uint16_t Opcode) const {
719 return get(Opcode).TSFlags & SIInstrFlags::IsDOT;
720 }
721
722 static bool isLDSDIR(const MachineInstr &MI) {
723 return MI.getDesc().TSFlags & SIInstrFlags::LDSDIR;
724 }
725
726 bool isLDSDIR(uint16_t Opcode) const {
727 return get(Opcode).TSFlags & SIInstrFlags::LDSDIR;
728 }
729
730 static bool isVINTERP(const MachineInstr &MI) {
731 return MI.getDesc().TSFlags & SIInstrFlags::VINTERP;
732 }
733
734 bool isVINTERP(uint16_t Opcode) const {
735 return get(Opcode).TSFlags & SIInstrFlags::VINTERP;
736 }
737
738 static bool isScalarUnit(const MachineInstr &MI) {
739 return MI.getDesc().TSFlags & (SIInstrFlags::SALU | SIInstrFlags::SMRD);
740 }
741
742 static bool usesVM_CNT(const MachineInstr &MI) {
743 return MI.getDesc().TSFlags & SIInstrFlags::VM_CNT;
744 }
745
746 static bool usesLGKM_CNT(const MachineInstr &MI) {
747 return MI.getDesc().TSFlags & SIInstrFlags::LGKM_CNT;
748 }
749
750 static bool sopkIsZext(const MachineInstr &MI) {
751 return MI.getDesc().TSFlags & SIInstrFlags::SOPK_ZEXT;
752 }
753
754 bool sopkIsZext(uint16_t Opcode) const {
755 return get(Opcode).TSFlags & SIInstrFlags::SOPK_ZEXT;
756 }
757
758 /// \returns true if this is an s_store_dword* instruction. This is more
759 /// specific than isSMEM && mayStore.
760 static bool isScalarStore(const MachineInstr &MI) {
761 return MI.getDesc().TSFlags & SIInstrFlags::SCALAR_STORE;
762 }
763
764 bool isScalarStore(uint16_t Opcode) const {
765 return get(Opcode).TSFlags & SIInstrFlags::SCALAR_STORE;
766 }
767
768 static bool isFixedSize(const MachineInstr &MI) {
769 return MI.getDesc().TSFlags & SIInstrFlags::FIXED_SIZE;
770 }
771
772 bool isFixedSize(uint16_t Opcode) const {
773 return get(Opcode).TSFlags & SIInstrFlags::FIXED_SIZE;
774 }
775
776 static bool hasFPClamp(const MachineInstr &MI) {
777 return MI.getDesc().TSFlags & SIInstrFlags::FPClamp;
778 }
779
780 bool hasFPClamp(uint16_t Opcode) const {
781 return get(Opcode).TSFlags & SIInstrFlags::FPClamp;
782 }
783
784 static bool hasIntClamp(const MachineInstr &MI) {
785 return MI.getDesc().TSFlags & SIInstrFlags::IntClamp;
786 }
787
789 const uint64_t ClampFlags = SIInstrFlags::FPClamp |
793 return MI.getDesc().TSFlags & ClampFlags;
794 }
795
796 static bool usesFPDPRounding(const MachineInstr &MI) {
797 return MI.getDesc().TSFlags & SIInstrFlags::FPDPRounding;
798 }
799
800 bool usesFPDPRounding(uint16_t Opcode) const {
801 return get(Opcode).TSFlags & SIInstrFlags::FPDPRounding;
802 }
803
804 static bool isFPAtomic(const MachineInstr &MI) {
805 return MI.getDesc().TSFlags & SIInstrFlags::FPAtomic;
806 }
807
808 bool isFPAtomic(uint16_t Opcode) const {
809 return get(Opcode).TSFlags & SIInstrFlags::FPAtomic;
810 }
811
812 static bool isNeverUniform(const MachineInstr &MI) {
813 return MI.getDesc().TSFlags & SIInstrFlags::IsNeverUniform;
814 }
815
817 return MI.getDesc().TSFlags & SIInstrFlags::TiedSourceNotRead;
818 }
819
820 bool doesNotReadTiedSource(uint16_t Opcode) const {
821 return get(Opcode).TSFlags & SIInstrFlags::TiedSourceNotRead;
822 }
823
824 bool isVGPRCopy(const MachineInstr &MI) const {
825 assert(MI.isCopy());
826 Register Dest = MI.getOperand(0).getReg();
827 const MachineFunction &MF = *MI.getParent()->getParent();
828 const MachineRegisterInfo &MRI = MF.getRegInfo();
829 return !RI.isSGPRReg(MRI, Dest);
830 }
831
832 bool hasVGPRUses(const MachineInstr &MI) const {
833 const MachineFunction &MF = *MI.getParent()->getParent();
834 const MachineRegisterInfo &MRI = MF.getRegInfo();
835 return llvm::any_of(MI.explicit_uses(),
836 [&MRI, this](const MachineOperand &MO) {
837 return MO.isReg() && RI.isVGPR(MRI, MO.getReg());});
838 }
839
840 /// Return true if the instruction modifies the mode register.q
841 static bool modifiesModeRegister(const MachineInstr &MI);
842
843 /// Whether we must prevent this instruction from executing with EXEC = 0.
845
846 /// Returns true if the instruction could potentially depend on the value of
847 /// exec. If false, exec dependencies may safely be ignored.
848 bool mayReadEXEC(const MachineRegisterInfo &MRI, const MachineInstr &MI) const;
849
850 bool isInlineConstant(const APInt &Imm) const;
851
852 bool isInlineConstant(const APFloat &Imm) const {
853 return isInlineConstant(Imm.bitcastToAPInt());
854 }
855
856 // Returns true if this non-register operand definitely does not need to be
857 // encoded as a 32-bit literal. Note that this function handles all kinds of
858 // operands, not just immediates.
859 //
860 // Some operands like FrameIndexes could resolve to an inline immediate value
861 // that will not require an additional 4-bytes; this function assumes that it
862 // will.
863 bool isInlineConstant(const MachineOperand &MO, uint8_t OperandType) const;
864
866 const MCOperandInfo &OpInfo) const {
867 return isInlineConstant(MO, OpInfo.OperandType);
868 }
869
870 /// \p returns true if \p UseMO is substituted with \p DefMO in \p MI it would
871 /// be an inline immediate.
873 const MachineOperand &UseMO,
874 const MachineOperand &DefMO) const {
875 assert(UseMO.getParent() == &MI);
876 int OpIdx = UseMO.getOperandNo();
877 if (OpIdx >= MI.getDesc().NumOperands)
878 return false;
879
880 return isInlineConstant(DefMO, MI.getDesc().operands()[OpIdx]);
881 }
882
883 /// \p returns true if the operand \p OpIdx in \p MI is a valid inline
884 /// immediate.
885 bool isInlineConstant(const MachineInstr &MI, unsigned OpIdx) const {
886 const MachineOperand &MO = MI.getOperand(OpIdx);
887 return isInlineConstant(MO, MI.getDesc().operands()[OpIdx].OperandType);
888 }
889
890 bool isInlineConstant(const MachineInstr &MI, unsigned OpIdx,
891 const MachineOperand &MO) const {
892 if (OpIdx >= MI.getDesc().NumOperands)
893 return false;
894
895 if (MI.isCopy()) {
896 unsigned Size = getOpSize(MI, OpIdx);
897 assert(Size == 8 || Size == 4);
898
899 uint8_t OpType = (Size == 8) ?
901 return isInlineConstant(MO, OpType);
902 }
903
904 return isInlineConstant(MO, MI.getDesc().operands()[OpIdx].OperandType);
905 }
906
907 bool isInlineConstant(const MachineOperand &MO) const {
908 return isInlineConstant(*MO.getParent(), MO.getOperandNo());
909 }
910
911 bool isImmOperandLegal(const MachineInstr &MI, unsigned OpNo,
912 const MachineOperand &MO) const;
913
914 /// Return true if this 64-bit VALU instruction has a 32-bit encoding.
915 /// This function will return false if you pass it a 32-bit instruction.
916 bool hasVALU32BitEncoding(unsigned Opcode) const;
917
918 /// Returns true if this operand uses the constant bus.
920 const MachineOperand &MO,
921 const MCOperandInfo &OpInfo) const;
922
923 /// Return true if this instruction has any modifiers.
924 /// e.g. src[012]_mod, omod, clamp.
925 bool hasModifiers(unsigned Opcode) const;
926
927 bool hasModifiersSet(const MachineInstr &MI,
928 unsigned OpName) const;
929 bool hasAnyModifiersSet(const MachineInstr &MI) const;
930
931 bool canShrink(const MachineInstr &MI,
932 const MachineRegisterInfo &MRI) const;
933
935 unsigned NewOpcode) const;
936
938 StringRef &ErrInfo) const override;
939
940 unsigned getVALUOp(const MachineInstr &MI) const;
941
942 /// Return the correct register class for \p OpNo. For target-specific
943 /// instructions, this will return the register class that has been defined
944 /// in tablegen. For generic instructions, like REG_SEQUENCE it will return
945 /// the register class of its machine operand.
946 /// to infer the correct register class base on the other operands.
948 unsigned OpNo) const;
949
950 /// Return the size in bytes of the operand OpNo on the given
951 // instruction opcode.
952 unsigned getOpSize(uint16_t Opcode, unsigned OpNo) const {
953 const MCOperandInfo &OpInfo = get(Opcode).operands()[OpNo];
954
955 if (OpInfo.RegClass == -1) {
956 // If this is an immediate operand, this must be a 32-bit literal.
958 return 4;
959 }
960
961 return RI.getRegSizeInBits(*RI.getRegClass(OpInfo.RegClass)) / 8;
962 }
963
964 /// This form should usually be preferred since it handles operands
965 /// with unknown register classes.
966 unsigned getOpSize(const MachineInstr &MI, unsigned OpNo) const {
967 const MachineOperand &MO = MI.getOperand(OpNo);
968 if (MO.isReg()) {
969 if (unsigned SubReg = MO.getSubReg()) {
970 return RI.getSubRegIdxSize(SubReg) / 8;
971 }
972 }
973 return RI.getRegSizeInBits(*getOpRegClass(MI, OpNo)) / 8;
974 }
975
976 /// Legalize the \p OpIndex operand of this instruction by inserting
977 /// a MOV. For example:
978 /// ADD_I32_e32 VGPR0, 15
979 /// to
980 /// MOV VGPR1, 15
981 /// ADD_I32_e32 VGPR0, VGPR1
982 ///
983 /// If the operand being legalized is a register, then a COPY will be used
984 /// instead of MOV.
985 void legalizeOpWithMove(MachineInstr &MI, unsigned OpIdx) const;
986
987 /// Check if \p MO is a legal operand if it was the \p OpIdx Operand
988 /// for \p MI.
989 bool isOperandLegal(const MachineInstr &MI, unsigned OpIdx,
990 const MachineOperand *MO = nullptr) const;
991
992 /// Check if \p MO would be a valid operand for the given operand
993 /// definition \p OpInfo. Note this does not attempt to validate constant bus
994 /// restrictions (e.g. literal constant usage).
996 const MCOperandInfo &OpInfo,
997 const MachineOperand &MO) const;
998
999 /// Check if \p MO (a register operand) is a legal register for the
1000 /// given operand description.
1002 const MCOperandInfo &OpInfo,
1003 const MachineOperand &MO) const;
1004
1005 /// Legalize operands in \p MI by either commuting it or inserting a
1006 /// copy of src1.
1008
1009 /// Fix operands in \p MI to satisfy constant bus requirements.
1011
1012 /// Copy a value from a VGPR (\p SrcReg) to SGPR. This function can only
1013 /// be used when it is know that the value in SrcReg is same across all
1014 /// threads in the wave.
1015 /// \returns The SGPR register that \p SrcReg was copied to.
1017 MachineRegisterInfo &MRI) const;
1018
1021
1024 const TargetRegisterClass *DstRC,
1026 const DebugLoc &DL) const;
1027
1028 /// Legalize all operands in this instruction. This function may create new
1029 /// instructions and control-flow around \p MI. If present, \p MDT is
1030 /// updated.
1031 /// \returns A new basic block that contains \p MI if new blocks were created.
1033 legalizeOperands(MachineInstr &MI, MachineDominatorTree *MDT = nullptr) const;
1034
1035 /// Change SADDR form of a FLAT \p Inst to its VADDR form if saddr operand
1036 /// was moved to VGPR. \returns true if succeeded.
1037 bool moveFlatAddrToVGPR(MachineInstr &Inst) const;
1038
1039 /// Replace the instructions opcode with the equivalent VALU
1040 /// opcode. This function will also move the users of MachineInstruntions
1041 /// in the \p WorkList to the VALU if necessary. If present, \p MDT is
1042 /// updated.
1043 void moveToVALU(SIInstrWorklist &Worklist, MachineDominatorTree *MDT) const;
1044
1046 MachineInstr &Inst) const;
1047
1049 MachineBasicBlock::iterator MI) const override;
1050
1052 unsigned Quantity) const override;
1053
1054 void insertReturn(MachineBasicBlock &MBB) const;
1055 /// Return the number of wait states that result from executing this
1056 /// instruction.
1057 static unsigned getNumWaitStates(const MachineInstr &MI);
1058
1059 /// Returns the operand named \p Op. If \p MI does not have an
1060 /// operand named \c Op, this function returns nullptr.
1062 MachineOperand *getNamedOperand(MachineInstr &MI, unsigned OperandName) const;
1063
1066 unsigned OpName) const {
1067 return getNamedOperand(const_cast<MachineInstr &>(MI), OpName);
1068 }
1069
1070 /// Get required immediate operand
1071 int64_t getNamedImmOperand(const MachineInstr &MI, unsigned OpName) const {
1072 int Idx = AMDGPU::getNamedOperandIdx(MI.getOpcode(), OpName);
1073 return MI.getOperand(Idx).getImm();
1074 }
1075
1078
1079 bool isLowLatencyInstruction(const MachineInstr &MI) const;
1080 bool isHighLatencyDef(int Opc) const override;
1081
1082 /// Return the descriptor of the target-specific machine instruction
1083 /// that corresponds to the specified pseudo or native opcode.
1084 const MCInstrDesc &getMCOpcodeFromPseudo(unsigned Opcode) const {
1085 return get(pseudoToMCOpcode(Opcode));
1086 }
1087
1088 unsigned isStackAccess(const MachineInstr &MI, int &FrameIndex) const;
1089 unsigned isSGPRStackAccess(const MachineInstr &MI, int &FrameIndex) const;
1090
1091 unsigned isLoadFromStackSlot(const MachineInstr &MI,
1092 int &FrameIndex) const override;
1093 unsigned isStoreToStackSlot(const MachineInstr &MI,
1094 int &FrameIndex) const override;
1095
1096 unsigned getInstBundleSize(const MachineInstr &MI) const;
1097 unsigned getInstSizeInBytes(const MachineInstr &MI) const override;
1098
1099 bool mayAccessFlatAddressSpace(const MachineInstr &MI) const;
1100
1101 bool isNonUniformBranchInstr(MachineInstr &Instr) const;
1102
1104 MachineBasicBlock *IfEnd) const;
1105
1107 MachineBasicBlock *LoopEnd) const;
1108
1109 std::pair<unsigned, unsigned>
1110 decomposeMachineOperandsTargetFlags(unsigned TF) const override;
1111
1113 getSerializableTargetIndices() const override;
1114
1117
1120
1123 const ScheduleDAG *DAG) const override;
1124
1126 CreateTargetPostRAHazardRecognizer(const MachineFunction &MF) const override;
1127
1130 const ScheduleDAGMI *DAG) const override;
1131
1132 bool isBasicBlockPrologue(const MachineInstr &MI) const override;
1133
1136 const DebugLoc &DL, Register Src,
1137 Register Dst) const override;
1138
1141 const DebugLoc &DL, Register Src,
1142 unsigned SrcSubReg,
1143 Register Dst) const override;
1144
1145 bool isWave32() const;
1146
1147 /// Return a partially built integer add instruction without carry.
1148 /// Caller must add source operands.
1149 /// For pre-GFX9 it will generate unused carry destination operand.
1150 /// TODO: After GFX9 it should return a no-carry operation.
1153 const DebugLoc &DL,
1154 Register DestReg) const;
1155
1158 const DebugLoc &DL,
1159 Register DestReg,
1160 RegScavenger &RS) const;
1161
1162 static bool isKillTerminator(unsigned Opcode);
1163 const MCInstrDesc &getKillTerminatorFromPseudo(unsigned Opcode) const;
1164
1165 static bool isLegalMUBUFImmOffset(unsigned Imm) {
1166 return isUInt<12>(Imm);
1167 }
1168
1169 static unsigned getMaxMUBUFImmOffset();
1170
1171 bool splitMUBUFOffset(uint32_t Imm, uint32_t &SOffset, uint32_t &ImmOffset,
1172 Align Alignment = Align(4)) const;
1173
1174 /// Returns if \p Offset is legal for the subtarget as the offset to a FLAT
1175 /// encoded instruction. If \p Signed, this is for an instruction that
1176 /// interprets the offset as signed.
1177 bool isLegalFLATOffset(int64_t Offset, unsigned AddrSpace,
1178 uint64_t FlatVariant) const;
1179
1180 /// Split \p COffsetVal into {immediate offset field, remainder offset}
1181 /// values.
1182 std::pair<int64_t, int64_t> splitFlatOffset(int64_t COffsetVal,
1183 unsigned AddrSpace,
1184 uint64_t FlatVariant) const;
1185
1186 /// \brief Return a target-specific opcode if Opcode is a pseudo instruction.
1187 /// Return -1 if the target-specific opcode for the pseudo instruction does
1188 /// not exist. If Opcode is not a pseudo instruction, this is identity.
1189 int pseudoToMCOpcode(int Opcode) const;
1190
1191 /// \brief Check if this instruction should only be used by assembler.
1192 /// Return true if this opcode should not be used by codegen.
1193 bool isAsmOnlyOpcode(int MCOp) const;
1194
1195 const TargetRegisterClass *getRegClass(const MCInstrDesc &TID, unsigned OpNum,
1196 const TargetRegisterInfo *TRI,
1197 const MachineFunction &MF)
1198 const override;
1199
1200 void fixImplicitOperands(MachineInstr &MI) const;
1201
1205 int FrameIndex,
1206 LiveIntervals *LIS = nullptr,
1207 VirtRegMap *VRM = nullptr) const override;
1208
1209 unsigned getInstrLatency(const InstrItineraryData *ItinData,
1210 const MachineInstr &MI,
1211 unsigned *PredCost = nullptr) const override;
1212
1214 getInstructionUniformity(const MachineInstr &MI) const override final;
1215
1218
1219 const MIRFormatter *getMIRFormatter() const override {
1220 if (!Formatter.get())
1221 Formatter = std::make_unique<AMDGPUMIRFormatter>();
1222 return Formatter.get();
1223 }
1224
1225 static unsigned getDSShaderTypeValue(const MachineFunction &MF);
1226
1227 const TargetSchedModel &getSchedModel() const { return SchedModel; }
1228
1229 // Enforce operand's \p OpName even alignment if required by target.
1230 // This is used if an operand is a 32 bit register but needs to be aligned
1231 // regardless.
1232 void enforceOperandRCAlignment(MachineInstr &MI, unsigned OpName) const;
1233};
1234
1235/// \brief Returns true if a reg:subreg pair P has a TRC class
1237 const TargetRegisterClass &TRC,
1239 auto *RC = MRI.getRegClass(P.Reg);
1240 if (!P.SubReg)
1241 return RC == &TRC;
1242 auto *TRI = MRI.getTargetRegisterInfo();
1243 return RC == TRI->getMatchingSuperRegClass(RC, &TRC, P.SubReg);
1244}
1245
1246/// \brief Create RegSubRegPair from a register MachineOperand
1247inline
1249 assert(O.isReg());
1250 return TargetInstrInfo::RegSubRegPair(O.getReg(), O.getSubReg());
1251}
1252
1253/// \brief Return the SubReg component from REG_SEQUENCE
1254TargetInstrInfo::RegSubRegPair getRegSequenceSubReg(MachineInstr &MI,
1255 unsigned SubReg);
1256
1257/// \brief Return the defining instruction for a given reg:subreg pair
1258/// skipping copy like instructions and subreg-manipulation pseudos.
1259/// Following another subreg of a reg:subreg isn't supported.
1260MachineInstr *getVRegSubRegDef(const TargetInstrInfo::RegSubRegPair &P,
1261 MachineRegisterInfo &MRI);
1262
1263/// \brief Return false if EXEC is not changed between the def of \p VReg at \p
1264/// DefMI and the use at \p UseMI. Should be run on SSA. Currently does not
1265/// attempt to track between blocks.
1266bool execMayBeModifiedBeforeUse(const MachineRegisterInfo &MRI,
1267 Register VReg,
1268 const MachineInstr &DefMI,
1269 const MachineInstr &UseMI);
1270
1271/// \brief Return false if EXEC is not changed between the def of \p VReg at \p
1272/// DefMI and all its uses. Should be run on SSA. Currently does not attempt to
1273/// track between blocks.
1274bool execMayBeModifiedBeforeAnyUse(const MachineRegisterInfo &MRI,
1275 Register VReg,
1276 const MachineInstr &DefMI);
1277
1278namespace AMDGPU {
1279
1281 int getVOPe64(uint16_t Opcode);
1282
1284 int getVOPe32(uint16_t Opcode);
1285
1287 int getSDWAOp(uint16_t Opcode);
1288
1291
1294
1297
1300
1303
1306
1307 /// Check if \p Opcode is an Addr64 opcode.
1308 ///
1309 /// \returns \p Opcode if it is an Addr64 opcode, otherwise -1.
1312
1315
1317 int getSOPKOp(uint16_t Opcode);
1318
1319 /// \returns SADDR form of a FLAT Global instruction given an \p Opcode
1320 /// of a VADDR form.
1323
1324 /// \returns VADDR form of a FLAT Global instruction given an \p Opcode
1325 /// of a SADDR form.
1328
1331
1332 /// \returns ST form with only immediate offset of a FLAT Scratch instruction
1333 /// given an \p Opcode of an SS (SADDR) form.
1336
1337 /// \returns SV (VADDR) form of a FLAT Scratch instruction given an \p Opcode
1338 /// of an SVS (SADDR + VADDR) form.
1341
1342 /// \returns SS (SADDR) form of a FLAT Scratch instruction given an \p Opcode
1343 /// of an SV (VADDR) form.
1346
1347 /// \returns SV (VADDR) form of a FLAT Scratch instruction given an \p Opcode
1348 /// of an SS (SADDR) form.
1351
1352 /// \returns earlyclobber version of a MAC MFMA is exists.
1355
1356 /// \returns v_cmpx version of a v_cmp instruction.
1359
1360 const uint64_t RSRC_DATA_FORMAT = 0xf00000000000LL;
1363 const uint64_t RSRC_TID_ENABLE = UINT64_C(1) << (32 + 23);
1364
1365} // end namespace AMDGPU
1366
1367namespace SI {
1368namespace KernelInputOffsets {
1369
1370/// Offsets in bytes from the start of the input buffer
1380 LOCAL_SIZE_Z = 32
1382
1383} // end namespace KernelInputOffsets
1384} // end namespace SI
1385
1386} // end namespace llvm
1387
1388#endif // LLVM_LIB_TARGET_AMDGPU_SIINSTRINFO_H
unsigned SubReg
unsigned const MachineRegisterInfo * MRI
MachineInstrBuilder & UseMI
MachineInstrBuilder MachineInstrBuilder & DefMI
MachineBasicBlock & MBB
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Provides AMDGPU specific target descriptions.
AMDGPU specific overrides of MIRFormatter.
SmallVector< MachineOperand, 4 > Cond
#define LLVM_READONLY
Definition: Compiler.h:196
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
#define P(N)
const SmallVectorImpl< MachineOperand > MachineBasicBlock * TBB
@ SI
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Interface definition for SIRegisterInfo.
This file implements a set that has insertion order iteration characteristics.
@ Flags
Definition: TextStubV5.cpp:93
Class for arbitrary precision integers.
Definition: APInt.h:75
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
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:24
MIRFormater - Interface to format MIR operand based on target.
Definition: MIRFormatter.h:28
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:68
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 isFLATGlobal(uint16_t Opcode) const
Definition: SIInstrInfo.h:566
bool isInlineConstant(const APInt &Imm) const
static bool isMAI(const MachineInstr &MI)
Definition: SIInstrInfo.h:689
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:520
static bool isVMEM(const MachineInstr &MI)
Definition: SIInstrInfo.h:398
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
bool isNonUniformBranchInstr(MachineInstr &Instr) const
static bool isVOP3(const MachineInstr &MI)
Definition: SIInstrInfo.h:470
bool isSMRD(uint16_t Opcode) const
Definition: SIInstrInfo.h:514
unsigned getInstSizeInBytes(const MachineInstr &MI) const override
static bool isNeverUniform(const MachineInstr &MI)
Definition: SIInstrInfo.h:812
unsigned getOpSize(uint16_t Opcode, unsigned OpNo) const
Return the size in bytes of the operand OpNo on the given.
Definition: SIInstrInfo.h:952
bool isAtomic(uint16_t Opcode) const
Definition: SIInstrInfo.h:620
bool isLDSDIR(uint16_t Opcode) const
Definition: SIInstrInfo.h:726
bool isFLATScratch(uint16_t Opcode) const
Definition: SIInstrInfo.h:574
uint64_t getDefaultRsrcDataFormat() const
static bool isSOPP(const MachineInstr &MI)
Definition: SIInstrInfo.h:438
InstructionUniformity getGenericInstructionUniformity(const MachineInstr &MI) const
bool hasVGPRUses(const MachineInstr &MI) const
Definition: SIInstrInfo.h:832
uint64_t getClampMask(const MachineInstr &MI) const
Definition: SIInstrInfo.h:788
static bool isFLATScratch(const MachineInstr &MI)
Definition: SIInstrInfo.h:570
const MCInstrDesc & getIndirectRegWriteMovRelPseudo(unsigned VecSize, unsigned EltSize, bool IsSGPR) const
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
unsigned isStoreToStackSlot(const MachineInstr &MI, int &FrameIndex) const override
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:510
bool isVGPRSpill(uint16_t Opcode) const
Definition: SIInstrInfo.h:645
bool usesConstantBus(const MachineRegisterInfo &MRI, const MachineOperand &MO, const MCOperandInfo &OpInfo) const
Returns true if this operand uses the constant bus.
void legalizeOperandsFLAT(MachineRegisterInfo &MRI, MachineInstr &MI) const
bool FoldImmediate(MachineInstr &UseMI, MachineInstr &DefMI, Register Reg, MachineRegisterInfo *MRI) const final
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:557
int64_t getNamedImmOperand(const MachineInstr &MI, unsigned OpName) const
Get required immediate operand.
Definition: SIInstrInfo.h:1071
bool getMemOperandsWithOffsetWidth(const MachineInstr &LdSt, SmallVectorImpl< const MachineOperand * > &BaseOps, int64_t &Offset, bool &OffsetIsScalable, unsigned &Width, const TargetRegisterInfo *TRI) const final
bool isPacked(uint16_t Opcode) const
Definition: SIInstrInfo.h:450
static bool isMTBUF(const MachineInstr &MI)
Definition: SIInstrInfo.h:502
const MCInstrDesc & getIndirectGPRIDXPseudo(unsigned VecSize, bool IsIndirectSrc) const
void insertReturn(MachineBasicBlock &MBB) const
static bool isEXP(const MachineInstr &MI)
Definition: SIInstrInfo.h:583
static bool isSALU(const MachineInstr &MI)
Definition: SIInstrInfo.h:382
bool sopkIsZext(uint16_t Opcode) const
Definition: SIInstrInfo.h:754
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:462
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:478
bool isSOP1(uint16_t Opcode) const
Definition: SIInstrInfo.h:410
bool isInlineConstant(const APFloat &Imm) const
Definition: SIInstrInfo.h:852
const MCInstrDesc & getKillTerminatorFromPseudo(unsigned Opcode) const
void insertNoops(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned Quantity) const override
static bool isVINTRP(const MachineInstr &MI)
Definition: SIInstrInfo.h:681
bool isAtomicRet(uint16_t Opcode) const
Definition: SIInstrInfo.h:611
static bool isGather4(const MachineInstr &MI)
Definition: SIInstrInfo.h:538
static bool isMFMAorWMMA(const MachineInstr &MI)
Definition: SIInstrInfo.h:714
static bool isWQM(const MachineInstr &MI)
Definition: SIInstrInfo.h:625
static bool doesNotReadTiedSource(const MachineInstr &MI)
Definition: SIInstrInfo.h:816
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:426
static bool isDOT(const MachineInstr &MI)
Definition: SIInstrInfo.h:702
unsigned buildExtractSubReg(MachineBasicBlock::iterator MI, MachineRegisterInfo &MRI, MachineOperand &SuperReg, const TargetRegisterClass *SuperRC, unsigned SubIdx, const TargetRegisterClass *SubRC) const
static bool usesFPDPRounding(const MachineInstr &MI)
Definition: SIInstrInfo.h:796
bool isFixedSize(uint16_t Opcode) const
Definition: SIInstrInfo.h:772
MachineInstr * createPHISourceCopy(MachineBasicBlock &MBB, MachineBasicBlock::iterator InsPt, const DebugLoc &DL, Register Src, unsigned SrcSubReg, Register Dst) const override
Register readlaneVGPRToSGPR(Register SrcReg, MachineInstr &UseMI, MachineRegisterInfo &MRI) const
Copy a value from a VGPR (SrcReg) to SGPR.
bool isInlineConstant(const MachineOperand &MO) const
Definition: SIInstrInfo.h:907
bool hasModifiers(unsigned Opcode) const
Return true if this instruction has any modifiers.
bool isVOP3(uint16_t Opcode) const
Definition: SIInstrInfo.h:474
ScheduleHazardRecognizer * CreateTargetMIHazardRecognizer(const InstrItineraryData *II, const ScheduleDAGMI *DAG) const override
bool isDOT(uint16_t Opcode) const
Definition: SIInstrInfo.h:718
bool isWave32() const
bool isHighLatencyDef(int Opc) const override
bool isBasicBlockPrologue(const MachineInstr &MI) 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:486
void removeModOperands(MachineInstr &MI) const
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:542
bool isFLAT(uint16_t Opcode) const
Definition: SIInstrInfo.h:579
static bool isLDSDIR(const MachineInstr &MI)
Definition: SIInstrInfo.h:722
static bool isSOP2(const MachineInstr &MI)
Definition: SIInstrInfo.h:414
const TargetSchedModel & getSchedModel() const
Definition: SIInstrInfo.h:1227
bool isVOPC(uint16_t Opcode) const
Definition: SIInstrInfo.h:490
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:872
LLVM_READONLY MachineOperand * getNamedOperand(MachineInstr &MI, unsigned OperandName) const
Returns the operand named Op.
const MIRFormatter * getMIRFormatter() const override
Definition: SIInstrInfo.h:1219
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:693
static bool isFLATGlobal(const MachineInstr &MI)
Definition: SIInstrInfo.h:562
unsigned getMachineCSELookAheadLimit() const override
Definition: SIInstrInfo.h:373
static bool isAtomicRet(const MachineInstr &MI)
Definition: SIInstrInfo.h:607
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:211
bool isDS(uint16_t Opcode) const
Definition: SIInstrInfo.h:524
static bool isLegalMUBUFImmOffset(unsigned Imm)
Definition: SIInstrInfo.h:1165
bool isFPAtomic(uint16_t Opcode) const
Definition: SIInstrInfo.h:808
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:633
bool isAtomicNoRet(uint16_t Opcode) const
Definition: SIInstrInfo.h:603
unsigned getMovOpcode(const TargetRegisterClass *DstRC) const
unsigned isSGPRStackAccess(const MachineInstr &MI, int &FrameIndex) const
void legalizeOperandsVOP2(MachineRegisterInfo &MRI, MachineInstr &MI) const
Legalize operands in MI by either commuting it or inserting a copy of src1.
static bool isTRANS(const MachineInstr &MI)
Definition: SIInstrInfo.h:665
static bool isSOPK(const MachineInstr &MI)
Definition: SIInstrInfo.h:430
const TargetRegisterClass * getOpRegClass(const MachineInstr &MI, unsigned OpNo) const
Return the correct register class for OpNo.
bool isInlineConstant(const MachineInstr &MI, unsigned OpIdx) const
returns true if the operand OpIdx in MI is a valid inline immediate.
Definition: SIInstrInfo.h:885
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:730
static bool isMUBUF(const MachineInstr &MI)
Definition: SIInstrInfo.h:494
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:386
void convertNonUniformLoopRegion(MachineBasicBlock *LoopEntry, MachineBasicBlock *LoopEnd) const
bool isVOP2(uint16_t Opcode) const
Definition: SIInstrInfo.h:466
static bool hasFPClamp(const MachineInstr &MI)
Definition: SIInstrInfo.h:776
InstructionUniformity getInstructionUniformity(const MachineInstr &MI) const override final
static bool isSegmentSpecificFLAT(const MachineInstr &MI)
Definition: SIInstrInfo.h:552
bool isSDWA(uint16_t Opcode) const
Definition: SIInstrInfo.h:482
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:966
bool isInlineConstant(const MachineOperand &MO, const MCOperandInfo &OpInfo) const
Definition: SIInstrInfo.h:865
bool isSOPK(uint16_t Opcode) const
Definition: SIInstrInfo.h:434
void insertSelect(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, Register DstReg, ArrayRef< MachineOperand > Cond, Register TrueReg, Register FalseReg) const override
static bool isDPP(const MachineInstr &MI)
Definition: SIInstrInfo.h:657
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:697
bool isSGPRSpill(uint16_t Opcode) const
Definition: SIInstrInfo.h:653
bool isLowLatencyInstruction(const MachineInstr &MI) const
static bool isScalarStore(const MachineInstr &MI)
Definition: SIInstrInfo.h:760
static bool sopkIsZext(const MachineInstr &MI)
Definition: SIInstrInfo.h:750
bool isTRANS(uint16_t Opcode) const
Definition: SIInstrInfo.h:669
void materializeImmediate(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const DebugLoc &DL, Register DestReg, int64_t Value) const
bool isSOP2(uint16_t Opcode) const
Definition: SIInstrInfo.h:418
bool isVALU(uint16_t Opcode) const
Definition: SIInstrInfo.h:394
bool isVOP1(uint16_t Opcode) const
Definition: SIInstrInfo.h:458
bool isAlwaysGDS(uint16_t Opcode) const
bool isMUBUF(uint16_t Opcode) const
Definition: SIInstrInfo.h:498
static bool isFPAtomic(const MachineInstr &MI)
Definition: SIInstrInfo.h:804
static bool usesLGKM_CNT(const MachineInstr &MI)
Definition: SIInstrInfo.h:746
void moveToVALUImpl(SIInstrWorklist &Worklist, MachineDominatorTree *MDT, MachineInstr &Inst) const
static bool isPacked(const MachineInstr &MI)
Definition: SIInstrInfo.h:446
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:710
bool isMTBUF(uint16_t Opcode) const
Definition: SIInstrInfo.h:506
static unsigned getMaxMUBUFImmOffset()
bool isDisableWQM(uint16_t Opcode) const
Definition: SIInstrInfo.h:637
static bool isVGPRSpill(const MachineInstr &MI)
Definition: SIInstrInfo.h:641
ScheduleHazardRecognizer * CreateTargetPostRAHazardRecognizer(const InstrItineraryData *II, const ScheduleDAG *DAG) const override
This is used by the post-RA scheduler (SchedulePostRAList.cpp).
bool verifyInstruction(const MachineInstr &MI, StringRef &ErrInfo) const override
unsigned isLoadFromStackSlot(const MachineInstr &MI, int &FrameIndex) 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.
unsigned getInstrLatency(const InstrItineraryData *ItinData, const MachineInstr &MI, unsigned *PredCost=nullptr) const override
bool isVMEM(uint16_t Opcode) const
Definition: SIInstrInfo.h:402
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:685
bool isVGPRCopy(const MachineInstr &MI) const
Definition: SIInstrInfo.h:824
bool isScalarStore(uint16_t Opcode) const
Definition: SIInstrInfo.h:764
static bool isMIMG(const MachineInstr &MI)
Definition: SIInstrInfo.h:530
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.
LLVM_READONLY int commuteOpcode(const MachineInstr &MI) const
Definition: SIInstrInfo.h:292
MachineOperand buildExtractSubRegOrImm(MachineBasicBlock::iterator MI, MachineRegisterInfo &MRI, MachineOperand &SuperReg, const TargetRegisterClass *SuperRC, unsigned SubIdx, const TargetRegisterClass *SubRC) const
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:673
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const DebugLoc &DL, MCRegister DestReg, MCRegister SrcReg, bool KillSrc) const override
bool isWQM(uint16_t Opcode) const
Definition: SIInstrInfo.h:629
unsigned getVALUOp(const MachineInstr &MI) const
static bool modifiesModeRegister(const MachineInstr &MI)
Return true if the instruction modifies the mode register.q.
void convertNonUniformIfRegion(MachineBasicBlock *IfEntry, MachineBasicBlock *IfEnd) const
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:677
LLVM_READONLY const MachineOperand * getNamedOperand(const MachineInstr &MI, unsigned OpName) const
Definition: SIInstrInfo.h:1065
bool isEXP(uint16_t Opcode) const
Definition: SIInstrInfo.h:595
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:587
bool hasUnwantedEffectsWhenEXECEmpty(const MachineInstr &MI) const
Whether we must prevent this instruction from executing with EXEC = 0.
static bool isAtomic(const MachineInstr &MI)
Definition: SIInstrInfo.h:615
bool canInsertSelect(const MachineBasicBlock &MBB, ArrayRef< MachineOperand > Cond, Register DstReg, Register TrueReg, Register FalseReg, int &CondCycles, int &TrueCycles, int &FalseCycles) const override
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:649
static bool isWMMA(const MachineInstr &MI)
Definition: SIInstrInfo.h:706
ArrayRef< std::pair< MachineMemOperand::Flags, const char * > > getSerializableMachineMemOperandTargetFlags() const override
bool isVINTERP(uint16_t Opcode) const
Definition: SIInstrInfo.h:734
bool shouldClusterMemOps(ArrayRef< const MachineOperand * > BaseOps1, ArrayRef< const MachineOperand * > BaseOps2, unsigned NumLoads, unsigned NumBytes) const override
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:820
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:661
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:406
static bool isSOPC(const MachineInstr &MI)
Definition: SIInstrInfo.h:422
static bool isFLAT(const MachineInstr &MI)
Definition: SIInstrInfo.h:546
const SIRegisterInfo & getRegisterInfo() const
Definition: SIInstrInfo.h:207
static bool isVALU(const MachineInstr &MI)
Definition: SIInstrInfo.h:390
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:784
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:1084
bool isInlineConstant(const MachineInstr &MI, unsigned OpIdx, const MachineOperand &MO) const
Definition: SIInstrInfo.h:890
static bool isScalarUnit(const MachineInstr &MI)
Definition: SIInstrInfo.h:738
bool isSOPP(uint16_t Opcode) const
Definition: SIInstrInfo.h:442
bool isMIMG(uint16_t Opcode) const
Definition: SIInstrInfo.h:534
bool hasFPClamp(uint16_t Opcode) const
Definition: SIInstrInfo.h:780
static bool usesVM_CNT(const MachineInstr &MI)
Definition: SIInstrInfo.h:742
bool usesFPDPRounding(uint16_t Opcode) const
Definition: SIInstrInfo.h:800
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:768
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.
unsigned isStackAccess(const MachineInstr &MI, int &FrameIndex) const
static bool isAtomicNoRet(const MachineInstr &MI)
Definition: SIInstrInfo.h:599
static bool isVOP1(const MachineInstr &MI)
Definition: SIInstrInfo.h:454
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:51
A SetVector that performs no allocations if smaller than a certain size.
Definition: SetVector.h:312
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:577
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
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:1360
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)
LLVM_READONLY int getAtomicNoRetOp(uint16_t Opcode)
const uint64_t RSRC_ELEMENT_SIZE_SHIFT
Definition: SIInstrInfo.h:1361
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)
const uint64_t RSRC_TID_ENABLE
Definition: SIInstrInfo.h:1363
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:168
@ OPERAND_REG_IMM_INT32
Operands with register or 32-bit immediate.
Definition: SIDefines.h:167
LLVM_READONLY int getCommuteOrig(uint16_t Opcode)
const uint64_t RSRC_INDEX_STRIDE_SHIFT
Definition: SIInstrInfo.h:1362
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:1371
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ Offset
Definition: DWP.cpp:440
TargetInstrInfo::RegSubRegPair getRegSubRegPair(const MachineOperand &O)
Create RegSubRegPair from a register MachineOperand.
Definition: SIInstrInfo.h:1248
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:41
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:1826
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...
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:1236
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
Utility to store machine instructions worklist.
Definition: SIInstrInfo.h:45
MachineInstr * top() const
Definition: SIInstrInfo.h:50
bool empty() const
Definition: SIInstrInfo.h:60
bool isDeferred(MachineInstr *MI)
SetVector< MachineInstr * > & getDeferredList()
Definition: SIInstrInfo.h:69
void insert(MachineInstr *MI)
A pair composed of a register and a sub-register index.