Commit e61d7b78 by Kazu Hirata Committed by Kazu Hirata

tree-cfg.c (thread_jumps): Use a do-while loop instead of a loop with goto.

	* tree-cfg.c (thread_jumps): Use a do-while loop instead of a
	loop with goto.

From-SVN: r89276
parent e836a5a2
2004-10-19 Kazu Hirata <kazu@cs.umass.edu> 2004-10-19 Kazu Hirata <kazu@cs.umass.edu>
* tree-cfg.c (thread_jumps): Use a do-while loop instead of a
loop with goto.
2004-10-19 Kazu Hirata <kazu@cs.umass.edu>
* expr.c (expand_assignment): Remove the last argument. * expr.c (expand_assignment): Remove the last argument.
Change the return type to void. Change the return type to void.
* expr.h: Update the prototype of expand_assignment. * expr.h: Update the prototype of expand_assignment.
......
...@@ -3781,7 +3781,8 @@ thread_jumps (void) ...@@ -3781,7 +3781,8 @@ thread_jumps (void)
FOR_EACH_BB (bb) FOR_EACH_BB (bb)
bb_ann (bb)->forwardable = tree_forwarder_block_p (bb); bb_ann (bb)->forwardable = tree_forwarder_block_p (bb);
restart: do
{
rerun = false; rerun = false;
FOR_EACH_BB (bb) FOR_EACH_BB (bb)
{ {
...@@ -3846,7 +3847,8 @@ thread_jumps (void) ...@@ -3846,7 +3847,8 @@ thread_jumps (void)
nodes that will need updating. */ nodes that will need updating. */
dest = last->src; dest = last->src;
/* That might mean that no forwarding at all is possible. */ /* That might mean that no forwarding at all is
possible. */
if (dest == e->dest) if (dest == e->dest)
{ {
ei_next (&ei); ei_next (&ei);
...@@ -3864,7 +3866,9 @@ thread_jumps (void) ...@@ -3864,7 +3866,9 @@ thread_jumps (void)
/* Update the profile. */ /* Update the profile. */
if (profile_status != PROFILE_ABSENT) if (profile_status != PROFILE_ABSENT)
for (curr = old_dest; curr != dest; curr = EDGE_SUCC (curr, 0)->dest) for (curr = old_dest;
curr != dest;
curr = EDGE_SUCC (curr, 0)->dest)
{ {
curr->frequency -= freq; curr->frequency -= freq;
if (curr->frequency < 0) if (curr->frequency < 0)
...@@ -3879,9 +3883,10 @@ thread_jumps (void) ...@@ -3879,9 +3883,10 @@ thread_jumps (void)
if (!old) if (!old)
{ {
/* Update PHI nodes. We know that the new argument should /* Update PHI nodes. We know that the new argument
have the same value as the argument associated with LAST. should have the same value as the argument
Otherwise we would have changed our target block above. */ associated with LAST. Otherwise we would have
changed our target block above. */
for (phi = phi_nodes (dest); phi; phi = PHI_CHAIN (phi)) for (phi = phi_nodes (dest); phi; phi = PHI_CHAIN (phi))
{ {
arg = phi_arg_from_edge (phi, last); arg = phi_arg_from_edge (phi, last);
...@@ -3907,14 +3912,15 @@ thread_jumps (void) ...@@ -3907,14 +3912,15 @@ thread_jumps (void)
/* Update the dominators. */ /* Update the dominators. */
if (dom_info_available_p (CDI_DOMINATORS)) if (dom_info_available_p (CDI_DOMINATORS))
{ {
/* If the dominator of the destination was in the path, set its /* If the dominator of the destination was in the
dominator to the start of the redirected edge. */ path, set its dominator to the start of the
redirected edge. */
if (get_immediate_dominator (CDI_DOMINATORS, old_dest) == NULL) if (get_immediate_dominator (CDI_DOMINATORS, old_dest) == NULL)
set_immediate_dominator (CDI_DOMINATORS, old_dest, bb); set_immediate_dominator (CDI_DOMINATORS, old_dest, bb);
/* Now proceed like if we forwarded just over one edge at a time. /* Now proceed like if we forwarded just over one
Algorithm for forwarding edge S --> A over edge A --> B then edge at a time. Algorithm for forwarding edge
is S --> A over edge A --> B then is
if (idom (B) == A if (idom (B) == A
&& !dominated_by (S, B)) && !dominated_by (S, B))
...@@ -3939,15 +3945,15 @@ thread_jumps (void) ...@@ -3939,15 +3945,15 @@ thread_jumps (void)
} }
/* If we succeeded in threading a jump at BB, update the /* If we succeeded in threading a jump at BB, update the
forwardable mark as BB may have become a new forwarder block. forwardable mark as BB may have become a new forwarder
This could happen if we have a useless "if" statement whose block. This could happen if we have a useless "if"
two arms eventually merge without any intervening statement whose two arms eventually merge without any
statements. */ intervening statements. */
if (this_jump_threaded && tree_forwarder_block_p (bb)) if (this_jump_threaded && tree_forwarder_block_p (bb))
bb_ann (bb)->forwardable = rerun = true; bb_ann (bb)->forwardable = rerun = true;
} }
if (rerun) }
goto restart; while (rerun);
return retval; return retval;
} }
......
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