forked from OSchip/llvm-project
MachineScheduler: Move code to initialize a Candidate out of tryCandidate(); NFC
llvm-svn: 267191
This commit is contained in:
parent
fe3def7c2a
commit
4f57377c68
|
@ -903,11 +903,13 @@ public:
|
|||
protected:
|
||||
void checkAcyclicLatency();
|
||||
|
||||
void initCandidate(SchedCandidate &Cand, SUnit *SU, bool AtTop,
|
||||
const RegPressureTracker &RPTracker,
|
||||
RegPressureTracker &TempTracker);
|
||||
|
||||
void tryCandidate(SchedCandidate &Cand,
|
||||
SchedCandidate &TryCand,
|
||||
SchedBoundary &Zone,
|
||||
const RegPressureTracker &RPTracker,
|
||||
RegPressureTracker &TempTracker);
|
||||
SchedBoundary &Zone);
|
||||
|
||||
SUnit *pickNodeBidirectional(bool &IsTopNode);
|
||||
|
||||
|
|
|
@ -2738,6 +2738,42 @@ static int biasPhysRegCopy(const SUnit *SU, bool isTop) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void GenericScheduler::initCandidate(SchedCandidate &Cand, SUnit *SU,
|
||||
bool AtTop,
|
||||
const RegPressureTracker &RPTracker,
|
||||
RegPressureTracker &TempTracker) {
|
||||
Cand.SU = SU;
|
||||
if (DAG->isTrackingPressure()) {
|
||||
if (AtTop) {
|
||||
TempTracker.getMaxDownwardPressureDelta(
|
||||
Cand.SU->getInstr(),
|
||||
Cand.RPDelta,
|
||||
DAG->getRegionCriticalPSets(),
|
||||
DAG->getRegPressure().MaxSetPressure);
|
||||
} else {
|
||||
if (VerifyScheduling) {
|
||||
TempTracker.getMaxUpwardPressureDelta(
|
||||
Cand.SU->getInstr(),
|
||||
&DAG->getPressureDiff(Cand.SU),
|
||||
Cand.RPDelta,
|
||||
DAG->getRegionCriticalPSets(),
|
||||
DAG->getRegPressure().MaxSetPressure);
|
||||
} else {
|
||||
RPTracker.getUpwardPressureDelta(
|
||||
Cand.SU->getInstr(),
|
||||
DAG->getPressureDiff(Cand.SU),
|
||||
Cand.RPDelta,
|
||||
DAG->getRegionCriticalPSets(),
|
||||
DAG->getRegPressure().MaxSetPressure);
|
||||
}
|
||||
}
|
||||
}
|
||||
DEBUG(if (Cand.RPDelta.Excess.isValid())
|
||||
dbgs() << " Try SU(" << Cand.SU->NodeNum << ") "
|
||||
<< TRI->getRegPressureSetName(Cand.RPDelta.Excess.getPSet())
|
||||
<< ":" << Cand.RPDelta.Excess.getUnitInc() << "\n");
|
||||
}
|
||||
|
||||
/// Apply a set of heursitics to a new candidate. Heuristics are currently
|
||||
/// hierarchical. This may be more efficient than a graduated cost model because
|
||||
/// we don't need to evaluate all aspects of the model for each node in the
|
||||
|
@ -2747,45 +2783,9 @@ static int biasPhysRegCopy(const SUnit *SU, bool isTop) {
|
|||
/// \param Cand provides the policy and current best candidate.
|
||||
/// \param TryCand refers to the next SUnit candidate, otherwise uninitialized.
|
||||
/// \param Zone describes the scheduled zone that we are extending.
|
||||
/// \param RPTracker describes reg pressure within the scheduled zone.
|
||||
/// \param TempTracker is a scratch pressure tracker to reuse in queries.
|
||||
void GenericScheduler::tryCandidate(SchedCandidate &Cand,
|
||||
SchedCandidate &TryCand,
|
||||
SchedBoundary &Zone,
|
||||
const RegPressureTracker &RPTracker,
|
||||
RegPressureTracker &TempTracker) {
|
||||
|
||||
if (DAG->isTrackingPressure()) {
|
||||
// Always initialize TryCand's RPDelta.
|
||||
if (Zone.isTop()) {
|
||||
TempTracker.getMaxDownwardPressureDelta(
|
||||
TryCand.SU->getInstr(),
|
||||
TryCand.RPDelta,
|
||||
DAG->getRegionCriticalPSets(),
|
||||
DAG->getRegPressure().MaxSetPressure);
|
||||
} else {
|
||||
if (VerifyScheduling) {
|
||||
TempTracker.getMaxUpwardPressureDelta(
|
||||
TryCand.SU->getInstr(),
|
||||
&DAG->getPressureDiff(TryCand.SU),
|
||||
TryCand.RPDelta,
|
||||
DAG->getRegionCriticalPSets(),
|
||||
DAG->getRegPressure().MaxSetPressure);
|
||||
} else {
|
||||
RPTracker.getUpwardPressureDelta(
|
||||
TryCand.SU->getInstr(),
|
||||
DAG->getPressureDiff(TryCand.SU),
|
||||
TryCand.RPDelta,
|
||||
DAG->getRegionCriticalPSets(),
|
||||
DAG->getRegPressure().MaxSetPressure);
|
||||
}
|
||||
}
|
||||
}
|
||||
DEBUG(if (TryCand.RPDelta.Excess.isValid())
|
||||
dbgs() << " Try SU(" << TryCand.SU->NodeNum << ") "
|
||||
<< TRI->getRegPressureSetName(TryCand.RPDelta.Excess.getPSet())
|
||||
<< ":" << TryCand.RPDelta.Excess.getUnitInc() << "\n");
|
||||
|
||||
SchedBoundary &Zone) {
|
||||
// Initialize the candidate if needed.
|
||||
if (!Cand.isValid()) {
|
||||
TryCand.Reason = NodeOrder;
|
||||
|
@ -2897,8 +2897,8 @@ void GenericScheduler::pickNodeFromQueue(SchedBoundary &Zone,
|
|||
for (ReadyQueue::iterator I = Q.begin(), E = Q.end(); I != E; ++I) {
|
||||
|
||||
SchedCandidate TryCand(Cand.Policy);
|
||||
TryCand.SU = *I;
|
||||
tryCandidate(Cand, TryCand, Zone, RPTracker, TempTracker);
|
||||
initCandidate(TryCand, *I, Zone.isTop(), RPTracker, TempTracker);
|
||||
tryCandidate(Cand, TryCand, Zone);
|
||||
if (TryCand.Reason != NoCand) {
|
||||
// Initialize resource delta if needed in case future heuristics query it.
|
||||
if (TryCand.ResDelta == SchedResourceDelta())
|
||||
|
|
Loading…
Reference in New Issue