50#define DEBUG_TYPE "gcn-dpp-combine"
52STATISTIC(NumDPPMovsCombined,
"Number of DPP moves combined.");
68 bool IsShrinkable)
const;
72 bool IsShrinkable)
const;
75 int64_t Mask = -1)
const;
79 int getDPPOp(
unsigned Op,
bool IsShrinkable)
const;
90 GCNDPPCombineLegacy() : MachineFunctionPass(ID) {}
94 StringRef getPassName()
const override {
return "GCN DPP Combine"; }
96 void getAnalysisUsage(AnalysisUsage &AU)
const override {
101 MachineFunctionProperties getRequiredProperties()
const override {
102 return MachineFunctionProperties().setIsSSA();
111char GCNDPPCombineLegacy::ID = 0;
116 unsigned Op =
MI.getOpcode();
117 if (!
TII->isVOP3(
Op)) {
120 if (!
TII->hasVALU32BitEncoding(
Op)) {
121 LLVM_DEBUG(dbgs() <<
" Inst hasn't e32 equivalent\n");
128 if (
const auto *SDst =
TII->getNamedOperand(
MI, AMDGPU::OpName::sdst)) {
133 if (!MRI->use_nodbg_empty(SDst->getReg()))
138 if (!hasNoImmOrEqual(
MI, AMDGPU::OpName::src0_modifiers, 0, Mask) ||
139 !hasNoImmOrEqual(
MI, AMDGPU::OpName::src1_modifiers, 0, Mask) ||
140 !hasNoImmOrEqual(
MI, AMDGPU::OpName::clamp, 0) ||
141 !hasNoImmOrEqual(
MI, AMDGPU::OpName::omod, 0) ||
142 !hasNoImmOrEqual(
MI, AMDGPU::OpName::byte_sel, 0)) {
149int GCNDPPCombine::getDPPOp(
unsigned Op,
bool IsShrinkable)
const {
154 DPP32 = (E32 == -1) ? -1 : AMDGPU::
getDPPOp32(E32);
156 if (DPP32 != -1 &&
TII->pseudoToMCOpcode(DPP32) != -1)
161 if (DPP64 != -1 &&
TII->pseudoToMCOpcode(DPP64) != -1)
170MachineOperand *GCNDPPCombine::getOldOpndValue(MachineOperand &OldOpnd)
const {
175 switch(
Def->getOpcode()) {
177 case AMDGPU::IMPLICIT_DEF:
180 case AMDGPU::V_MOV_B32_e32:
181 case AMDGPU::V_MOV_B64_PSEUDO:
182 case AMDGPU::V_MOV_B64_e32:
183 case AMDGPU::V_MOV_B64_e64: {
184 auto &Op1 =
Def->getOperand(1);
193MachineInstr *GCNDPPCombine::createDPPInst(MachineInstr &OrigMI,
197 bool IsShrinkable)
const {
199 MovMI.
getOpcode() == AMDGPU::V_MOV_B64_dpp ||
200 MovMI.
getOpcode() == AMDGPU::V_MOV_B64_DPP_PSEUDO);
206 dbgs() <<
" failed: Did not expect any 16-bit uses of dpp values\n");
209 auto DPPOp = getDPPOp(OrigOp, IsShrinkable);
215 const int OldIdx = AMDGPU::getNamedOperandIdx(DPPOp, AMDGPU::OpName::old);
216 const int MovDstIdx =
217 AMDGPU::getNamedOperandIdx(MovMI.
getOpcode(), AMDGPU::OpName::vdst);
219 TII->getOpSize(DPPOp, OldIdx) !=
TII->getOpSize(MovMI, MovDstIdx)) {
220 LLVM_DEBUG(
dbgs() <<
" failed: old operand size differs from dst\n");
226 auto *RowMaskOpnd =
TII->getNamedOperand(MovMI, AMDGPU::OpName::row_mask);
227 assert(RowMaskOpnd && RowMaskOpnd->isImm());
228 auto *BankMaskOpnd =
TII->getNamedOperand(MovMI, AMDGPU::OpName::bank_mask);
229 assert(BankMaskOpnd && BankMaskOpnd->isImm());
230 const bool MaskAllLanes =
231 RowMaskOpnd->getImm() == 0xF && BankMaskOpnd->getImm() == 0xF;
234 !(
TII->isVOPC(DPPOp) || (
TII->isVOP3(DPPOp) && OrigOpE32 != -1 &&
235 TII->isVOPC(OrigOpE32)))) &&
236 "VOPC cannot form DPP unless mask is full");
245 if (
auto *Dst =
TII->getNamedOperand(OrigMI, AMDGPU::OpName::vdst)) {
249 if (
auto *SDst =
TII->getNamedOperand(OrigMI, AMDGPU::OpName::sdst)) {
258 assert(OldIdx == NumOperands);
262 TII->getNamedOperand(MovMI, AMDGPU::OpName::vdst)->getReg()),
268 }
else if (
TII->isVOPC(DPPOp) || (
TII->isVOP3(DPPOp) && OrigOpE32 != -1 &&
269 TII->isVOPC(OrigOpE32))) {
274 LLVM_DEBUG(
dbgs() <<
" failed: no old operand in DPP instruction,"
280 auto *Mod0 =
TII->getNamedOperand(OrigMI, AMDGPU::OpName::src0_modifiers);
282 assert(NumOperands == AMDGPU::getNamedOperandIdx(DPPOp,
283 AMDGPU::OpName::src0_modifiers));
286 DPPInst.addImm(Mod0->getImm());
292 auto *
Src0 =
TII->getNamedOperand(MovMI, AMDGPU::OpName::src0);
296 DPPInst->getOperand(NumOperands).setIsKill(
false);
299 auto *Mod1 =
TII->getNamedOperand(OrigMI, AMDGPU::OpName::src1_modifiers);
301 assert(NumOperands == AMDGPU::getNamedOperandIdx(DPPOp,
302 AMDGPU::OpName::src1_modifiers));
305 DPPInst.addImm(Mod1->getImm());
311 auto *
Src1 =
TII->getNamedOperand(OrigMI, AMDGPU::OpName::src1);
314 "dpp version of instruction missing src1");
320 auto *Mod2 =
TII->getNamedOperand(OrigMI, AMDGPU::OpName::src2_modifiers);
323 AMDGPU::getNamedOperandIdx(DPPOp, AMDGPU::OpName::src2_modifiers));
326 DPPInst.addImm(Mod2->getImm());
329 auto *
Src2 =
TII->getNamedOperand(OrigMI, AMDGPU::OpName::src2);
341 auto *ClampOpr =
TII->getNamedOperand(OrigMI, AMDGPU::OpName::clamp);
343 DPPInst.addImm(ClampOpr->getImm());
345 auto *VdstInOpr =
TII->getNamedOperand(OrigMI, AMDGPU::OpName::vdst_in);
348 DPPInst.add(*VdstInOpr);
350 auto *OmodOpr =
TII->getNamedOperand(OrigMI, AMDGPU::OpName::omod);
352 DPPInst.addImm(OmodOpr->getImm());
356 if (
TII->getNamedOperand(OrigMI, AMDGPU::OpName::op_sel)) {
361 if (Mod0 &&
TII->isVOP3(OrigMI) && !
TII->isVOP3P(OrigMI))
370 DPPInst.addImm(OpSel);
372 if (
TII->getNamedOperand(OrigMI, AMDGPU::OpName::op_sel_hi)) {
380 assert(Src2 &&
"Expected vop3p with 3 operands");
382 LLVM_DEBUG(
dbgs() <<
" failed: op_sel_hi must be all set to one\n");
387 DPPInst.addImm(OpSelHi);
389 auto *NegOpr =
TII->getNamedOperand(OrigMI, AMDGPU::OpName::neg_lo);
391 DPPInst.addImm(NegOpr->getImm());
393 auto *NegHiOpr =
TII->getNamedOperand(OrigMI, AMDGPU::OpName::neg_hi);
395 DPPInst.addImm(NegHiOpr->getImm());
397 auto *ByteSelOpr =
TII->getNamedOperand(OrigMI, AMDGPU::OpName::byte_sel);
400 DPPInst.addImm(ByteSelOpr->getImm());
402 if (MachineOperand *BitOp3 =
403 TII->getNamedOperand(OrigMI, AMDGPU::OpName::bitop3)) {
405 DPPInst.add(*BitOp3);
408 DPPInst.add(*
TII->getNamedOperand(MovMI, AMDGPU::OpName::dpp_ctrl));
409 DPPInst.add(*
TII->getNamedOperand(MovMI, AMDGPU::OpName::row_mask));
410 DPPInst.add(*
TII->getNamedOperand(MovMI, AMDGPU::OpName::bank_mask));
411 DPPInst.addImm(CombBCZ ? 1 : 0);
413 constexpr AMDGPU::OpName Srcs[] = {
414 AMDGPU::OpName::src0, AMDGPU::OpName::src1, AMDGPU::OpName::src2};
420 int OpIdx = AMDGPU::getNamedOperandIdx(DPPOp, OpName);
424 if (!
TII->isOperandLegal(*DPPInst, OpIdx)) {
433 DPPInst.getInstr()->eraseFromParent();
437 return DPPInst.getInstr();
444 case AMDGPU::V_ADD_U32_e32:
445 case AMDGPU::V_ADD_U32_e64:
446 case AMDGPU::V_ADD_CO_U32_e32:
447 case AMDGPU::V_ADD_CO_U32_e64:
448 case AMDGPU::V_OR_B32_e32:
449 case AMDGPU::V_OR_B32_e64:
450 case AMDGPU::V_SUBREV_U32_e32:
451 case AMDGPU::V_SUBREV_U32_e64:
452 case AMDGPU::V_SUBREV_CO_U32_e32:
453 case AMDGPU::V_SUBREV_CO_U32_e64:
454 case AMDGPU::V_MAX_U32_e32:
455 case AMDGPU::V_MAX_U32_e64:
456 case AMDGPU::V_XOR_B32_e32:
457 case AMDGPU::V_XOR_B32_e64:
458 if (OldOpnd->
getImm() == 0)
461 case AMDGPU::V_AND_B32_e32:
462 case AMDGPU::V_AND_B32_e64:
463 case AMDGPU::V_MIN_U32_e32:
464 case AMDGPU::V_MIN_U32_e64:
466 std::numeric_limits<uint32_t>::max())
469 case AMDGPU::V_MIN_I32_e32:
470 case AMDGPU::V_MIN_I32_e64:
471 if (
static_cast<int32_t
>(OldOpnd->
getImm()) ==
472 std::numeric_limits<int32_t>::max())
475 case AMDGPU::V_MAX_I32_e32:
476 case AMDGPU::V_MAX_I32_e64:
477 if (
static_cast<int32_t
>(OldOpnd->
getImm()) ==
478 std::numeric_limits<int32_t>::min())
481 case AMDGPU::V_MUL_I32_I24_e32:
482 case AMDGPU::V_MUL_I32_I24_e64:
483 case AMDGPU::V_MUL_U32_U24_e32:
484 case AMDGPU::V_MUL_U32_U24_e64:
485 if (OldOpnd->
getImm() == 1)
488 case AMDGPU::V_MIN_F32_e32:
489 case AMDGPU::V_MIN_F32_e64:
493 case AMDGPU::V_MAX_F32_e32:
494 case AMDGPU::V_MAX_F32_e64:
498 case AMDGPU::V_MIN_F64_e64:
499 case AMDGPU::V_MIN_NUM_F64_e64:
500 if (
static_cast<uint64_t>(OldOpnd->
getImm()) == 0x7FF0000000000000)
503 case AMDGPU::V_MAX_F64_e64:
504 case AMDGPU::V_MAX_NUM_F64_e64:
505 if (
static_cast<uint64_t>(OldOpnd->
getImm()) == 0xFFF0000000000000)
508 case AMDGPU::V_MIN_F16_e32:
509 case AMDGPU::V_MIN_F16_e64:
510 case AMDGPU::V_MIN_F16_t16_e32:
511 case AMDGPU::V_MIN_F16_t16_e64:
512 case AMDGPU::V_MIN_F16_fake16_e32:
513 case AMDGPU::V_MIN_F16_fake16_e64:
517 case AMDGPU::V_MAX_F16_e32:
518 case AMDGPU::V_MAX_F16_e64:
519 case AMDGPU::V_MAX_F16_t16_e32:
520 case AMDGPU::V_MAX_F16_t16_e64:
521 case AMDGPU::V_MAX_F16_fake16_e32:
522 case AMDGPU::V_MAX_F16_fake16_e64:
530MachineInstr *GCNDPPCombine::createDPPInst(
531 MachineInstr &OrigMI, MachineInstr &MovMI,
RegSubRegPair CombOldVGPR,
532 MachineOperand *OldOpndValue,
bool CombBCZ,
bool IsShrinkable)
const {
534 if (!CombBCZ && OldOpndValue && OldOpndValue->
isImm()) {
535 auto *
Src1 =
TII->getNamedOperand(OrigMI, AMDGPU::OpName::src1);
536 if (!Src1 || !
Src1->isReg()) {
537 LLVM_DEBUG(
dbgs() <<
" failed: no src1 or it isn't a register\n");
541 LLVM_DEBUG(
dbgs() <<
" failed: old immediate isn't an identity\n");
545 auto *MovDst =
TII->getNamedOperand(MovMI, AMDGPU::OpName::vdst);
552 return createDPPInst(OrigMI, MovMI, CombOldVGPR, CombBCZ, IsShrinkable);
557bool GCNDPPCombine::hasNoImmOrEqual(MachineInstr &
MI, AMDGPU::OpName OpndName,
558 int64_t
Value, int64_t Mask)
const {
559 auto *
Imm =
TII->getNamedOperand(
MI, OpndName);
564 return (
Imm->getImm() & Mask) ==
Value;
567bool GCNDPPCombine::combineDPPMov(MachineInstr &MovMI)
const {
569 MovMI.
getOpcode() == AMDGPU::V_MOV_B64_dpp ||
570 MovMI.
getOpcode() == AMDGPU::V_MOV_B64_DPP_PSEUDO);
573 auto *DstOpnd =
TII->getNamedOperand(MovMI, AMDGPU::OpName::vdst);
574 assert(DstOpnd && DstOpnd->isReg());
575 auto DPPMovReg = DstOpnd->getReg();
576 if (DPPMovReg.isPhysical()) {
586 auto *
DppCtrl =
TII->getNamedOperand(MovMI, AMDGPU::OpName::dpp_ctrl);
588 unsigned DppCtrlVal =
DppCtrl->getImm();
589 if ((MovMI.
getOpcode() == AMDGPU::V_MOV_B64_DPP_PSEUDO ||
590 MovMI.
getOpcode() == AMDGPU::V_MOV_B64_dpp)) {
591 if (!ST->hasFeature(AMDGPU::FeatureDPALU_DPP)) {
592 LLVM_DEBUG(
dbgs() <<
" failed: 64 bit dpp move is unsupported\n");
604 auto *RowMaskOpnd =
TII->getNamedOperand(MovMI, AMDGPU::OpName::row_mask);
605 assert(RowMaskOpnd && RowMaskOpnd->isImm());
606 auto *BankMaskOpnd =
TII->getNamedOperand(MovMI, AMDGPU::OpName::bank_mask);
607 assert(BankMaskOpnd && BankMaskOpnd->isImm());
608 const bool MaskAllLanes = RowMaskOpnd->getImm() == 0xF &&
609 BankMaskOpnd->getImm() == 0xF;
611 auto *BCZOpnd =
TII->getNamedOperand(MovMI, AMDGPU::OpName::bound_ctrl);
612 assert(BCZOpnd && BCZOpnd->isImm());
613 bool BoundCtrlZero = BCZOpnd->getImm();
615 auto *OldOpnd =
TII->getNamedOperand(MovMI, AMDGPU::OpName::old);
616 auto *SrcOpnd =
TII->getNamedOperand(MovMI, AMDGPU::OpName::src0);
618 assert(SrcOpnd && SrcOpnd->isReg());
624 auto *
const OldOpndValue = getOldOpndValue(*OldOpnd);
629 assert(!OldOpndValue || OldOpndValue->
isImm() || OldOpndValue == OldOpnd);
631 bool CombBCZ =
false;
633 if (MaskAllLanes && BoundCtrlZero) {
636 if (!OldOpndValue || !OldOpndValue->
isImm()) {
641 if (OldOpndValue->
getImm() == 0) {
646 }
else if (BoundCtrlZero) {
649 " failed: old!=0 and bctrl:0 and not all lanes isn't combinable\n");
658 dbgs() << *OldOpndValue;
659 dbgs() <<
", bound_ctrl=" << CombBCZ <<
'\n');
661 SmallVector<MachineInstr*, 4> OrigMIs, DPPMIs;
662 DenseMap<MachineInstr*, SmallVector<unsigned, 4>> RegSeqWithOpNos;
665 if (CombBCZ && OldOpndValue) {
670 TII->get(AMDGPU::IMPLICIT_DEF), CombOldVGPR.
Reg);
671 DPPMIs.push_back(UndefInst.getInstr());
674 OrigMIs.push_back(&MovMI);
675 bool Rollback =
true;
680 while (!
Uses.empty()) {
681 MachineOperand *
Use =
Uses.pop_back_val();
684 auto &OrigMI = *
Use->getParent();
689 "There should not be e32 True16 instructions pre-RA");
690 if (OrigOp == AMDGPU::REG_SEQUENCE) {
692 if (
Use->getReg() != DPPMovReg) {
711 LaneBitmask FwdLanes =
TRI->getSubRegIndexLaneMask(FwdSubReg);
714 return Op.getSubReg() != FwdSubReg &&
715 (TRI->getSubRegIndexLaneMask(Op.getSubReg()) & FwdLanes)
718 LLVM_DEBUG(
dbgs() <<
" failed: REG_SEQUENCE lane has other reads\n");
723 if (
Op.getSubReg() == FwdSubReg)
726 RegSeqWithOpNos[&OrigMI].push_back(OpNo);
730 bool IsShrinkable = isShrinkable(OrigMI);
731 if (!(IsShrinkable ||
732 ((
TII->isVOP3P(OrigOp) ||
TII->isVOPC(OrigOp) ||
733 TII->isVOP3(OrigOp)) &&
735 TII->isVOP1(OrigOp) ||
TII->isVOP2(OrigOp))) {
744 auto *
Src0 =
TII->getNamedOperand(OrigMI, AMDGPU::OpName::src0);
745 auto *
Src1 =
TII->getNamedOperand(OrigMI, AMDGPU::OpName::src1);
746 if (Use != Src0 && !(Use == Src1 && OrigMI.
isCommutable())) {
751 auto *
Src2 =
TII->getNamedOperand(OrigMI, AMDGPU::OpName::src2);
752 assert(Src0 &&
"Src1 without Src0?");
753 if ((Use == Src0 && ((Src1 &&
Src1->isIdenticalTo(*Src0)) ||
754 (Src2 &&
Src2->isIdenticalTo(*Src0)))) ||
755 (Use == Src1 && (
Src1->isIdenticalTo(*Src0) ||
756 (Src2 &&
Src2->isIdenticalTo(*Src1))))) {
760 <<
" failed: DPP register is used more than once per instruction\n");
769 (
Use ==
Src0) ?
static_cast<int>(OrigOp) :
TII->commuteOpcode(OrigOp);
770 if (FoldedOp < 0 || TII->isSrc1DPPRevOpcode(*ST, FoldedOp)) {
772 dbgs() <<
" failed: Use operand cannot have DPP applied to it\n");
780 if (!ST->hasFeature(AMDGPU::FeatureDPALU_DPP)) {
782 <<
" failed: DPP ALU DPP is not supported\n");
788 <<
" failed: not valid 64-bit DPP control value\n");
795 if (
auto *DPPInst = createDPPInst(OrigMI, MovMI, CombOldVGPR,
796 OldOpndValue, CombBCZ, IsShrinkable)) {
797 DPPMIs.push_back(DPPInst);
803 auto *NewMI = BB->
getParent()->CloneMachineInstr(&OrigMI);
804 BB->
insert(OrigMI, NewMI);
805 if (
TII->commuteInstruction(*NewMI)) {
808 createDPPInst(*NewMI, MovMI, CombOldVGPR, OldOpndValue, CombBCZ,
810 DPPMIs.push_back(DPPInst);
815 NewMI->eraseFromParent();
819 OrigMIs.push_back(&OrigMI);
822 Rollback |= !
Uses.empty();
824 for (
auto *
MI : *(Rollback? &DPPMIs : &OrigMIs))
825 MI->eraseFromParent();
828 for (
auto &S : RegSeqWithOpNos) {
830 S.first->eraseFromParent();
833 while (!S.second.empty())
834 S.first->getOperand(S.second.pop_back_val()).setIsUndef();
845 return GCNDPPCombine().run(MF);
857 for (
auto &
MBB : MF) {
859 if (
MI.getOpcode() == AMDGPU::V_MOV_B32_dpp && combineDPPMov(
MI)) {
861 ++NumDPPMovsCombined;
862 }
else if (
MI.getOpcode() == AMDGPU::V_MOV_B64_DPP_PSEUDO ||
863 MI.getOpcode() == AMDGPU::V_MOV_B64_dpp) {
864 if (ST->hasDPALU_DPP() && combineDPPMov(
MI)) {
866 ++NumDPPMovsCombined;
870 if (M && combineDPPMov(*M))
871 ++NumDPPMovsCombined;
888 bool Changed = GCNDPPCombine().run(MF);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
Provides AMDGPU specific target descriptions.
static bool isIdentityValue(unsigned OrigMIOp, MachineOperand *OldOpnd)
AMD GCN specific subclass of TargetSubtarget.
const HexagonInstrInfo * TII
TargetInstrInfo::RegSubRegPair RegSubRegPair
Register const TargetRegisterInfo * TRI
Promote Memory to Register
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
MachineRegisterInfo & MRI
Remove Loads Into Fake Uses
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
LLVM_ABI void setPreservesCFG()
This function should be called by the pass, iff they do not:
Represents analyses that only rely on functions' control flow.
bool hasOptNone() const
Do not optimize this function (-O0).
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MAM)
const SIInstrInfo * getInstrInfo() const override
const SIRegisterInfo * getRegisterInfo() const override
bool useRealTrue16Insts() const
Return true if real (non-fake) variants of True16 instructions using 16-bit registers should be code-...
unsigned getSize(const MachineInstr &MI) const
An RAII based helper class to modify MachineFunctionProperties when running pass.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Function & getFunction()
Return the LLVM function that this machine code represents.
void insert(iterator MBBI, MachineBasicBlock *MBB)
const MachineInstrBuilder & setMIFlags(unsigned Flags) const
Representation of each machine instruction.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
const MachineBasicBlock * getParent() const
unsigned getOperandNo(const_mop_iterator I) const
Returns the number of the operand iterator I points to.
bool modifiesRegister(Register Reg, const TargetRegisterInfo *TRI) const
Return true if the MachineInstr modifies (fully define or partially define) the specified register.
bool isCommutable(QueryType Type=IgnoreBundle) const
Return true if this may be a 2- or 3-address instruction (of the form "X = op Y, Z,...
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
const MachineOperand & getOperand(unsigned i) const
uint32_t getFlags() const
Return the MI flags bitvector.
MachineOperand class - Representation of each machine instruction operand.
bool isReg() const
isReg - Tests if this is a MO_Register operand.
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
Register getReg() const
getReg - Returns the register number.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
const TargetRegisterClass * getRegClass(Register Reg) const
Return the register class of the specified virtual register.
iterator_range< use_nodbg_iterator > use_nodbg_operands(Register Reg) const
bool use_nodbg_empty(Register RegNo) const
use_nodbg_empty - Return true if there are no non-Debug instructions using the specified register.
LLVM_ABI Register createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
constexpr bool isPhysical() const
Return true if the specified register number is in the physical register namespace.
LLVM Value Representation.
LLVM_READONLY int32_t getDPPOp32(uint32_t Opcode)
LLVM_READNONE bool isLegalDPALU_DPPControl(const MCSubtargetInfo &ST, unsigned DC)
LLVM_READONLY bool hasNamedOperand(uint32_t Opcode, OpName NamedIdx)
bool isTrue16Inst(unsigned Opc)
LLVM_READONLY int32_t getVOPe32(uint32_t Opcode)
LLVM_READONLY int32_t getDPPOp64(uint32_t Opcode)
bool isDPALU_DPP(const MCInstrDesc &OpDesc, const MCInstrInfo &MII, const MCSubtargetInfo &ST)
NodeAddr< DefNode * > Def
NodeAddr< UseNode * > Use
This is an optimization pass for GlobalISel generic memory operations.
TargetInstrInfo::RegSubRegPair getRegSubRegPair(const MachineOperand &O)
Create RegSubRegPair from a register MachineOperand.
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
auto enumerate(FirstRange &&First, RestRanges &&...Rest)
Given two or more input ranges, returns a new range whose values are tuples (A, B,...
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Value
LLVM_ABI PreservedAnalyses getMachineFunctionPassPreservedAnalyses()
Returns the minimum set of Analyses that all machine function passes must preserve.
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
auto reverse(ContainerTy &&C)
MachineInstr * getVRegSubRegDef(const TargetInstrInfo::RegSubRegPair &P, const MachineRegisterInfo &MRI)
Return the defining instruction for a given reg:subreg pair skipping copy like instructions and subre...
char & GCNDPPCombineLegacyID
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
DWARFExpression::Operation Op
iterator_range< pointer_iterator< WrappedIteratorT > > make_pointer_range(RangeT &&Range)
bool isOfRegClass(const TargetInstrInfo::RegSubRegPair &P, const TargetRegisterClass &TRC, MachineRegisterInfo &MRI)
Returns true if a reg:subreg pair P has a TRC class.
constexpr RegState getUndefRegState(bool B)
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.
MCRegisterClass TargetRegisterClass
A pair composed of a register and a sub-register index.