diff options
author | 2015-04-23 01:56:11 +0000 | |
---|---|---|
committer | 2015-04-23 01:56:12 +0000 | |
commit | 9d4d13f38398e880e610323242fe73d609bac40d (patch) | |
tree | 02e96b57b3f90d08617923f7f21f9b19aff04af2 /compiler/dex/mir_optimization.cc | |
parent | baba16a405df121542b66eba1a025e58850092b4 (diff) | |
parent | 1b717f63847de8762e7f7bdd6708fdfae9d24a67 (diff) |
Merge "Revert "Quick: Rewrite type inference pass.""
Diffstat (limited to 'compiler/dex/mir_optimization.cc')
-rw-r--r-- | compiler/dex/mir_optimization.cc | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/compiler/dex/mir_optimization.cc b/compiler/dex/mir_optimization.cc index 467c14ed55..ac7963d5c0 100644 --- a/compiler/dex/mir_optimization.cc +++ b/compiler/dex/mir_optimization.cc @@ -25,7 +25,6 @@ #include "gvn_dead_code_elimination.h" #include "local_value_numbering.h" #include "mir_field_info.h" -#include "type_inference.h" #include "quick/dex_file_method_inliner.h" #include "quick/dex_file_to_method_inliner_map.h" #include "stack.h" @@ -577,6 +576,7 @@ bool MIRGraph::BasicBlockOpt(BasicBlock* bb) { // Copy the SSA information that is relevant. mir_next->ssa_rep->num_uses = mir->ssa_rep->num_uses; mir_next->ssa_rep->uses = mir->ssa_rep->uses; + mir_next->ssa_rep->fp_use = mir->ssa_rep->fp_use; mir_next->ssa_rep->num_defs = 0; mir->ssa_rep->num_uses = 0; mir->ssa_rep->num_defs = 0; @@ -670,7 +670,16 @@ bool MIRGraph::BasicBlockOpt(BasicBlock* bb) { mir->ssa_rep->uses = src_ssa; mir->ssa_rep->num_uses = 3; } - AllocateSSADefData(mir, 1); + mir->ssa_rep->num_defs = 1; + mir->ssa_rep->defs = arena_->AllocArray<int32_t>(1, kArenaAllocDFInfo); + mir->ssa_rep->fp_def = arena_->AllocArray<bool>(1, kArenaAllocDFInfo); + mir->ssa_rep->fp_def[0] = if_true->ssa_rep->fp_def[0]; + // Match type of uses to def. + mir->ssa_rep->fp_use = arena_->AllocArray<bool>(mir->ssa_rep->num_uses, + kArenaAllocDFInfo); + for (int i = 0; i < mir->ssa_rep->num_uses; i++) { + mir->ssa_rep->fp_use[i] = mir->ssa_rep->fp_def[0]; + } /* * There is usually a Phi node in the join block for our two cases. If the * Phi node only contains our two cases as input, we will use the result @@ -1125,26 +1134,23 @@ void MIRGraph::EliminateNullChecksEnd() { } } -void MIRGraph::InferTypesStart() { - DCHECK(temp_scoped_alloc_ != nullptr); - temp_.ssa.ti = new (temp_scoped_alloc_.get()) TypeInference(this, temp_scoped_alloc_.get()); -} - /* * Perform type and size inference for a basic block. */ bool MIRGraph::InferTypes(BasicBlock* bb) { if (bb->data_flow_info == nullptr) return false; - DCHECK(temp_.ssa.ti != nullptr); - return temp_.ssa.ti->Apply(bb); -} + bool infer_changed = false; + for (MIR* mir = bb->first_mir_insn; mir != NULL; mir = mir->next) { + if (mir->ssa_rep == NULL) { + continue; + } + + // Propagate type info. + infer_changed = InferTypeAndSize(bb, mir, infer_changed); + } -void MIRGraph::InferTypesEnd() { - DCHECK(temp_.ssa.ti != nullptr); - temp_.ssa.ti->Finish(); - delete temp_.ssa.ti; - temp_.ssa.ti = nullptr; + return infer_changed; } bool MIRGraph::EliminateClassInitChecksGate() { |