Commit 2270623a by Jason Merrill Committed by Jason Merrill

jump.c (squeeze_notes): Take parms by reference.

        * jump.c (squeeze_notes): Take parms by reference.  Handle END being
        a squeezable note.
        * rtl.h: Adjust.
        * ifcvt.c (dead_or_predicable): Adjust.
        * loop.c (find_and_verify_loops): Adjust.
        * stmt.c (expand_end_case): Adjust.
        * flow.c (merge_blocks_move_successor_nojumps): Adjust.  Modify the
        head and end insn pointers in the basic block, not just local copies.
        (merge_blocks_move_predecessor_nojumps): Likewise.

From-SVN: r45107
parent fd10dd09
2001-08-22 Jason Merrill <jason_merrill@redhat.com>
* jump.c (squeeze_notes): Take parms by reference. Handle END being
a squeezable note.
* rtl.h: Adjust.
* ifcvt.c (dead_or_predicable): Adjust.
* loop.c (find_and_verify_loops): Adjust.
* stmt.c (expand_end_case): Adjust.
* flow.c (merge_blocks_move_successor_nojumps): Adjust. Modify the
head and end insn pointers in the basic block, not just local copies.
(merge_blocks_move_predecessor_nojumps): Likewise.
2001-08-22 Lars Brinkhoff <lars@nocrew.org>
* Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c,
......
......@@ -3074,13 +3074,10 @@ static int
merge_blocks_move_predecessor_nojumps (a, b)
basic_block a, b;
{
rtx start, end, barrier;
rtx barrier;
int index;
start = a->head;
end = a->end;
barrier = next_nonnote_insn (end);
barrier = next_nonnote_insn (a->end);
if (GET_CODE (barrier) != BARRIER)
abort ();
flow_delete_insn (barrier);
......@@ -3092,11 +3089,11 @@ merge_blocks_move_predecessor_nojumps (a, b)
and adjust the block trees appropriately. Even better would be to have
a tighter connection between block trees and rtl so that this is not
necessary. */
start = squeeze_notes (start, end);
squeeze_notes (&a->head, &a->end);
/* Scramble the insn chain. */
if (end != PREV_INSN (b->head))
reorder_insns (start, end, PREV_INSN (b->head));
if (a->end != PREV_INSN (b->head))
reorder_insns (a->head, a->end, PREV_INSN (b->head));
if (rtl_dump_file)
{
......@@ -3127,11 +3124,9 @@ static int
merge_blocks_move_successor_nojumps (a, b)
basic_block a, b;
{
rtx start, end, barrier;
rtx barrier;
start = b->head;
end = b->end;
barrier = NEXT_INSN (end);
barrier = NEXT_INSN (b->end);
/* Recognize a jump table following block B. */
if (barrier
......@@ -3141,8 +3136,8 @@ merge_blocks_move_successor_nojumps (a, b)
&& (GET_CODE (PATTERN (NEXT_INSN (barrier))) == ADDR_VEC
|| GET_CODE (PATTERN (NEXT_INSN (barrier))) == ADDR_DIFF_VEC))
{
end = NEXT_INSN (barrier);
barrier = NEXT_INSN (end);
b->end = NEXT_INSN (barrier);
barrier = NEXT_INSN (b->end);
}
/* There had better have been a barrier there. Delete it. */
......@@ -3156,10 +3151,10 @@ merge_blocks_move_successor_nojumps (a, b)
and adjust the block trees appropriately. Even better would be to have
a tighter connection between block trees and rtl so that this is not
necessary. */
start = squeeze_notes (start, end);
squeeze_notes (&b->head, &b->end);
/* Scramble the insn chain. */
reorder_insns (start, end, a->end);
reorder_insns (b->head, b->end, a->end);
/* Now blocks A and B are contiguous. Merge them. */
merge_blocks_nomove (a, b);
......
......@@ -2667,19 +2667,7 @@ dead_or_predicable (test_bb, merge_bb, other_bb, new_dest, reversep)
if (end == merge_bb->end)
merge_bb->end = PREV_INSN (head);
head = squeeze_notes (head, end);
if (GET_CODE (end) == NOTE
&& (NOTE_LINE_NUMBER (end) == NOTE_INSN_BLOCK_END
|| NOTE_LINE_NUMBER (end) == NOTE_INSN_BLOCK_BEG
|| NOTE_LINE_NUMBER (end) == NOTE_INSN_LOOP_BEG
|| NOTE_LINE_NUMBER (end) == NOTE_INSN_LOOP_END
|| NOTE_LINE_NUMBER (end) == NOTE_INSN_LOOP_CONT
|| NOTE_LINE_NUMBER (end) == NOTE_INSN_LOOP_VTOP))
{
if (head == end)
return TRUE;
end = PREV_INSN (end);
}
squeeze_notes (&head, &end);
reorder_insns (head, end, PREV_INSN (earliest));
}
......
......@@ -539,19 +539,24 @@ duplicate_loop_exit_test (loop_start)
}
/* Move all block-beg, block-end, loop-beg, loop-cont, loop-vtop, loop-end,
notes between START and END out before START. Assume that END is not
such a note. START may be such a note. Returns the value of the new
starting insn, which may be different if the original start was such a
note. */
notes between START and END out before START. START and END may be such
notes. Returns the values of the new starting and ending insns, which
may be different if the original ones were such notes. */
rtx
squeeze_notes (start, end)
rtx start, end;
void
squeeze_notes (startp, endp)
rtx* startp;
rtx* endp;
{
rtx start = *startp;
rtx end = *endp;
rtx insn;
rtx next;
rtx last = NULL;
rtx past_end = NEXT_INSN (end);
for (insn = start; insn != end; insn = next)
for (insn = start; insn != past_end; insn = next)
{
next = NEXT_INSN (insn);
if (GET_CODE (insn) == NOTE
......@@ -575,9 +580,19 @@ squeeze_notes (start, end)
PREV_INSN (next) = prev;
}
}
else
last = insn;
}
return start;
/* There were no real instructions, and we can't represent an empty
range. Die. */
if (start == past_end)
abort ();
end = last;
*startp = start;
*endp = end;
}
/* Return the label before INSN, or put a new label there. */
......
......@@ -2749,8 +2749,7 @@ find_and_verify_loops (f, loops)
/* Include the BARRIER after INSN and copy the
block after LOC. */
new_label = squeeze_notes (new_label,
last_insn_to_move);
squeeze_notes (&new_label, &last_insn_to_move);
reorder_insns (new_label, last_insn_to_move, loc);
/* All those insns are now in TARGET_LOOP. */
......
......@@ -1284,7 +1284,7 @@ extern void mark_jump_label PARAMS ((rtx, rtx, int));
extern void cleanup_barriers PARAMS ((void));
/* In jump.c */
extern rtx squeeze_notes PARAMS ((rtx, rtx));
extern void squeeze_notes PARAMS ((rtx *, rtx *));
extern rtx delete_insn PARAMS ((rtx));
extern void delete_jump PARAMS ((rtx));
extern void delete_barrier PARAMS ((rtx));
......
......@@ -5152,7 +5152,7 @@ expand_end_case (orig_index)
int ncases;
rtx *labelvec;
register int i;
rtx before_case;
rtx before_case, end;
register struct nesting *thiscase = case_stack;
tree index_expr, index_type;
int unsignedp;
......@@ -5414,8 +5414,10 @@ expand_end_case (orig_index)
#endif
}
before_case = squeeze_notes (NEXT_INSN (before_case), get_last_insn ());
reorder_insns (before_case, get_last_insn (),
before_case = NEXT_INSN (before_case);
end = get_last_insn ();
squeeze_notes (&before_case, &end);
reorder_insns (before_case, end,
thiscase->data.case_stmt.start);
}
else
......
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