Create HGraph outside Builder, print timings
This patch refactors the way HGraph objects are created, moving the
instantiation out of the Builder class and creating the CodeGenerator
earlier. The patch uses this to build a single interface for printing
timings info and dumping the CFG.
Change-Id: I2eb63eabf28e2d0f5cdc7affaa690c3a4b1bdd21
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc
index 41e5164..32f6972 100644
--- a/compiler/optimizing/inliner.cc
+++ b/compiler/optimizing/inliner.cc
@@ -124,16 +124,18 @@
resolved_method->GetAccessFlags(),
nullptr);
+ HGraph* callee_graph =
+ new (graph_->GetArena()) HGraph(graph_->GetArena(), graph_->GetCurrentInstructionId());
+
OptimizingCompilerStats inline_stats;
- HGraphBuilder builder(graph_->GetArena(),
+ HGraphBuilder builder(callee_graph,
&dex_compilation_unit,
&outer_compilation_unit_,
&outer_dex_file,
compiler_driver_,
&inline_stats);
- HGraph* callee_graph = builder.BuildGraph(*code_item, graph_->GetCurrentInstructionId());
- if (callee_graph == nullptr) {
+ if (!builder.BuildGraph(*code_item)) {
VLOG(compiler) << "Method " << PrettyMethod(method_index, outer_dex_file)
<< " could not be built, so cannot be inlined";
return false;