aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDave Brolley <brolley@cygnus.com>1999-01-29 15:25:17 +0000
committerDave Brolley <brolley@gcc.gnu.org>1999-01-29 10:25:17 -0500
commit89e99eea8015548093218f652c9d8a17e78542a3 (patch)
tree8692386860ab7ebbe81ec29448463ae26a6f5977 /gcc
parent061ac426189161b669a2a0b6e67fab19e7fde25d (diff)
downloadgcc-89e99eea8015548093218f652c9d8a17e78542a3.zip
gcc-89e99eea8015548093218f652c9d8a17e78542a3.tar.gz
gcc-89e99eea8015548093218f652c9d8a17e78542a3.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/emit-rtl.c58
-rw-r--r--gcc/function.c15
-rw-r--r--gcc/rtl.h1
4 files changed, 68 insertions, 12 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 476d746..af18275 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index d58b895..2e48bde 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -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. */
diff --git a/gcc/function.c b/gcc/function.c
index e2c836d..0a86580 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -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);
}
}
diff --git a/gcc/rtl.h b/gcc/rtl.h
index eb9b825..6c2c1b3 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -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));