[llvm-commits] [llvm] r156575 - /llvm/trunk/lib/CodeGen/MachineScheduler.cpp
Andrew Trick
atrick at apple.com
Thu May 10 14:06:19 PDT 2012
Author: atrick
Date: Thu May 10 16:06:19 2012
New Revision: 156575
URL: http://llvm.org/viewvc/llvm-project?rev=156575&view=rev
Log:
misched: tracing register pressure heuristics.
Modified:
llvm/trunk/lib/CodeGen/MachineScheduler.cpp
Modified: llvm/trunk/lib/CodeGen/MachineScheduler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineScheduler.cpp?rev=156575&r1=156574&r2=156575&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineScheduler.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineScheduler.cpp Thu May 10 16:06:19 2012
@@ -724,11 +724,28 @@
BotQueue.push(SU);
}
protected:
+#ifndef NDEBUG
+ void traceCandidate(const char *Label, unsigned QID, SUnit *SU,
+ int RPDiff, unsigned PSetID);
+#endif
bool pickNodeFromQueue(ReadyQ &Q, const RegPressureTracker &RPTracker,
SchedCandidate &Candidate);
};
} // 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.
///
/// TODO: getMaxPressureDelta results can be mostly cached for each SUnit during
@@ -749,6 +766,8 @@
// Avoid exceeding the target's limit.
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.RPDelta = RPDelta;
FoundCandidate = true;
@@ -759,15 +778,11 @@
// Avoid increasing the max pressure.
if (RPDelta.MaxUnitIncrease < Candidate.RPDelta.MaxUnitIncrease) {
+ DEBUG(traceCandidate("MCAND", Q.ID, *I,
+ RPDelta.ExcessUnits, RPDelta.ExcessSetID));
Candidate.SU = *I;
Candidate.RPDelta = RPDelta;
FoundCandidate = true;
-
- DEBUG(dbgs() << "CAND " << getQName(Q.ID) << " ";
- if (RPDelta.MaxUnitIncrease)
- dbgs() << TRI->getRegPressureSetName(RPDelta.MaxSetID) << ":"
- << RPDelta.MaxUnitIncrease << " ";
- (*I)->dump(DAG); dbgs() << "\n");
continue;
}
if (RPDelta.MaxUnitIncrease > Candidate.RPDelta.MaxUnitIncrease)
@@ -780,6 +795,7 @@
if ((Q.ID == TopQID && (*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.RPDelta = RPDelta;
FoundCandidate = true;
More information about the llvm-commits
mailing list