Populates |new_loop| descriptor according to |old_loop|'s one.
| 638 | |
| 639 | // Populates |new_loop| descriptor according to |old_loop|'s one. |
| 640 | void LoopUtils::PopulateLoopDesc( |
| 641 | Loop* new_loop, Loop* old_loop, |
| 642 | const LoopCloningResult& cloning_result) const { |
| 643 | for (uint32_t bb_id : old_loop->GetBlocks()) { |
| 644 | BasicBlock* bb = cloning_result.old_to_new_bb_.at(bb_id); |
| 645 | new_loop->AddBasicBlock(bb); |
| 646 | } |
| 647 | new_loop->SetHeaderBlock( |
| 648 | cloning_result.old_to_new_bb_.at(old_loop->GetHeaderBlock()->id())); |
| 649 | if (old_loop->GetLatchBlock()) |
| 650 | new_loop->SetLatchBlock( |
| 651 | cloning_result.old_to_new_bb_.at(old_loop->GetLatchBlock()->id())); |
| 652 | if (old_loop->GetContinueBlock()) |
| 653 | new_loop->SetContinueBlock( |
| 654 | cloning_result.old_to_new_bb_.at(old_loop->GetContinueBlock()->id())); |
| 655 | if (old_loop->GetMergeBlock()) { |
| 656 | auto it = |
| 657 | cloning_result.old_to_new_bb_.find(old_loop->GetMergeBlock()->id()); |
| 658 | BasicBlock* bb = it != cloning_result.old_to_new_bb_.end() |
| 659 | ? it->second |
| 660 | : old_loop->GetMergeBlock(); |
| 661 | new_loop->SetMergeBlock(bb); |
| 662 | } |
| 663 | if (old_loop->GetPreHeaderBlock()) { |
| 664 | auto it = |
| 665 | cloning_result.old_to_new_bb_.find(old_loop->GetPreHeaderBlock()->id()); |
| 666 | if (it != cloning_result.old_to_new_bb_.end()) { |
| 667 | new_loop->SetPreHeaderBlock(it->second); |
| 668 | } |
| 669 | } |
| 670 | } |
| 671 | |
| 672 | // Class to gather some metrics about a region of interest. |
| 673 | void CodeMetrics::Analyze(const Loop& loop) { |
nothing calls this directly
no test coverage detected