Commit a368a2fa by Jan Hubicka Committed by Richard Henderson

flow.c (find_sub_basic_blocks): Fix handling of the last BB in the sequence.

        * flow.c (find_sub_basic_blocks): Fix handling of the last BB in
        the sequence.
        (make_edges): New argument update_p; populate the edge cache if set.
        (find_basic_blocks): Update make_edges invocation.

Co-Authored-By: Richard Henderson <rth@redhat.com>

From-SVN: r44335
parent d38cd8ae
2001-07-25 Jan Hubicka <jh@suse.cz>
Richard Henderson <rth@redhat.com>
* flow.c (find_sub_basic_blocks): Fix handling of the last BB in
the sequence.
(make_edges): New argument update_p; populate the edge cache if set.
(find_basic_blocks): Update make_edges invocation.
2001-07-24 Joel Sherrill <joel@OARcorp.com> 2001-07-24 Joel Sherrill <joel@OARcorp.com>
* config/i960/i960.h (CPP_SPEC): Define _SOFT_FLOAT for -msoft-float. * config/i960/i960.h (CPP_SPEC): Define _SOFT_FLOAT for -msoft-float.
......
...@@ -374,7 +374,7 @@ static int flow_find_cross_jump PARAMS ((int, basic_block, basic_block, ...@@ -374,7 +374,7 @@ static int flow_find_cross_jump PARAMS ((int, basic_block, basic_block,
static int count_basic_blocks PARAMS ((rtx)); static int count_basic_blocks PARAMS ((rtx));
static void find_basic_blocks_1 PARAMS ((rtx)); static void find_basic_blocks_1 PARAMS ((rtx));
static rtx find_label_refs PARAMS ((rtx, rtx)); static rtx find_label_refs PARAMS ((rtx, rtx));
static void make_edges PARAMS ((rtx, int, int)); static void make_edges PARAMS ((rtx, int, int, int));
static void make_label_edge PARAMS ((sbitmap *, basic_block, static void make_label_edge PARAMS ((sbitmap *, basic_block,
rtx, int)); rtx, int));
static void make_eh_edge PARAMS ((sbitmap *, basic_block, rtx)); static void make_eh_edge PARAMS ((sbitmap *, basic_block, rtx));
...@@ -540,7 +540,7 @@ find_basic_blocks (f, nregs, file) ...@@ -540,7 +540,7 @@ find_basic_blocks (f, nregs, file)
compute_bb_for_insn (max_uid); compute_bb_for_insn (max_uid);
/* Discover the edges of our cfg. */ /* Discover the edges of our cfg. */
make_edges (label_value_list, 0, n_basic_blocks - 1); make_edges (label_value_list, 0, n_basic_blocks - 1, 0);
/* Do very simple cleanup now, for the benefit of code that runs between /* Do very simple cleanup now, for the benefit of code that runs between
here and cleanup_cfg, e.g. thread_prologue_and_epilogue_insns. */ here and cleanup_cfg, e.g. thread_prologue_and_epilogue_insns. */
...@@ -709,8 +709,6 @@ find_sub_basic_blocks (bb) ...@@ -709,8 +709,6 @@ find_sub_basic_blocks (bb)
rtx insn = bb->head; rtx insn = bb->head;
rtx end = bb->end; rtx end = bb->end;
rtx jump_insn = NULL_RTX; rtx jump_insn = NULL_RTX;
int created = 0;
int barrier = 0;
edge falltru = 0; edge falltru = 0;
basic_block first_bb = bb; basic_block first_bb = bb;
...@@ -729,7 +727,6 @@ find_sub_basic_blocks (bb) ...@@ -729,7 +727,6 @@ find_sub_basic_blocks (bb)
case BARRIER: case BARRIER:
if (!jump_insn) if (!jump_insn)
abort (); abort ();
barrier = 1;
break; break;
/* On code label, split current basic block. */ /* On code label, split current basic block. */
case CODE_LABEL: case CODE_LABEL:
...@@ -738,9 +735,7 @@ find_sub_basic_blocks (bb) ...@@ -738,9 +735,7 @@ find_sub_basic_blocks (bb)
bb->end = jump_insn; bb->end = jump_insn;
bb = falltru->dest; bb = falltru->dest;
remove_edge (falltru); remove_edge (falltru);
barrier = 0;
jump_insn = 0; jump_insn = 0;
created = 1;
if (LABEL_ALTERNATE_NAME (insn)) if (LABEL_ALTERNATE_NAME (insn))
make_edge (NULL, ENTRY_BLOCK_PTR, bb, 0); make_edge (NULL, ENTRY_BLOCK_PTR, bb, 0);
break; break;
...@@ -773,10 +768,11 @@ find_sub_basic_blocks (bb) ...@@ -773,10 +768,11 @@ find_sub_basic_blocks (bb)
insn = NEXT_INSN (insn); insn = NEXT_INSN (insn);
} }
/* In case we've got barrier at the end of new insn stream, put it /* In case expander replaced normal insn by sequence terminating by
outside basic block. */ return and barrier, or possibly other sequence not behaving like
if (GET_CODE (bb->end) == BARRIER) ordinary jump, we need to take care and move basic block boundary. */
bb->end = PREV_INSN (bb->end); if (jump_insn && GET_CODE (bb->end) != JUMP_INSN)
bb->end = jump_insn;
/* We've possibly replaced the conditional jump by conditional jump /* We've possibly replaced the conditional jump by conditional jump
followed by cleanup at fallthru edge, so the outgoing edges may followed by cleanup at fallthru edge, so the outgoing edges may
...@@ -785,7 +781,7 @@ find_sub_basic_blocks (bb) ...@@ -785,7 +781,7 @@ find_sub_basic_blocks (bb)
/* Now re-scan and wire in all edges. This expect simple (conditional) /* Now re-scan and wire in all edges. This expect simple (conditional)
jumps at the end of each new basic blocks. */ jumps at the end of each new basic blocks. */
make_edges (NULL, first_bb->index, bb->index - 1); make_edges (NULL, first_bb->index, bb->index, 1);
} }
/* Find all basic blocks of the function whose first insn is F. /* Find all basic blocks of the function whose first insn is F.
...@@ -1160,9 +1156,9 @@ clear_edges () ...@@ -1160,9 +1156,9 @@ clear_edges ()
the list of exception regions active at the end of the basic block. */ the list of exception regions active at the end of the basic block. */
static void static void
make_edges (label_value_list, min, max) make_edges (label_value_list, min, max, update_p)
rtx label_value_list; rtx label_value_list;
int min, max; int min, max, update_p;
{ {
int i; int i;
sbitmap *edge_cache = NULL; sbitmap *edge_cache = NULL;
...@@ -1177,6 +1173,15 @@ make_edges (label_value_list, min, max) ...@@ -1177,6 +1173,15 @@ make_edges (label_value_list, min, max)
{ {
edge_cache = sbitmap_vector_alloc (n_basic_blocks, n_basic_blocks); edge_cache = sbitmap_vector_alloc (n_basic_blocks, n_basic_blocks);
sbitmap_vector_zero (edge_cache, n_basic_blocks); sbitmap_vector_zero (edge_cache, n_basic_blocks);
if (update_p)
for (i = min; i <= max; ++i)
{
edge e;
for (e = BASIC_BLOCK (i)->succ; e ; e = e->succ_next)
if (e->dest != EXIT_BLOCK_PTR)
SET_BIT (edge_cache[i], e->dest->index);
}
} }
/* By nature of the way these get numbered, block 0 is always the entry. */ /* By nature of the way these get numbered, block 0 is always the entry. */
......
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