SCCIterator.h (199481) | SCCIterator.h (201360) |
---|---|
1//===-- Support/SCCIterator.h - Strongly Connected Comp. Iter. --*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 58 unchanged lines hidden (view full) --- 67 68 // A single "visit" within the non-recursive DFS traversal. 69 void DFSVisitOne(NodeType* N) { 70 ++visitNum; // Global counter for the visit order 71 nodeVisitNumbers[N] = visitNum; 72 SCCNodeStack.push_back(N); 73 MinVisitNumStack.push_back(visitNum); 74 VisitStack.push_back(std::make_pair(N, GT::child_begin(N))); | 1//===-- Support/SCCIterator.h - Strongly Connected Comp. Iter. --*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 58 unchanged lines hidden (view full) --- 67 68 // A single "visit" within the non-recursive DFS traversal. 69 void DFSVisitOne(NodeType* N) { 70 ++visitNum; // Global counter for the visit order 71 nodeVisitNumbers[N] = visitNum; 72 SCCNodeStack.push_back(N); 73 MinVisitNumStack.push_back(visitNum); 74 VisitStack.push_back(std::make_pair(N, GT::child_begin(N))); |
75 //errs() << "TarjanSCC: Node " << N << | 75 //dbgs() << "TarjanSCC: Node " << N << |
76 // " : visitNum = " << visitNum << "\n"; 77 } 78 79 // The stack-based DFS traversal; defined below. 80 void DFSVisitChildren() { 81 assert(!VisitStack.empty()); 82 while (VisitStack.back().second != GT::child_end(VisitStack.back().first)) { 83 // TOS has at least one more child so continue DFS --- 18 unchanged lines hidden (view full) --- 102 assert(VisitStack.back().second ==GT::child_end(VisitStack.back().first)); 103 NodeType* visitingN = VisitStack.back().first; 104 unsigned minVisitNum = MinVisitNumStack.back(); 105 VisitStack.pop_back(); 106 MinVisitNumStack.pop_back(); 107 if (!MinVisitNumStack.empty() && MinVisitNumStack.back() > minVisitNum) 108 MinVisitNumStack.back() = minVisitNum; 109 | 76 // " : visitNum = " << visitNum << "\n"; 77 } 78 79 // The stack-based DFS traversal; defined below. 80 void DFSVisitChildren() { 81 assert(!VisitStack.empty()); 82 while (VisitStack.back().second != GT::child_end(VisitStack.back().first)) { 83 // TOS has at least one more child so continue DFS --- 18 unchanged lines hidden (view full) --- 102 assert(VisitStack.back().second ==GT::child_end(VisitStack.back().first)); 103 NodeType* visitingN = VisitStack.back().first; 104 unsigned minVisitNum = MinVisitNumStack.back(); 105 VisitStack.pop_back(); 106 MinVisitNumStack.pop_back(); 107 if (!MinVisitNumStack.empty() && MinVisitNumStack.back() > minVisitNum) 108 MinVisitNumStack.back() = minVisitNum; 109 |
110 //errs() << "TarjanSCC: Popped node " << visitingN << | 110 //dbgs() << "TarjanSCC: Popped node " << visitingN << |
111 // " : minVisitNum = " << minVisitNum << "; Node visit num = " << 112 // nodeVisitNumbers[visitingN] << "\n"; 113 114 if (minVisitNum == nodeVisitNumbers[visitingN]) { 115 // A full SCC is on the SCCNodeStack! It includes all nodes below 116 // visitingN on the stack. Copy those nodes to CurrentSCC, 117 // reset their minVisit values, and return (this suspends 118 // the DFS traversal till the next ++). --- 92 unchanged lines hidden --- | 111 // " : minVisitNum = " << minVisitNum << "; Node visit num = " << 112 // nodeVisitNumbers[visitingN] << "\n"; 113 114 if (minVisitNum == nodeVisitNumbers[visitingN]) { 115 // A full SCC is on the SCCNodeStack! It includes all nodes below 116 // visitingN on the stack. Copy those nodes to CurrentSCC, 117 // reset their minVisit values, and return (this suspends 118 // the DFS traversal till the next ++). --- 92 unchanged lines hidden --- |