diff options
Diffstat (limited to 'contrib/gcc/jump.c')
-rw-r--r-- | contrib/gcc/jump.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/contrib/gcc/jump.c b/contrib/gcc/jump.c index fcb3c61..cad10ff 100644 --- a/contrib/gcc/jump.c +++ b/contrib/gcc/jump.c @@ -1,6 +1,6 @@ /* Optimize jump instructions, for GNU compiler. Copyright (C) 1987, 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997 - 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of GCC. @@ -91,13 +91,6 @@ rebuild_jump_labels (f) for (insn = forced_labels; insn; insn = XEXP (insn, 1)) if (GET_CODE (XEXP (insn, 0)) == CODE_LABEL) LABEL_NUSES (XEXP (insn, 0))++; - - /* Keep track of labels used for marking handlers for exception - regions; they cannot usually be deleted. */ - - for (insn = exception_handler_labels; insn; insn = XEXP (insn, 1)) - if (GET_CODE (XEXP (insn, 0)) == CODE_LABEL) - LABEL_NUSES (XEXP (insn, 0))++; } /* Some old code expects exactly one BARRIER as the NEXT_INSN of a @@ -1913,13 +1906,12 @@ delete_for_peephole (from, to) so it's possible to get spurious warnings from this. */ void -never_reached_warning (avoided_insn) - rtx avoided_insn; +never_reached_warning (avoided_insn, finish) + rtx avoided_insn, finish; { rtx insn; rtx a_line_note = NULL; - int two_avoided_lines = 0; - int contains_insn = 0; + int two_avoided_lines = 0, contains_insn = 0, reached_end = 0; if (! warn_notreached) return; @@ -1929,10 +1921,11 @@ never_reached_warning (avoided_insn) for (insn = avoided_insn; insn != NULL; insn = NEXT_INSN (insn)) { - if (GET_CODE (insn) == CODE_LABEL) + if (finish == NULL && GET_CODE (insn) == CODE_LABEL) break; - else if (GET_CODE (insn) == NOTE /* A line number note? */ - && NOTE_LINE_NUMBER (insn) >= 0) + + if (GET_CODE (insn) == NOTE /* A line number note? */ + && NOTE_LINE_NUMBER (insn) >= 0) { if (a_line_note == NULL) a_line_note = insn; @@ -1941,7 +1934,14 @@ never_reached_warning (avoided_insn) != NOTE_LINE_NUMBER (insn)); } else if (INSN_P (insn)) - contains_insn = 1; + { + if (reached_end) + break; + contains_insn = 1; + } + + if (insn == finish) + reached_end = 1; } if (two_avoided_lines && contains_insn) warning_with_file_and_line (NOTE_SOURCE_FILE (a_line_note), @@ -2084,7 +2084,9 @@ redirect_jump (jump, nlabel, delete_unused) && NOTE_LINE_NUMBER (NEXT_INSN (olabel)) == NOTE_INSN_FUNCTION_END) emit_note_after (NOTE_INSN_FUNCTION_END, nlabel); - if (olabel && --LABEL_NUSES (olabel) == 0 && delete_unused) + if (olabel && --LABEL_NUSES (olabel) == 0 && delete_unused + /* Undefined labels will remain outside the insn stream. */ + && INSN_UID (olabel)) delete_related_insns (olabel); return 1; |