dbgs() << '\n';
}
-void RegPressureTracker::dump(const TargetRegisterInfo *TRI) const {
+void RegPressureTracker::dump() const {
dbgs() << "Curr Pressure: ";
dumpSetPressure(CurrSetPressure, TRI);
P.dump(TRI);
/// Collect physical and virtual register operands.
static void collectOperands(const MachineInstr *MI,
RegisterOperands &RegOpers) {
- for(ConstMIBundleOperands OperI(MI); OperI.isValid(); ++OperI)
+ for (ConstMIBundleOperands OperI(MI); OperI.isValid(); ++OperI)
RegOpers.collect(*OperI);
// Remove redundant physreg dead defs.
- for (unsigned i = RegOpers.DeadDefs.size(); i > 0; --i) {
- unsigned Reg = RegOpers.DeadDefs[i-1];
- if (containsReg(RegOpers.Defs, Reg))
- RegOpers.DeadDefs.erase(&RegOpers.DeadDefs[i-1]);
- }
+ SmallVectorImpl<unsigned>::iterator I =
+ std::remove_if(RegOpers.DeadDefs.begin(), RegOpers.DeadDefs.end(),
+ std::bind1st(std::ptr_fun(containsReg), RegOpers.Defs));
+ RegOpers.DeadDefs.erase(I, RegOpers.DeadDefs.end());
}
/// Force liveness of registers.
static void computeExcessPressureDelta(ArrayRef<unsigned> OldPressureVec,
ArrayRef<unsigned> NewPressureVec,
RegPressureDelta &Delta,
- const TargetRegisterInfo *TRI) {
+ const RegisterClassInfo *RCI) {
int ExcessUnits = 0;
unsigned PSetID = ~0U;
for (unsigned i = 0, e = OldPressureVec.size(); i < e; ++i) {
if (!PDiff) // No change in this set in the common case.
continue;
// Only consider change beyond the limit.
- unsigned Limit = TRI->getRegPressureSetLimit(i);
+ unsigned Limit = RCI->getRegPressureSetLimit(i);
if (Limit > POld) {
if (Limit > PNew)
PDiff = 0; // Under the limit
int MDiff = (int)PNew - (int)MaxPressureLimit[i];
if (MDiff > Delta.CurrentMax.UnitIncrease) {
Delta.CurrentMax.PSetID = i;
- Delta.CurrentMax.UnitIncrease = PNew;
+ Delta.CurrentMax.UnitIncrease = MDiff;
}
}
}
bumpUpwardPressure(MI);
- computeExcessPressureDelta(SavedPressure, CurrSetPressure, Delta, TRI);
+ computeExcessPressureDelta(SavedPressure, CurrSetPressure, Delta, RCI);
computeMaxPressureDelta(SavedMaxPressure, P.MaxSetPressure, CriticalPSets,
MaxPressureLimit, Delta);
assert(Delta.CriticalMax.UnitIncrease >= 0 &&
UI = MRI->use_nodbg_begin(Reg), UE = MRI->use_nodbg_end();
UI != UE; UI.skipInstruction()) {
const MachineInstr* MI = &*UI;
+ if (MI->isDebugValue())
+ continue;
SlotIndex InstSlot = LIS->getInstructionIndex(MI).getRegSlot();
if (InstSlot >= PriorUseIdx && InstSlot < NextUseIdx)
return true;
bumpDownwardPressure(MI);
- computeExcessPressureDelta(SavedPressure, CurrSetPressure, Delta, TRI);
+ computeExcessPressureDelta(SavedPressure, CurrSetPressure, Delta, RCI);
computeMaxPressureDelta(SavedMaxPressure, P.MaxSetPressure, CriticalPSets,
MaxPressureLimit, Delta);
assert(Delta.CriticalMax.UnitIncrease >= 0 &&