mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-21 23:17:16 +00:00
mi-sched: improve the generic register pressure comparison.
Only compare pressure within the same set. When multiple sets are affected, we prioritize the most constrained set. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189641 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2182,21 +2182,19 @@ static bool tryPressure(const PressureChange &TryP,
|
||||
ConvergingScheduler::SchedCandidate &TryCand,
|
||||
ConvergingScheduler::SchedCandidate &Cand,
|
||||
ConvergingScheduler::CandReason Reason) {
|
||||
if (TryP.isValid() && CandP.isValid()) {
|
||||
// If both candidates affect the same set, go with the smallest increase.
|
||||
if (TryP.getPSet() == CandP.getPSet()) {
|
||||
return tryLess(TryP.getUnitInc(), CandP.getUnitInc(), TryCand, Cand,
|
||||
Reason);
|
||||
}
|
||||
// If one candidate decreases and the other increases, go with it.
|
||||
if (tryLess(TryP.getUnitInc() < 0, CandP.getUnitInc() < 0, TryCand, Cand,
|
||||
Reason)) {
|
||||
return true;
|
||||
}
|
||||
int TryRank = TryP.getPSetOrMax();
|
||||
int CandRank = CandP.getPSetOrMax();
|
||||
// If both candidates affect the same set, go with the smallest increase.
|
||||
if (TryRank == CandRank) {
|
||||
return tryLess(TryP.getUnitInc(), CandP.getUnitInc(), TryCand, Cand,
|
||||
Reason);
|
||||
}
|
||||
// If one candidate decreases and the other increases, go with it.
|
||||
// Invalid candidates have UnitInc==0.
|
||||
if (tryLess(TryP.getUnitInc() < 0, CandP.getUnitInc() < 0, TryCand, Cand,
|
||||
Reason)) {
|
||||
return true;
|
||||
}
|
||||
// If TryP has lower Rank, it has a higher priority.
|
||||
int TryRank = TryP.getRank();
|
||||
int CandRank = CandP.getRank();
|
||||
// If the candidates are decreasing pressure, reverse priority.
|
||||
if (TryP.getUnitInc() < 0)
|
||||
std::swap(TryRank, CandRank);
|
||||
|
||||
Reference in New Issue
Block a user