Populates |new_loop| descriptor according to |old_loop|'s one.
| 682 | |
| 683 | // Populates |new_loop| descriptor according to |old_loop|'s one. |
| 684 | void LoopUtils::PopulateLoopDesc( |
| 685 | Loop* new_loop, Loop* old_loop, |
| 686 | const LoopCloningResult& cloning_result) const { |
| 687 | for (uint32_t bb_id : old_loop->GetBlocks()) { |
| 688 | BasicBlock* bb = cloning_result.old_to_new_bb_.at(bb_id); |
| 689 | new_loop->AddBasicBlock(bb); |
| 690 | } |
| 691 | new_loop->SetHeaderBlock( |
| 692 | cloning_result.old_to_new_bb_.at(old_loop->GetHeaderBlock()->id())); |
| 693 | if (old_loop->GetLatchBlock()) |
| 694 | new_loop->SetLatchBlock( |
| 695 | cloning_result.old_to_new_bb_.at(old_loop->GetLatchBlock()->id())); |
| 696 | if (old_loop->GetContinueBlock()) |
| 697 | new_loop->SetContinueBlock( |
| 698 | cloning_result.old_to_new_bb_.at(old_loop->GetContinueBlock()->id())); |
| 699 | if (old_loop->GetMergeBlock()) { |
| 700 | auto it = |
| 701 | cloning_result.old_to_new_bb_.find(old_loop->GetMergeBlock()->id()); |
| 702 | BasicBlock* bb = it != cloning_result.old_to_new_bb_.end() |
| 703 | ? it->second |
| 704 | : old_loop->GetMergeBlock(); |
| 705 | new_loop->SetMergeBlock(bb); |
| 706 | } |
| 707 | if (old_loop->GetPreHeaderBlock()) { |
| 708 | auto it = |
| 709 | cloning_result.old_to_new_bb_.find(old_loop->GetPreHeaderBlock()->id()); |
| 710 | if (it != cloning_result.old_to_new_bb_.end()) { |
| 711 | new_loop->SetPreHeaderBlock(it->second); |
| 712 | } |
| 713 | } |
| 714 | } |
| 715 | |
| 716 | // Class to gather some metrics about a region of interest. |
| 717 | void CodeMetrics::Analyze(const Loop& loop) { |
nothing calls this directly
no test coverage detected