aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Henderson <rth@cygnus.com>2000-02-08 15:48:32 -0800
committerRichard Henderson <rth@gcc.gnu.org>2000-02-08 15:48:32 -0800
commit5568fb48cc080bfcf8164b60e90f489130b0ea2e (patch)
treedb7d0793127b534b06938e68ece7da9c05f9fd68 /gcc
parentf5a500108ae0df4eedbe6212e16ae237aec51e93 (diff)
downloadgcc-5568fb48cc080bfcf8164b60e90f489130b0ea2e.zip
gcc-5568fb48cc080bfcf8164b60e90f489130b0ea2e.tar.gz
gcc-5568fb48cc080bfcf8164b60e90f489130b0ea2e.tar.bz2
flow.c (tidy_fallthru_edges): Split out from ...
* flow.c (tidy_fallthru_edges): Split out from ... (delete_unreachable_blocks): ... here. (find_basic_blocks): Use it. From-SVN: r31857
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/flow.c80
2 files changed, 52 insertions, 34 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bbbdf4c..5020e42 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2000-02-08 Richard Henderson <rth@cygnus.com>
+
+ * flow.c (tidy_fallthru_edges): Split out from ...
+ (delete_unreachable_blocks): ... here.
+ (find_basic_blocks): Use it.
+
Tue Feb 8 15:51:50 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* stmt.c (expand_decl): Do set RTX_UNCHANGING_P for TREE_READONLY.
diff --git a/gcc/flow.c b/gcc/flow.c
index 1ce45f0..c6efbd7 100644
--- a/gcc/flow.c
+++ b/gcc/flow.c
@@ -309,7 +309,7 @@ static void merge_blocks_nomove PARAMS ((basic_block, basic_block));
static int merge_blocks PARAMS ((edge,basic_block,basic_block));
static void try_merge_blocks PARAMS ((void));
static void tidy_fallthru_edge PARAMS ((edge,basic_block,basic_block));
-
+static void tidy_fallthru_edges PARAMS ((void));
static int verify_wide_reg_1 PARAMS ((rtx *, void *));
static void verify_wide_reg PARAMS ((int, rtx, rtx));
static void verify_local_live_at_start PARAMS ((regset, basic_block));
@@ -422,6 +422,11 @@ find_basic_blocks (f, nregs, file)
/* Discover the edges of our cfg. */
record_active_eh_regions (f);
make_edges (label_value_list);
+
+ /* Do very simple cleanup now, for the benefit of code that runs between
+ here and cleanup_cfg, e.g. thread_prologue_and_epilogue_insns. */
+ tidy_fallthru_edges ();
+
mark_critical_edges ();
#ifdef ENABLE_CHECKING
@@ -1746,36 +1751,7 @@ delete_unreachable_blocks ()
deleted_handler |= delete_block (b);
}
- /* Fix up edges that now fall through, or rather should now fall through
- but previously required a jump around now deleted blocks. Simplify
- the search by only examining blocks numerically adjacent, since this
- is how find_basic_blocks created them. */
-
- for (i = 1; i < n_basic_blocks; ++i)
- {
- basic_block b = BASIC_BLOCK (i - 1);
- basic_block c = BASIC_BLOCK (i);
- edge s;
-
- /* We care about simple conditional or unconditional jumps with
- a single successor.
-
- If we had a conditional branch to the next instruction when
- find_basic_blocks was called, then there will only be one
- out edge for the block which ended with the conditional
- branch (since we do not create duplicate edges).
-
- Furthermore, the edge will be marked as a fallthru because we
- merge the flags for the duplicate edges. So we do not want to
- check that the edge is not a FALLTHRU edge. */
- if ((s = b->succ) != NULL
- && s->succ_next == NULL
- && s->dest == c
- /* If the jump insn has side effects, we can't tidy the edge. */
- && (GET_CODE (b->end) != JUMP_INSN
- || onlyjump_p (b->end)))
- tidy_fallthru_edge (s, b, c);
- }
+ tidy_fallthru_edges ();
/* If we deleted an exception handler, we may have EH region begin/end
blocks to remove as well. */
@@ -2365,9 +2341,8 @@ try_merge_blocks ()
}
}
-/* The given edge should potentially a fallthru edge. If that is in
- fact true, delete the unconditional jump and barriers that are in
- the way. */
+/* The given edge should potentially be a fallthru edge. If that is in
+ fact true, delete the jump and barriers that are in the way. */
static void
tidy_fallthru_edge (e, b, c)
@@ -2419,6 +2394,43 @@ tidy_fallthru_edge (e, b, c)
e->flags |= EDGE_FALLTHRU;
}
+/* Fix up edges that now fall through, or rather should now fall through
+ but previously required a jump around now deleted blocks. Simplify
+ the search by only examining blocks numerically adjacent, since this
+ is how find_basic_blocks created them. */
+
+static void
+tidy_fallthru_edges ()
+{
+ int i;
+
+ for (i = 1; i < n_basic_blocks; ++i)
+ {
+ basic_block b = BASIC_BLOCK (i - 1);
+ basic_block c = BASIC_BLOCK (i);
+ edge s;
+
+ /* We care about simple conditional or unconditional jumps with
+ a single successor.
+
+ If we had a conditional branch to the next instruction when
+ find_basic_blocks was called, then there will only be one
+ out edge for the block which ended with the conditional
+ branch (since we do not create duplicate edges).
+
+ Furthermore, the edge will be marked as a fallthru because we
+ merge the flags for the duplicate edges. So we do not want to
+ check that the edge is not a FALLTHRU edge. */
+ if ((s = b->succ) != NULL
+ && s->succ_next == NULL
+ && s->dest == c
+ /* If the jump insn has side effects, we can't tidy the edge. */
+ && (GET_CODE (b->end) != JUMP_INSN
+ || onlyjump_p (b->end)))
+ tidy_fallthru_edge (s, b, c);
+ }
+}
+
/* Discover and record the loop depth at the head of each basic block. */
void