diff options
author | Evan Cheng <evan.cheng@apple.com> | 2006-05-12 06:05:18 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2006-05-12 06:05:18 +0000 |
commit | 626da3d9aeb5e18a47a7516cbeae38c9324636e5 (patch) | |
tree | 53deba5cc49ff47058d7c045dcb9bb6b2fc31965 /lib/CodeGen/SelectionDAG/ScheduleDAG.cpp | |
parent | 8f60c56a06c4bc2027c5d1a7ee7ad626ae274604 (diff) |
Duh. That could take a long time.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28235 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/ScheduleDAG.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/ScheduleDAG.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp index e05d9d7103..8a32fee1eb 100644 --- a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp +++ b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp @@ -170,27 +170,31 @@ void ScheduleDAG::BuildSchedUnits() { return; } -static void CalculateDepths(SUnit *SU, unsigned Depth) { - if (Depth > SU->Depth) SU->Depth = Depth; - for (std::set<std::pair<SUnit*, bool> >::iterator I = SU->Succs.begin(), - E = SU->Succs.end(); I != E; ++I) - CalculateDepths(I->first, Depth+1); +static void CalculateDepths(SUnit *SU, unsigned Depth, unsigned Max) { + if (Depth > SU->Depth) { + SU->Depth = Depth; + for (std::set<std::pair<SUnit*, bool> >::iterator I = SU->Succs.begin(), + E = SU->Succs.end(); I != E; ++I) + CalculateDepths(I->first, Depth+1, Max); + } } void ScheduleDAG::CalculateDepths() { SUnit *Entry = SUnitMap[DAG.getEntryNode().Val]; - ::CalculateDepths(Entry, 0U); + ::CalculateDepths(Entry, 0U, SUnits.size()); for (unsigned i = 0, e = SUnits.size(); i != e; ++i) if (SUnits[i].Preds.size() == 0 && &SUnits[i] != Entry) { - ::CalculateDepths(&SUnits[i], 0U); + ::CalculateDepths(&SUnits[i], 0U, SUnits.size()); } } static void CalculateHeights(SUnit *SU, unsigned Height) { - if (Height > SU->Height) SU->Height = Height; - for (std::set<std::pair<SUnit*, bool> >::iterator I = SU->Preds.begin(), - E = SU->Preds.end(); I != E; ++I) - CalculateHeights(I->first, Height+1); + if (Height > SU->Height) { + SU->Height = Height; + for (std::set<std::pair<SUnit*, bool> >::iterator I = SU->Preds.begin(), + E = SU->Preds.end(); I != E; ++I) + CalculateHeights(I->first, Height+1); + } } void ScheduleDAG::CalculateHeights() { SUnit *Root = SUnitMap[DAG.getRoot().Val]; |