aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2000-03-02 18:29:56 +0000
committerRichard Kenner <kenner@gcc.gnu.org>2000-03-02 13:29:56 -0500
commit21318741bb4f00d87f558a2f11d462fa61381e80 (patch)
tree012b815e352352c505a47f997f46e1b9d2d6618a
parent42f602d842e3fe935b626e082eff27d5621ea2b3 (diff)
downloadgcc-21318741bb4f00d87f558a2f11d462fa61381e80.zip
gcc-21318741bb4f00d87f558a2f11d462fa61381e80.tar.gz
gcc-21318741bb4f00d87f558a2f11d462fa61381e80.tar.bz2
c-common.c (c_common_nodes_and_builtins): Make sizetype_endlink reference the language-equivalent of sizetype.
* 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
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/c-common.c2
-rw-r--r--gcc/c-typeck.c10
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/typeck.c20
-rw-r--r--gcc/fold-const.c8
-rw-r--r--gcc/gcse.c13
-rw-r--r--gcc/stor-layout.c10
8 files changed, 55 insertions, 23 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 248c1f5..0d08e6b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 0a7db5c..262022f 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -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);
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 01446f2..6d85c35 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -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. */
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index e42c764..d7e697a 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index dd246af..8fc3ab8 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -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)
{
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 097650f..7a4a485 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -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. */
diff --git a/gcc/gcse.c b/gcc/gcse.c
index 21829e7..1ac9829 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -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");
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index c1187b7..ab92569 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -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));