tree.h (sizetype_tab[2], [...]): Merge all of these into a single struct, with additi...
authorRichard Henderson <rth@cygnus.com>
Sat, 4 Apr 1998 17:46:06 +0000 (09:46 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Sat, 4 Apr 1998 17:46:06 +0000 (09:46 -0800)
* tree.h (sizetype_tab[2], sbitsizetype, ubitsizetype): Merge all
of these into a single struct, with additional [us]sizetype entries.
* stor-layout.c (set_sizetype): Initialize [us]sizetype.
* fold-const.c (size_int_wide): Don't rely on sizetype_tab being
an array.

From-SVN: r18994

gcc/ChangeLog
gcc/fold-const.c
gcc/stor-layout.c
gcc/tree.h

index 789c87c5f5a69640dad1617b49766f38267868a3..4cd6303c7930e12ae2568b655ce1f0766e5141ed 100644 (file)
@@ -1,3 +1,11 @@
+Sat Apr  4 17:42:05 1998  Richard Henderson  <rth@cygnus.com>
+
+       * tree.h (sizetype_tab[2], sbitsizetype, ubitsizetype): Merge all
+       of these into a single struct, with additional [us]sizetype entries.
+       * stor-layout.c (set_sizetype): Initialize [us]sizetype.
+       * fold-const.c (size_int_wide): Don't rely on sizetype_tab being
+       an array.
+
 Sat Apr  4 17:04:41 1998  Richard Henderson  <rth@cygnus.com>
 
        * configure.in (alpha-*-linux-*): Undo tm_file changes from gcc2 merge.
index 648dc3b81b3f3755819d1fc09ee9447f48b2b8b9..afdd26b679d85d28b411f0a3392ba51c6a7fcc2e 100644 (file)
@@ -1444,14 +1444,14 @@ size_int_wide (number, high, bit_p)
       /* Make this a permanent node.  */
       end_temporary_allocation ();
       t = build_int_2 (number, 0);
-      TREE_TYPE (t) = sizetype_tab[bit_p];
+      TREE_TYPE (t) = bit_p ? bitsizetype : sizetype;
       size_table[number][bit_p] = t;
       pop_obstacks ();
     }
   else
     {
       t = build_int_2 (number, high);
-      TREE_TYPE (t) = sizetype_tab[bit_p];
+      TREE_TYPE (t) = bit_p ? bitsizetype : sizetype;
       TREE_OVERFLOW (t) = TREE_CONSTANT_OVERFLOW (t) = force_fit_type (t, 0);
     }
   return t;
index 8aaf2f692f2af466e6a68c537133f7248a478b96..365826d1727007ced6d6b10bc03a1ccc372ce8c0 100644 (file)
@@ -32,10 +32,9 @@ Boston, MA 02111-1307, USA.  */
 #define CEIL(x,y) (((x) + (y) - 1) / (y))
 
 /* Data type for the expressions representing sizes of data types.
-   It is the first integer type laid out.
-   In C, this is int.  */
+   It is the first integer type laid out.  */
 
-tree sizetype_tab[2], sbitsizetype, ubitsizetype;
+struct sizetype_tab sizetype_tab;
 
 /* An integer constant with value 0 whose type is sizetype.  */
 
@@ -1103,14 +1102,14 @@ make_unsigned_type (precision)
   return type;
 }
 
-/* Set sizetype to TYPE, and initialize *bitsizetype accordingly.
+/* Set sizetype to TYPE, and initialize *sizetype accordingly.
    Also update the type of any standard type's sizes made so far.  */
 
 void
 set_sizetype (type)
      tree type;
 {
-  int precision = TYPE_PRECISION (type);
+  int oprecision = TYPE_PRECISION (type), precision;
 
   sizetype = type;
 
@@ -1124,18 +1123,32 @@ set_sizetype (type)
   if (! bitsizetype)
     bitsizetype = make_node (INTEGER_TYPE);
 
-  precision += BITS_PER_UNIT_LOG + 1;
+  precision = oprecision + BITS_PER_UNIT_LOG + 1;
   /* However, when cross-compiling from a 32 bit to a 64 bit host,
      we are limited to 64 bit precision.  */
   if (precision > 2 * HOST_BITS_PER_WIDE_INT)
     precision = 2 * HOST_BITS_PER_WIDE_INT;
   TYPE_PRECISION (bitsizetype) = precision;
-  (TREE_UNSIGNED (type) ? fixup_unsigned_type : fixup_signed_type)
-    (bitsizetype);
+  if (TREE_UNSIGNED (type))
+    fixup_unsigned_type (bitsizetype);
+  else
+    fixup_signed_type (bitsizetype);
   layout_type (bitsizetype);
 
-  sbitsizetype = make_signed_type (precision);
-  ubitsizetype = make_unsigned_type (precision);
+  if (TREE_UNSIGNED (type))
+    {
+      usizetype = sizetype;
+      ubitsizetype = bitsizetype;
+      ssizetype = make_signed_type (oprecision);
+      sbitsizetype = make_signed_type (precision);
+    }
+  else
+    {
+      ssizetype = sizetype;
+      sbitsizetype = bitsizetype;
+      usizetype = make_unsigned_type (oprecision);
+      ubitsizetype = make_unsigned_type (precision);
+    }
 }
 
 /* Set the extreme values of TYPE based on its precision in bits,
index 8fee5211230bbf66502230ce44310feaa526839d..667cab951c3c701eafeaef70c0b332e6daf381aa 100644 (file)
@@ -1435,9 +1435,21 @@ extern void put_pending_sizes            PROTO((tree));
    + (BITS_PER_UNIT > 8) + (BITS_PER_UNIT > 16) + (BITS_PER_UNIT > 32) \
    + (BITS_PER_UNIT > 64) + (BITS_PER_UNIT > 128) + (BITS_PER_UNIT > 256))
 
-extern tree sizetype_tab[2], sbitsizetype, ubitsizetype;
-#define sizetype sizetype_tab[0]
-#define bitsizetype sizetype_tab[1]
+struct sizetype_tab
+{
+  tree xsizetype, xbitsizetype;
+  tree ssizetype, usizetype;
+  tree sbitsizetype, ubitsizetype;
+};
+
+extern struct sizetype_tab sizetype_tab;
+
+#define sizetype sizetype_tab.xsizetype
+#define bitsizetype sizetype_tab.xbitsizetype
+#define ssizetype sizetype_tab.ssizetype
+#define usizetype sizetype_tab.usizetype
+#define sbitsizetype sizetype_tab.sbitsizetype
+#define ubitsizetype sizetype_tab.ubitsizetype
 
 /* If nonzero, an upper limit on alignment of structure fields, in bits. */
 extern int maximum_field_alignment;