Commit 1e29ee12 by Jeffrey A Law Committed by Jeff Law

flow.c (find_unreachable_blocks): New function.

	* flow.c (find_unreachable_blocks): New function.
	(delete_unreachable_blocks): Use find_unreachable_blocks.
	* basic-block.h (find_unreachable_blocks): Declare.

From-SVN: r43448
parent fbf83349
Mon Jun 18 12:50:49 2001 Jeffrey A Law (law@cygnus.com) Mon Jun 18 12:50:49 2001 Jeffrey A Law (law@cygnus.com)
* flow.c (find_unreachable_blocks): New function.
(delete_unreachable_blocks): Use find_unreachable_blocks.
* basic-block.h (find_unreachable_blocks): Declare.
* dce.c (eliminate_dead_code): Fix formatting glitch. * dce.c (eliminate_dead_code): Fix formatting glitch.
2001-06-18 Jason Merrill <jason_merrill@redhat.com> 2001-06-18 Jason Merrill <jason_merrill@redhat.com>
......
...@@ -555,6 +555,7 @@ extern void debug_bb_n PARAMS ((int)); ...@@ -555,6 +555,7 @@ extern void debug_bb_n PARAMS ((int));
extern void dump_regset PARAMS ((regset, FILE *)); extern void dump_regset PARAMS ((regset, FILE *));
extern void debug_regset PARAMS ((regset)); extern void debug_regset PARAMS ((regset));
extern void allocate_reg_life_data PARAMS ((void)); extern void allocate_reg_life_data PARAMS ((void));
extern void find_unreachable_blocks PARAMS ((void));
/* This function is always defined so it can be called from the /* This function is always defined so it can be called from the
debugger, and it is declared extern so we don't get warnings about debugger, and it is declared extern so we don't get warnings about
......
...@@ -2055,14 +2055,15 @@ flow_call_edges_add (blocks) ...@@ -2055,14 +2055,15 @@ flow_call_edges_add (blocks)
return blocks_split; return blocks_split;
} }
/* Delete all unreachable basic blocks. */ /* Find unreachable blocks. An unreachable block will have NULL in
block->aux, a non-NULL value indicates the block is reachable. */
static void void
delete_unreachable_blocks () find_unreachable_blocks ()
{ {
basic_block *worklist, *tos;
edge e; edge e;
int i, n; int i, n;
basic_block *tos, *worklist;
n = n_basic_blocks; n = n_basic_blocks;
tos = worklist = (basic_block *) xmalloc (sizeof (basic_block) * n); tos = worklist = (basic_block *) xmalloc (sizeof (basic_block) * n);
...@@ -2098,11 +2099,20 @@ delete_unreachable_blocks () ...@@ -2098,11 +2099,20 @@ delete_unreachable_blocks ()
} }
} }
free (worklist);
}
/* Delete all unreachable basic blocks. */
static void
delete_unreachable_blocks ()
{
int i;
/* Delete all unreachable basic blocks. Count down so that we /* Delete all unreachable basic blocks. Count down so that we
don't interfere with the block renumbering that happens in don't interfere with the block renumbering that happens in
flow_delete_block. */ flow_delete_block. */
for (i = n - 1; i >= 0; --i) for (i = n_basic_blocks - 1; i >= 0; --i)
{ {
basic_block b = BASIC_BLOCK (i); basic_block b = BASIC_BLOCK (i);
...@@ -2114,8 +2124,6 @@ delete_unreachable_blocks () ...@@ -2114,8 +2124,6 @@ delete_unreachable_blocks ()
} }
tidy_fallthru_edges (); tidy_fallthru_edges ();
free (worklist);
} }
/* Return true if NOTE is not one of the ones that must be kept paired, /* Return true if NOTE is not one of the ones that must be kept paired,
......
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