llvm.org GIT mirror llvm / 8b14624
tidy up git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101548 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 10 years ago
1 changed file(s) with 28 addition(s) and 26 deletion(s). Raw diff Collapse all Expand all
8484 if (!nodeVisitNumbers.count(childN)) {
8585 // this node has never been seen
8686 DFSVisitOne(childN);
87 } else {
88 unsigned childNum = nodeVisitNumbers[childN];
89 if (MinVisitNumStack.back() > childNum)
90 MinVisitNumStack.back() = childNum;
87 continue;
9188 }
89
90 unsigned childNum = nodeVisitNumbers[childN];
91 if (MinVisitNumStack.back() > childNum)
92 MinVisitNumStack.back() = childNum;
9293 }
9394 }
9495
99100 while (!VisitStack.empty()) {
100101 DFSVisitChildren();
101102 assert(VisitStack.back().second ==GT::child_end(VisitStack.back().first));
102 NodeType* visitingN = VisitStack.back().first;
103 NodeType *visitingN = VisitStack.back().first;
103104 unsigned minVisitNum = MinVisitNumStack.back();
104105 VisitStack.pop_back();
105106 MinVisitNumStack.pop_back();
110111 // " : minVisitNum = " << minVisitNum << "; Node visit num = " <<
111112 // nodeVisitNumbers[visitingN] << "\n";
112113
113 if (minVisitNum == nodeVisitNumbers[visitingN]) {
114 // A full SCC is on the SCCNodeStack! It includes all nodes below
115 // visitingN on the stack. Copy those nodes to CurrentSCC,
116 // reset their minVisit values, and return (this suspends
117 // the DFS traversal till the next ++).
118 do {
119 CurrentSCC.push_back(SCCNodeStack.back());
120 SCCNodeStack.pop_back();
121 nodeVisitNumbers[CurrentSCC.back()] = ~0U;
122 } while (CurrentSCC.back() != visitingN);
123 return;
124 }
114 if (minVisitNum != nodeVisitNumbers[visitingN])
115 continue;
116
117 // A full SCC is on the SCCNodeStack! It includes all nodes below
118 // visitingN on the stack. Copy those nodes to CurrentSCC,
119 // reset their minVisit values, and return (this suspends
120 // the DFS traversal till the next ++).
121 do {
122 CurrentSCC.push_back(SCCNodeStack.back());
123 SCCNodeStack.pop_back();
124 nodeVisitNumbers[CurrentSCC.back()] = ~0U;
125 } while (CurrentSCC.back() != visitingN);
126 return;
125127 }
126128 }
127129
185187
186188 // Global constructor for the SCC iterator.
187189 template
188 scc_iterator scc_begin(const T& G) {
190 scc_iterator scc_begin(const T &G) {
189191 return scc_iterator::begin(G);
190192 }
191193
192194 template
193 scc_iterator scc_end(const T& G) {
195 scc_iterator scc_end(const T &G) {
194196 return scc_iterator::end(G);
195197 }
196198
197199 template
198 scc_iterator > scc_begin(const Inverse& G) {
199 return scc_iterator >::begin(G);
200 }
201
202 template
203 scc_iterator > scc_end(const Inverse& G) {
204 return scc_iterator >::end(G);
200 scc_iterator > scc_begin(const Inverse &G) {
201 return scc_iterator >::begin(G);
202 }
203
204 template
205 scc_iterator > scc_end(const Inverse &G) {
206 return scc_iterator >::end(G);
205207 }
206208
207209 } // End llvm namespace