Lines Matching refs:Def
219 static bool ShouldRematerialize(const MachineInstr &Def, AliasAnalysis &AA, in ShouldRematerialize() argument
221 return Def.isAsCheapAsAMove() && TII->isTriviallyReMaterializable(Def, &AA); in ShouldRematerialize()
232 if (MachineInstr *Def = MRI.getUniqueVRegDef(Reg)) in GetVRegDef() local
233 return Def; in GetVRegDef()
246 static bool HasOneUse(unsigned Reg, MachineInstr *Def, in HasOneUse() argument
256 LIS.getInstructionIndex(*Def).getRegSlot()); in HasOneUse()
276 static bool IsSafeToMove(const MachineInstr *Def, const MachineInstr *Insert, in IsSafeToMove() argument
279 assert(Def->getParent() == Insert->getParent()); in IsSafeToMove()
282 for (const MachineOperand &MO : Def->operands()) { in IsSafeToMove()
312 (MO.isDef() || Def->definesRegister(Reg)) ? in IsSafeToMove()
313 LI.getVNInfoAt(LIS.getInstructionIndex(*Def).getRegSlot()) : in IsSafeToMove()
314 LI.getVNInfoBefore(LIS.getInstructionIndex(*Def)); in IsSafeToMove()
322 Query(*Def, AA, Read, Write, Effects, StackPointer); in IsSafeToMove()
330 MachineBasicBlock::const_iterator D(Def), I(Insert); in IsSafeToMove()
435 MachineInstr *Def, in MoveForSingleUse() argument
440 DEBUG(dbgs() << "Move for single use: "; Def->dump()); in MoveForSingleUse()
442 MBB.splice(Insert, &MBB, Def); in MoveForSingleUse()
443 LIS.handleMove(*Def); in MoveForSingleUse()
453 Def->getOperand(0).setReg(NewReg); in MoveForSingleUse()
461 LI.removeSegment(LIS.getInstructionIndex(*Def).getRegSlot(), in MoveForSingleUse()
467 DEBUG(dbgs() << " - Replaced register: "; Def->dump()); in MoveForSingleUse()
470 ImposeStackOrdering(Def); in MoveForSingleUse()
471 return Def; in MoveForSingleUse()
477 unsigned Reg, MachineOperand &Op, MachineInstr &Def, MachineBasicBlock &MBB, in RematerializeCheapDef() argument
481 DEBUG(dbgs() << "Rematerializing cheap def: "; Def.dump()); in RematerializeCheapDef()
485 TII->reMaterialize(MBB, Insert, NewReg, 0, Def, *TRI); in RematerializeCheapDef()
500 IsDead = !LI.liveAt(LIS.getInstructionIndex(Def).getDeadSlot()); in RematerializeCheapDef()
506 SlotIndex Idx = LIS.getInstructionIndex(Def).getRegSlot(); in RematerializeCheapDef()
509 LIS.RemoveMachineInstrFromMaps(Def); in RematerializeCheapDef()
510 Def.eraseFromParent(); in RematerializeCheapDef()
537 unsigned Reg, MachineOperand &Op, MachineInstr *Def, MachineBasicBlock &MBB, in MoveAndTeeForMultiUse() argument
540 DEBUG(dbgs() << "Move and tee for multi-use:"; Def->dump()); in MoveAndTeeForMultiUse()
543 MBB.splice(Insert, &MBB, Def); in MoveAndTeeForMultiUse()
544 LIS.handleMove(*Def); in MoveAndTeeForMultiUse()
550 MachineOperand &DefMO = Def->getOperand(0); in MoveAndTeeForMultiUse()
558 SlotIndex DefIdx = LIS.getInstructionIndex(*Def).getRegSlot(); in MoveAndTeeForMultiUse()
573 ImposeStackOrdering(Def); in MoveAndTeeForMultiUse()
576 DEBUG(dbgs() << " - Replaced register: "; Def->dump()); in MoveAndTeeForMultiUse()
578 return Def; in MoveAndTeeForMultiUse()
754 MachineInstr *Def = GetVRegDef(Reg, Insert, MRI, LIS); in runOnMachineFunction() local
755 if (!Def) in runOnMachineFunction()
760 if (Def->getOpcode() == TargetOpcode::INLINEASM) in runOnMachineFunction()
765 if (Def->getOpcode() == WebAssembly::ARGUMENT_I32 || in runOnMachineFunction()
766 Def->getOpcode() == WebAssembly::ARGUMENT_I64 || in runOnMachineFunction()
767 Def->getOpcode() == WebAssembly::ARGUMENT_F32 || in runOnMachineFunction()
768 Def->getOpcode() == WebAssembly::ARGUMENT_F64) in runOnMachineFunction()
777 bool SameBlock = Def->getParent() == &MBB; in runOnMachineFunction()
778 bool CanMove = SameBlock && IsSafeToMove(Def, Insert, AA, LIS, MRI) && in runOnMachineFunction()
780 if (CanMove && HasOneUse(Reg, Def, MRI, MDT, LIS)) { in runOnMachineFunction()
781 Insert = MoveForSingleUse(Reg, Op, Def, MBB, Insert, LIS, MFI, MRI); in runOnMachineFunction()
782 } else if (ShouldRematerialize(*Def, AA, TII)) { in runOnMachineFunction()
784 RematerializeCheapDef(Reg, Op, *Def, MBB, Insert->getIterator(), in runOnMachineFunction()
788 Insert = MoveAndTeeForMultiUse(Reg, Op, Def, MBB, Insert, LIS, MFI, in runOnMachineFunction()