Fixups to last patches
Richard Kenner
kenner@vlsi1.ultra.nyu.edu
Thu Mar 2 10:42:00 GMT 2000
This fixes the problems reported with some recent changes of mine.
Thu Mar 2 13:32:01 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.
* cp/typeck.c (comptypes): Treat sizetype like its language equivalent.
*** c-common.c 2000/02/24 04:04:05 1.94
--- c-common.c 2000/03/02 18:15:44
*************** c_common_nodes_and_builtins (cplus_mode,
*** 3548,3552 ****
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);
/* We realloc here because sizetype could be int or unsigned. S'ok. */
ptr_ftype_sizetype = build_function_type (ptr_type_node, sizetype_endlink);
--- 3548,3552 ----
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, 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);
*** c-typeck.c 2000/02/27 21:39:35 1.53
--- c-typeck.c 2000/03/02 18:16:15
*************** comptypes (type1, type2)
*** 437,440 ****
--- 437,450 ----
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. */
*** fold-const.c 2000/03/01 00:54:48 1.106
--- fold-const.c 2000/03/02 18:16:50
*************** size_binop (code, arg0, arg1)
*** 1869,1874 ****
tree type = TREE_TYPE (arg0);
! if (TREE_CODE (type) != INTEGER_TYPE
! || TREE_CODE (TREE_TYPE (arg1)) != INTEGER_TYPE)
abort ();
--- 1869,1874 ----
tree type = TREE_TYPE (arg0);
! if (TREE_CODE (type) != INTEGER_TYPE || ! TYPE_IS_SIZETYPE (type)
! || type != TREE_TYPE (arg1))
abort ();
*************** size_diffop (arg0, arg1)
*** 1906,1911 ****
tree ctype;
! if (TREE_CODE (type) != INTEGER_TYPE
! || TREE_CODE (TREE_TYPE (arg1)) != INTEGER_TYPE)
abort ();
--- 1906,1911 ----
tree ctype;
! if (TREE_CODE (type) != INTEGER_TYPE || ! TYPE_IS_SIZETYPE (type)
! || type != TREE_TYPE (arg1))
abort ();
*** gcse.c 2000/02/29 20:08:52 1.79
--- gcse.c 2000/03/02 18:17:15
*************** dump_hash_table (file, name, table, tabl
*** 2010,2019 ****
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");
! }
fprintf (file, "\n");
--- 2010,2020 ----
for (i = 0; i < total_size; i++)
! 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");
*** stor-layout.c 2000/03/01 22:29:56 1.50
--- stor-layout.c 2000/03/02 18:17:23
*************** set_sizetype (type)
*** 1403,1406 ****
--- 1403,1407 ----
/* 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);
*************** set_sizetype (type)
*** 1431,1436 ****
TYPE_NAME (bitsizetype) = get_identifier ("bit_size_type");
for (i = 0; i < sizeof sizetype_tab / sizeof sizetype_tab[0]; i++)
! TYPE_IS_SIZETYPE (sizetype_tab[i]) = 1;
ggc_add_tree_root ((tree *) &sizetype_tab,
--- 1432,1444 ----
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_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,
*** cp/typeck.c 2000/03/01 21:41:15 1.254
--- cp/typeck.c 2000/03/02 18:18:06
*************** comptypes (t1, t2, strict)
*** 935,949 ****
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 (strict & COMPARE_RELAXED)
--- 935,947 ----
return 0;
! /* 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)
More information about the Gcc-patches
mailing list