Commit 3abd3239 by Michael Hayes Committed by Michael Hayes

flow.c (flow_loop_tree_node_add): Use better algorithm by passing previously…

flow.c (flow_loop_tree_node_add): Use better algorithm by passing previously inserted node instead of root node.

	* flow.c (flow_loop_tree_node_add): Use better algorithm by passing
 	previously inserted node instead of root node.	Caller changed.

From-SVN: r31948
parent f5b647ab
2000-02-12 Michael Hayes <m.hayes@elec.canterbury.ac.nz> 2000-02-13 Michael Hayes <m.hayes@elec.canterbury.ac.nz>
* flow.c (flow_loop_tree_node_add): Use better algorithm by passing
previously inserted node instead of root node. Caller changed.
2000-02-13 Michael Hayes <m.hayes@elec.canterbury.ac.nz>
* basic-block.h (FLOW_LOOP_FIRST_BLOCK, FLOW_LOOP_LAST_BLOCK): Delete. * basic-block.h (FLOW_LOOP_FIRST_BLOCK, FLOW_LOOP_LAST_BLOCK): Delete.
......
...@@ -6716,41 +6716,35 @@ flow_loop_pre_header_find (header, dom) ...@@ -6716,41 +6716,35 @@ flow_loop_pre_header_find (header, dom)
} }
/* Add LOOP to the loop hierarchy tree so that it is a sibling or a /* Add LOOP to the loop hierarchy tree where PREVLOOP was the loop
descendant of ROOT. */ previously added. The insertion algorithm assumes that the loops
are added in the order found by a depth first search of the CFG. */
static void static void
flow_loop_tree_node_add (root, loop) flow_loop_tree_node_add (prevloop, loop)
struct loop *root; struct loop *prevloop;
struct loop *loop; struct loop *loop;
{ {
struct loop *outer;
if (! loop) if (flow_loop_nested_p (prevloop, loop))
return; {
prevloop->inner = loop;
loop->outer = prevloop;
return;
}
for (outer = root; outer; outer = outer->next) while (prevloop->outer)
{ {
if (flow_loop_nested_p (outer, loop)) if (flow_loop_nested_p (prevloop->outer, loop))
{ {
if (outer->inner) prevloop->next = loop;
{ loop->outer = prevloop->outer;
/* Add LOOP as a sibling or descendent of OUTER->INNER. */
flow_loop_tree_node_add (outer->inner, loop);
}
else
{
/* Add LOOP as child of OUTER. */
outer->inner = loop;
loop->outer = outer;
loop->next = NULL;
}
return; return;
} }
prevloop = prevloop->outer;
} }
/* Add LOOP as a sibling of ROOT. */
loop->next = root->next; prevloop->next = loop;
root->next = loop; loop->outer = NULL;
loop->outer = root->outer;
} }
...@@ -6774,7 +6768,7 @@ flow_loops_tree_build (loops) ...@@ -6774,7 +6768,7 @@ flow_loops_tree_build (loops)
/* Add the remaining loops to the tree. */ /* Add the remaining loops to the tree. */
for (i = 1; i < num_loops; i++) for (i = 1; i < num_loops; i++)
flow_loop_tree_node_add (loops->tree, &loops->array[i]); flow_loop_tree_node_add (&loops->array[i - 1], &loops->array[i]);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment