aboutsummaryrefslogtreecommitdiff
path: root/gcc/flow.c
diff options
context:
space:
mode:
authorJeffrey A Law <law@cygnus.com>2001-06-18 19:46:37 +0000
committerJeff Law <law@gcc.gnu.org>2001-06-18 13:46:37 -0600
commit1e29ee12f059af6e1451bcd73d72c6f80f8b94c3 (patch)
tree64e47a115963e9436d678452ca7775bb2d4864a6 /gcc/flow.c
parentfbf8334971f8d6528f4847acb8453df0c838ec7c (diff)
downloadgcc-1e29ee12f059af6e1451bcd73d72c6f80f8b94c3.zip
gcc-1e29ee12f059af6e1451bcd73d72c6f80f8b94c3.tar.gz
gcc-1e29ee12f059af6e1451bcd73d72c6f80f8b94c3.tar.bz2
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
Diffstat (limited to 'gcc/flow.c')
-rw-r--r--gcc/flow.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/gcc/flow.c b/gcc/flow.c
index 77783aa..43ed9cc 100644
--- a/gcc/flow.c
+++ b/gcc/flow.c
@@ -2055,14 +2055,15 @@ flow_call_edges_add (blocks)
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
-delete_unreachable_blocks ()
+void
+find_unreachable_blocks ()
{
- basic_block *worklist, *tos;
edge e;
int i, n;
+ basic_block *tos, *worklist;
n = n_basic_blocks;
tos = worklist = (basic_block *) xmalloc (sizeof (basic_block) * n);
@@ -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
don't interfere with the block renumbering that happens in
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);
@@ -2114,8 +2124,6 @@ delete_unreachable_blocks ()
}
tidy_fallthru_edges ();
-
- free (worklist);
}
/* Return true if NOTE is not one of the ones that must be kept paired,