MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / PopulateLoopDesc

Method PopulateLoopDesc

source/opt/loop_utils.cpp:684–714  ·  view source on GitHub ↗

Populates |new_loop| descriptor according to |old_loop|'s one.

Source from the content-addressed store, hash-verified

682
683// Populates |new_loop| descriptor according to |old_loop|'s one.
684void 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.
717void CodeMetrics::Analyze(const Loop& loop) {

Callers

nothing calls this directly

Calls 13

SetHeaderBlockMethod · 0.80
GetLatchBlockMethod · 0.80
SetLatchBlockMethod · 0.80
GetContinueBlockMethod · 0.80
SetContinueBlockMethod · 0.80
GetMergeBlockMethod · 0.80
SetMergeBlockMethod · 0.80
GetPreHeaderBlockMethod · 0.80
SetPreHeaderBlockMethod · 0.80
AddBasicBlockMethod · 0.45
idMethod · 0.45
GetHeaderBlockMethod · 0.45

Tested by

no test coverage detected