builtins.c (dummy_object): Use build_int_cst instead of convert.
authorRoger Sayle <roger@eyesopen.com>
Mon, 3 Apr 2006 03:07:40 +0000 (03:07 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Mon, 3 Apr 2006 03:07:40 +0000 (03:07 +0000)
* builtins.c (dummy_object): Use build_int_cst instead of convert.
* tree-ssa-ccp.c (maybe_fold_stmt_addition): Use fold_convert
instead of convert.
* dojump.c (do_jump): Likewise.
* expr.h (ADD_PARM_SIZE, SUB_PARM_SIZE, ARGS_SIZE_TREE): Likewise.
* gimplify.c (gimple_boolify, gimplify_init_constructor,
gimplify_boolean_expr): Likewise.
* emit-rtl.c (set_mem_attributes_minus_bitpos): Likewise.
* varasm.c (array_size_for_constructor): Likewise.
* tree-object-size.c (compute_object_offset): Likewise.

From-SVN: r112633

gcc/ChangeLog
gcc/builtins.c
gcc/dojump.c
gcc/emit-rtl.c
gcc/expr.h
gcc/gimplify.c
gcc/tree-object-size.c
gcc/tree-ssa-ccp.c
gcc/varasm.c

index c9f4902..dbe991a 100644 (file)
@@ -1,5 +1,18 @@
 2006-04-02  Roger Sayle  <roger@eyesopen.com>
 
+       * builtins.c (dummy_object): Use build_int_cst instead of convert.
+       * tree-ssa-ccp.c (maybe_fold_stmt_addition): Use fold_convert
+       instead of convert.
+       * dojump.c (do_jump): Likewise.
+       * expr.h (ADD_PARM_SIZE, SUB_PARM_SIZE, ARGS_SIZE_TREE): Likewise.
+       * gimplify.c (gimple_boolify, gimplify_init_constructor,
+       gimplify_boolean_expr): Likewise.
+       * emit-rtl.c (set_mem_attributes_minus_bitpos): Likewise.
+       * varasm.c (array_size_for_constructor): Likewise.
+       * tree-object-size.c (compute_object_offset): Likewise.
+
+2006-04-02  Roger Sayle  <roger@eyesopen.com>
+
        PR middle-end/26977
        * expr.c (emit_group_store): Check whether simplify_gen_subreg returns
        NULL_RTX, indicating it couldn't create a valid paradoxical subreg.
index c4200c2..763d5b2 100644 (file)
@@ -4295,7 +4295,7 @@ build_va_arg_indirect_ref (tree addr)
 static tree
 dummy_object (tree type)
 {
-  tree t = convert (build_pointer_type (type), null_pointer_node);
+  tree t = build_int_cst (build_pointer_type (type), 0);
   return build1 (INDIRECT_REF, type, t);
 }
 
index aa9c710..3be77a7 100644 (file)
@@ -277,7 +277,7 @@ do_jump (tree exp, rtx if_false_label, rtx if_true_label)
           && (cmp_optab->handlers[(int) TYPE_MODE (type)].insn_code
               != CODE_FOR_nothing))
         {
-          do_jump (convert (type, exp), if_false_label, if_true_label);
+          do_jump (fold_convert (type, exp), if_false_label, if_true_label);
           break;
         }
       goto normal;
@@ -336,7 +336,7 @@ do_jump (tree exp, rtx if_false_label, rtx if_true_label)
             && (cmp_optab->handlers[(int) TYPE_MODE (type)].insn_code
                != CODE_FOR_nothing))
           {
-            do_jump (convert (type, exp), if_false_label, if_true_label);
+            do_jump (fold_convert (type, exp), if_false_label, if_true_label);
             break;
           }
         goto normal;
index eabf88f..9607bf6 100644 (file)
@@ -1,6 +1,7 @@
 /* Emit RTL for the GCC expander.
    Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+   Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -1596,8 +1597,9 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp,
                                     index, low_bound);
 
              off_tree = size_binop (PLUS_EXPR,
-                                    size_binop (MULT_EXPR, convert (sizetype,
-                                                                    index),
+                                    size_binop (MULT_EXPR,
+                                                fold_convert (sizetype,
+                                                              index),
                                                 unit_size),
                                     off_tree);
              t2 = TREE_OPERAND (t2, 0);
index c3e0b92..9ba5d4e 100644 (file)
@@ -29,8 +29,8 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
 #include "rtl.h"
 /* For optimize_size */
 #include "flags.h"
-/* For host_integerp, tree_low_cst, convert, size_binop, ssize_int, TREE_CODE,
-   TYPE_SIZE, int_size_in_bytes,    */
+/* For host_integerp, tree_low_cst, fold_convert, size_binop, ssize_int,
+   TREE_CODE, TYPE_SIZE, int_size_in_bytes,    */
 #include "tree.h"
 /* For GET_MODE_BITSIZE, word_mode */
 #include "machmode.h"
@@ -123,36 +123,36 @@ struct locate_and_pad_arg_data
 
 /* Add the value of the tree INC to the `struct args_size' TO.  */
 
-#define ADD_PARM_SIZE(TO, INC)                         \
-do {                                                   \
-  tree inc = (INC);                                    \
-  if (host_integerp (inc, 0))                          \
-    (TO).constant += tree_low_cst (inc, 0);            \
-  else if ((TO).var == 0)                              \
-    (TO).var = convert (ssizetype, inc);               \
-  else                                                 \
-    (TO).var = size_binop (PLUS_EXPR, (TO).var,                \
-                          convert (ssizetype, inc));   \
+#define ADD_PARM_SIZE(TO, INC)                                 \
+do {                                                           \
+  tree inc = (INC);                                            \
+  if (host_integerp (inc, 0))                                  \
+    (TO).constant += tree_low_cst (inc, 0);                    \
+  else if ((TO).var == 0)                                      \
+    (TO).var = fold_convert (ssizetype, inc);                  \
+  else                                                         \
+    (TO).var = size_binop (PLUS_EXPR, (TO).var,                        \
+                          fold_convert (ssizetype, inc));      \
 } while (0)
 
-#define SUB_PARM_SIZE(TO, DEC)                         \
-do {                                                   \
-  tree dec = (DEC);                                    \
-  if (host_integerp (dec, 0))                          \
-    (TO).constant -= tree_low_cst (dec, 0);            \
-  else if ((TO).var == 0)                              \
-    (TO).var = size_binop (MINUS_EXPR, ssize_int (0),  \
-                          convert (ssizetype, dec));   \
-  else                                                 \
-    (TO).var = size_binop (MINUS_EXPR, (TO).var,       \
-                          convert (ssizetype, dec));   \
+#define SUB_PARM_SIZE(TO, DEC)                                 \
+do {                                                           \
+  tree dec = (DEC);                                            \
+  if (host_integerp (dec, 0))                                  \
+    (TO).constant -= tree_low_cst (dec, 0);                    \
+  else if ((TO).var == 0)                                      \
+    (TO).var = size_binop (MINUS_EXPR, ssize_int (0),          \
+                          fold_convert (ssizetype, dec));      \
+  else                                                         \
+    (TO).var = size_binop (MINUS_EXPR, (TO).var,               \
+                          fold_convert (ssizetype, dec));      \
 } while (0)
 
 /* Convert the implicit sum in a `struct args_size' into a tree
    of type ssizetype.  */
 #define ARGS_SIZE_TREE(SIZE)                                   \
 ((SIZE).var == 0 ? ssize_int ((SIZE).constant)                 \
- : size_binop (PLUS_EXPR, convert (ssizetype, (SIZE).var),     \
+ : size_binop (PLUS_EXPR, fold_convert (ssizetype, (SIZE).var),        \
               ssize_int ((SIZE).constant)))
 
 /* Convert the implicit sum in a `struct args_size' into an rtx.  */
index d95a18e..797877e 100644 (file)
@@ -2340,7 +2340,7 @@ gimple_boolify (tree expr)
     default:
       /* Other expressions that get here must have boolean values, but
         might need to be converted to the appropriate mode.  */
-      return convert (boolean_type_node, expr);
+      return fold_convert (boolean_type_node, expr);
     }
 }
 
@@ -3042,7 +3042,7 @@ gimplify_init_constructor (tree *expr_p, tree *pre_p,
        i = VEC_index (constructor_elt, elts, 1)->value;
        if (r == NULL || i == NULL)
          {
-           tree zero = convert (TREE_TYPE (type), integer_zero_node);
+           tree zero = fold_convert (TREE_TYPE (type), integer_zero_node);
            if (r == NULL)
              r = zero;
            if (i == NULL)
@@ -3545,8 +3545,8 @@ gimplify_boolean_expr (tree *expr_p)
   tree type = TREE_TYPE (*expr_p);
 
   *expr_p = build3 (COND_EXPR, type, *expr_p,
-                   convert (type, boolean_true_node),
-                   convert (type, boolean_false_node));
+                   fold_convert (type, boolean_true_node),
+                   fold_convert (type, boolean_false_node));
 
   return GS_OK;
 }
index 068bacf..9c510bb 100644 (file)
@@ -1,5 +1,5 @@
 /* __builtin_object_size (ptr, object_size_type) computation
-   Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
    Contributed by Jakub Jelinek <jakub@redhat.com>
 
 This file is part of GCC.
@@ -134,7 +134,7 @@ compute_object_offset (tree expr, tree var)
          code = MINUS_EXPR;
          t = fold_build1 (NEGATE_EXPR, TREE_TYPE (t), t);
        }
-      t = convert (sizetype, t);
+      t = fold_convert (sizetype, t);
       off = size_binop (MULT_EXPR, TYPE_SIZE_UNIT (TREE_TYPE (expr)), t);
       break;
 
index ae441fa..83dce72 100644 (file)
@@ -1,5 +1,5 @@
 /* Conditional constant propagation pass for the GNU compiler.
-   Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005
+   Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006
    Free Software Foundation, Inc.
    Adapted from original RTL SSA-CCP by Daniel Berlin <dberlin@dberlin.org>
    Adapted to GIMPLE trees by Diego Novillo <dnovillo@redhat.com>
@@ -1879,7 +1879,7 @@ maybe_fold_stmt_addition (tree expr)
              if (TREE_CODE (min_idx) != INTEGER_CST)
                break;
 
-             array_idx = convert (TREE_TYPE (min_idx), array_idx);
+             array_idx = fold_convert (TREE_TYPE (min_idx), array_idx);
              if (!integer_zerop (min_idx))
                array_idx = int_const_binop (MINUS_EXPR, array_idx,
                                             min_idx, 0);
@@ -1887,7 +1887,7 @@ maybe_fold_stmt_addition (tree expr)
        }
 
       /* Convert the index to a byte offset.  */
-      array_idx = convert (sizetype, array_idx);
+      array_idx = fold_convert (sizetype, array_idx);
       array_idx = int_const_binop (MULT_EXPR, array_idx, elt_size, 0);
 
       /* Update the operands for the next round, or for folding.  */
index 04fb52c..2d8a6bf 100644 (file)
@@ -4137,7 +4137,7 @@ array_size_for_constructor (tree val)
 {
   tree max_index, i;
   unsigned HOST_WIDE_INT cnt;
-  tree index, value;
+  tree index, value, tmp;
 
   /* This code used to attempt to handle string constants that are not
      arrays of single-bytes, but nothing else does, so there's no point in
@@ -4158,9 +4158,9 @@ array_size_for_constructor (tree val)
     return 0;
 
   /* Compute the total number of array elements.  */
-  i = size_binop (MINUS_EXPR, convert (sizetype, max_index),
-                 convert (sizetype,
-                          TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (val)))));
+  tmp = TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (val)));
+  i = size_binop (MINUS_EXPR, fold_convert (sizetype, max_index),
+                 fold_convert (sizetype, tmp));
   i = size_binop (PLUS_EXPR, i, build_int_cst (sizetype, 1));
 
   /* Multiply by the array element unit size to find number of bytes.  */