2012-05-10 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 10 May 2012 07:58:27 +0000 (07:58 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 10 May 2012 07:58:27 +0000 (07:58 +0000)
ada/
* gcc-interface/cuintp.c (UI_From_gnu): Remove TYPE_IS_SIZETYPE use.

c-family/
* c-common.c (c_sizeof_or_alignof_type): Remove assert and
adjust commentary about TYPE_IS_SIZETYPE types.

* tree.h (TYPE_IS_SIZETYPE): Remove.
* fold-const.c (int_const_binop_1): Remove TYPE_IS_SIZETYPE use.
(extract_muldiv_1): Likewise.
* gimple.c (gtc_visit): Likewise.
(gimple_types_compatible_p): Likewise.
(iterative_hash_canonical_type): Likewise.
(gimple_canonical_types_compatible_p): Likewise.
* gimplify.c (gimplify_one_sizepos): Likewise.
* print-tree.c (print_node): Likewise.
* stor-layout.c (initialize_sizetypes): Do not set TYPE_IS_SIZETYPE.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@187363 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/ada/ChangeLog
gcc/ada/gcc-interface/cuintp.c
gcc/c-family/ChangeLog
gcc/c-family/c-common.c
gcc/fold-const.c
gcc/gimple.c
gcc/gimplify.c
gcc/print-tree.c
gcc/stor-layout.c
gcc/tree.h

index 40ff5a1..afe2c63 100644 (file)
@@ -1,3 +1,16 @@
+2012-05-10  Richard Guenther  <rguenther@suse.de>
+
+       * tree.h (TYPE_IS_SIZETYPE): Remove.
+       * fold-const.c (int_const_binop_1): Remove TYPE_IS_SIZETYPE use.
+       (extract_muldiv_1): Likewise.
+       * gimple.c (gtc_visit): Likewise.
+       (gimple_types_compatible_p): Likewise.
+       (iterative_hash_canonical_type): Likewise.
+       (gimple_canonical_types_compatible_p): Likewise.
+       * gimplify.c (gimplify_one_sizepos): Likewise.
+       * print-tree.c (print_node): Likewise.
+       * stor-layout.c (initialize_sizetypes): Do not set TYPE_IS_SIZETYPE.
+
 2012-05-09  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/52908
index fa564b1..d24810f 100644 (file)
@@ -1,3 +1,7 @@
+2012-05-10  Richard Guenther  <rguenther@suse.de>
+
+       * gcc-interface/cuintp.c (UI_From_gnu): Remove TYPE_IS_SIZETYPE use.
+
 2012-05-06  Tristan Gingold  <gingold@adacore.com>
 
        * gcc-interface/trans.c (gigi): Decorate reraise_zcx_decl.
index 31ed801..60cb26f 100644 (file)
@@ -177,10 +177,7 @@ UI_From_gnu (tree Input)
      in a signed 64-bit integer.  */
   if (host_integerp (Input, 0))
     return UI_From_Int (TREE_INT_CST_LOW (Input));
-  else if (TREE_INT_CST_HIGH (Input) < 0
-          && TYPE_UNSIGNED (gnu_type)
-          && !(TREE_CODE (gnu_type) == INTEGER_TYPE
-               && TYPE_IS_SIZETYPE (gnu_type)))
+  else if (TREE_INT_CST_HIGH (Input) < 0 && TYPE_UNSIGNED (gnu_type))
     return No_Uint;
 #endif
 
index 52a7f5c..f0e6147 100644 (file)
@@ -1,3 +1,8 @@
+2012-05-10  Richard Guenther  <rguenther@suse.de>
+
+       * c-common.c (c_sizeof_or_alignof_type): Remove assert and
+       adjust commentary about TYPE_IS_SIZETYPE types.
+
 2012-05-09  Manuel López-Ibáñez  <manu@gcc.gnu.org>
 
        PR c++/53261
index 1cdef9a..a5ddbee 100644 (file)
@@ -4539,12 +4539,10 @@ c_sizeof_or_alignof_type (location_t loc,
        value = size_int (TYPE_ALIGN_UNIT (type));
     }
 
-  /* VALUE will have an integer type with TYPE_IS_SIZETYPE set.
-     TYPE_IS_SIZETYPE means that certain things (like overflow) will
-     never happen.  However, this node should really have type
-     `size_t', which is just a typedef for an ordinary integer type.  */
+  /* VALUE will have the middle-end integer type sizetype.
+     However, we should really return a value of type `size_t',
+     which is just a typedef for an ordinary integer type.  */
   value = fold_convert_loc (loc, size_type_node, value);
-  gcc_assert (!TYPE_IS_SIZETYPE (TREE_TYPE (value)));
 
   return value;
 }
index 5bb75d4..c68db73 100644 (file)
@@ -940,8 +940,6 @@ int_const_binop_1 (enum tree_code code, const_tree arg1, const_tree arg2,
   tree t;
   tree type = TREE_TYPE (arg1);
   bool uns = TYPE_UNSIGNED (type);
-  bool is_sizetype
-    = (TREE_CODE (type) == INTEGER_TYPE && TYPE_IS_SIZETYPE (type));
   bool overflow = false;
 
   op1 = tree_to_double_int (arg1);
@@ -1077,7 +1075,7 @@ int_const_binop_1 (enum tree_code code, const_tree arg1, const_tree arg2,
     }
 
   t = force_fit_type_double (TREE_TYPE (arg1), res, overflowable,
-                            ((!uns || is_sizetype) && overflow)
+                            (!uns && overflow)
                             | TREE_OVERFLOW (arg1) | TREE_OVERFLOW (arg2));
 
   return t;
@@ -5639,8 +5637,6 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type,
          /* ... and has wrapping overflow, and its type is smaller
             than ctype, then we cannot pass through as widening.  */
          && ((TYPE_OVERFLOW_WRAPS (TREE_TYPE (op0))
-              && ! (TREE_CODE (TREE_TYPE (op0)) == INTEGER_TYPE
-                    && TYPE_IS_SIZETYPE (TREE_TYPE (op0)))
               && (TYPE_PRECISION (ctype)
                   > TYPE_PRECISION (TREE_TYPE (op0))))
              /* ... or this is a truncation (t is narrower than op0),
@@ -5818,7 +5814,6 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type,
         the operation since it will change the result if the original
         computation overflowed.  */
       if (TYPE_UNSIGNED (ctype)
-         && ! (TREE_CODE (ctype) == INTEGER_TYPE && TYPE_IS_SIZETYPE (ctype))
          && ctype != type)
        break;
 
@@ -5844,14 +5839,8 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type,
         (C * 8) % 4 since we know that's zero.  */
       if ((code == TRUNC_MOD_EXPR || code == CEIL_MOD_EXPR
           || code == FLOOR_MOD_EXPR || code == ROUND_MOD_EXPR)
-         /* If the multiplication can overflow we cannot optimize this.
-            ???  Until we can properly mark individual operations as
-            not overflowing we need to treat sizetype special here as
-            stor-layout relies on this opimization to make
-            DECL_FIELD_BIT_OFFSET always a constant.  */
-         && (TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (t))
-             || (TREE_CODE (TREE_TYPE (t)) == INTEGER_TYPE
-                 && TYPE_IS_SIZETYPE (TREE_TYPE (t))))
+         /* If the multiplication can overflow we cannot optimize this.  */
+         && TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (t))
          && TREE_CODE (TREE_OPERAND (t, 1)) == INTEGER_CST
          && integer_zerop (const_binop (TRUNC_MOD_EXPR, op1, c)))
        {
@@ -5893,16 +5882,11 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type,
                     (tree_to_double_int (c),
                      TYPE_PRECISION (ctype), TYPE_UNSIGNED (ctype)),
                   false, &overflow_p);
-         overflow_p = (((!TYPE_UNSIGNED (ctype)
-                         || (TREE_CODE (ctype) == INTEGER_TYPE
-                             && TYPE_IS_SIZETYPE (ctype)))
-                        && overflow_p)
+         overflow_p = ((!TYPE_UNSIGNED (ctype) && overflow_p)
                        | TREE_OVERFLOW (c) | TREE_OVERFLOW (op1));
          if (!double_int_fits_to_tree_p (ctype, mul)
              && ((TYPE_UNSIGNED (ctype) && tcode != MULT_EXPR)
-                 || !TYPE_UNSIGNED (ctype)
-                 || (TREE_CODE (ctype) == INTEGER_TYPE
-                     && TYPE_IS_SIZETYPE (ctype))))
+                 || !TYPE_UNSIGNED (ctype)))
            overflow_p = 1;
          if (!overflow_p)
            return fold_build2 (tcode, ctype, fold_convert (ctype, op0),
index e8841ec..79da12c 100644 (file)
@@ -3326,8 +3326,7 @@ gtc_visit (tree t1, tree t2,
        return false;
 
       if (TREE_CODE (t1) == INTEGER_TYPE
-         && (TYPE_IS_SIZETYPE (t1) != TYPE_IS_SIZETYPE (t2)
-             || TYPE_STRING_FLAG (t1) != TYPE_STRING_FLAG (t2)))
+         && TYPE_STRING_FLAG (t1) != TYPE_STRING_FLAG (t2))
        return false;
 
       /* That's all we need to check for float and fixed-point types.  */
@@ -3756,8 +3755,7 @@ gimple_types_compatible_p (tree t1, tree t2)
        return false;
 
       if (TREE_CODE (t1) == INTEGER_TYPE
-         && (TYPE_IS_SIZETYPE (t1) != TYPE_IS_SIZETYPE (t2)
-             || TYPE_STRING_FLAG (t1) != TYPE_STRING_FLAG (t2)))
+         && TYPE_STRING_FLAG (t1) != TYPE_STRING_FLAG (t2))
        return false;
 
       /* That's all we need to check for float and fixed-point types.  */
@@ -4206,10 +4204,7 @@ iterative_hash_canonical_type (tree type, hashval_t val)
 
   /* For integer types hash the types min/max values and the string flag.  */
   if (TREE_CODE (type) == INTEGER_TYPE)
-    {
-      v = iterative_hash_hashval_t (TYPE_STRING_FLAG (type), v);
-      v = iterative_hash_hashval_t (TYPE_IS_SIZETYPE (type), v);
-    }
+    v = iterative_hash_hashval_t (TYPE_STRING_FLAG (type), v);
 
   /* For array types hash their domain and the string flag.  */
   if (TREE_CODE (type) == ARRAY_TYPE
@@ -4425,8 +4420,7 @@ gimple_canonical_types_compatible_p (tree t1, tree t2)
        return false;
 
       if (TREE_CODE (t1) == INTEGER_TYPE
-         && (TYPE_IS_SIZETYPE (t1) != TYPE_IS_SIZETYPE (t2)
-             || TYPE_STRING_FLAG (t1) != TYPE_STRING_FLAG (t2)))
+         && TYPE_STRING_FLAG (t1) != TYPE_STRING_FLAG (t2))
        return false;
 
       /* For canonical type comparisons we do not want to build SCCs
index 74d7895..811fa22 100644 (file)
@@ -8098,7 +8098,7 @@ gimplify_type_sizes (tree type, gimple_seq *list_p)
 void
 gimplify_one_sizepos (tree *expr_p, gimple_seq *stmt_p)
 {
-  tree type, expr = *expr_p;
+  tree expr = *expr_p;
 
   /* We don't do anything if the value isn't there, is constant, or contains
      A PLACEHOLDER_EXPR.  We also don't want to do anything if it's already
@@ -8110,30 +8110,10 @@ gimplify_one_sizepos (tree *expr_p, gimple_seq *stmt_p)
       || CONTAINS_PLACEHOLDER_P (expr))
     return;
 
-  type = TREE_TYPE (expr);
   *expr_p = unshare_expr (expr);
 
   gimplify_expr (expr_p, stmt_p, NULL, is_gimple_val, fb_rvalue);
   expr = *expr_p;
-
-  /* Verify that we've an exact type match with the original expression.
-     In particular, we do not wish to drop a "sizetype" in favour of a
-     type of similar dimensions.  We don't want to pollute the generic
-     type-stripping code with this knowledge because it doesn't matter
-     for the bulk of GENERIC/GIMPLE.  It only matters that TYPE_SIZE_UNIT
-     and friends retain their "sizetype-ness".  */
-  if (TREE_TYPE (expr) != type
-      && TREE_CODE (type) == INTEGER_TYPE
-      && TYPE_IS_SIZETYPE (type))
-    {
-      tree tmp;
-      gimple stmt;
-
-      *expr_p = create_tmp_var (type, NULL);
-      tmp = build1 (NOP_EXPR, type, expr);
-      stmt = gimplify_assign (*expr_p, tmp, stmt_p);
-      gimple_set_location (stmt, EXPR_LOC_OR_HERE (expr));
-    }
 }
 
 /* Gimplify the body of statements of FNDECL and return a GIMPLE_BIND node
index 466b7db..28f51b0 100644 (file)
@@ -611,9 +611,6 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
           || code == QUAL_UNION_TYPE)
          && TYPE_NO_FORCE_BLK (node))
        fputs (" no-force-blk", file);
-      else if (code == INTEGER_TYPE
-              && TYPE_IS_SIZETYPE (node))
-       fputs (" sizetype", file);
 
       if (TYPE_STRING_FLAG (node))
        fputs (" string-flag", file);
index fb00b5f..842b506 100644 (file)
@@ -2479,12 +2479,10 @@ initialize_sizetypes (void)
   TYPE_NAME (sizetype) = get_identifier ("sizetype");
   TYPE_PRECISION (sizetype) = precision;
   TYPE_UNSIGNED (sizetype) = 1;
-  TYPE_IS_SIZETYPE (sizetype) = 1;
   bitsizetype = make_node (INTEGER_TYPE);
   TYPE_NAME (bitsizetype) = get_identifier ("bitsizetype");
   TYPE_PRECISION (bitsizetype) = bprecision;
   TYPE_UNSIGNED (bitsizetype) = 1;
-  TYPE_IS_SIZETYPE (bitsizetype) = 1;
 
   /* Now layout both types manually.  */
   SET_TYPE_MODE (sizetype, smallest_mode_for_size (precision, MODE_INT));
@@ -2505,10 +2503,8 @@ initialize_sizetypes (void)
   /* Create the signed variants of *sizetype.  */
   ssizetype = make_signed_type (TYPE_PRECISION (sizetype));
   TYPE_NAME (ssizetype) = get_identifier ("ssizetype");
-  TYPE_IS_SIZETYPE (ssizetype) = 1;
   sbitsizetype = make_signed_type (TYPE_PRECISION (bitsizetype));
   TYPE_NAME (sbitsizetype) = get_identifier ("sbitsizetype");
-  TYPE_IS_SIZETYPE (sbitsizetype) = 1;
 }
 \f
 /* TYPE is an integral type, i.e., an INTEGRAL_TYPE, ENUMERAL_TYPE
index 9d53a14..419d8f4 100644 (file)
@@ -2251,17 +2251,6 @@ extern enum machine_mode vector_type_mode (const_tree);
 #define TYPE_NO_FORCE_BLK(NODE) \
   (TYPE_CHECK (NODE)->type_common.no_force_blk_flag)
 
-/* In an INTEGER_TYPE, it means the type represents a size.  We use
-   this both for validity checking and to permit optimizations that
-   are unsafe for other types.  Note that the C `size_t' type should
-   *not* have this flag set.  The `size_t' type is simply a typedef
-   for an ordinary integer type that happens to be the type of an
-   expression returned by `sizeof'; `size_t' has no special
-   properties.  Expressions whose type have TYPE_IS_SIZETYPE set are
-   always actual sizes.  */
-#define TYPE_IS_SIZETYPE(NODE) \
-  (INTEGER_TYPE_CHECK (NODE)->type_common.no_force_blk_flag)
-
 /* Nonzero in a type considered volatile as a whole.  */
 #define TYPE_VOLATILE(NODE) (TYPE_CHECK (NODE)->base.volatile_flag)