Commit 452ba14d by Zdenek Dvorak Committed by Zdenek Dvorak

cfghooks.c (remove_edge): New function.

	* cfghooks.c (remove_edge): New function.
	(redirect_edge_and_branch, remove_branch, merge_blocks): Updated
	loop exit rescans.
	* cfghooks.h (remove_edge): Declare.
	* cfg.c (remove_edge): Renamed to remove_edge_raw.
	* basic-block.h (remove_edge): Declaration changed to remove_edge_raw.

From-SVN: r126499
parent 18c492a9
2007-07-10 Zdenek Dvorak <dvorakz@suse.cz>
* cfghooks.c (remove_edge): New function.
(redirect_edge_and_branch, remove_branch, merge_blocks): Updated
loop exit rescans.
* cfghooks.h (remove_edge): Declare.
* cfg.c (remove_edge): Renamed to remove_edge_raw.
* basic-block.h (remove_edge): Declaration changed to remove_edge_raw.
2007-07-09 Wolfgang Gellerich <gellerich@de.ibm.com> 2007-07-09 Wolfgang Gellerich <gellerich@de.ibm.com>
* optabs.h: Added declaration for signbit_optab. * optabs.h: Added declaration for signbit_optab.
......
...@@ -490,7 +490,7 @@ extern edge unchecked_make_edge (basic_block, basic_block, int); ...@@ -490,7 +490,7 @@ extern edge unchecked_make_edge (basic_block, basic_block, int);
extern edge cached_make_edge (sbitmap, basic_block, basic_block, int); extern edge cached_make_edge (sbitmap, basic_block, basic_block, int);
extern edge make_edge (basic_block, basic_block, int); extern edge make_edge (basic_block, basic_block, int);
extern edge make_single_succ_edge (basic_block, basic_block, int); extern edge make_single_succ_edge (basic_block, basic_block, int);
extern void remove_edge (edge); extern void remove_edge_raw (edge);
extern void redirect_edge_succ (edge, basic_block); extern void redirect_edge_succ (edge, basic_block);
extern edge redirect_edge_succ_nodup (edge, basic_block); extern edge redirect_edge_succ_nodup (edge, basic_block);
extern void redirect_edge_pred (edge, basic_block); extern void redirect_edge_pred (edge, basic_block);
......
...@@ -352,7 +352,7 @@ make_single_succ_edge (basic_block src, basic_block dest, int flags) ...@@ -352,7 +352,7 @@ make_single_succ_edge (basic_block src, basic_block dest, int flags)
/* This function will remove an edge from the flow graph. */ /* This function will remove an edge from the flow graph. */
void void
remove_edge (edge e) remove_edge_raw (edge e)
{ {
remove_predictions_associated_with_edge (e); remove_predictions_associated_with_edge (e);
execute_on_shrinking_pred (e); execute_on_shrinking_pred (e);
......
...@@ -310,10 +310,10 @@ redirect_edge_and_branch (edge e, basic_block dest) ...@@ -310,10 +310,10 @@ redirect_edge_and_branch (edge e, basic_block dest)
ret = cfg_hooks->redirect_edge_and_branch (e, dest); ret = cfg_hooks->redirect_edge_and_branch (e, dest);
/* If RET != E, then the edge E was removed since RET already lead to the /* If RET != E, then either the redirection failed, or the edge E
same destination. */ was removed since RET already lead to the same destination. */
if (ret != NULL && current_loops != NULL) if (current_loops != NULL && ret == e)
rescan_loop_exit (e, false, ret != e); rescan_loop_exit (e, false, false);
return ret; return ret;
} }
...@@ -350,9 +350,6 @@ remove_branch (edge e) ...@@ -350,9 +350,6 @@ remove_branch (edge e)
other = EDGE_SUCC (src, EDGE_SUCC (src, 0) == e); other = EDGE_SUCC (src, EDGE_SUCC (src, 0) == e);
irr = other->flags & EDGE_IRREDUCIBLE_LOOP; irr = other->flags & EDGE_IRREDUCIBLE_LOOP;
if (current_loops != NULL)
rescan_loop_exit (e, false, true);
e = redirect_edge_and_branch (e, other->dest); e = redirect_edge_and_branch (e, other->dest);
gcc_assert (e != NULL); gcc_assert (e != NULL);
...@@ -360,6 +357,17 @@ remove_branch (edge e) ...@@ -360,6 +357,17 @@ remove_branch (edge e)
e->flags |= irr; e->flags |= irr;
} }
/* Removes edge E from cfg. Unlike remove_branch, it does not update IL. */
void
remove_edge (edge e)
{
if (current_loops != NULL)
rescan_loop_exit (e, false, true);
remove_edge_raw (e);
}
/* Redirect the edge E to basic block DEST even if it requires creating /* Redirect the edge E to basic block DEST even if it requires creating
of a new basic block; then it returns the newly created basic block. of a new basic block; then it returns the newly created basic block.
Aborts when redirection is impossible. */ Aborts when redirection is impossible. */
...@@ -657,11 +665,7 @@ merge_blocks (basic_block a, basic_block b) ...@@ -657,11 +665,7 @@ merge_blocks (basic_block a, basic_block b)
whole lot of them and hope the caller knows what they're doing. */ whole lot of them and hope the caller knows what they're doing. */
while (EDGE_COUNT (a->succs) != 0) while (EDGE_COUNT (a->succs) != 0)
{ remove_edge (EDGE_SUCC (a, 0));
if (current_loops != NULL)
rescan_loop_exit (EDGE_SUCC (a, 0), false, true);
remove_edge (EDGE_SUCC (a, 0));
}
/* Adjust the edges out of B for the new owner. */ /* Adjust the edges out of B for the new owner. */
FOR_EACH_EDGE (e, ei, b->succs) FOR_EACH_EDGE (e, ei, b->succs)
......
...@@ -144,6 +144,7 @@ extern edge redirect_edge_and_branch (edge, basic_block); ...@@ -144,6 +144,7 @@ extern edge redirect_edge_and_branch (edge, basic_block);
extern basic_block redirect_edge_and_branch_force (edge, basic_block); extern basic_block redirect_edge_and_branch_force (edge, basic_block);
extern bool can_remove_branch_p (edge); extern bool can_remove_branch_p (edge);
extern void remove_branch (edge); extern void remove_branch (edge);
extern void remove_edge (edge);
extern edge split_block (basic_block, void *); extern edge split_block (basic_block, void *);
extern edge split_block_after_labels (basic_block); extern edge split_block_after_labels (basic_block);
extern bool move_block_after (basic_block, basic_block); extern bool move_block_after (basic_block, basic_block);
......
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