emit-rtl.c (remove_insn): New function.

Fri Jan 29 18:26:07 1999  Dave Brolley  <brolley@cygnus.com>
	* emit-rtl.c (remove_insn): New function.
	* rtl.h (remove_insn): Add prototype.
	* function.c (reposition_prologue_and_epilogue_notes): Call remove_insn.

From-SVN: r24908
This commit is contained in:
Dave Brolley 1999-01-29 15:25:17 +00:00 committed by Dave Brolley
parent 061ac42618
commit 89e99eea80
4 changed files with 68 additions and 12 deletions

View File

@ -1,3 +1,9 @@
Fri Jan 29 18:26:07 1999 Dave Brolley <brolley@cygnus.com>
* emit-rtl.c (remove_insn): New function.
* rtl.h (remove_insn): Add prototype.
* function.c (reposition_prologue_and_epilogue_notes): Call remove_insn.
Fri Jan 29 22:34:41 1999 J"orn Rennecke <amylaar@cygnus.co.uk>
* loop.c (recombine_givs): Don't try to derive givs that have combined.

View File

@ -2473,6 +2473,64 @@ add_insn_before (insn, before)
PREV_INSN (XVECEXP (PATTERN (before), 0, 0)) = insn;
}
/* Remove an insn from its doubly-linked list. This function knows how
to handle sequences. */
void
remove_insn (insn)
rtx insn;
{
rtx next = NEXT_INSN (insn);
rtx prev = PREV_INSN (insn);
if (prev)
{
NEXT_INSN (prev) = next;
if (GET_CODE (prev) == INSN && GET_CODE (PATTERN (prev)) == SEQUENCE)
{
rtx sequence = PATTERN (prev);
NEXT_INSN (XVECEXP (sequence, 0, XVECLEN (sequence, 0) - 1)) = next;
}
}
else if (first_insn == insn)
first_insn = next;
else
{
struct sequence_stack *stack = sequence_stack;
/* Scan all pending sequences too. */
for (; stack; stack = stack->next)
if (insn == stack->first)
{
stack->first = next;
break;
}
if (stack == 0)
abort ();
}
if (next)
{
PREV_INSN (next) = prev;
if (GET_CODE (next) == INSN && GET_CODE (PATTERN (next)) == SEQUENCE)
PREV_INSN (XVECEXP (PATTERN (next), 0, 0)) = prev;
}
else if (last_insn == insn)
last_insn = prev;
else
{
struct sequence_stack *stack = sequence_stack;
/* Scan all pending sequences too. */
for (; stack; stack = stack->next)
if (insn == stack->last)
{
stack->last = prev;
break;
}
if (stack == 0)
abort ();
}
}
/* Delete all insns made since FROM.
FROM becomes the new last instruction. */

View File

@ -6439,7 +6439,6 @@ reposition_prologue_and_epilogue_notes (f)
/* Reposition the prologue and epilogue notes. */
if (n_basic_blocks)
{
rtx next, prev;
int len;
if (prologue)
@ -6460,6 +6459,7 @@ reposition_prologue_and_epilogue_notes (f)
}
else if ((len -= contains (insn, prologue)) == 0)
{
rtx next;
/* Find the prologue-end note if we haven't already, and
move it to just after the last prologue insn. */
if (note == 0)
@ -6471,17 +6471,13 @@ reposition_prologue_and_epilogue_notes (f)
}
next = NEXT_INSN (note);
prev = PREV_INSN (note);
if (prev)
NEXT_INSN (prev) = next;
if (next)
PREV_INSN (next) = prev;
/* Whether or not we can depend on BLOCK_HEAD,
attempt to keep it up-to-date. */
if (BLOCK_HEAD (0) == note)
BLOCK_HEAD (0) = next;
remove_insn (note);
add_insn_after (note, insn);
}
}
@ -6514,12 +6510,6 @@ reposition_prologue_and_epilogue_notes (f)
&& NOTE_LINE_NUMBER (note) == NOTE_INSN_EPILOGUE_BEG)
break;
}
next = NEXT_INSN (note);
prev = PREV_INSN (note);
if (prev)
NEXT_INSN (prev) = next;
if (next)
PREV_INSN (next) = prev;
/* Whether or not we can depend on BLOCK_HEAD,
attempt to keep it up-to-date. */
@ -6527,6 +6517,7 @@ reposition_prologue_and_epilogue_notes (f)
&& BLOCK_HEAD (n_basic_blocks-1) == insn)
BLOCK_HEAD (n_basic_blocks-1) = note;
remove_insn (note);
add_insn_before (note, insn);
}
}

View File

@ -1342,6 +1342,7 @@ extern void link_cc0_insns PROTO ((rtx));
extern void add_insn PROTO ((rtx));
extern void add_insn_before PROTO ((rtx, rtx));
extern void add_insn_after PROTO ((rtx, rtx));
extern void remove_insn PROTO ((rtx));
extern void reorder_insns_with_line_notes PROTO ((rtx, rtx, rtx));
extern void emit_insn_after_with_line_notes PROTO ((rtx, rtx, rtx));
extern enum rtx_code classify_insn PROTO ((rtx));