Adds a new loop nest to the descriptor set.
| 985 | |
| 986 | // Adds a new loop nest to the descriptor set. |
| 987 | Loop* LoopDescriptor::AddLoopNest(std::unique_ptr<Loop> new_loop) { |
| 988 | Loop* loop = new_loop.release(); |
| 989 | if (!loop->HasParent()) placeholder_top_loop_.nested_loops_.push_back(loop); |
| 990 | // Iterate from inner to outer most loop, adding basic block to loop mapping |
| 991 | // as we go. |
| 992 | for (Loop& current_loop : |
| 993 | make_range(iterator::begin(loop), iterator::end(nullptr))) { |
| 994 | loops_.push_back(¤t_loop); |
| 995 | for (uint32_t bb_id : current_loop.GetBlocks()) |
| 996 | basic_block_to_loop_.insert(std::make_pair(bb_id, ¤t_loop)); |
| 997 | } |
| 998 | |
| 999 | return loop; |
| 1000 | } |
| 1001 | |
| 1002 | void LoopDescriptor::RemoveLoop(Loop* loop) { |
| 1003 | Loop* parent = loop->GetParent() ? loop->GetParent() : &placeholder_top_loop_; |
no test coverage detected