[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp

Evan Cheng evan.cheng at apple.com
Thu May 11 23:05:31 PDT 2006



Changes in directory llvm/lib/CodeGen/SelectionDAG:

ScheduleDAG.cpp updated: 1.88 -> 1.89
---
Log message:

Duh. That could take a long time.

---
Diffs of the changes:  (+15 -11)

 ScheduleDAG.cpp |   26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.88 llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.89
--- llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.88	Thu May 11 20:58:24 2006
+++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp	Fri May 12 01:05:18 2006
@@ -170,27 +170,31 @@
   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];






More information about the llvm-commits mailing list