OSDN Git Service

* tree.c (build_common_builtin_nodes): Do not initialize
[pf3gnuchains/gcc-fork.git] / gcc / rtl.c
index fe9c951..6f34979 100644 (file)
--- a/gcc/rtl.c
+++ b/gcc/rtl.c
@@ -30,12 +30,11 @@ along with GCC; see the file COPYING3.  If not see
 #include "coretypes.h"
 #include "tm.h"
 #include "rtl.h"
-#include "real.h"
 #include "ggc.h"
 #ifdef GENERATOR_FILE
 # include "errors.h"
 #else
-# include "toplev.h"
+# include "diagnostic-core.h"
 #endif
 
 \f
@@ -150,7 +149,7 @@ rtvec_alloc (int n)
 {
   rtvec rt;
 
-  rt = ggc_alloc_rtvec (n);
+  rt = ggc_alloc_rtvec_sized (n);
   /* Clear out the vector.  */
   memset (&rt->elem[0], 0, n * sizeof (rtx));
 
@@ -194,9 +193,8 @@ rtx_size (const_rtx x)
 rtx
 rtx_alloc_stat (RTX_CODE code MEM_STAT_DECL)
 {
-  rtx rt;
-
-  rt = (rtx) ggc_alloc_zone_pass_stat (RTX_CODE_SIZE (code), &rtl_zone);
+  rtx rt = ggc_alloc_zone_rtx_def_stat (&rtl_zone, RTX_CODE_SIZE (code)
+                                        PASS_MEM_STAT);
 
   /* We want to clear everything up to the FLD array.  Normally, this
      is one int, but we don't want to assume that and it isn't very
@@ -338,7 +336,7 @@ rtx
 shallow_copy_rtx_stat (const_rtx orig MEM_STAT_DECL)
 {
   const unsigned int size = rtx_size (orig);
-  rtx const copy = (rtx) ggc_alloc_zone_pass_stat (size, &rtl_zone);
+  rtx const copy = ggc_alloc_zone_rtx_def_stat (&rtl_zone, size PASS_MEM_STAT);
   return (rtx) memcpy (copy, orig, size);
 }
 \f
@@ -409,6 +407,10 @@ 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);
+
     default:
       break;
     }
@@ -529,6 +531,10 @@ 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);
+
     default:
       break;
     }
@@ -595,6 +601,79 @@ 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:
+      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)
 {