summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Henderson <rth@cygnus.com>2000-05-22 20:40:53 -0700
committerRichard Henderson <rth@gcc.gnu.org>2000-05-22 20:40:53 -0700
commitca1117ccf724e0b1b543e3e7b607087444340191 (patch)
tree7ca7a2beb746e40066364f14177f7d1358975cc0 /gcc
parent941cc05afd83b2a1af44a98d7c6598c947ea6a3d (diff)
downloadgcc-ca1117ccf724e0b1b543e3e7b607087444340191.tar.gz
function.c (thread_prologue_and_epilogue_insns): Make sure existing line number notes appear after the prologue.
* function.c (thread_prologue_and_epilogue_insns): Make sure existing line number notes appear after the prologue. From-SVN: r34098
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/function.c84
2 files changed, 62 insertions, 27 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ab84d2460a8..f3af63bdfa7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2000-05-22 Richard Henderson <rth@cygnus.com>
+
+ * function.c (thread_prologue_and_epilogue_insns): Make sure
+ existing line number notes appear after the prologue.
+
Mon May 22 21:49:00 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* config/alpha/alpha.c (alpha_fnname): New static variable.
diff --git a/gcc/function.c b/gcc/function.c
index 0f6785b9bdc..63634bb602c 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -6812,15 +6812,16 @@ void
thread_prologue_and_epilogue_insns (f)
rtx f ATTRIBUTE_UNUSED;
{
- int insertted = 0;
+ int inserted = 0;
edge e;
rtx seq;
+#ifdef HAVE_prologue
+ rtx prologue_end = NULL_RTX;
+#endif
#ifdef HAVE_prologue
if (HAVE_prologue)
{
- rtx insn;
-
start_sequence ();
seq = gen_prologue();
emit_insn (seq);
@@ -6829,26 +6830,7 @@ thread_prologue_and_epilogue_insns (f)
if (GET_CODE (seq) != SEQUENCE)
seq = get_insns ();
record_insns (seq, &prologue);
- emit_note (NULL, NOTE_INSN_PROLOGUE_END);
-
- /* GDB handles `break f' by setting a breakpoint on the first
- line note *after* the prologue. That means that we should
- insert a line note here; otherwise, if the next line note
- comes part way into the next block, GDB will skip all the way
- to that point. */
- insn = next_nonnote_insn (f);
- while (insn)
- {
- if (GET_CODE (insn) == NOTE
- && NOTE_LINE_NUMBER (insn) >= 0)
- {
- emit_line_note_force (NOTE_SOURCE_FILE (insn),
- NOTE_LINE_NUMBER (insn));
- break;
- }
-
- insn = PREV_INSN (insn);
- }
+ prologue_end = emit_note (NULL, NOTE_INSN_PROLOGUE_END);
seq = gen_sequence ();
end_sequence ();
@@ -6862,7 +6844,7 @@ thread_prologue_and_epilogue_insns (f)
abort ();
insert_insn_on_edge (seq, ENTRY_BLOCK_PTR->succ);
- insertted = 1;
+ inserted = 1;
}
else
emit_insn_after (seq, f);
@@ -6977,7 +6959,7 @@ thread_prologue_and_epilogue_insns (f)
seq = gen_sequence ();
end_sequence ();
insert_insn_on_edge (seq, e);
- insertted = 1;
+ inserted = 1;
}
goto epilogue_done;
}
@@ -7011,12 +6993,12 @@ thread_prologue_and_epilogue_insns (f)
end_sequence();
insert_insn_on_edge (seq, e);
- insertted = 1;
+ inserted = 1;
}
#endif
epilogue_done:
- if (insertted)
+ if (inserted)
commit_edge_insertions ();
#ifdef HAVE_sibcall_epilogue
@@ -7049,6 +7031,54 @@ epilogue_done:
? seq : newinsn, &sibcall_epilogue);
}
#endif
+
+#ifdef HAVE_prologue
+ if (prologue_end)
+ {
+ rtx insn, prev;
+
+ /* GDB handles `break f' by setting a breakpoint on the first
+ line note *after* the prologue. Which means (1) that if
+ there are line number notes before where we inserted the
+ prologue we should move them, and (2) if there is no such
+ note, then we should generate one at the prologue. */
+
+ for (insn = prologue_end; insn ; insn = prev)
+ {
+ prev = PREV_INSN (insn);
+ if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > 0)
+ {
+ /* Note that we cannot reorder the first insn in the
+ chain, since rest_of_compilation relies on that
+ remaining constant. Do the next best thing. */
+ if (prev == NULL)
+ {
+ emit_line_note_after (NOTE_SOURCE_FILE (insn),
+ NOTE_LINE_NUMBER (insn),
+ prologue_end);
+ NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
+ }
+ else
+ reorder_insns (insn, insn, prologue_end);
+ }
+ }
+
+ insn = NEXT_INSN (prologue_end);
+ if (! insn || GET_CODE (insn) != NOTE || NOTE_LINE_NUMBER (insn) <= 0)
+ {
+ for (insn = next_active_insn (f); insn ; insn = PREV_INSN (insn))
+ {
+ if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > 0)
+ {
+ emit_line_note_after (NOTE_SOURCE_FILE (insn),
+ NOTE_LINE_NUMBER (insn),
+ prologue_end);
+ break;
+ }
+ }
+ }
+ }
+#endif
}
/* Reposition the prologue-end and epilogue-begin notes after instruction