Lines Matching +full:tri +full:- +full:state
1 //===- RegisterPressure.cpp - Dynamic Register Pressure -------------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
12 //===----------------------------------------------------------------------===//
30 #include "llvm/Config/llvm-config.h"
75 CurrSetPressure[*PSetI] -= Weight; in decreaseSetPressure()
82 const TargetRegisterInfo *TRI) { in dumpRegSetPressure() argument
86 dbgs() << TRI->getRegPressureSetName(i) << "=" << SetPressure[i] << '\n'; in dumpRegSetPressure()
95 void RegisterPressure::dump(const TargetRegisterInfo *TRI) const { in dump()
97 dumpRegSetPressure(MaxSetPressure, TRI); in dump()
100 dbgs() << printVRegOrUnit(P.RegUnit, TRI); in dump()
108 dbgs() << printVRegOrUnit(P.RegUnit, TRI); in dump()
120 dumpRegSetPressure(CurrSetPressure, TRI); in dump()
122 P.dump(TRI); in dump()
126 void PressureDiff::dump(const TargetRegisterInfo &TRI) const { in dump()
131 dbgs() << sep << TRI.getRegPressureSetName(Change.getPSet()) in dump()
161 PSetIterator PSetI = MRI->getPressureSets(RegUnit); in increaseRegPressure()
226 const TargetRegisterInfo &TRI = *MRI.getTargetRegisterInfo(); in init() local
227 unsigned NumRegUnits = TRI.getNumRegs(); in init()
230 this->NumRegUnits = NumRegUnits; in init()
272 TRI = MF->getSubtarget().getRegisterInfo(); in init()
274 MRI = &MF->getRegInfo(); in init()
276 this->TrackUntiedDefs = TrackUntiedDefs; in init()
277 this->TrackLaneMasks = TrackLaneMasks; in init()
285 CurrSetPressure.assign(TRI->getNumRegPressureSets(), 0); in init()
291 UntiedDefs.setUniverse(MRI->getNumVirtRegs()); in init()
312 skipDebugInstructionsForward(CurrPos, MBB->end()); in getCurrSlot()
313 if (IdxPos == MBB->end()) in getCurrSlot()
314 return LIS->getMBBEndIdx(MBB); in getCurrSlot()
315 return LIS->getInstructionIndex(*IdxPos).getRegSlot(); in getCurrSlot()
356 /// live-thru ranges. However, two-address or coalesced chains can also lead
360 LiveThruPressure.assign(TRI->getNumRegPressureSets(), 0); in initLiveThru()
361 assert(isBottomClosed() && "need bottom-up tracking to intialize."); in initLiveThru()
377 return I->LaneMask; in getRegLanes()
390 I->LaneMask |= Pair.LaneMask; in addRegLanes()
402 I->LaneMask = LaneBitmask::getNone(); in setRegZero()
414 I->LaneMask &= ~Pair.LaneMask; in removeRegLanes()
415 if (I->LaneMask.none()) in removeRegLanes()
470 const TargetRegisterInfo &TRI; member in __anondcf0e0b20611::RegisterOperandsCollector
475 const TargetRegisterInfo &TRI, in RegisterOperandsCollector() argument
477 : RegOpers(RegOpers), TRI(TRI), MRI(MRI), IgnoreDead(IgnoreDead) {} in RegisterOperandsCollector()
524 for (MCRegUnit Unit : TRI.regunits(Reg.asMCReg())) in pushReg()
539 // Treat read-undef subreg defs as definitions of the whole register. in collectOperandLanes()
555 ? TRI.getSubRegIndexLaneMask(SubRegIdx) in pushRegLanes()
559 for (MCRegUnit Unit : TRI.regunits(Reg.asMCReg())) in pushRegLanes()
568 const TargetRegisterInfo &TRI, in collect() argument
571 RegisterOperandsCollector Collector(*this, TRI, MRI, IgnoreDead); in collect()
582 Register Reg = RI->RegUnit; in detectDeadDefs()
585 LiveQueryResult LRQ = LR->Query(SlotIdx); in detectDeadDefs()
603 LaneBitmask LiveAfter = getLiveLanesAt(LIS, MRI, true, I->RegUnit, in adjustLaneLiveness()
606 // of a subregister def we need a read-undef flag. in adjustLaneLiveness()
607 Register RegUnit = I->RegUnit; in adjustLaneLiveness()
609 (LiveAfter & ~I->LaneMask).none()) in adjustLaneLiveness()
610 AddFlagsMI->setRegisterDefReadUndef(RegUnit); in adjustLaneLiveness()
612 LaneBitmask ActualDef = I->LaneMask & LiveAfter; in adjustLaneLiveness()
616 I->LaneMask = ActualDef; in adjustLaneLiveness()
633 AddFlagsMI->setRegisterDefReadUndef(RegUnit); in adjustLaneLiveness()
654 assert(!PDiff.begin()->isValid() && "stale PDiff"); in addInstruction()
665 PSetIterator PSetI = MRI->getPressureSets(RegUnit); in addPressureChange()
666 int Weight = IsDec ? -PSetI.getWeight() : PSetI.getWeight(); in addPressureChange()
670 for (; I != E && I->isValid(); ++I) { in addPressureChange()
671 if (I->getPSet() >= *PSetI) in addPressureChange()
678 if (!I->isValid() || I->getPSet() != *PSetI) { in addPressureChange()
684 unsigned NewUnitInc = I->getUnitInc() + Weight; in addPressureChange()
686 I->setUnitInc(NewUnitInc); in addPressureChange()
690 for (J = std::next(I); J != E && J->isValid(); ++J, ++I) in addPressureChange()
721 PrevMask = I->LaneMask; in discoverLiveInOrOut()
723 I->LaneMask = NewMask; in discoverLiveInOrOut()
758 assert(!CurrPos->isDebugOrPseudoInstr()); in recede()
792 SlotIdx = LIS->getInstructionIndex(*CurrPos).getRegSlot(); in recede()
813 bool IsRedef = I != LiveUses->end(); in recede()
815 // ignore re-defs here... in recede()
816 assert(I->LaneMask.none()); in recede()
845 assert(CurrPos != MBB->begin()); in recedeSkipDebugValues()
854 CurrPos = prev_nodbg(CurrPos, MBB->begin()); in recedeSkipDebugValues()
857 if (RequireIntervals && !CurrPos->isDebugOrPseudoInstr()) in recedeSkipDebugValues()
858 SlotIdx = LIS->getInstructionIndex(*CurrPos).getRegSlot(); in recedeSkipDebugValues()
867 if (CurrPos->isDebugInstr() || CurrPos->isPseudoProbe()) { in recede()
870 assert(CurrPos == MBB->begin()); in recede()
876 RegOpers.collect(MI, *TRI, *MRI, TrackLaneMasks, /*IgnoreDead=*/false); in recede()
878 SlotIndex SlotIdx = LIS->getInstructionIndex(*CurrPos).getRegSlot(); in recede()
890 assert(CurrPos != MBB->end()); in advance()
936 CurrPos = next_nodbg(CurrPos, MBB->end()); in advance()
942 RegOpers.collect(MI, *TRI, *MRI, TrackLaneMasks, false); in advance()
960 int PDiff = (int)PNew - (int)POld; in computeExcessPressureDelta()
964 unsigned Limit = RCI->getRegPressureSetLimit(i); in computeExcessPressureDelta()
972 PDiff = PNew - Limit; // Just exceeded limit. in computeExcessPressureDelta()
974 PDiff = Limit - POld; // Just obeyed limit. in computeExcessPressureDelta()
1010 int PDiff = (int)PNew - (int)CriticalPSets[CritIdx].getUnitInc(); in computeMaxPressureDelta()
1021 Delta.CurrentMax.setUnitInc(PNew - POld); in computeMaxPressureDelta()
1035 assert(!MI->isDebugOrPseudoInstr() && "Expect a nondebug instruction."); in bumpUpwardPressure()
1039 SlotIdx = LIS->getInstructionIndex(*MI).getRegSlot(); in bumpUpwardPressure()
1043 RegOpers.collect(*MI, *TRI, *MRI, TrackLaneMasks, /*IgnoreDead=*/true); in bumpUpwardPressure()
1082 /// bottom-up. Find the pressure set with the most change beyond its pressure
1089 /// This is expensive for an on-the-fly query because it calls
1092 /// -verify-misched. getUpwardPressureDelta is the fast version of this query
1093 /// that uses the per-SUnit cache of the PressureDiff.
1114 // Restore the tracker's state. in getMaxUpwardPressureDelta()
1127 PDiff->dump(*TRI); in getMaxUpwardPressureDelta()
1130 dbgs() << "Excess1 " << TRI->getRegPressureSetName(Delta.Excess.getPSet()) in getMaxUpwardPressureDelta()
1133 dbgs() << "Critic1 " << TRI->getRegPressureSetName(Delta.CriticalMax.getPSet()) in getMaxUpwardPressureDelta()
1136 dbgs() << "CurrMx1 " << TRI->getRegPressureSetName(Delta.CurrentMax.getPSet()) in getMaxUpwardPressureDelta()
1139 dbgs() << "Excess2 " << TRI->getRegPressureSetName(Delta2.Excess.getPSet()) in getMaxUpwardPressureDelta()
1142 dbgs() << "Critic2 " << TRI->getRegPressureSetName(Delta2.CriticalMax.getPSet()) in getMaxUpwardPressureDelta()
1145 dbgs() << "CurrMx2 " << TRI->getRegPressureSetName(Delta2.CurrentMax.getPSet()) in getMaxUpwardPressureDelta()
1170 PDiffI != PDiffE && PDiffI->isValid(); ++PDiffI) { in getUpwardPressureDelta()
1172 unsigned PSetID = PDiffI->getPSet(); in getUpwardPressureDelta()
1173 unsigned Limit = RCI->getRegPressureSetLimit(PSetID); in getUpwardPressureDelta()
1181 unsigned PNew = POld + PDiffI->getUnitInc(); in getUpwardPressureDelta()
1182 assert((PDiffI->getUnitInc() >= 0) == (PNew >= POld) in getUpwardPressureDelta()
1190 ExcessInc = POld > Limit ? PNew - POld : PNew - Limit; in getUpwardPressureDelta()
1192 ExcessInc = Limit - POld; in getUpwardPressureDelta()
1206 int CritInc = (int)MNew - (int)CriticalPSets[CritIdx].getUnitInc(); in getUpwardPressureDelta()
1216 Delta.CurrentMax.setUnitInc(MNew - MOld); in getUpwardPressureDelta()
1228 const TargetRegisterInfo &TRI = *MRI.getTargetRegisterInfo(); in findUseBetween() local
1233 SlotIndex InstSlot = LIS->getInstructionIndex(*MI).getRegSlot(); in findUseBetween()
1236 LaneBitmask UseMask = TRI.getSubRegIndexLaneMask(SubRegIdx); in findUseBetween()
1262 return S != nullptr && S->end == Pos.getRegSlot(); in getLastUsedLanes()
1273 return S != nullptr && S->start < Pos.getRegSlot(true) && in getLiveThroughAt()
1274 S->end != Pos.getDeadSlot(); in getLiveThroughAt()
1285 assert(!MI->isDebugOrPseudoInstr() && "Expect a nondebug instruction."); in bumpDownwardPressure()
1289 SlotIdx = LIS->getInstructionIndex(*MI).getRegSlot(); in bumpDownwardPressure()
1293 RegOpers.collect(*MI, *TRI, *MRI, TrackLaneMasks, /*IgnoreDead=*/false); in bumpDownwardPressure()
1307 // to be bottom-scheduled to avoid searching uses at each query. in bumpDownwardPressure()
1333 /// top-down. Find the register class with the most change in its pressure limit
1339 /// This is expensive for an on-the-fly query because it calls
1360 // Restore the tracker's state. in getMaxDownwardPressureDelta()
1365 /// Get the pressure of each PSet after traversing this instruction bottom-up.
1381 /// Get the pressure of each PSet after traversing this instruction top-down.