+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,
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);
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)
{
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
&& (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. */
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);
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));
}
}
\f
/* 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
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;
}
\f
/* Return the label before INSN, or put a new label there. */
/* 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. */
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));
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;
#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