From 535664e3ad516768f57ba0112323411554854745 Mon Sep 17 00:00:00 2001 From: sayle Date: Mon, 3 Apr 2006 03:07:40 +0000 Subject: [PATCH] * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@112633 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 13 +++++++++++++ gcc/builtins.c | 2 +- gcc/dojump.c | 4 ++-- gcc/emit-rtl.c | 8 +++++--- gcc/expr.h | 48 ++++++++++++++++++++++++------------------------ gcc/gimplify.c | 8 ++++---- gcc/tree-object-size.c | 4 ++-- gcc/tree-ssa-ccp.c | 6 +++--- gcc/varasm.c | 8 ++++---- 9 files changed, 58 insertions(+), 43 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c9f490232ca..dbe991a4166 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,18 @@ 2006-04-02 Roger Sayle + * 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 + 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. diff --git a/gcc/builtins.c b/gcc/builtins.c index c4200c236f6..763d5b2f34c 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -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); } diff --git a/gcc/dojump.c b/gcc/dojump.c index aa9c710f4b6..3be77a7dbe6 100644 --- a/gcc/dojump.c +++ b/gcc/dojump.c @@ -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; diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index eabf88f646d..9607bf69653 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -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); diff --git a/gcc/expr.h b/gcc/expr.h index c3e0b92e082..9ba5d4e7da9 100644 --- a/gcc/expr.h +++ b/gcc/expr.h @@ -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. */ diff --git a/gcc/gimplify.c b/gcc/gimplify.c index d95a18e3a35..797877ebf70 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -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; } diff --git a/gcc/tree-object-size.c b/gcc/tree-object-size.c index 068bacf4645..9c510bbc00f 100644 --- a/gcc/tree-object-size.c +++ b/gcc/tree-object-size.c @@ -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 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; diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index ae441fa3cc4..83dce72770b 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -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 Adapted to GIMPLE trees by Diego Novillo @@ -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. */ diff --git a/gcc/varasm.c b/gcc/varasm.c index 04fb52cebd3..2d8a6bfe81a 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -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. */ -- 2.11.0