OSDN Git Service

compiler: No error if shift operand inherits interface type.
[pf3gnuchains/gcc-fork.git] / gcc / rtl.c
index d886e93..a812d31 100644 (file)
--- a/gcc/rtl.c
+++ b/gcc/rtl.c
@@ -1,6 +1,7 @@
 /* RTL utility routines.
    Copyright (C) 1987, 1988, 1991, 1994, 1997, 1998, 1999, 2000, 2001, 2002,
-   2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+   Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -34,7 +35,7 @@ along with GCC; see the file COPYING3.  If not see
 #ifdef GENERATOR_FILE
 # include "errors.h"
 #else
-# include "toplev.h"
+# include "diagnostic-core.h"
 #endif
 
 \f
@@ -254,6 +255,8 @@ copy_rtx (rtx orig)
     case CODE_LABEL:
     case PC:
     case CC0:
+    case RETURN:
+    case SIMPLE_RETURN:
     case SCRATCH:
       /* SCRATCH must be shared because they represent distinct values.  */
       return orig;
@@ -286,12 +289,6 @@ copy_rtx (rtx orig)
      walks over the RTL.  */
   RTX_FLAG (copy, used) = 0;
 
-  /* We do not copy FRAME_RELATED for INSNs.  */
-  if (INSN_P (orig))
-    RTX_FLAG (copy, frame_related) = 0;
-  RTX_FLAG (copy, jump) = RTX_FLAG (orig, jump);
-  RTX_FLAG (copy, call) = RTX_FLAG (orig, call);
-
   format_ptr = GET_RTX_FORMAT (GET_CODE (copy));
 
   for (i = 0; i < GET_RTX_LENGTH (GET_CODE (copy)); i++)
@@ -407,6 +404,17 @@ rtx_equal_p_cb (const_rtx x, const_rtx y, rtx_equal_p_callback_function cb)
     case CONST_FIXED:
       return 0;
 
+    case DEBUG_IMPLICIT_PTR:
+      return DEBUG_IMPLICIT_PTR_DECL (x)
+            == DEBUG_IMPLICIT_PTR_DECL (y);
+
+    case DEBUG_PARAMETER_REF:
+      return DEBUG_PARAMETER_REF_DECL (x)
+            == DEBUG_PARAMETER_REF_DECL (x);
+
+    case ENTRY_VALUE:
+      return rtx_equal_p_cb (ENTRY_VALUE_EXP (x), ENTRY_VALUE_EXP (y), cb);
+
     default:
       break;
     }
@@ -427,7 +435,15 @@ rtx_equal_p_cb (const_rtx x, const_rtx y, rtx_equal_p_callback_function cb)
        case 'n':
        case 'i':
          if (XINT (x, i) != XINT (y, i))
-           return 0;
+           {
+#ifndef GENERATOR_FILE
+             if (((code == ASM_OPERANDS && i == 6)
+                  || (code == ASM_INPUT && i == 1))
+                 && locator_eq (XINT (x, i), XINT (y, i)))
+               break;
+#endif
+             return 0;
+           }
          break;
 
        case 'V':
@@ -527,6 +543,17 @@ rtx_equal_p (const_rtx x, const_rtx y)
     case CONST_FIXED:
       return 0;
 
+    case DEBUG_IMPLICIT_PTR:
+      return DEBUG_IMPLICIT_PTR_DECL (x)
+            == DEBUG_IMPLICIT_PTR_DECL (y);
+
+    case DEBUG_PARAMETER_REF:
+      return DEBUG_PARAMETER_REF_DECL (x)
+            == DEBUG_PARAMETER_REF_DECL (y);
+
+    case ENTRY_VALUE:
+      return rtx_equal_p (ENTRY_VALUE_EXP (x), ENTRY_VALUE_EXP (y));
+
     default:
       break;
     }
@@ -547,7 +574,15 @@ rtx_equal_p (const_rtx x, const_rtx y)
        case 'n':
        case 'i':
          if (XINT (x, i) != XINT (y, i))
-           return 0;
+           {
+#ifndef GENERATOR_FILE
+             if (((code == ASM_OPERANDS && i == 6)
+                  || (code == ASM_INPUT && i == 1))
+                 && locator_eq (XINT (x, i), XINT (y, i)))
+               break;
+#endif
+             return 0;
+           }
          break;
 
        case 'V':
@@ -593,6 +628,80 @@ rtx_equal_p (const_rtx x, const_rtx y)
   return 1;
 }
 
+/* Iteratively hash rtx X.  */
+
+hashval_t
+iterative_hash_rtx (const_rtx x, hashval_t hash)
+{
+  enum rtx_code code;
+  enum machine_mode mode;
+  int i, j;
+  const char *fmt;
+
+  if (x == NULL_RTX)
+    return hash;
+  code = GET_CODE (x);
+  hash = iterative_hash_object (code, hash);
+  mode = GET_MODE (x);
+  hash = iterative_hash_object (mode, hash);
+  switch (code)
+    {
+    case REG:
+      i = REGNO (x);
+      return iterative_hash_object (i, hash);
+    case CONST_INT:
+      return iterative_hash_object (INTVAL (x), hash);
+    case SYMBOL_REF:
+      if (XSTR (x, 0))
+       return iterative_hash (XSTR (x, 0), strlen (XSTR (x, 0)) + 1,
+                              hash);
+      return hash;
+    case LABEL_REF:
+    case DEBUG_EXPR:
+    case VALUE:
+    case SCRATCH:
+    case CONST_DOUBLE:
+    case CONST_FIXED:
+    case DEBUG_IMPLICIT_PTR:
+    case DEBUG_PARAMETER_REF:
+      return hash;
+    default:
+      break;
+    }
+
+  fmt = GET_RTX_FORMAT (code);
+  for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
+    switch (fmt[i])
+      {
+      case 'w':
+       hash = iterative_hash_object (XWINT (x, i), hash);
+       break;
+      case 'n':
+      case 'i':
+       hash = iterative_hash_object (XINT (x, i), hash);
+       break;
+      case 'V':
+      case 'E':
+       j = XVECLEN (x, i);
+       hash = iterative_hash_object (j, hash);
+       for (j = 0; j < XVECLEN (x, i); j++)
+         hash = iterative_hash_rtx (XVECEXP (x, i, j), hash);
+       break;
+      case 'e':
+       hash = iterative_hash_rtx (XEXP (x, i), hash);
+       break;
+      case 'S':
+      case 's':
+       if (XSTR (x, i))
+         hash = iterative_hash (XSTR (x, 0), strlen (XSTR (x, 0)) + 1,
+                                hash);
+       break;
+      default:
+       break;
+      }
+  return hash;
+}
+
 void
 dump_rtx_statistics (void)
 {