Lines Matching refs:bb
28 static unsigned int Predecessors(BasicBlock* bb) { in Predecessors() argument
29 return bb->predecessors->Size(); in Predecessors()
45 void MIRGraph::DoConstantPropagation(BasicBlock* bb) { in DoConstantPropagation() argument
48 for (mir = bb->first_mir_insn; mir != NULL; mir = mir->next) { in DoConstantPropagation()
108 BasicBlock* bb = *p_bb; in AdvanceMIR() local
112 bb = GetBasicBlock(bb->fall_through); in AdvanceMIR()
113 if ((bb == NULL) || Predecessors(bb) != 1) { in AdvanceMIR()
116 *p_bb = bb; in AdvanceMIR()
117 mir = bb->first_mir_insn; in AdvanceMIR()
131 MIR* MIRGraph::FindMoveResult(BasicBlock* bb, MIR* mir) { in FindMoveResult() argument
132 BasicBlock* tbb = bb; in FindMoveResult()
150 BasicBlock* MIRGraph::NextDominatedBlock(BasicBlock* bb) { in NextDominatedBlock() argument
151 if (bb->block_type == kDead) { in NextDominatedBlock()
154 DCHECK((bb->block_type == kEntryBlock) || (bb->block_type == kDalvikByteCode) in NextDominatedBlock()
155 || (bb->block_type == kExitBlock)); in NextDominatedBlock()
156 BasicBlock* bb_taken = GetBasicBlock(bb->taken); in NextDominatedBlock()
157 BasicBlock* bb_fall_through = GetBasicBlock(bb->fall_through); in NextDominatedBlock()
161 bb = bb_taken; in NextDominatedBlock()
164 bb = (bb_taken != NULL) ? NULL : bb_fall_through; in NextDominatedBlock()
166 if (bb == NULL || (Predecessors(bb) != 1)) { in NextDominatedBlock()
169 DCHECK((bb->block_type == kDalvikByteCode) || (bb->block_type == kExitBlock)); in NextDominatedBlock()
170 return bb; in NextDominatedBlock()
173 static MIR* FindPhi(BasicBlock* bb, int ssa_name) { in FindPhi() argument
174 for (MIR* mir = bb->first_mir_insn; mir != NULL; mir = mir->next) { in FindPhi()
320 bool MIRGraph::BasicBlockOpt(BasicBlock* bb) { in BasicBlockOpt() argument
321 if (bb->block_type == kDead) { in BasicBlockOpt()
325 bool use_lvn = bb->use_lvn && (cu_->disable_opt & (1u << kGlobalValueNumbering)) != 0u; in BasicBlockOpt()
332 local_valnum.reset(new (allocator.get()) LocalValueNumbering(global_valnum.get(), bb->id, in BasicBlockOpt()
335 while (bb != NULL) { in BasicBlockOpt()
336 for (MIR* mir = bb->first_mir_insn; mir != NULL; mir = mir->next) { in BasicBlockOpt()
413 if ((IsBackedge(bb, bb->taken) && GetBasicBlock(bb->taken)->dominates_return) || in BasicBlockOpt()
414 (IsBackedge(bb, bb->fall_through) && in BasicBlockOpt()
415 GetBasicBlock(bb->fall_through)->dominates_return)) { in BasicBlockOpt()
433 BasicBlock* ft = GetBasicBlock(bb->fall_through); in BasicBlockOpt()
438 BasicBlock* tk = GetBasicBlock(bb->taken); in BasicBlockOpt()
544 incoming[i] = bb->id; in BasicBlockOpt()
556 bb->taken = NullBasicBlockId; in BasicBlockOpt()
566 bb = ((cu_->disable_opt & (1 << kSuppressExceptionEdges)) != 0) ? NextDominatedBlock(bb) : NULL; in BasicBlockOpt()
576 void MIRGraph::CountChecks(struct BasicBlock* bb) { in CountChecks() argument
577 if (bb->data_flow_info != NULL) { in CountChecks()
578 for (MIR* mir = bb->first_mir_insn; mir != NULL; mir = mir->next) { in CountChecks()
600 bool MIRGraph::LayoutBlocks(BasicBlock* bb) { in LayoutBlocks() argument
602 if (!bb->explicit_throw) { in LayoutBlocks()
607 if (bb->visited) { in LayoutBlocks()
610 bb->visited = true; in LayoutBlocks()
612 BasicBlock* walker = bb; in LayoutBlocks()
661 void MIRGraph::CombineBlocks(struct BasicBlock* bb) { in CombineBlocks() argument
665 if ((bb->first_mir_insn == NULL) in CombineBlocks()
666 || (bb->data_flow_info == NULL) in CombineBlocks()
667 || (bb->block_type == kExceptionHandling) in CombineBlocks()
668 || (bb->block_type == kExitBlock) in CombineBlocks()
669 || (bb->block_type == kDead) in CombineBlocks()
670 || (bb->taken == NullBasicBlockId) in CombineBlocks()
671 || (GetBasicBlock(bb->taken)->block_type != kExceptionHandling) in CombineBlocks()
672 || (bb->successor_block_list_type != kNotUsed) in CombineBlocks()
673 || (static_cast<int>(bb->last_mir_insn->dalvikInsn.opcode) != kMirOpCheck)) { in CombineBlocks()
678 MIR* mir = bb->last_mir_insn; in CombineBlocks()
693 BasicBlock* bb_next = GetBasicBlock(bb->fall_through); in CombineBlocks()
698 *bb->last_mir_insn = *throw_insn; in CombineBlocks()
700 bb->successor_block_list_type = bb_next->successor_block_list_type; in CombineBlocks()
701 bb->successor_blocks = bb_next->successor_blocks; in CombineBlocks()
703 bb->fall_through = bb_next->fall_through; in CombineBlocks()
704 GetBasicBlock(bb->taken)->block_type = kDead; // Kill the unused exception block in CombineBlocks()
705 bb->taken = bb_next->taken; in CombineBlocks()
707 bb->last_mir_insn = bb_next->last_mir_insn; in CombineBlocks()
712 bb->terminated_by_return = bb_next->terminated_by_return; in CombineBlocks()
721 block_id_map_.Overwrite(bb_next->id, bb->id); in CombineBlocks()
731 for (BasicBlock* bb = iter.Next(); bb != nullptr; bb = iter.Next()) { in EliminateNullChecksAndInferTypesStart() local
732 CHECK(bb->data_flow_info == nullptr || bb->data_flow_info->ending_check_v == nullptr); in EliminateNullChecksAndInferTypesStart()
748 bool MIRGraph::EliminateNullChecksAndInferTypes(BasicBlock* bb) { in EliminateNullChecksAndInferTypes() argument
749 if (bb->data_flow_info == NULL) return false; in EliminateNullChecksAndInferTypes()
758 if (bb->block_type == kEntryBlock) { in EliminateNullChecksAndInferTypes()
770 } else if (bb->predecessors->Size() == 1) { in EliminateNullChecksAndInferTypes()
771 BasicBlock* pred_bb = GetBasicBlock(bb->predecessors->Get(0)); in EliminateNullChecksAndInferTypes()
781 if (pred_bb->fall_through == bb->id) { in EliminateNullChecksAndInferTypes()
787 if (pred_bb->taken == bb->id) { in EliminateNullChecksAndInferTypes()
797 GrowableArray<BasicBlockId>::Iterator iter(bb->predecessors); in EliminateNullChecksAndInferTypes()
822 for (MIR* mir = bb->first_mir_insn; mir != NULL; mir = mir->next) { in EliminateNullChecksAndInferTypes()
828 infer_changed = InferTypeAndSize(bb, mir, infer_changed); in EliminateNullChecksAndInferTypes()
889 } else if (bb->fall_through != NullBasicBlockId) { in EliminateNullChecksAndInferTypes()
891 struct BasicBlock* next_bb = GetBasicBlock(bb->fall_through); in EliminateNullChecksAndInferTypes()
934 if (bb->data_flow_info->ending_check_v == nullptr) { in EliminateNullChecksAndInferTypes()
936 bb->data_flow_info->ending_check_v = new (temp_scoped_alloc_.get()) ArenaBitVector( in EliminateNullChecksAndInferTypes()
939 bb->data_flow_info->ending_check_v->Copy(ssa_regs_to_check); in EliminateNullChecksAndInferTypes()
940 } else if (!ssa_regs_to_check->SameBitsSet(bb->data_flow_info->ending_check_v)) { in EliminateNullChecksAndInferTypes()
942 bb->data_flow_info->ending_check_v->Copy(ssa_regs_to_check); in EliminateNullChecksAndInferTypes()
954 for (BasicBlock* bb = iter.Next(); bb != nullptr; bb = iter.Next()) { in EliminateNullChecksAndInferTypesEnd() local
955 if (bb->data_flow_info != nullptr) { in EliminateNullChecksAndInferTypesEnd()
956 bb->data_flow_info->ending_check_v = nullptr; in EliminateNullChecksAndInferTypesEnd()
972 for (BasicBlock* bb = iter.Next(); bb != nullptr; bb = iter.Next()) { in EliminateClassInitChecksGate() local
973 CHECK(bb->data_flow_info == nullptr || bb->data_flow_info->ending_check_v == nullptr); in EliminateClassInitChecksGate()
1013 for (BasicBlock* bb = iter.Next(); bb != nullptr; bb = iter.Next()) { in EliminateClassInitChecksGate() local
1014 for (MIR* mir = bb->first_mir_insn; mir != nullptr; mir = mir->next) { in EliminateClassInitChecksGate()
1015 DCHECK(bb->data_flow_info != nullptr); in EliminateClassInitChecksGate()
1057 bool MIRGraph::EliminateClassInitChecks(BasicBlock* bb) { in EliminateClassInitChecks() argument
1059 if (bb->data_flow_info == NULL) { in EliminateClassInitChecks()
1068 if (bb->block_type == kEntryBlock) { in EliminateClassInitChecks()
1070 } else if (bb->predecessors->Size() == 1) { in EliminateClassInitChecks()
1071 BasicBlock* pred_bb = GetBasicBlock(bb->predecessors->Get(0)); in EliminateClassInitChecks()
1079 GrowableArray<BasicBlockId>::Iterator iter(bb->predecessors); in EliminateClassInitChecks()
1103 for (MIR* mir = bb->first_mir_insn; mir != nullptr; mir = mir->next) { in EliminateClassInitChecks()
1126 if (bb->data_flow_info->ending_check_v == nullptr) { in EliminateClassInitChecks()
1128 DCHECK(bb->data_flow_info != nullptr); in EliminateClassInitChecks()
1129 bb->data_flow_info->ending_check_v = new (temp_scoped_alloc_.get()) ArenaBitVector( in EliminateClassInitChecks()
1132 bb->data_flow_info->ending_check_v->Copy(classes_to_check); in EliminateClassInitChecks()
1133 } else if (!classes_to_check->Equal(bb->data_flow_info->ending_check_v)) { in EliminateClassInitChecks()
1135 bb->data_flow_info->ending_check_v->Copy(classes_to_check); in EliminateClassInitChecks()
1145 for (BasicBlock* bb = iter.Next(); bb != nullptr; bb = iter.Next()) { in EliminateClassInitChecksEnd() local
1146 if (bb->data_flow_info != nullptr) { in EliminateClassInitChecksEnd()
1147 bb->data_flow_info->ending_check_v = nullptr; in EliminateClassInitChecksEnd()
1170 bool MIRGraph::ApplyGlobalValueNumbering(BasicBlock* bb) { in ApplyGlobalValueNumbering() argument
1172 LocalValueNumbering* lvn = temp_gvn_->PrepareBasicBlock(bb); in ApplyGlobalValueNumbering()
1174 for (MIR* mir = bb->first_mir_insn; mir != nullptr; mir = mir->next) { in ApplyGlobalValueNumbering()
1178 bool change = (lvn != nullptr) && temp_gvn_->FinishBasicBlock(bb); in ApplyGlobalValueNumbering()
1187 for (BasicBlock* bb = iter.Next(); bb != nullptr; bb = iter.Next()) { in ApplyGlobalValueNumberingEnd() local
1189 LocalValueNumbering* lvn = temp_gvn_->PrepareBasicBlock(bb, &allocator); in ApplyGlobalValueNumberingEnd()
1191 for (MIR* mir = bb->first_mir_insn; mir != nullptr; mir = mir->next) { in ApplyGlobalValueNumberingEnd()
1194 bool change = temp_gvn_->FinishBasicBlock(bb); in ApplyGlobalValueNumberingEnd()
1259 void MIRGraph::InlineSpecialMethods(BasicBlock* bb) { in InlineSpecialMethods() argument
1260 if (bb->block_type != kDalvikByteCode) { in InlineSpecialMethods()
1263 for (MIR* mir = bb->first_mir_insn; mir != NULL; mir = mir->next) { in InlineSpecialMethods()
1282 ->GenInline(this, bb, mir, target.dex_method_index)) { in InlineSpecialMethods()
1307 for (BasicBlock* bb = iter.Next(); bb != NULL; bb = iter.Next()) { in DumpCheckStats() local
1308 CountChecks(bb); in DumpCheckStats()
1326 bool MIRGraph::BuildExtendedBBList(struct BasicBlock* bb) { in BuildExtendedBBList() argument
1327 if (bb->visited) return false; in BuildExtendedBBList()
1328 if (!((bb->block_type == kEntryBlock) || (bb->block_type == kDalvikByteCode) in BuildExtendedBBList()
1329 || (bb->block_type == kExitBlock))) { in BuildExtendedBBList()
1331 bb->visited = true; in BuildExtendedBBList()
1335 BasicBlock* start_bb = bb; in BuildExtendedBBList()
1336 extended_basic_blocks_.push_back(bb->id); in BuildExtendedBBList()
1340 while (bb != NULL) { in BuildExtendedBBList()
1341 bb->visited = true; in BuildExtendedBBList()
1342 terminated_by_return |= bb->terminated_by_return; in BuildExtendedBBList()
1343 do_local_value_numbering |= bb->use_lvn; in BuildExtendedBBList()
1344 bb = NextDominatedBlock(bb); in BuildExtendedBBList()
1348 bb = start_bb; in BuildExtendedBBList()
1349 while (bb != NULL) { in BuildExtendedBBList()
1350 bb->use_lvn = do_local_value_numbering; in BuildExtendedBBList()
1351 bb->dominates_return = terminated_by_return; in BuildExtendedBBList()
1352 bb = NextDominatedBlock(bb); in BuildExtendedBBList()
1362 for (BasicBlock* bb = iter2.Next(); bb != NULL; bb = iter2.Next()) { in BasicBlockOptimization() local
1363 BuildExtendedBBList(bb); in BasicBlockOptimization()
1371 for (BasicBlock* bb = iter.Next(); bb != NULL; bb = iter.Next()) { in BasicBlockOptimization() local
1372 BasicBlockOpt(bb); in BasicBlockOptimization()