From 4e97c539408f47145526f0062c1c06df99146a73 Mon Sep 17 00:00:00 2001 From: Jean Christophe Beyler Date: Tue, 7 Jan 2014 10:07:18 -0800 Subject: Added pass framework The patch adds a Middle-End pass system and normalizes the current passes into the pass framework. Passes have: - A start, work, and end functions. - A gate to determine to apply the pass. - Can provide a CFG dump folder. mir_dataflow.cc, mir_graph.cc, mir_optimization.cc, ssa_transformation.cc: - Changed due to moving code into bb_optimizations.cc. - Moved certain functions from private to public due to needed from the passes. pass.cc, pass.h: - Pass base class pass_driver.cc, pass_driver.h: - The pass driver implementation. frontend.cc: - Replace the function calls to the passes with the pass driver. Change-Id: I88cd82efbf6499df9e6c7f135d7e294dd724a079 Signed-off-by: Jean Christophe Beyler --- compiler/dex/frontend.cc | 34 ++++------------------------------ 1 file changed, 4 insertions(+), 30 deletions(-) (limited to 'compiler/dex/frontend.cc') diff --git a/compiler/dex/frontend.cc b/compiler/dex/frontend.cc index adfbf2f3b5..f5bb85a910 100644 --- a/compiler/dex/frontend.cc +++ b/compiler/dex/frontend.cc @@ -21,6 +21,7 @@ #include "dataflow_iterator-inl.h" #include "leb128.h" #include "mirror/object.h" +#include "pass_driver.h" #include "runtime.h" #include "backend.h" #include "base/logging.h" @@ -251,36 +252,9 @@ static CompiledMethod* CompileMethod(CompilerDriver& compiler, } #endif - /* Do a code layout pass */ - cu.NewTimingSplit("MIROpt:CodeLayout"); - cu.mir_graph->CodeLayout(); - - /* Perform SSA transformation for the whole method */ - cu.NewTimingSplit("MIROpt:SSATransform"); - cu.mir_graph->SSATransformation(); - - /* Do constant propagation */ - cu.NewTimingSplit("MIROpt:ConstantProp"); - cu.mir_graph->PropagateConstants(); - - cu.NewTimingSplit("MIROpt:InitRegLoc"); - cu.mir_graph->InitRegLocations(); - - /* Count uses */ - cu.NewTimingSplit("MIROpt:UseCount"); - cu.mir_graph->MethodUseCount(); - - /* Perform null check elimination and type inference*/ - cu.NewTimingSplit("MIROpt:NCE_TypeInference"); - cu.mir_graph->NullCheckEliminationAndTypeInference(); - - /* Combine basic blocks where possible */ - cu.NewTimingSplit("MIROpt:BBCombine"); - cu.mir_graph->BasicBlockCombine(); - - /* Do some basic block optimizations */ - cu.NewTimingSplit("MIROpt:BBOpt"); - cu.mir_graph->BasicBlockOptimization(); + /* Create the pass driver and launch it */ + PassDriver driver(&cu); + driver.Launch(); if (cu.enable_debug & (1 << kDebugDumpCheckStats)) { cu.mir_graph->DumpCheckStats(); -- cgit v1.2.3-59-g8ed1b