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

Method PopulateLoopNest

source/opt/loop_utils.cpp:663–681  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

661}
662
663void LoopUtils::PopulateLoopNest(
664 Loop* new_loop, const LoopCloningResult& cloning_result) const {
665 std::unordered_map<Loop*, Loop*> loop_mapping;
666 loop_mapping[loop_] = new_loop;
667
668 if (loop_->HasParent()) loop_->GetParent()->AddNestedLoop(new_loop);
669 PopulateLoopDesc(new_loop, loop_, cloning_result);
670
671 for (Loop& sub_loop :
672 make_range(++TreeDFIterator<Loop>(loop_), TreeDFIterator<Loop>())) {
673 Loop* cloned = new Loop(context_);
674 if (Loop* parent = loop_mapping[sub_loop.GetParent()])
675 parent->AddNestedLoop(cloned);
676 loop_mapping[&sub_loop] = cloned;
677 PopulateLoopDesc(cloned, &sub_loop, cloning_result);
678 }
679
680 loop_desc_->AddLoopNest(std::unique_ptr<Loop>(new_loop));
681}
682
683// Populates |new_loop| descriptor according to |old_loop|'s one.
684void LoopUtils::PopulateLoopDesc(

Callers

nothing calls this directly

Calls 5

make_rangeFunction · 0.85
HasParentMethod · 0.80
AddNestedLoopMethod · 0.80
AddLoopNestMethod · 0.80
GetParentMethod · 0.45

Tested by

no test coverage detected