diff options
author | Andrew Trick <atrick@apple.com> | 2013-08-29 18:04:49 +0000 |
---|---|---|
committer | Andrew Trick <atrick@apple.com> | 2013-08-29 18:04:49 +0000 |
commit | 851bb2c9cbbd3b1847def5ca7ea8dadf457298b5 (patch) | |
tree | b4f08a1adb25153efb2e5b94f4b6bbd8cd33a413 /lib/CodeGen/ScheduleDAGInstrs.cpp | |
parent | 33f4c796ac2c373ed18e882431ba3661d24c2cfa (diff) | |
download | llvm-851bb2c9cbbd3b1847def5ca7ea8dadf457298b5.tar.gz llvm-851bb2c9cbbd3b1847def5ca7ea8dadf457298b5.tar.bz2 llvm-851bb2c9cbbd3b1847def5ca7ea8dadf457298b5.tar.xz |
Comment and revise the cyclic critical path code.
This should be much more clear now. It's still disabled pending testing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189597 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/ScheduleDAGInstrs.cpp')
-rw-r--r-- | lib/CodeGen/ScheduleDAGInstrs.cpp | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/lib/CodeGen/ScheduleDAGInstrs.cpp b/lib/CodeGen/ScheduleDAGInstrs.cpp index f6496e6187..17d31f48b1 100644 --- a/lib/CodeGen/ScheduleDAGInstrs.cpp +++ b/lib/CodeGen/ScheduleDAGInstrs.cpp @@ -987,65 +987,6 @@ void ScheduleDAGInstrs::buildSchedGraph(AliasAnalysis *AA, PendingLoads.clear(); } -/// Compute the max cyclic critical path through the DAG. For loops that span -/// basic blocks, MachineTraceMetrics should be used for this instead. -unsigned ScheduleDAGInstrs::computeCyclicCriticalPath() { - // This only applies to single block loop. - if (!BB->isSuccessor(BB)) - return 0; - - unsigned MaxCyclicLatency = 0; - // Visit each live out vreg def to find def/use pairs that cross iterations. - for (SUnit::const_pred_iterator - PI = ExitSU.Preds.begin(), PE = ExitSU.Preds.end(); PI != PE; ++PI) { - MachineInstr *MI = PI->getSUnit()->getInstr(); - for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { - const MachineOperand &MO = MI->getOperand(i); - if (!MO.isReg() || !MO.isDef()) - break; - unsigned Reg = MO.getReg(); - if (!Reg || TRI->isPhysicalRegister(Reg)) - continue; - - const LiveInterval &LI = LIS->getInterval(Reg); - unsigned LiveOutHeight = PI->getSUnit()->getHeight(); - unsigned LiveOutDepth = PI->getSUnit()->getDepth() + PI->getLatency(); - // Visit all local users of the vreg def. - for (VReg2UseMap::iterator - UI = VRegUses.find(Reg); UI != VRegUses.end(); ++UI) { - if (UI->SU == &ExitSU) - continue; - - // Only consider uses of the phi. - LiveRangeQuery LRQ(LI, LIS->getInstructionIndex(UI->SU->getInstr())); - if (!LRQ.valueIn()->isPHIDef()) - continue; - - // Cheat a bit and assume that a path spanning two iterations is a - // cycle, which could overestimate in strange cases. This allows cyclic - // latency to be estimated as the minimum height or depth slack. - unsigned CyclicLatency = 0; - if (LiveOutDepth > UI->SU->getDepth()) - CyclicLatency = LiveOutDepth - UI->SU->getDepth(); - unsigned LiveInHeight = UI->SU->getHeight() + PI->getLatency(); - if (LiveInHeight > LiveOutHeight) { - if (LiveInHeight - LiveOutHeight < CyclicLatency) - CyclicLatency = LiveInHeight - LiveOutHeight; - } - else - CyclicLatency = 0; - DEBUG(dbgs() << "Cyclic Path: SU(" << PI->getSUnit()->NodeNum - << ") -> SU(" << UI->SU->NodeNum << ") = " - << CyclicLatency << "\n"); - if (CyclicLatency > MaxCyclicLatency) - MaxCyclicLatency = CyclicLatency; - } - } - } - DEBUG(dbgs() << "Cyclic Critical Path: " << MaxCyclicLatency << "\n"); - return MaxCyclicLatency; -} - void ScheduleDAGInstrs::dumpNode(const SUnit *SU) const { #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) SU->getInstr()->dump(); |