diff options
author | Bill Buzbee <buzbee@android.com> | 2014-03-20 14:04:24 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-03-20 14:04:24 +0000 |
commit | ac05eb59b8998b31684b32cc69d2de767d5482cc (patch) | |
tree | f6b2e8b7f79686906eede8e6cace6f663134a84d /compiler | |
parent | 77bef430373a56f7dd9ba99ab8471bf5f571253a (diff) | |
parent | cdacac4a8196bdc620185079ec9e886329606f3d (diff) | |
download | art-ac05eb59b8998b31684b32cc69d2de767d5482cc.zip art-ac05eb59b8998b31684b32cc69d2de767d5482cc.tar.gz art-ac05eb59b8998b31684b32cc69d2de767d5482cc.tar.bz2 |
Merge "ART: API changes"
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/dex/mir_graph.cc | 48 | ||||
-rw-r--r-- | compiler/dex/mir_graph.h | 28 | ||||
-rw-r--r-- | compiler/dex/mir_optimization_test.cc | 2 | ||||
-rw-r--r-- | compiler/dex/quick/dex_file_method_inliner.cc | 8 | ||||
-rw-r--r-- | compiler/dex/quick/mir_to_lir.cc | 6 | ||||
-rw-r--r-- | compiler/dex/ssa_transformation.cc | 2 |
6 files changed, 47 insertions, 47 deletions
diff --git a/compiler/dex/mir_graph.cc b/compiler/dex/mir_graph.cc index 60719a5..34f140b 100644 --- a/compiler/dex/mir_graph.cc +++ b/compiler/dex/mir_graph.cc @@ -528,7 +528,7 @@ BasicBlock* MIRGraph::ProcessCanThrow(BasicBlock* cur_block, MIR* insn, DexOffse static_cast<Instruction::Code>(kMirOpCheck); // Associate the two halves insn->meta.throw_insn = new_insn; - AppendMIR(new_block, new_insn); + new_block->AppendMIR(new_insn); return new_block; } @@ -646,7 +646,7 @@ void MIRGraph::InlineMethod(const DexFile::CodeItem* code_item, uint32_t access_ } if (width == 1) { // It is a simple nop - treat normally. - AppendMIR(cur_block, insn); + cur_block->AppendMIR(insn); } else { DCHECK(cur_block->fall_through == NullBasicBlockId); DCHECK(cur_block->taken == NullBasicBlockId); @@ -654,7 +654,7 @@ void MIRGraph::InlineMethod(const DexFile::CodeItem* code_item, uint32_t access_ flags &= ~Instruction::kContinue; } } else { - AppendMIR(cur_block, insn); + cur_block->AppendMIR(insn); } // Associate the starting dex_pc for this opcode with its containing basic block. @@ -873,42 +873,42 @@ void MIRGraph::DumpCFG(const char* dir_prefix, bool all_blocks, const char *suff } /* Insert an MIR instruction to the end of a basic block */ -void MIRGraph::AppendMIR(BasicBlock* bb, MIR* mir) { - if (bb->first_mir_insn == NULL) { - DCHECK(bb->last_mir_insn == NULL); - bb->last_mir_insn = bb->first_mir_insn = mir; - mir->next = NULL; +void BasicBlock::AppendMIR(MIR* mir) { + if (first_mir_insn == nullptr) { + DCHECK(last_mir_insn == nullptr); + last_mir_insn = first_mir_insn = mir; + mir->next = nullptr; } else { - bb->last_mir_insn->next = mir; - mir->next = NULL; - bb->last_mir_insn = mir; + last_mir_insn->next = mir; + mir->next = nullptr; + last_mir_insn = mir; } } /* Insert an MIR instruction to the head of a basic block */ -void MIRGraph::PrependMIR(BasicBlock* bb, MIR* mir) { - if (bb->first_mir_insn == NULL) { - DCHECK(bb->last_mir_insn == NULL); - bb->last_mir_insn = bb->first_mir_insn = mir; - mir->next = NULL; +void BasicBlock::PrependMIR(MIR* mir) { + if (first_mir_insn == nullptr) { + DCHECK(last_mir_insn == nullptr); + last_mir_insn = first_mir_insn = mir; + mir->next = nullptr; } else { - mir->next = bb->first_mir_insn; - bb->first_mir_insn = mir; + mir->next = first_mir_insn; + first_mir_insn = mir; } } /* Insert a MIR instruction after the specified MIR */ -void MIRGraph::InsertMIRAfter(BasicBlock* bb, MIR* current_mir, MIR* new_mir) { +void BasicBlock::InsertMIRAfter(MIR* current_mir, MIR* new_mir) { new_mir->next = current_mir->next; current_mir->next = new_mir; - if (bb->last_mir_insn == current_mir) { + if (last_mir_insn == current_mir) { /* Is the last MIR in the block */ - bb->last_mir_insn = new_mir; + last_mir_insn = new_mir; } } -MIR* MIRGraph::GetNextUnconditionalMir(BasicBlock* bb, MIR* current) { +MIR* BasicBlock::GetNextUnconditionalMir(MIRGraph* mir_graph, MIR* current) { MIR* next_mir = nullptr; if (current != nullptr) { @@ -917,8 +917,8 @@ MIR* MIRGraph::GetNextUnconditionalMir(BasicBlock* bb, MIR* current) { if (next_mir == nullptr) { // Only look for next MIR that follows unconditionally. - if ((bb->taken == NullBasicBlockId) && (bb->fall_through != NullBasicBlockId)) { - next_mir = GetBasicBlock(bb->fall_through)->first_mir_insn; + if ((taken == NullBasicBlockId) && (fall_through != NullBasicBlockId)) { + next_mir = mir_graph->GetBasicBlock(fall_through)->first_mir_insn; } } diff --git a/compiler/dex/mir_graph.h b/compiler/dex/mir_graph.h index fd25798..e10f66f 100644 --- a/compiler/dex/mir_graph.h +++ b/compiler/dex/mir_graph.h @@ -308,6 +308,20 @@ struct BasicBlock { ArenaBitVector* dom_frontier; // Dominance frontier. GrowableArray<BasicBlockId>* predecessors; GrowableArray<SuccessorBlockInfo*>* successor_blocks; + + void AppendMIR(MIR* mir); + void PrependMIR(MIR* mir); + void InsertMIRAfter(MIR* current_mir, MIR* new_mir); + + /** + * @brief Used to obtain the next MIR that follows unconditionally. + * @details The implementation does not guarantee that a MIR does not + * follow even if this method returns nullptr. + * @param mir_graph the MIRGraph. + * @param current The MIR for which to find an unconditional follower. + * @return Returns the following MIR if one can be found. + */ + MIR* GetNextUnconditionalMir(MIRGraph* mir_graph, MIR* current); }; /* @@ -786,20 +800,6 @@ class MIRGraph { bool SetHigh(int index, bool is_high); bool SetHigh(int index); - void AppendMIR(BasicBlock* bb, MIR* mir); - void PrependMIR(BasicBlock* bb, MIR* mir); - void InsertMIRAfter(BasicBlock* bb, MIR* current_mir, MIR* new_mir); - - /** - * @brief Used to obtain the next MIR that follows unconditionally. - * @details The implementation does not guarantee that a MIR does not - * follow even if this method returns nullptr. - * @param bb The basic block of "current" MIR. - * @param current The MIR for which to find an unconditional follower. - * @return Returns the following MIR if one can be found. - */ - MIR* GetNextUnconditionalMir(BasicBlock* bb, MIR* current); - char* GetDalvikDisassembly(const MIR* mir); void ReplaceSpecialChars(std::string& str); std::string GetSSAName(int ssa_reg); diff --git a/compiler/dex/mir_optimization_test.cc b/compiler/dex/mir_optimization_test.cc index f499364..40ced70 100644 --- a/compiler/dex/mir_optimization_test.cc +++ b/compiler/dex/mir_optimization_test.cc @@ -163,7 +163,7 @@ class ClassInitCheckEliminationTest : public testing::Test { mir->dalvikInsn.opcode = def->opcode; ASSERT_LT(def->bbid, cu_.mir_graph->block_list_.Size()); BasicBlock* bb = cu_.mir_graph->block_list_.Get(def->bbid); - cu_.mir_graph->AppendMIR(bb, mir); + bb->AppendMIR(mir); if (def->opcode >= Instruction::SGET && def->opcode <= Instruction::SPUT_SHORT) { ASSERT_LT(def->field_or_method_info, cu_.mir_graph->sfield_lowering_infos_.Size()); mir->meta.sfield_lowering_info = def->field_or_method_info; diff --git a/compiler/dex/quick/dex_file_method_inliner.cc b/compiler/dex/quick/dex_file_method_inliner.cc index 53e26c7..fa6de96 100644 --- a/compiler/dex/quick/dex_file_method_inliner.cc +++ b/compiler/dex/quick/dex_file_method_inliner.cc @@ -564,7 +564,7 @@ bool DexFileMethodInliner::GenInlineConst(MIRGraph* mir_graph, BasicBlock* bb, M insn->dalvikInsn.opcode = Instruction::CONST; insn->dalvikInsn.vA = move_result->dalvikInsn.vA; insn->dalvikInsn.vB = method.d.data; - mir_graph->InsertMIRAfter(bb, move_result, insn); + bb->InsertMIRAfter(move_result, insn); return true; } @@ -603,7 +603,7 @@ bool DexFileMethodInliner::GenInlineReturnArg(MIRGraph* mir_graph, BasicBlock* b insn->dalvikInsn.opcode = opcode; insn->dalvikInsn.vA = move_result->dalvikInsn.vA; insn->dalvikInsn.vB = arg; - mir_graph->InsertMIRAfter(bb, move_result, insn); + bb->InsertMIRAfter(move_result, insn); return true; } @@ -650,7 +650,7 @@ bool DexFileMethodInliner::GenInlineIGet(MIRGraph* mir_graph, BasicBlock* bb, MI DCHECK_EQ(data.field_offset, mir_graph->GetIFieldLoweringInfo(insn).FieldOffset().Uint32Value()); DCHECK_EQ(data.is_volatile, mir_graph->GetIFieldLoweringInfo(insn).IsVolatile() ? 1u : 0u); - mir_graph->InsertMIRAfter(bb, move_result, insn); + bb->InsertMIRAfter(move_result, insn); return true; } @@ -688,7 +688,7 @@ bool DexFileMethodInliner::GenInlineIPut(MIRGraph* mir_graph, BasicBlock* bb, MI DCHECK_EQ(data.field_offset, mir_graph->GetIFieldLoweringInfo(insn).FieldOffset().Uint32Value()); DCHECK_EQ(data.is_volatile, mir_graph->GetIFieldLoweringInfo(insn).IsVolatile() ? 1u : 0u); - mir_graph->InsertMIRAfter(bb, invoke, insn); + bb->InsertMIRAfter(invoke, insn); return true; } diff --git a/compiler/dex/quick/mir_to_lir.cc b/compiler/dex/quick/mir_to_lir.cc index 39994e9..82664e2 100644 --- a/compiler/dex/quick/mir_to_lir.cc +++ b/compiler/dex/quick/mir_to_lir.cc @@ -212,7 +212,7 @@ bool Mir2Lir::GenSpecialCase(BasicBlock* bb, MIR* mir, const InlineMethod& speci RegLocation rl_dest = GetReturn(cu_->shorty[0] == 'F'); GenPrintLabel(mir); LoadConstant(rl_dest.reg.GetReg(), static_cast<int>(special.d.data)); - return_mir = mir_graph_->GetNextUnconditionalMir(bb, mir); + return_mir = bb->GetNextUnconditionalMir(mir_graph_, mir); break; } case kInlineOpReturnArg: @@ -221,11 +221,11 @@ bool Mir2Lir::GenSpecialCase(BasicBlock* bb, MIR* mir, const InlineMethod& speci break; case kInlineOpIGet: successful = GenSpecialIGet(mir, special); - return_mir = mir_graph_->GetNextUnconditionalMir(bb, mir); + return_mir = bb->GetNextUnconditionalMir(mir_graph_, mir); break; case kInlineOpIPut: successful = GenSpecialIPut(mir, special); - return_mir = mir_graph_->GetNextUnconditionalMir(bb, mir); + return_mir = bb->GetNextUnconditionalMir(mir_graph_, mir); break; default: break; diff --git a/compiler/dex/ssa_transformation.cc b/compiler/dex/ssa_transformation.cc index d70e3f5..dab98d9 100644 --- a/compiler/dex/ssa_transformation.cc +++ b/compiler/dex/ssa_transformation.cc @@ -563,7 +563,7 @@ void MIRGraph::InsertPhiNodes() { phi->dalvikInsn.vA = dalvik_reg; phi->offset = phi_bb->start_offset; phi->m_unit_index = 0; // Arbitrarily assign all Phi nodes to outermost method. - PrependMIR(phi_bb, phi); + phi_bb->PrependMIR(phi); } } } |