From 5e8b137d28c840b128e2488f954cccee3e86db14 Mon Sep 17 00:00:00 2001 From: David Brazdil Date: Fri, 23 Jan 2015 14:39:08 +0000 Subject: 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 --- compiler/optimizing/builder.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'compiler/optimizing/builder.h') diff --git a/compiler/optimizing/builder.h b/compiler/optimizing/builder.h index 8ee27a1b35..c5101363ee 100644 --- a/compiler/optimizing/builder.h +++ b/compiler/optimizing/builder.h @@ -34,19 +34,19 @@ class SwitchTable; class HGraphBuilder : public ValueObject { public: - HGraphBuilder(ArenaAllocator* arena, + HGraphBuilder(HGraph* graph, DexCompilationUnit* dex_compilation_unit, const DexCompilationUnit* const outer_compilation_unit, const DexFile* dex_file, CompilerDriver* driver, OptimizingCompilerStats* compiler_stats) - : arena_(arena), - branch_targets_(arena, 0), - locals_(arena, 0), + : arena_(graph->GetArena()), + branch_targets_(graph->GetArena(), 0), + locals_(graph->GetArena(), 0), entry_block_(nullptr), exit_block_(nullptr), current_block_(nullptr), - graph_(nullptr), + graph_(graph), constant0_(nullptr), constant1_(nullptr), dex_file_(dex_file), @@ -59,14 +59,14 @@ class HGraphBuilder : public ValueObject { compilation_stats_(compiler_stats) {} // Only for unit testing. - HGraphBuilder(ArenaAllocator* arena, Primitive::Type return_type = Primitive::kPrimInt) - : arena_(arena), - branch_targets_(arena, 0), - locals_(arena, 0), + HGraphBuilder(HGraph* graph, Primitive::Type return_type = Primitive::kPrimInt) + : arena_(graph->GetArena()), + branch_targets_(graph->GetArena(), 0), + locals_(graph->GetArena(), 0), entry_block_(nullptr), exit_block_(nullptr), current_block_(nullptr), - graph_(nullptr), + graph_(graph), constant0_(nullptr), constant1_(nullptr), dex_file_(nullptr), @@ -78,7 +78,7 @@ class HGraphBuilder : public ValueObject { latest_result_(nullptr), compilation_stats_(nullptr) {} - HGraph* BuildGraph(const DexFile::CodeItem& code, int start_instruction_id = 0); + bool BuildGraph(const DexFile::CodeItem& code); private: // Analyzes the dex instruction and adds HInstruction to the graph @@ -249,7 +249,7 @@ class HGraphBuilder : public ValueObject { HBasicBlock* entry_block_; HBasicBlock* exit_block_; HBasicBlock* current_block_; - HGraph* graph_; + HGraph* const graph_; HIntConstant* constant0_; HIntConstant* constant1_; -- cgit v1.2.3-59-g8ed1b