/* 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.
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))++;
}
\f
/* Some old code expects exactly one BARRIER as the NEXT_INSN of a
break;
}
- /* In case we give up IEEE compatibility, all comparisons are reversible. */
- if (TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT
- || flag_unsafe_math_optimizations)
- return reverse_condition (code);
-
if (GET_MODE_CLASS (mode) == MODE_CC
#ifdef HAVE_cc0
|| arg0 == cc0_rtx
}
}
- /* An integer condition. */
+ /* Test for an integer condition, or a floating-point comparison
+ in which NaNs can be ignored. */
if (GET_CODE (arg0) == CONST_INT
|| (GET_MODE (arg0) != VOIDmode
&& GET_MODE_CLASS (mode) != MODE_CC
- && ! FLOAT_MODE_P (mode)))
+ && !HONOR_NANS (mode)))
return reverse_condition (code);
return UNKNOWN;
reverse_condition_maybe_unordered (code)
enum rtx_code code;
{
- /* Non-IEEE formats don't have unordered conditions. */
- if (TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT)
- return reverse_condition (code);
-
switch (code)
{
case EQ:
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;
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;
!= 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),
&& 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;