summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2006-09-14 21:43:24 +0000
committerDevang Patel <dpatel@apple.com>2006-09-14 21:43:24 +0000
commit9ce9df59129c00afd15ebdd50ff3cfb0ce1a2d2f (patch)
treeceb415f34e4879443b7d50ad2e2b43b567e4bd25
parent46d710e6ea9676c1fb2becfbddf9b7b42fab79c7 (diff)
downloadbcm5719-llvm-9ce9df59129c00afd15ebdd50ff3cfb0ce1a2d2f.tar.gz
bcm5719-llvm-9ce9df59129c00afd15ebdd50ff3cfb0ce1a2d2f.zip
Undo previous check-in.
Reintroduce recursive assignDFSNumber(). llvm-svn: 30380
-rw-r--r--llvm/include/llvm/Analysis/ET-Forest.h11
-rw-r--r--llvm/lib/VMCore/Dominators.cpp33
2 files changed, 10 insertions, 34 deletions
diff --git a/llvm/include/llvm/Analysis/ET-Forest.h b/llvm/include/llvm/Analysis/ET-Forest.h
index ef2b2155c72..b05776a9e0f 100644
--- a/llvm/include/llvm/Analysis/ET-Forest.h
+++ b/llvm/include/llvm/Analysis/ET-Forest.h
@@ -250,7 +250,16 @@ public:
return this->Below(other);
}
- void assignDFSNumber(int &);
+ void assignDFSNumber(int &num) {
+ DFSNumIn = num++;
+
+ if (Son) {
+ Son->assignDFSNumber(num);
+ for (ETNode *son = Son->Right; son != Son; son = son->Right)
+ son->assignDFSNumber(num);
+ }
+ DFSNumOut = num++;
+ }
bool hasFather() const {
return Father != NULL;
diff --git a/llvm/lib/VMCore/Dominators.cpp b/llvm/lib/VMCore/Dominators.cpp
index fd193b8d7aa..9f7e5d9365d 100644
--- a/llvm/lib/VMCore/Dominators.cpp
+++ b/llvm/lib/VMCore/Dominators.cpp
@@ -890,39 +890,6 @@ void ETForest::calculate(const ImmediateDominators &ID) {
updateDFSNumbers ();
}
-// Walk ETNode and its children using DFS algorithm and assign
-// DFSNumIn and DFSNumOut numbers for each node.
-void ETNode::assignDFSNumber(int &num) {
-
- std::vector<ETNode *> DFSInStack;
- std::set<ETNode *> visited;
-
- DFSInStack.push_back(this);
-
- visited.insert(this);
-
- while(!DFSInStack.empty()) {
- ETNode *Parent = DFSInStack.back();
- DFSInStack.pop_back();
- Parent->DFSNumIn = num++;
- Parent->DFSNumOut = Parent->DFSNumIn + 1;
-
- ETNode *son = Parent->Son;
- if (son && visited.count(son) == 0) {
-
- DFSInStack.push_back(son);
- son->DFSNumIn = Parent->DFSNumIn + 1;
- visited.insert(son);
-
- for (ETNode *s = son->Right; s != son; s = s->Right) {
- DFSInStack.push_back(s);
- s->DFSNumIn = Parent->DFSNumIn + 1;
- visited.insert(s);
- }
- }
- }
-}
-
//===----------------------------------------------------------------------===//
// ETForestBase Implementation
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud