mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-11-04 05:17:07 +00:00 
			
		
		
		
	misched: tracing register pressure heuristics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156575 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
		@@ -724,11 +724,28 @@ public:
 | 
				
			|||||||
      BotQueue.push(SU);
 | 
					      BotQueue.push(SU);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
 | 
					#ifndef NDEBUG
 | 
				
			||||||
 | 
					  void traceCandidate(const char *Label, unsigned QID, SUnit *SU,
 | 
				
			||||||
 | 
					                      int RPDiff, unsigned PSetID);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
  bool pickNodeFromQueue(ReadyQ &Q, const RegPressureTracker &RPTracker,
 | 
					  bool pickNodeFromQueue(ReadyQ &Q, const RegPressureTracker &RPTracker,
 | 
				
			||||||
                         SchedCandidate &Candidate);
 | 
					                         SchedCandidate &Candidate);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
} // namespace
 | 
					} // namespace
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef NDEBUG
 | 
				
			||||||
 | 
					void ConvergingScheduler::
 | 
				
			||||||
 | 
					traceCandidate(const char *Label, unsigned QID, SUnit *SU,
 | 
				
			||||||
 | 
					               int RPDiff, unsigned PSetID) {
 | 
				
			||||||
 | 
					  dbgs() << Label << getQName(QID) << " ";
 | 
				
			||||||
 | 
					  if (RPDiff)
 | 
				
			||||||
 | 
					    dbgs() << TRI->getRegPressureSetName(PSetID) << ":" << RPDiff << " ";
 | 
				
			||||||
 | 
					  else
 | 
				
			||||||
 | 
					    dbgs() << "     ";
 | 
				
			||||||
 | 
					  SU->dump(DAG);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// Pick the best candidate from the top queue.
 | 
					/// Pick the best candidate from the top queue.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// TODO: getMaxPressureDelta results can be mostly cached for each SUnit during
 | 
					/// TODO: getMaxPressureDelta results can be mostly cached for each SUnit during
 | 
				
			||||||
@@ -749,6 +766,8 @@ bool ConvergingScheduler::pickNodeFromQueue(ReadyQ &Q,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // Avoid exceeding the target's limit.
 | 
					    // Avoid exceeding the target's limit.
 | 
				
			||||||
    if (!Candidate.SU || RPDelta.ExcessUnits < Candidate.RPDelta.ExcessUnits) {
 | 
					    if (!Candidate.SU || RPDelta.ExcessUnits < Candidate.RPDelta.ExcessUnits) {
 | 
				
			||||||
 | 
					      DEBUG(traceCandidate(Candidate.SU ? "PCAND" : "ACAND", Q.ID, *I,
 | 
				
			||||||
 | 
					                           RPDelta.ExcessUnits, RPDelta.ExcessSetID));
 | 
				
			||||||
      Candidate.SU = *I;
 | 
					      Candidate.SU = *I;
 | 
				
			||||||
      Candidate.RPDelta = RPDelta;
 | 
					      Candidate.RPDelta = RPDelta;
 | 
				
			||||||
      FoundCandidate = true;
 | 
					      FoundCandidate = true;
 | 
				
			||||||
@@ -759,15 +778,11 @@ bool ConvergingScheduler::pickNodeFromQueue(ReadyQ &Q,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // Avoid increasing the max pressure.
 | 
					    // Avoid increasing the max pressure.
 | 
				
			||||||
    if (RPDelta.MaxUnitIncrease < Candidate.RPDelta.MaxUnitIncrease) {
 | 
					    if (RPDelta.MaxUnitIncrease < Candidate.RPDelta.MaxUnitIncrease) {
 | 
				
			||||||
 | 
					      DEBUG(traceCandidate("MCAND", Q.ID, *I,
 | 
				
			||||||
 | 
					                           RPDelta.ExcessUnits, RPDelta.ExcessSetID));
 | 
				
			||||||
      Candidate.SU = *I;
 | 
					      Candidate.SU = *I;
 | 
				
			||||||
      Candidate.RPDelta = RPDelta;
 | 
					      Candidate.RPDelta = RPDelta;
 | 
				
			||||||
      FoundCandidate = true;
 | 
					      FoundCandidate = true;
 | 
				
			||||||
 | 
					 | 
				
			||||||
      DEBUG(dbgs() << "CAND " << getQName(Q.ID) << " ";
 | 
					 | 
				
			||||||
            if (RPDelta.MaxUnitIncrease)
 | 
					 | 
				
			||||||
              dbgs() << TRI->getRegPressureSetName(RPDelta.MaxSetID) << ":"
 | 
					 | 
				
			||||||
                     << RPDelta.MaxUnitIncrease << " ";
 | 
					 | 
				
			||||||
            (*I)->dump(DAG); dbgs() << "\n");
 | 
					 | 
				
			||||||
      continue;
 | 
					      continue;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (RPDelta.MaxUnitIncrease > Candidate.RPDelta.MaxUnitIncrease)
 | 
					    if (RPDelta.MaxUnitIncrease > Candidate.RPDelta.MaxUnitIncrease)
 | 
				
			||||||
@@ -780,6 +795,7 @@ bool ConvergingScheduler::pickNodeFromQueue(ReadyQ &Q,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if ((Q.ID == TopQID && (*I)->NodeNum < Candidate.SU->NodeNum)
 | 
					    if ((Q.ID == TopQID && (*I)->NodeNum < Candidate.SU->NodeNum)
 | 
				
			||||||
        || (Q.ID == BotQID && (*I)->NodeNum > Candidate.SU->NodeNum)) {
 | 
					        || (Q.ID == BotQID && (*I)->NodeNum > Candidate.SU->NodeNum)) {
 | 
				
			||||||
 | 
					      DEBUG(traceCandidate("NCAND", Q.ID, *I, 0, 0));
 | 
				
			||||||
      Candidate.SU = *I;
 | 
					      Candidate.SU = *I;
 | 
				
			||||||
      Candidate.RPDelta = RPDelta;
 | 
					      Candidate.RPDelta = RPDelta;
 | 
				
			||||||
      FoundCandidate = true;
 | 
					      FoundCandidate = true;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user