Chromium Code Reviews| Index: src/compiler/graph-visualizer.cc |
| diff --git a/src/compiler/graph-visualizer.cc b/src/compiler/graph-visualizer.cc |
| index aca9dbcba3642a9b2acd60153530865d99254f06..e0153f33d47fc98704d1b1a98202cfa770215541 100644 |
| --- a/src/compiler/graph-visualizer.cc |
| +++ b/src/compiler/graph-visualizer.cc |
| @@ -618,6 +618,19 @@ const int kVisited = 2; |
| std::ostream& operator<<(std::ostream& os, const AsRPO& ar) { |
| base::AccountingAllocator allocator; |
| Zone local_zone(&allocator); |
| + |
| + // Do a post-order depth-first search on the RPO graph. For every node, |
| + // print: |
| + // |
| + // - the node id |
| + // - the operator mnemonic |
| + // - in square brackets its parameter (if present) |
| + // - in parentheses the list of argument ids and their mnemonics |
| + // - the node type (if it is typed) |
| + |
| + // Post-order guarantees that all inputs of a node will be printed before |
| + // the node itself. |
|
Jarin
2016/06/07 19:35:31
Maybe you should hedge with "(if possible, cycles
bgeron
2016/06/08 12:04:56
Done.
|
| + |
| ZoneVector<byte> state(ar.graph.NodeCount(), kUnvisited, &local_zone); |
| ZoneStack<Node*> stack(&local_zone); |
| @@ -638,12 +651,14 @@ std::ostream& operator<<(std::ostream& os, const AsRPO& ar) { |
| state[n->id()] = kVisited; |
| stack.pop(); |
| os << "#" << n->id() << ":" << *n->op() << "("; |
| + // Print the arguments |
|
Jarin
2016/06/07 19:35:31
arguments -> inputs.
Please end sentences in comm
bgeron
2016/06/08 12:04:56
Done.
|
| int j = 0; |
| for (Node* const i : n->inputs()) { |
| if (j++ > 0) os << ", "; |
| os << "#" << SafeId(i) << ":" << SafeMnemonic(i); |
| } |
| os << ")"; |
| + // Print the node type, if any |
| if (NodeProperties::IsTyped(n)) { |
| os << " [Type: "; |
| NodeProperties::GetType(n)->PrintTo(os); |