OSDN Git Service

2008-05-16 Tobias Burnus <burnus@net-b.de>
[pf3gnuchains/gcc-fork.git] / gcc / rtlanal.c
index 423d6ef..f0dc512 100644 (file)
@@ -1,6 +1,6 @@
 /* Analyze RTL for GNU compiler.
    Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
+   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software
    Foundation, Inc.
 
 This file is part of GCC.
@@ -1846,29 +1846,6 @@ find_regno_fusage (const_rtx insn, enum rtx_code code, unsigned int regno)
   return 0;
 }
 
-/* Return true if INSN is a call to a pure function.  */
-
-int
-pure_call_p (const_rtx insn)
-{
-  const_rtx link;
-
-  if (!CALL_P (insn) || ! CONST_OR_PURE_CALL_P (insn))
-    return 0;
-
-  /* Look for the note that differentiates const and pure functions.  */
-  for (link = CALL_INSN_FUNCTION_USAGE (insn); link; link = XEXP (link, 1))
-    {
-      rtx u, m;
-
-      if (GET_CODE (u = XEXP (link, 0)) == USE
-         && MEM_P (m = XEXP (u, 0)) && GET_MODE (m) == BLKmode
-         && GET_CODE (XEXP (m, 0)) == SCRATCH)
-       return 1;
-    }
-
-  return 0;
-}
 \f
 /* Remove register note NOTE from the REG_NOTES of INSN.  */
 
@@ -2182,7 +2159,7 @@ enum may_trap_p_flags
    cannot trap at its current location, but it might become trapping if moved
    elsewhere.  */
 
-static int
+int
 may_trap_p_1 (const_rtx x, unsigned flags)
 {
   int i;
@@ -2209,8 +2186,11 @@ may_trap_p_1 (const_rtx x, unsigned flags)
     case SCRATCH:
       return 0;
 
-    case ASM_INPUT:
+    case UNSPEC:
     case UNSPEC_VOLATILE:
+      return targetm.unspec_may_trap_p (x, flags);
+
+    case ASM_INPUT:
     case TRAP_IF:
       return 1;
 
@@ -2986,16 +2966,15 @@ loc_mentioned_in_p (rtx *loc, const_rtx in)
   fmt = GET_RTX_FORMAT (code);
   for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
     {
-      if (loc == &in->u.fld[i].rt_rtx)
-       return 1;
       if (fmt[i] == 'e')
        {
-         if (loc_mentioned_in_p (loc, XEXP (in, i)))
+         if (loc == &XEXP (in, i) || loc_mentioned_in_p (loc, XEXP (in, i)))
            return 1;
        }
       else if (fmt[i] == 'E')
        for (j = XVECLEN (in, i) - 1; j >= 0; j--)
-         if (loc_mentioned_in_p (loc, XVECEXP (in, i, j)))
+         if (loc == &XVECEXP (in, i, j)
+             || loc_mentioned_in_p (loc, XVECEXP (in, i, j)))
            return 1;
     }
   return 0;
@@ -3431,6 +3410,9 @@ label_is_jump_target_p (const_rtx label, const_rtx jump_insn)
          return true;
     }
 
+  if (find_reg_note (jump_insn, REG_LABEL_TARGET, label))
+    return true;
+
   return false;
 }