summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrow <drow@138bc75d-0d04-0410-961f-82ee72b054a4>2004-01-17 22:11:58 +0000
committerdrow <drow@138bc75d-0d04-0410-961f-82ee72b054a4>2004-01-17 22:11:58 +0000
commite69efecb72b8d04781f939b2dabb071b17b6cb61 (patch)
tree7de4afefa966b929d0319fac40149b2d67c66d26
parent180e93cf98c06e263807203dd8ceaae184a78281 (diff)
downloadgcc-e69efecb72b8d04781f939b2dabb071b17b6cb61.tar.gz
* final.c (SEEN_BB, SEEN_NOTE, SEEN_EMITTED): Define.
(final_scan_insn): Update to take an additional SEEN argument. Emit a line note after the prologue. Make static. (line_note_exists): Remove. (final): Don't initialize line_note_exists. Update call to final_scan_insn. * output.h (final_scan_insn): Remove prologue. * function.c (set_insn_locators): Update comment. (thread_prologue_and_epilogue_insns): Add a comment. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@76060 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog12
-rw-r--r--gcc/final.c86
-rw-r--r--gcc/function.c5
-rw-r--r--gcc/output.h7
4 files changed, 69 insertions, 41 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ee0da69d6a4..a40dc42d511 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,15 @@
+2004-01-17 Daniel Jacobowitz <drow@mvista.com>
+
+ * final.c (SEEN_BB, SEEN_NOTE, SEEN_EMITTED): Define.
+ (final_scan_insn): Update to take an additional SEEN argument. Emit
+ a line note after the prologue. Make static.
+ (line_note_exists): Remove.
+ (final): Don't initialize line_note_exists. Update call to
+ final_scan_insn.
+ * output.h (final_scan_insn): Remove prologue.
+ * function.c (set_insn_locators): Update comment.
+ (thread_prologue_and_epilogue_insns): Add a comment.
+
2004-01-17 Andrew Pinski <pinskia@physics.uc.edu>
PR target/10781
diff --git a/gcc/final.c b/gcc/final.c
index fbbff317d5e..c146f189419 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -111,6 +111,11 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#define HAVE_READONLY_DATA_SECTION 0
#endif
+/* Bitflags used by final_scan_insn. */
+#define SEEN_BB 1
+#define SEEN_NOTE 2
+#define SEEN_EMITTED 4
+
/* Last insn processed by final_scan_insn. */
static rtx debug_insn;
rtx current_output_insn;
@@ -201,10 +206,6 @@ rtx final_sequence;
static int dialect_number;
#endif
-/* Indexed by line number, nonzero if there is a note for that line. */
-
-static char *line_note_exists;
-
#ifdef HAVE_conditional_execution
/* Nonnull if the insn currently being emitted was a COND_EXEC pattern. */
rtx current_insn_predicate;
@@ -234,6 +235,7 @@ static int final_addr_vec_align (rtx);
#ifdef HAVE_ATTR_length
static int align_fuzz (rtx, rtx, int, unsigned);
#endif
+static rtx final_scan_insn (rtx, FILE *, int, int, int, int *);
/* Initialize data in final at the beginning of a compilation. */
@@ -1500,16 +1502,15 @@ void
final (rtx first, FILE *file, int optimize, int prescan)
{
rtx insn;
- int max_line = 0;
int max_uid = 0;
+ int seen = 0;
last_ignored_compare = 0;
- /* Make a map indicating which line numbers appear in this function.
- When producing SDB debugging info, delete troublesome line number
+#ifdef SDB_DEBUGGING_INFO
+ /* When producing SDB debugging info, delete troublesome line number
notes from inlined functions in other files as well as duplicate
line number notes. */
-#ifdef SDB_DEBUGGING_INFO
if (write_symbols == SDB_DEBUG)
{
rtx last = 0;
@@ -1518,34 +1519,22 @@ final (rtx first, FILE *file, int optimize, int prescan)
{
if ((RTX_INTEGRATED_P (insn)
&& strcmp (NOTE_SOURCE_FILE (insn), main_input_filename) != 0)
- || (last != 0
- && NOTE_LINE_NUMBER (insn) == NOTE_LINE_NUMBER (last)
- && NOTE_SOURCE_FILE (insn) == NOTE_SOURCE_FILE (last)))
+ || (last != 0
+ && NOTE_LINE_NUMBER (insn) == NOTE_LINE_NUMBER (last)
+ && NOTE_SOURCE_FILE (insn) == NOTE_SOURCE_FILE (last)))
{
delete_insn (insn); /* Use delete_note. */
continue;
}
last = insn;
- if (NOTE_LINE_NUMBER (insn) > max_line)
- max_line = NOTE_LINE_NUMBER (insn);
}
}
- else
#endif
- {
- for (insn = first; insn; insn = NEXT_INSN (insn))
- if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > max_line)
- max_line = NOTE_LINE_NUMBER (insn);
- }
-
- line_note_exists = xcalloc (max_line + 1, sizeof (char));
for (insn = first; insn; insn = NEXT_INSN (insn))
{
if (INSN_UID (insn) > max_uid) /* Find largest UID. */
max_uid = INSN_UID (insn);
- if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > 0)
- line_note_exists[NOTE_LINE_NUMBER (insn)] = 1;
#ifdef HAVE_cc0
/* If CC tracking across branches is enabled, record the insn which
jumps to each branch only reached from one place. */
@@ -1581,11 +1570,8 @@ final (rtx first, FILE *file, int optimize, int prescan)
insn_current_address = INSN_ADDRESSES (INSN_UID (insn));
#endif /* HAVE_ATTR_length */
- insn = final_scan_insn (insn, file, optimize, prescan, 0);
+ insn = final_scan_insn (insn, file, optimize, prescan, 0, &seen);
}
-
- free (line_note_exists);
- line_note_exists = NULL;
}
const char *
@@ -1644,11 +1630,18 @@ output_alternate_entry_point (FILE *file, rtx insn)
Value returned is the next insn to be scanned.
NOPEEPHOLES is the flag to disallow peephole processing (currently
- used for within delayed branch sequence output). */
+ used for within delayed branch sequence output).
-rtx
+ SEEN is used to track the end of the prologue, for emitting
+ debug information. We force the emission of a line note after
+ both NOTE_INSN_PROLOGUE_END and NOTE_INSN_FUNCTION_BEG, or
+ at the beginning of the second basic block, whichever comes
+ first. */
+
+static rtx
final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
- int prescan, int nopeepholes ATTRIBUTE_UNUSED)
+ int prescan, int nopeepholes ATTRIBUTE_UNUSED,
+ int *seen)
{
#ifdef HAVE_cc0
rtx set;
@@ -1687,6 +1680,15 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
if (flag_debug_asm)
fprintf (asm_out_file, "\t%s basic block %d\n",
ASM_COMMENT_START, NOTE_BASIC_BLOCK (insn)->index);
+
+ if ((*seen & (SEEN_EMITTED | SEEN_BB)) == SEEN_BB)
+ {
+ *seen |= SEEN_EMITTED;
+ last_filename = NULL;
+ }
+ else
+ *seen |= SEEN_BB;
+
break;
case NOTE_INSN_EH_REGION_BEG:
@@ -1702,6 +1704,15 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
case NOTE_INSN_PROLOGUE_END:
(*targetm.asm_out.function_end_prologue) (file);
profile_after_prologue (file);
+
+ if ((*seen & (SEEN_EMITTED | SEEN_NOTE)) == SEEN_NOTE)
+ {
+ *seen |= SEEN_EMITTED;
+ last_filename = NULL;
+ }
+ else
+ *seen |= SEEN_NOTE;
+
break;
case NOTE_INSN_EPILOGUE_BEG:
@@ -1711,6 +1722,15 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
case NOTE_INSN_FUNCTION_BEG:
app_disable ();
(*debug_hooks->end_prologue) (last_linenum, last_filename);
+
+ if ((*seen & (SEEN_EMITTED | SEEN_NOTE)) == SEEN_NOTE)
+ {
+ *seen |= SEEN_EMITTED;
+ last_filename = NULL;
+ }
+ else
+ *seen |= SEEN_NOTE;
+
break;
case NOTE_INSN_BLOCK_BEG:
@@ -2084,7 +2104,7 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
thought unnecessary. If that happens, cancel this sequence
and cause that insn to be restored. */
- next = final_scan_insn (XVECEXP (body, 0, 0), file, 0, prescan, 1);
+ next = final_scan_insn (XVECEXP (body, 0, 0), file, 0, prescan, 1, seen);
if (next != XVECEXP (body, 0, 1))
{
final_sequence = 0;
@@ -2098,7 +2118,7 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
/* We loop in case any instruction in a delay slot gets
split. */
do
- insn = final_scan_insn (insn, file, 0, prescan, 1);
+ insn = final_scan_insn (insn, file, 0, prescan, 1, seen);
while (insn != next);
}
#ifdef DBR_OUTPUT_SEQEND
@@ -2302,7 +2322,7 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
for (note = NEXT_INSN (insn); note != next;
note = NEXT_INSN (note))
- final_scan_insn (note, file, optimize, prescan, nopeepholes);
+ final_scan_insn (note, file, optimize, prescan, nopeepholes, seen);
/* In case this is prescan, put the notes
in proper position for later rescan. */
diff --git a/gcc/function.c b/gcc/function.c
index 02f095a19b3..2b710b42aba 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -1,6 +1,6 @@
/* Expands front end tree to back end RTL for GCC.
Copyright (C) 1987, 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
- 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GCC.
@@ -7254,7 +7254,7 @@ record_insns (rtx insns, varray_type *vecp)
}
}
-/* Set the specified locator to the insn chain. */
+/* Set the locator of the insn chain starting at INSN to LOC. */
static void
set_insn_locators (rtx insn, int loc)
{
@@ -7895,6 +7895,7 @@ epilogue_done:
#endif
#ifdef HAVE_prologue
+ /* This is probably all useless now that we use locators. */
if (prologue_end)
{
rtx insn, prev;
diff --git a/gcc/output.h b/gcc/output.h
index 9fbc726a665..5c9497a3dff 100644
--- a/gcc/output.h
+++ b/gcc/output.h
@@ -1,7 +1,7 @@
/* Declarations for insn-output.c. These functions are defined in recog.c,
final.c, and varasm.c.
Copyright (C) 1987, 1991, 1994, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GCC.
@@ -68,11 +68,6 @@ extern void final_end_function (void);
/* Output assembler code for some insns: all or part of a function. */
extern void final (rtx, FILE *, int, int);
-/* The final scan for one insn, INSN. Args are same as in `final', except
- that INSN is the insn being scanned. Value returned is the next insn to
- be scanned. */
-extern rtx final_scan_insn (rtx, FILE *, int, int, int);
-
/* Replace a SUBREG with a REG or a MEM, based on the thing it is a
subreg of. */
extern rtx alter_subreg (rtx *);