Index: src/compiler/graph-visualizer.cc |
diff --git a/src/compiler/graph-visualizer.cc b/src/compiler/graph-visualizer.cc |
index 6a9e620d0bc8d2a71a58e5a040f735d9b04d0dcb..6493093dae6365a2ad02b0cc125cec9cce6046fb 100644 |
--- a/src/compiler/graph-visualizer.cc |
+++ b/src/compiler/graph-visualizer.cc |
@@ -612,6 +612,7 @@ std::ostream& operator<<(std::ostream& os, const AsRPO& ar) { |
Zone local_zone; |
ZoneVector<byte> state(ar.graph.NodeCount(), kUnvisited, &local_zone); |
ZoneStack<Node*> stack(&local_zone); |
+ ZoneVector<Node*> all(&local_zone); |
stack.push(ar.graph.end()); |
state[ar.graph.end()->id()] = kOnStack; |
@@ -627,6 +628,7 @@ std::ostream& operator<<(std::ostream& os, const AsRPO& ar) { |
} |
} |
if (pop) { |
+ all.push_back(n); |
state[n->id()] = kVisited; |
stack.pop(); |
os << "#" << n->id() << ":" << *n->op() << "("; |
@@ -638,6 +640,29 @@ std::ostream& operator<<(std::ostream& os, const AsRPO& ar) { |
os << ")" << std::endl; |
} |
} |
+ |
+ bool first = true; |
+ |
+ for (size_t i = 0; i < all.size(); i++) { |
+ Node* l = all[i]; |
+ for (Node* n : l->uses()) { |
+ if (state[n->id()] == kUnvisited) { |
+ state[n->id()] = kVisited; |
+ all.push_back(n); |
+ if (first) { |
+ os << "Gray nodes:" << std::endl; |
+ first = false; |
+ } |
+ os << "#" << n->id() << ":" << *n->op() << "("; |
+ int j = 0; |
+ for (Node* const i : n->inputs()) { |
+ if (j++ > 0) os << ", "; |
+ os << "#" << SafeId(i) << ":" << SafeMnemonic(i); |
+ } |
+ os << ")" << std::endl; |
+ } |
+ } |
+ } |
return os; |
} |
} // namespace compiler |