Lines Matching refs:Fold

81   bool updateOperand(FoldCandidate &Fold) const;
83 bool canUseImmWithOpSel(FoldCandidate &Fold) const;
85 bool tryFoldImmWithOpSel(FoldCandidate &Fold) const;
203 bool SIFoldOperands::canUseImmWithOpSel(FoldCandidate &Fold) const { in canUseImmWithOpSel()
204 MachineInstr *MI = Fold.UseMI; in canUseImmWithOpSel()
205 MachineOperand &Old = MI->getOperand(Fold.UseOpNo); in canUseImmWithOpSel()
208 assert(Old.isReg() && Fold.isImm()); in canUseImmWithOpSel()
231 bool SIFoldOperands::tryFoldImmWithOpSel(FoldCandidate &Fold) const { in tryFoldImmWithOpSel()
232 MachineInstr *MI = Fold.UseMI; in tryFoldImmWithOpSel()
233 MachineOperand &Old = MI->getOperand(Fold.UseOpNo); in tryFoldImmWithOpSel()
241 if (AMDGPU::isInlinableLiteralV216(Fold.ImmToFold, OpType)) { in tryFoldImmWithOpSel()
242 Old.ChangeToImmediate(Fold.ImmToFold); in tryFoldImmWithOpSel()
266 Fold.ImmToFold >> (ModVal & SISrcMods::OP_SEL_0 ? 16 : 0)); in tryFoldImmWithOpSel()
268 Fold.ImmToFold >> (ModVal & SISrcMods::OP_SEL_1 ? 16 : 0)); in tryFoldImmWithOpSel()
355 bool SIFoldOperands::updateOperand(FoldCandidate &Fold) const { in updateOperand()
356 MachineInstr *MI = Fold.UseMI; in updateOperand()
357 MachineOperand &Old = MI->getOperand(Fold.UseOpNo); in updateOperand()
360 if (Fold.isImm() && canUseImmWithOpSel(Fold)) { in updateOperand()
361 if (tryFoldImmWithOpSel(Fold)) in updateOperand()
366 MachineOperand New = MachineOperand::CreateImm(Fold.ImmToFold); in updateOperand()
370 Old.ChangeToImmediate(Fold.ImmToFold); in updateOperand()
374 if ((Fold.isImm() || Fold.isFI() || Fold.isGlobal()) && Fold.needsShrink()) { in updateOperand()
382 int Op32 = Fold.ShrinkOpcode; in updateOperand()
411 if (Fold.Commuted) in updateOperand()
416 assert(!Fold.needsShrink() && "not handled"); in updateOperand()
418 if (Fold.isImm()) { in updateOperand()
426 Old.ChangeToImmediate(Fold.ImmToFold); in updateOperand()
430 if (Fold.isGlobal()) { in updateOperand()
431 Old.ChangeToGA(Fold.OpToFold->getGlobal(), Fold.OpToFold->getOffset(), in updateOperand()
432 Fold.OpToFold->getTargetFlags()); in updateOperand()
436 if (Fold.isFI()) { in updateOperand()
437 Old.ChangeToFrameIndex(Fold.FrameIndexToFold); in updateOperand()
441 MachineOperand *New = Fold.OpToFold; in updateOperand()
457 for (FoldCandidate &Fold : FoldList) in appendFoldCandidate()
458 if (Fold.UseMI == MI && Fold.UseOpNo == OpNo) in appendFoldCandidate()
506 FoldCandidate Fold(MI, OpNo, OpToFold); in tryAddToFoldList() local
507 IsLegal = canUseImmWithOpSel(Fold); in tryAddToFoldList()
1396 for (FoldCandidate &Fold : FoldList) { in foldInstOperand()
1397 assert(!Fold.isReg() || Fold.OpToFold); in foldInstOperand()
1398 if (Fold.isReg() && Fold.OpToFold->getReg().isVirtual()) { in foldInstOperand()
1399 Register Reg = Fold.OpToFold->getReg(); in foldInstOperand()
1400 MachineInstr *DefMI = Fold.OpToFold->getParent(); in foldInstOperand()
1402 execMayBeModifiedBeforeUse(*MRI, Reg, *DefMI, *Fold.UseMI)) in foldInstOperand()
1405 if (updateOperand(Fold)) { in foldInstOperand()
1407 if (Fold.isReg()) { in foldInstOperand()
1408 assert(Fold.OpToFold && Fold.OpToFold->isReg()); in foldInstOperand()
1412 MRI->clearKillFlags(Fold.OpToFold->getReg()); in foldInstOperand()
1415 << static_cast<int>(Fold.UseOpNo) << " of " in foldInstOperand()
1416 << *Fold.UseMI); in foldInstOperand()
1417 } else if (Fold.Commuted) { in foldInstOperand()
1419 TII->commuteInstruction(*Fold.UseMI, false); in foldInstOperand()