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,75 +7592,69 @@ fixup_reorder_chain () ...@@ -7592,75 +7592,69 @@ 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;
label_insn = emit_label_before (new_label, if (GET_CODE (REORDER_BLOCK_ADD_JUMP (bbi)->head)
REORDER_BLOCK_ADD_JUMP (BASIC_BLOCK (i))->head); == CODE_LABEL)
REORDER_BLOCK_ADD_JUMP (BASIC_BLOCK (i))->head = label_insn; label_insn = REORDER_BLOCK_ADD_JUMP (bbi)->head;
else
{
rtx new_label = gen_label_rtx ();
label_insn = emit_label_before (new_label,
REORDER_BLOCK_ADD_JUMP (bbi)->head);
}
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; nb->global_live_at_start
b->end = barrier_insn; = OBSTACK_ALLOC_REG_SET (function_obstack);
nb->global_live_at_end
{ = OBSTACK_ALLOC_REG_SET (function_obstack);
basic_block nb = BASIC_BLOCK (n_basic_blocks - 1);
nb->global_live_at_start COPY_REG_SET (nb->global_live_at_start,
= OBSTACK_ALLOC_REG_SET (function_obstack); bbi->global_live_at_start);
nb->global_live_at_end COPY_REG_SET (nb->global_live_at_end,
= OBSTACK_ALLOC_REG_SET (function_obstack); bbi->global_live_at_start);
BASIC_BLOCK (nb->index)->local_set = 0;
COPY_REG_SET (nb->global_live_at_start,
BASIC_BLOCK (i)->global_live_at_start); nb->aux = xcalloc (1, sizeof (struct reorder_block_def));
COPY_REG_SET (nb->global_live_at_end, REORDER_BLOCK_INDEX (BASIC_BLOCK (n_basic_blocks - 1))
BASIC_BLOCK (i)->global_live_at_start); = REORDER_BLOCK_INDEX (bbi) + 1;
if (BASIC_BLOCK (i)->local_set) /* Relink to new block. */
{ nb->succ = bbi->succ;
OBSTACK_ALLOC_REG_SET (function_obstack); nb->succ->src = nb;
COPY_REG_SET (nb->local_set, BASIC_BLOCK (i)->local_set);
} make_edge (NULL, bbi, nb, 0);
else bbi->succ->succ_next
BASIC_BLOCK (nb->index)->local_set = 0; = bbi->succ->succ_next->succ_next;
nb->succ->succ_next = 0;
nb->aux = xcalloc (1, sizeof (struct reorder_block_def)); /* Fix reorder block index to reflect new block. */
REORDER_BLOCK_INDEX (BASIC_BLOCK (n_basic_blocks - 1)) for (j = 0; j < n_basic_blocks - 1; j++)
= REORDER_BLOCK_INDEX (BASIC_BLOCK (i)) + 1; {
/* Relink to new block. */ basic_block bbj = BASIC_BLOCK (j);
nb->succ = BASIC_BLOCK (i)->succ; if (REORDER_BLOCK_INDEX (bbj)
>= REORDER_BLOCK_INDEX (bbi) + 1)
make_edge (0, BASIC_BLOCK (i), nb, 0); REORDER_BLOCK_INDEX (bbj)++;
BASIC_BLOCK (i)->succ->succ_next }
= BASIC_BLOCK (i)->succ->succ_next->succ_next;
nb->succ->succ_next = 0;
/* Fix reorder block index to reflect new block. */
for (j = 0; j < n_basic_blocks - 1; j++)
{
basic_block bbj = BASIC_BLOCK (j);
basic_block bbi = BASIC_BLOCK (i);
if (REORDER_BLOCK_INDEX (bbj)
>= REORDER_BLOCK_INDEX (bbi) + 1)
REORDER_BLOCK_INDEX (bbj)++;
}
}
} }
} }
} }
......
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