Commit 8901decf by Jan Hubicka Committed by Jason Eckhardt

flow.c (fixup_reorder_chain): Avoid double labels in the basic block...

        * flow.c (fixup_reorder_chain): Avoid double labels in the basic block;
        end of basic block is jump_insn, not barrier; use create_basic_block
        instead of creating basic block by hand.

From-SVN: r32547
parent 90a883ae
Wed Feb 23 13:00:06 CET 2000 Jan Hubicka <jh@suse.cz>
* flow.c (fixup_reorder_chain): Avoid double labels in the basic block;
end of basic block is jump_insn, not barrier; use create_basic_block
instead of creating basic block by hand.
2000-03-14 Jason Eckhardt <jle@cygnus.com> 2000-03-14 Jason Eckhardt <jle@cygnus.com>
* flow.c (reorder_basic_blocks): Account for barriers when writing * flow.c (reorder_basic_blocks): Account for barriers when writing
......
...@@ -7592,70 +7592,65 @@ fixup_reorder_chain () ...@@ -7592,70 +7592,65 @@ fixup_reorder_chain ()
/* Add jumps and labels to fixup blocks. */ /* Add jumps and labels to fixup blocks. */
for (i = 0; i < n_basic_blocks - 1; i++) for (i = 0; i < n_basic_blocks - 1; i++)
{ {
if (REORDER_BLOCK_ADD_JUMP (BASIC_BLOCK (i))) basic_block bbi = BASIC_BLOCK (i);
if (REORDER_BLOCK_ADD_JUMP (bbi))
{ {
rtx new_label = gen_label_rtx ();
rtx label_insn, jump_insn, barrier_insn; rtx label_insn, jump_insn, barrier_insn;
if (GET_CODE (REORDER_BLOCK_ADD_JUMP (bbi)->head)
== CODE_LABEL)
label_insn = REORDER_BLOCK_ADD_JUMP (bbi)->head;
else
{
rtx new_label = gen_label_rtx ();
label_insn = emit_label_before (new_label, label_insn = emit_label_before (new_label,
REORDER_BLOCK_ADD_JUMP (BASIC_BLOCK (i))->head); REORDER_BLOCK_ADD_JUMP (bbi)->head);
REORDER_BLOCK_ADD_JUMP (BASIC_BLOCK (i))->head = label_insn; }
REORDER_BLOCK_ADD_JUMP (bbi)->head = label_insn;
jump_insn = emit_jump_insn_after (gen_jump (label_insn), jump_insn = emit_jump_insn_after (gen_jump (label_insn),
BASIC_BLOCK (i)->end); bbi->end);
JUMP_LABEL (jump_insn) = label_insn; JUMP_LABEL (jump_insn) = label_insn;
++LABEL_NUSES (label_insn); ++LABEL_NUSES (label_insn);
barrier_insn = emit_barrier_after (jump_insn); barrier_insn = emit_barrier_after (jump_insn);
if (GET_CODE (BASIC_BLOCK (i)->end) != JUMP_INSN) if (GET_CODE (bbi->end) != JUMP_INSN)
BASIC_BLOCK (i)->end = barrier_insn; bbi->end = jump_insn;
/* Add block for jump. Typically this is when a then is not /* Add block for jump. Typically this is when a then is not
predicted and we are jumping to the moved then block. */ predicted and we are jumping to the moved then block. */
else else
{ {
basic_block b; basic_block nb;
b = (basic_block) obstack_alloc (function_obstack, sizeof (*b));
VARRAY_GROW (basic_block_info, ++n_basic_blocks); VARRAY_GROW (basic_block_info, ++n_basic_blocks);
BASIC_BLOCK (n_basic_blocks - 1) = b; create_basic_block (n_basic_blocks - 1, jump_insn,
b->index = n_basic_blocks - 1; jump_insn, NULL);
b->head = emit_note_before (NOTE_INSN_BASIC_BLOCK, jump_insn); nb = BASIC_BLOCK (n_basic_blocks - 1);
NOTE_BASIC_BLOCK (b->head) = b;
b->end = barrier_insn;
{
basic_block nb = BASIC_BLOCK (n_basic_blocks - 1);
nb->global_live_at_start nb->global_live_at_start
= OBSTACK_ALLOC_REG_SET (function_obstack); = OBSTACK_ALLOC_REG_SET (function_obstack);
nb->global_live_at_end nb->global_live_at_end
= OBSTACK_ALLOC_REG_SET (function_obstack); = OBSTACK_ALLOC_REG_SET (function_obstack);
COPY_REG_SET (nb->global_live_at_start, COPY_REG_SET (nb->global_live_at_start,
BASIC_BLOCK (i)->global_live_at_start); bbi->global_live_at_start);
COPY_REG_SET (nb->global_live_at_end, COPY_REG_SET (nb->global_live_at_end,
BASIC_BLOCK (i)->global_live_at_start); bbi->global_live_at_start);
if (BASIC_BLOCK (i)->local_set)
{
OBSTACK_ALLOC_REG_SET (function_obstack);
COPY_REG_SET (nb->local_set, BASIC_BLOCK (i)->local_set);
}
else
BASIC_BLOCK (nb->index)->local_set = 0; BASIC_BLOCK (nb->index)->local_set = 0;
nb->aux = xcalloc (1, sizeof (struct reorder_block_def)); nb->aux = xcalloc (1, sizeof (struct reorder_block_def));
REORDER_BLOCK_INDEX (BASIC_BLOCK (n_basic_blocks - 1)) REORDER_BLOCK_INDEX (BASIC_BLOCK (n_basic_blocks - 1))
= REORDER_BLOCK_INDEX (BASIC_BLOCK (i)) + 1; = REORDER_BLOCK_INDEX (bbi) + 1;
/* Relink to new block. */ /* Relink to new block. */
nb->succ = BASIC_BLOCK (i)->succ; nb->succ = bbi->succ;
nb->succ->src = nb;
make_edge (0, BASIC_BLOCK (i), nb, 0); make_edge (NULL, bbi, nb, 0);
BASIC_BLOCK (i)->succ->succ_next bbi->succ->succ_next
= BASIC_BLOCK (i)->succ->succ_next->succ_next; = bbi->succ->succ_next->succ_next;
nb->succ->succ_next = 0; nb->succ->succ_next = 0;
/* Fix reorder block index to reflect new block. */ /* Fix reorder block index to reflect new block. */
for (j = 0; j < n_basic_blocks - 1; j++) for (j = 0; j < n_basic_blocks - 1; j++)
{ {
basic_block bbj = BASIC_BLOCK (j); basic_block bbj = BASIC_BLOCK (j);
basic_block bbi = BASIC_BLOCK (i);
if (REORDER_BLOCK_INDEX (bbj) if (REORDER_BLOCK_INDEX (bbj)
>= REORDER_BLOCK_INDEX (bbi) + 1) >= REORDER_BLOCK_INDEX (bbi) + 1)
REORDER_BLOCK_INDEX (bbj)++; REORDER_BLOCK_INDEX (bbj)++;
...@@ -7663,7 +7658,6 @@ fixup_reorder_chain () ...@@ -7663,7 +7658,6 @@ fixup_reorder_chain ()
} }
} }
} }
}
} }
......
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