Lines Matching refs:loop

5 #include "src/compiler/loop-analysis.h"
24 NodeInfo* next; // link in chaining loop members
28 // Temporary loop info needed during traversal and building the loop tree.
34 LoopTree::Loop* loop;
38 // Encapsulation of the loop finding algorithm.
40 // Conceptually, the contents of a loop are those nodes that are "between" the
41 // loop header and the backedges of the loop. Graphs in the soup of nodes can
42 // form improper cycles, so standard loop finding algorithms that work on CFGs
45 // phis are treated together as a set referred to here as the loop header.
46 // This loop finding algorithm works by traversing the graph in two directions,
48 // direction, from nodes to their uses, starting at loop headers.
49 // 1 bit per loop per node per direction are required during the marking phase.
51 // marks on edges into/out-of the loop header nodes.
101 for (LoopTree::Loop* loop : loop_tree_->outer_loops_) {
102 PrintLoop(loop);
179 // Propagate marks backward from loop headers.
192 // Setup loop headers first.
194 // found the loop node first.
218 // Only propagate the loop mark on backedges.
228 // Make a new loop if necessary for the given node.
237 // Create a new loop.
258 // Do not keep the loop alive if it does not have any backedges.
353 void AddNodeToLoop(NodeInfo* node_info, LoopInfo* loop, int loop_num) {
356 node_info->next = loop->header_list;
357 loop->header_list = node_info;
360 node_info->next = loop->exit_list;
361 loop->exit_list = node_info;
364 node_info->next = loop->body_list;
365 loop->body_list = node_info;
380 // Place the node into the innermost nested loop of which it is a member.
394 LoopInfo* loop = &loops_[loop_num - 1];
396 loop->loop->depth_ > innermost->loop->depth_) {
397 innermost = loop;
408 // Serialize the node lists for loops into the loop tree.
410 for (LoopTree::Loop* loop : loop_tree_->outer_loops_) {
411 SerializeLoop(loop);
415 // Handle the simpler case of a single loop (no checks for nesting necessary).
417 // Place nodes into the loop header and body.
419 li->loop = &loop_tree_->all_loops_[0];
420 loop_tree_->SetParent(nullptr, li->loop);
428 // Serialize the node lists for the loop into the loop tree.
430 SerializeLoop(li->loop);
435 void SerializeLoop(LoopTree::Loop* loop) {
436 int loop_num = loop_tree_->LoopNum(loop);
440 loop->header_start_ = static_cast<int>(loop_tree_->loop_nodes_.size());
447 loop->body_start_ = static_cast<int>(loop_tree_->loop_nodes_.size());
454 for (LoopTree::Loop* child : loop->children_) SerializeLoop(child);
457 loop->exits_start_ = static_cast<int>(loop_tree_->loop_nodes_.size());
463 loop->exits_end_ = static_cast<int>(loop_tree_->loop_nodes_.size());
469 if (li.loop != nullptr) return li.loop;
483 li.loop = &loop_tree_->all_loops_[loop_num - 1];
484 loop_tree_->SetParent(parent, li.loop);
485 return li.loop;
488 void PrintLoop(LoopTree::Loop* loop) {
489 for (int i = 0; i < loop->depth_; i++) PrintF(" ");
490 PrintF("Loop depth = %d ", loop->depth_);
491 int i = loop->header_start_;
492 while (i < loop->body_start_) {
495 while (i < loop->exits_start_) {
498 while (i < loop->exits_end_) {
502 for (LoopTree::Loop* child : loop->children_) PrintLoop(child);
519 Node* LoopTree::HeaderNode(Loop* loop) {
520 Node* first = *HeaderNodes(loop).begin();