Lines Matching refs:block

50 void HGraph::AddBlock(HBasicBlock* block) {  in AddBlock()  argument
51 block->SetBlockId(blocks_.size()); in AddBlock()
52 blocks_.push_back(block); in AddBlock()
148 HBasicBlock* block = blocks_[i]; in RemoveInstructionsAsUsersFromDeadBlocks() local
149 if (block == nullptr) continue; in RemoveInstructionsAsUsersFromDeadBlocks()
150 for (HInstructionIterator it(block->GetPhis()); !it.Done(); it.Advance()) { in RemoveInstructionsAsUsersFromDeadBlocks()
153 for (HInstructionIterator it(block->GetInstructions()); !it.Done(); it.Advance()) { in RemoveInstructionsAsUsersFromDeadBlocks()
163 HBasicBlock* block = blocks_[i]; in RemoveDeadBlocks() local
164 if (block == nullptr) continue; in RemoveDeadBlocks()
166 for (HBasicBlock* successor : block->GetSuccessors()) { in RemoveDeadBlocks()
167 successor->RemovePredecessor(block); in RemoveDeadBlocks()
172 if (block->IsExitBlock()) { in RemoveDeadBlocks()
177 block->SetGraph(nullptr); in RemoveDeadBlocks()
225 for (HBasicBlock* block : GetReversePostOrder()) { in ClearDominanceInformation()
226 block->ClearDominanceInformation(); in ClearDominanceInformation()
233 for (HBasicBlock* block : GetReversePostOrder()) { in ClearLoopInformation()
234 block->SetLoopInformation(nullptr); in ClearLoopInformation()
251 static bool UpdateDominatorOfSuccessor(HBasicBlock* block, HBasicBlock* successor) { in UpdateDominatorOfSuccessor() argument
252 DCHECK(ContainsElement(block->GetSuccessors(), successor)); in UpdateDominatorOfSuccessor()
256 (old_dominator == nullptr) ? block in UpdateDominatorOfSuccessor()
257 : CommonDominator::ForPair(old_dominator, block); in UpdateDominatorOfSuccessor()
311 for (HBasicBlock* block : blocks_) { in ComputeDominanceInformation()
312 if (block != nullptr && in ComputeDominanceInformation()
313 block->IsLoopHeader() && in ComputeDominanceInformation()
314 block->GetLoopInformation()->HasBackEdgeNotDominatedByHeader()) { in ComputeDominanceInformation()
323 for (HBasicBlock* block : GetReversePostOrder()) { in ComputeDominanceInformation()
324 for (HBasicBlock* successor : block->GetSuccessors()) { in ComputeDominanceInformation()
325 update_occurred |= UpdateDominatorOfSuccessor(block, successor); in ComputeDominanceInformation()
334 for (HBasicBlock* block : GetReversePostOrder()) { in ComputeDominanceInformation()
335 for (HBasicBlock* successor : block->GetSuccessors()) { in ComputeDominanceInformation()
336 DCHECK(!UpdateDominatorOfSuccessor(block, successor)); in ComputeDominanceInformation()
343 for (HBasicBlock* block : GetReversePostOrder()) { in ComputeDominanceInformation()
344 if (!block->IsEntryBlock()) { in ComputeDominanceInformation()
345 block->GetDominator()->AddDominatedBlock(block); in ComputeDominanceInformation()
350 HBasicBlock* HGraph::SplitEdge(HBasicBlock* block, HBasicBlock* successor) { in SplitEdge() argument
355 new_block->InsertBetween(block, successor); in SplitEdge()
359 void HGraph::SplitCriticalEdge(HBasicBlock* block, HBasicBlock* successor) { in SplitCriticalEdge() argument
362 HBasicBlock* new_block = SplitEdge(block, successor); in SplitCriticalEdge()
367 if (info->IsBackEdge(*block)) { in SplitCriticalEdge()
368 info->RemoveBackEdge(block); in SplitCriticalEdge()
375 static void FixPhisAfterPredecessorsReodering(HBasicBlock* block, size_t first, size_t second) { in FixPhisAfterPredecessorsReodering() argument
376 for (HInstructionIterator it(block->GetPhis()); !it.Done(); it.Advance()) { in FixPhisAfterPredecessorsReodering()
538 for (HBasicBlock* block : GetReversePostOrder()) { in ComputeTryBlockInformation()
539 if (block->IsEntryBlock() || block->IsCatchBlock()) { in ComputeTryBlockInformation()
548 HBasicBlock* first_predecessor = block->GetPredecessors()[0]; in ComputeTryBlockInformation()
549 DCHECK(!block->IsLoopHeader() || !block->GetLoopInformation()->IsBackEdge(*first_predecessor)); in ComputeTryBlockInformation()
552 (block->GetTryCatchInformation() == nullptr || in ComputeTryBlockInformation()
553 try_entry != &block->GetTryCatchInformation()->GetTryEntry())) { in ComputeTryBlockInformation()
556 block->SetTryCatchInformation(new (allocator_) TryCatchInformation(*try_entry)); in ComputeTryBlockInformation()
568 HBasicBlock* block = blocks_[block_id]; in SimplifyCFG() local
569 if (block == nullptr) continue; in SimplifyCFG()
570 if (block->GetSuccessors().size() > 1) { in SimplifyCFG()
574 ArrayRef<HBasicBlock* const> normal_successors = block->GetNormalSuccessors(); in SimplifyCFG()
581 DCHECK(block->IsSingleTryBoundary()); in SimplifyCFG()
583 SplitCriticalEdge(block, successor); in SimplifyCFG()
586 normal_successors = block->GetNormalSuccessors(); in SimplifyCFG()
592 if (block->IsLoopHeader()) { in SimplifyCFG()
593 SimplifyLoop(block); in SimplifyCFG()
594 } else if (!block->IsEntryBlock() && in SimplifyCFG()
595 block->GetFirstInstruction() != nullptr && in SimplifyCFG()
596 block->GetFirstInstruction()->IsSuspendCheck()) { in SimplifyCFG()
599 block->RemoveInstruction(block->GetFirstInstruction()); in SimplifyCFG()
608 for (HBasicBlock* block : GetPostOrder()) { in AnalyzeLoops()
609 if (block->IsLoopHeader()) { in AnalyzeLoops()
610 if (block->IsCatchBlock()) { in AnalyzeLoops()
616 block->GetLoopInformation()->Populate(); in AnalyzeLoops()
625 for (HBasicBlock* block : back_edges_) { in Dump()
626 os << "back edge: " << block->GetBlockId() << std::endl; in Dump()
628 for (HBasicBlock* block : header_->GetPredecessors()) { in Dump()
629 os << "predecessor: " << block->GetBlockId() << std::endl; in Dump()
736 void HLoopInformation::Add(HBasicBlock* block) { in Add() argument
737 blocks_.SetBit(block->GetBlockId()); in Add()
740 void HLoopInformation::Remove(HBasicBlock* block) { in Remove() argument
741 blocks_.ClearBit(block->GetBlockId()); in Remove()
744 void HLoopInformation::PopulateRecursive(HBasicBlock* block) { in PopulateRecursive() argument
745 if (blocks_.IsBitSet(block->GetBlockId())) { in PopulateRecursive()
749 blocks_.SetBit(block->GetBlockId()); in PopulateRecursive()
750 block->SetInLoop(this); in PopulateRecursive()
751 if (block->IsLoopHeader()) { in PopulateRecursive()
754 DCHECK(block->GetLoopInformation()->IsPopulated()); in PopulateRecursive()
755 if (block->GetLoopInformation()->IsIrreducible()) { in PopulateRecursive()
759 for (HBasicBlock* predecessor : block->GetPredecessors()) { in PopulateRecursive()
764 void HLoopInformation::PopulateIrreducibleRecursive(HBasicBlock* block, ArenaBitVector* finalized) { in PopulateIrreducibleRecursive() argument
765 size_t block_id = block->GetBlockId(); in PopulateIrreducibleRecursive()
774 if (block->IsLoopHeader()) { in PopulateIrreducibleRecursive()
780 HBasicBlock* pre_header = block->GetPredecessors()[0]; in PopulateIrreducibleRecursive()
783 block->SetInLoop(this); in PopulateIrreducibleRecursive()
788 HLoopInformation* info = block->GetLoopInformation(); in PopulateIrreducibleRecursive()
796 for (HBasicBlock* predecessor : block->GetPredecessors()) { in PopulateIrreducibleRecursive()
799 block->SetInLoop(this); in PopulateIrreducibleRecursive()
881 HBasicBlock* block = header_->GetPredecessors()[0]; in GetPreHeader() local
882 DCHECK(irreducible_ || (block == header_->GetDominator())); in GetPreHeader()
883 return block; in GetPreHeader()
886 bool HLoopInformation::Contains(const HBasicBlock& block) const { in Contains()
887 return blocks_.IsBitSet(block.GetBlockId()); in Contains()
916 bool HLoopInformation::DominatesAllBackEdges(HBasicBlock* block) { in DominatesAllBackEdges() argument
918 if (!block->Dominates(back_edge)) { in DominatesAllBackEdges()
992 HBasicBlock* block, in Add() argument
996 instruction->SetBlock(block); in Add()
997 instruction->SetId(block->GetGraph()->GetNextInstructionId()); in Add()
1048 HBasicBlock* block, in Remove() argument
1051 DCHECK_EQ(block, instruction->GetBlock()); in Remove()
1244 HBasicBlock* block = GetBlock(); in StrictlyDominates() local
1246 if (block != other_block) { in StrictlyDominates()
1270 return block->GetInstructions().FoundBefore(this, other_instruction); in StrictlyDominates()
1527 for (HBasicBlock* block : blocks) { in FOR_EACH_CONCRETE_INSTRUCTION()
1528 if (block != nullptr) { in FOR_EACH_CONCRETE_INSTRUCTION()
1529 VisitBasicBlock(block); in FOR_EACH_CONCRETE_INSTRUCTION()
1535 for (HBasicBlock* block : graph_->GetReversePostOrder()) { in VisitReversePostOrder()
1536 VisitBasicBlock(block); in VisitReversePostOrder()
1540 void HGraphVisitor::VisitBasicBlock(HBasicBlock* block) { in VisitBasicBlock() argument
1541 for (HInstructionIterator it(block->GetPhis()); !it.Done(); it.Advance()) { in VisitBasicBlock()
1544 for (HInstructionIterator it(block->GetInstructions()); !it.Done(); it.Advance()) { in VisitBasicBlock()
1969 static bool HasOnlyOneInstruction(const HBasicBlock& block) { in HasOnlyOneInstruction() argument
1970 return block.GetPhis().IsEmpty() in HasOnlyOneInstruction()
1971 && !block.GetInstructions().IsEmpty() in HasOnlyOneInstruction()
1972 && block.GetFirstInstruction() == block.GetLastInstruction(); in HasOnlyOneInstruction()
2060 void HInstructionList::SetBlockOfInstructions(HBasicBlock* block) const { in SetBlockOfInstructions()
2064 current->SetBlock(block); in SetBlockOfInstructions()
2369 void HGraph::DeleteDeadEmptyBlock(HBasicBlock* block) { in DeleteDeadEmptyBlock() argument
2370 DCHECK_EQ(block->GetGraph(), this); in DeleteDeadEmptyBlock()
2371 DCHECK(block->GetSuccessors().empty()); in DeleteDeadEmptyBlock()
2372 DCHECK(block->GetPredecessors().empty()); in DeleteDeadEmptyBlock()
2373 DCHECK(block->GetDominatedBlocks().empty()); in DeleteDeadEmptyBlock()
2374 DCHECK(block->GetDominator() == nullptr); in DeleteDeadEmptyBlock()
2375 DCHECK(block->GetInstructions().IsEmpty()); in DeleteDeadEmptyBlock()
2376 DCHECK(block->GetPhis().IsEmpty()); in DeleteDeadEmptyBlock()
2378 if (block->IsExitBlock()) { in DeleteDeadEmptyBlock()
2382 RemoveElement(reverse_post_order_, block); in DeleteDeadEmptyBlock()
2383 blocks_[block->GetBlockId()] = nullptr; in DeleteDeadEmptyBlock()
2384 block->SetGraph(nullptr); in DeleteDeadEmptyBlock()
2387 void HGraph::UpdateLoopAndTryInformationOfNewBlock(HBasicBlock* block, in UpdateLoopAndTryInformationOfNewBlock() argument
2390 if (block->IsLoopHeader()) { in UpdateLoopAndTryInformationOfNewBlock()
2395 block->GetLoopInformation()->ClearAllBlocks(); in UpdateLoopAndTryInformationOfNewBlock()
2399 if (!block->IsInLoop()) { in UpdateLoopAndTryInformationOfNewBlock()
2400 block->SetLoopInformation(reference->GetLoopInformation()); in UpdateLoopAndTryInformationOfNewBlock()
2404 HLoopInformation* loop_info = block->GetLoopInformation(); in UpdateLoopAndTryInformationOfNewBlock()
2406 for (HLoopInformationOutwardIterator loop_it(*block); in UpdateLoopAndTryInformationOfNewBlock()
2409 loop_it.Current()->Add(block); in UpdateLoopAndTryInformationOfNewBlock()
2412 loop_info->ReplaceBackEdge(reference, block); in UpdateLoopAndTryInformationOfNewBlock()
2420 block->SetTryCatchInformation(try_catch_info); in UpdateLoopAndTryInformationOfNewBlock()
2429 for (HBasicBlock* block : GetReversePostOrderSkipEntryBlock()) { in InlineInto()
2430 for (HInstructionIterator instr_it(block->GetInstructions()); in InlineInto()
3066 HBasicBlock* block = instr->GetBlock(); in ReplaceInstrOrPhiByClone() local
3072 block->ReplaceAndRemovePhiWith(phi, phi_clone); in ReplaceInstrOrPhiByClone()
3074 block->ReplaceAndRemoveInstructionWith(instr, clone); in ReplaceInstrOrPhiByClone()
3077 HLoopInformation* loop_info = block->GetLoopInformation(); in ReplaceInstrOrPhiByClone()