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/mir_dataflow.cc | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) (limited to 'compiler/dex/mir_dataflow.cc') diff --git a/compiler/dex/mir_dataflow.cc b/compiler/dex/mir_dataflow.cc index 728d48ad70..c235448f50 100644 --- a/compiler/dex/mir_dataflow.cc +++ b/compiler/dex/mir_dataflow.cc @@ -1235,9 +1235,9 @@ bool MIRGraph::InvokeUsesMethodStar(MIR* mir) { * counts explicitly used s_regs. A later phase will add implicit * counts for things such as Method*, null-checked references, etc. */ -bool MIRGraph::CountUses(struct BasicBlock* bb) { +void MIRGraph::CountUses(struct BasicBlock* bb) { if (bb->block_type != kDalvikByteCode) { - return false; + return; } // Each level of nesting adds *100 to count, up to 3 levels deep. uint32_t depth = std::min(3U, static_cast(bb->nesting_depth)); @@ -1269,26 +1269,6 @@ bool MIRGraph::CountUses(struct BasicBlock* bb) { } } } - return false; -} - -void MIRGraph::MethodUseCount() { - // Now that we know, resize the lists. - int num_ssa_regs = GetNumSSARegs(); - use_counts_.Resize(num_ssa_regs + 32); - raw_use_counts_.Resize(num_ssa_regs + 32); - // Initialize list - for (int i = 0; i < num_ssa_regs; i++) { - use_counts_.Insert(0); - raw_use_counts_.Insert(0); - } - if (cu_->disable_opt & (1 << kPromoteRegs)) { - return; - } - AllNodesIterator iter(this); - for (BasicBlock* bb = iter.Next(); bb != NULL; bb = iter.Next()) { - CountUses(bb); - } } /* Verify if all the successor is connected with all the claimed predecessors */ -- cgit v1.2.3-59-g8ed1b