mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-06 04:31:08 +00:00
Undo previous check-in.
Reintroduce recursive assignDFSNumber(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30380 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1ec72738ac
commit
697e590580
@ -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;
|
||||
|
@ -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
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
Loading…
Reference in New Issue
Block a user