c-common.c (c_common_nodes_and_builtins): Make sizetype_endlink reference the languag...
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>
Thu, 2 Mar 2000 18:29:56 +0000 (18:29 +0000)
committerRichard Kenner <kenner@gcc.gnu.org>
Thu, 2 Mar 2000 18:29:56 +0000 (13:29 -0500)
* c-common.c (c_common_nodes_and_builtins): Make sizetype_endlink
reference the language-equivalent of sizetype.
* c-typeck.c (comptypes): Treat sizetype like its language equivalent.
* fold-const.c (size_binop, size_diffop): Put back checks.
* gcse.c (dump_hash_table): Fix minor error in last change.
* stor-layout.c (set_sizetype): Set TYPE_DOMAIN of sizetype.
Clear TYPE_{NEXT,MAIN}_VARIANT and TYPE_{POINTER,REFERENCE}_to of
all sizetypes.
* cp/typeck.c (comptypes): Treat sizetype like its language equivalent.

From-SVN: r32291

gcc/ChangeLog
gcc/c-common.c
gcc/c-typeck.c
gcc/cp/ChangeLog
gcc/cp/typeck.c
gcc/fold-const.c
gcc/gcse.c
gcc/stor-layout.c

index 248c1f5..0d08e6b 100644 (file)
@@ -1,3 +1,14 @@
+Thu Mar  2 13:29:46 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
+
+       * c-common.c (c_common_nodes_and_builtins): Make sizetype_endlink
+       reference the language-equivalent of sizetype.
+       * c-typeck.c (comptypes): Treat sizetype like its language equivalent.
+       * fold-const.c (size_binop, size_diffop): Put back checks.
+       * gcse.c (dump_hash_table): Fix minor error in last change.
+       * stor-layout.c (set_sizetype): Set TYPE_DOMAIN of sizetype.
+       Clear TYPE_{NEXT,MAIN}_VARIANT and TYPE_{POINTER,REFERENCE}_to of
+       all sizetypes.
+
 Thu Mar  2 12:48:45 MET 2000  Jan Hubicka  <jh@suse.cz>
 
        * calls.c (expand_call)  Do not attempt to combine stack adjustments
index 0a7db5c..262022f 100644 (file)
@@ -3547,7 +3547,7 @@ c_common_nodes_and_builtins (cplus_mode, no_builtins, no_nonansi_builtins)
 
   ptr_ftype = build_function_type (ptr_type_node, NULL_TREE);
   ptr_ftype_unsigned = build_function_type (ptr_type_node, unsigned_endlink);
-  sizetype_endlink = tree_cons (NULL_TREE, sizetype, endlink);
+  sizetype_endlink = tree_cons (NULL_TREE, TYPE_DOMAIN (sizetype), endlink);
   /* We realloc here because sizetype could be int or unsigned.  S'ok.  */
   ptr_ftype_sizetype = build_function_type (ptr_type_node, sizetype_endlink);
 
index 01446f2..6d85c35 100644 (file)
@@ -436,6 +436,16 @@ comptypes (type1, type2)
       || TREE_CODE (t1) == ERROR_MARK || TREE_CODE (t2) == ERROR_MARK)
     return 1;
 
+  /* If either type is the internal version of sizetype, return the
+     language version.  */
+  if (TREE_CODE (t1) == INTEGER_TYPE && TYPE_IS_SIZETYPE (t1)
+      && TYPE_DOMAIN (t1) != 0)
+    t1 = TYPE_DOMAIN (t1);
+
+  if (TREE_CODE (t2) == INTEGER_TYPE && TYPE_IS_SIZETYPE (t2)
+      && TYPE_DOMAIN (t2) != 0)
+    t2 = TYPE_DOMAIN (t2);
+
   /* Treat an enum type as the integer type of the same width and 
      signedness.  */
 
index e42c764..d7e697a 100644 (file)
@@ -1,3 +1,7 @@
+Thu Mar  2 13:32:01 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
+
+       * typeck.c (comptypes): Treat sizetype like its language equivalent.
+
 2000-03-01  Bernd Schmidt  <bernds@cygnus.co.uk>
 
        * typeck.c (maybe_warn_about_returning_address_of_local): Reorganize
index dd246af..8fc3ab8 100644 (file)
@@ -934,17 +934,15 @@ comptypes (t1, t2, strict)
   if (t2 == error_mark_node)
     return 0;
 
-  /* If this is a strict comparison with a sizetype, the actual types
-     won't be the same (since we need to set TYPE_IS_SIZETYPE, so verify
-     if they are both the same size and signedness.  */
-  if (strict == COMPARE_STRICT
-      && TREE_CODE (t2) == INTEGER_TYPE && TYPE_IS_SIZETYPE (t2) 
-      && TREE_CODE (t1) == INTEGER_TYPE
-      && TREE_UNSIGNED (t1) == TREE_UNSIGNED (t2)
-      && TYPE_MODE (t1) == TYPE_MODE (t2)
-      && TYPE_MIN_VALUE (t1) == TYPE_MIN_VALUE (t2)
-      && TYPE_MAX_VALUE (t1) == TYPE_MAX_VALUE (t2))
-    return 1;
+  /* If either type is the internal version of sizetype, return the
+     language version.  */
+  if (TREE_CODE (t1) == INTEGER_TYPE && TYPE_IS_SIZETYPE (t1)
+      && TYPE_DOMAIN (t1) != 0)
+    t1 = TYPE_DOMAIN (t1);
+
+  if (TREE_CODE (t2) == INTEGER_TYPE && TYPE_IS_SIZETYPE (t2)
+      && TYPE_DOMAIN (t2) != 0)
+    t2 = TYPE_DOMAIN (t2);
 
   if (strict & COMPARE_RELAXED)
     {
index 097650f..7a4a485 100644 (file)
@@ -1868,8 +1868,8 @@ size_binop (code, arg0, arg1)
 {
   tree type = TREE_TYPE (arg0);
 
-  if (TREE_CODE (type) != INTEGER_TYPE 
-      || TREE_CODE (TREE_TYPE (arg1)) != INTEGER_TYPE)
+  if (TREE_CODE (type) != INTEGER_TYPE || ! TYPE_IS_SIZETYPE (type)
+      || type != TREE_TYPE (arg1))
     abort ();
 
   /* Handle the special case of two integer constants faster.  */
@@ -1905,8 +1905,8 @@ size_diffop (arg0, arg1)
   tree type = TREE_TYPE (arg0);
   tree ctype;
 
-  if (TREE_CODE (type) != INTEGER_TYPE 
-      || TREE_CODE (TREE_TYPE (arg1)) != INTEGER_TYPE)
+  if (TREE_CODE (type) != INTEGER_TYPE || ! TYPE_IS_SIZETYPE (type)
+      || type != TREE_TYPE (arg1))
     abort ();
 
   /* If the type is already signed, just do the simple thing.  */
index 21829e7..1ac9829 100644 (file)
@@ -2009,12 +2009,13 @@ dump_hash_table (file, name, table, table_size, total_size)
           name, table_size, total_size);
 
   for (i = 0; i < total_size; i++)
-    {
-      fprintf (file, "Index %d (hash value %d)\n  ",
-              expr->bitmap_index, hash_val[i]);
-      print_rtl (file, flat_table[i]->expr);
-      fprintf (file, "\n");
-    }
+    if (flat_table[i] != 0)
+      {
+       fprintf (file, "Index %d (hash value %d)\n  ",
+                expr->bitmap_index, hash_val[i]);
+       print_rtl (file, flat_table[i]->expr);
+       fprintf (file, "\n");
+      }
 
   fprintf (file, "\n");
 
index c1187b7..ab92569 100644 (file)
@@ -1402,6 +1402,7 @@ set_sizetype (type)
 
   /* Make copies of nodes since we'll be setting TYPE_IS_SIZETYPE.  */
   sizetype = copy_node (type);
+  TYPE_DOMAIN (sizetype) = type;
   bitsizetype = make_node (INTEGER_TYPE);
   TYPE_NAME (bitsizetype) = TYPE_NAME (type);
   TYPE_PRECISION (bitsizetype) = precision;
@@ -1430,8 +1431,15 @@ set_sizetype (type)
 
   TYPE_NAME (bitsizetype) = get_identifier ("bit_size_type");
 
+  /* Show is a sizetype, is a main type, and has no pointers to it.  */
   for (i = 0; i < sizeof sizetype_tab / sizeof sizetype_tab[0]; i++)
-    TYPE_IS_SIZETYPE (sizetype_tab[i]) = 1;
+    {
+      TYPE_IS_SIZETYPE (sizetype_tab[i]) = 1;
+      TYPE_MAIN_VARIANT (sizetype_tab[i]) = sizetype_tab[i];
+      TYPE_NEXT_VARIANT (sizetype_tab[i]) = 0;
+      TYPE_POINTER_TO (sizetype_tab[i]) = 0;
+      TYPE_REFERENCE_TO (sizetype_tab[i]) = 0;
+    }
 
   ggc_add_tree_root ((tree *) &sizetype_tab,
                     sizeof sizetype_tab / sizeof (tree));