Index: vm/flow_graph_builder.cc |
=================================================================== |
--- vm/flow_graph_builder.cc (revision 8145) |
+++ vm/flow_graph_builder.cc (working copy) |
@@ -24,6 +24,7 @@ |
"Eliminate type checks when allowed by static type analysis"); |
DEFINE_FLAG(bool, print_ast, false, "Print abstract syntax tree."); |
DEFINE_FLAG(bool, print_flow_graph, false, "Print the IR flow graph."); |
+DEFINE_FLAG(bool, print_flow_graph_file, false, "Print the IR into a file."); |
DECLARE_FLAG(bool, enable_type_checks); |
@@ -2301,14 +2302,20 @@ |
GrowableArray<BitVector*> dominance_frontier; |
ComputeDominators(&preorder_block_entries_, &parent, &dominance_frontier); |
} |
- if (FLAG_print_flow_graph) { |
+ if (FLAG_print_flow_graph || FLAG_print_flow_graph_file) { |
intptr_t length = postorder_block_entries_.length(); |
GrowableArray<BlockEntryInstr*> reverse_postorder(length); |
for (intptr_t i = length - 1; i >= 0; --i) { |
reverse_postorder.Add(postorder_block_entries_[i]); |
} |
- FlowGraphPrinter printer(function, reverse_postorder); |
- printer.PrintBlocks(); |
+ if (FLAG_print_flow_graph) { |
+ FlowGraphPrinter printer(function, reverse_postorder); |
+ printer.PrintBlocks(); |
+ } |
+ if (FLAG_print_flow_graph_file) { |
+ FlowGraphVisualizer printer(function, reverse_postorder); |
+ printer.PrintFunction(); |
+ } |
} |
} |