From d95787e646b7b5f027d7f241707aa0f297949792 Mon Sep 17 00:00:00 2001 From: Roger Sayle Date: Sat, 13 Jan 2007 05:39:00 +0000 Subject: [PATCH] tree.h (force_fit_type_double): Remove unused final argument. * tree.h (force_fit_type_double): Remove unused final argument. * c-common.c (constant_expression_warning): Replace use of TREE_CONSTANT_OVERFLOW with TREE_OVERFLOW. (convert_and_check): Likewise. (shorten_compare): Update call to force_fit_type_double. (c_common_truthvalue_conversion) : Use integer_zerop. * convert.c (convert_to_pointer): Update call to force_fit_type_double. * fold-const.c (force_fit_type_double): Remove overflowed_const argument. (int_const_binop, fold_convert_const_int_from_int, fold_convert_const_int_from_real, fold_div_compare, fold_sign_changed_comparison, fold_unary, fold_negate_const, fold_abs_const, fold_not_const): Remove the final argument from calls to force_fit_type_double. From-SVN: r120746 --- gcc/ChangeLog | 18 ++++++++++++++++++ gcc/c-common.c | 18 ++++++------------ gcc/convert.c | 3 +-- gcc/fold-const.c | 46 +++++++++++++++++++--------------------------- gcc/tree.h | 4 ++-- 5 files changed, 46 insertions(+), 43 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a346e2c254f..17baae3bb98 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,21 @@ +2007-01-12 Roger Sayle + + * tree.h (force_fit_type_double): Remove unused final argument. + * c-common.c (constant_expression_warning): Replace use of + TREE_CONSTANT_OVERFLOW with TREE_OVERFLOW. + (convert_and_check): Likewise. + (shorten_compare): Update call to force_fit_type_double. + (c_common_truthvalue_conversion) : Use integer_zerop. + * convert.c (convert_to_pointer): Update call to + force_fit_type_double. + * fold-const.c (force_fit_type_double): Remove overflowed_const + argument. + (int_const_binop, fold_convert_const_int_from_int, + fold_convert_const_int_from_real, fold_div_compare, + fold_sign_changed_comparison, fold_unary, fold_negate_const, + fold_abs_const, fold_not_const): Remove the final argument from + calls to force_fit_type_double. + 2007-01-12 Andrew Pinski * configure.ac: Set insn to "nop" for spu-*-* also. diff --git a/gcc/c-common.c b/gcc/c-common.c index 217228df794..4b1718cd817 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -918,7 +918,7 @@ constant_expression_warning (tree value) if ((TREE_CODE (value) == INTEGER_CST || TREE_CODE (value) == REAL_CST || TREE_CODE (value) == VECTOR_CST || TREE_CODE (value) == COMPLEX_CST) - && TREE_CONSTANT_OVERFLOW (value) + && TREE_OVERFLOW (value) && warn_overflow && pedantic) pedwarn ("overflow in constant expression"); @@ -1257,11 +1257,8 @@ convert_and_check (tree type, tree expr) /* Do not diagnose overflow in a constant expression merely because a conversion overflowed. */ if (TREE_OVERFLOW (result)) - { - TREE_CONSTANT_OVERFLOW (result) = TREE_CONSTANT_OVERFLOW (expr); - TREE_OVERFLOW (result) = TREE_OVERFLOW (expr); - } - + TREE_OVERFLOW (result) = TREE_OVERFLOW (expr); + if (TYPE_UNSIGNED (type)) { /* This detects cases like converting -129 or 256 to @@ -2323,8 +2320,7 @@ shorten_compare (tree *op0_ptr, tree *op1_ptr, tree *restype_ptr, primop1 = force_fit_type_double (*restype_ptr, TREE_INT_CST_LOW (primop1), TREE_INT_CST_HIGH (primop1), 0, - TREE_OVERFLOW (primop1), - TREE_CONSTANT_OVERFLOW (primop1)); + TREE_OVERFLOW (primop1)); } if (type != *restype_ptr) { @@ -2685,10 +2681,8 @@ c_common_truthvalue_conversion (tree expr) return expr; case INTEGER_CST: - /* Avoid integer_zerop to ignore TREE_CONSTANT_OVERFLOW. */ - return (TREE_INT_CST_LOW (expr) != 0 || TREE_INT_CST_HIGH (expr) != 0) - ? truthvalue_true_node - : truthvalue_false_node; + return integer_zerop (expr) ? truthvalue_false_node + : truthvalue_true_node; case REAL_CST: return real_compare (NE_EXPR, &TREE_REAL_CST (expr), &dconst0) diff --git a/gcc/convert.c b/gcc/convert.c index 771401ead2d..b7d26ee3c0a 100644 --- a/gcc/convert.c +++ b/gcc/convert.c @@ -47,8 +47,7 @@ convert_to_pointer (tree type, tree expr) /* Propagate overflow to the NULL pointer. */ if (integer_zerop (expr)) - return force_fit_type_double (type, 0, 0, 0, TREE_OVERFLOW (expr), - false); + return force_fit_type_double (type, 0, 0, 0, TREE_OVERFLOW (expr)); switch (TREE_CODE (TREE_TYPE (expr))) { diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 3a3fe362116..2ae560fa3bd 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -1,6 +1,7 @@ /* Fold a constant sub-tree into a single node for C-compiler Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 + Free Software Foundation, Inc. This file is part of GCC. @@ -28,7 +29,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA @@ for cross-compilers. */ /* The entry points in this file are fold, size_int_wide, size_binop - and force_fit_type. + and force_fit_type_double. fold takes a tree as argument and returns a simplified tree. @@ -39,10 +40,10 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA size_int takes an integer value, and creates a tree constant with type from `sizetype'. - force_fit_type takes a constant, an overflowable flag and prior - overflow indicators. It forces the value to fit the type and sets - TREE_OVERFLOW as appropriate. - + force_fit_type_double takes a constant, an overflowable flag and a + prior overflow indicator. It forces the value to fit the type and + sets TREE_OVERFLOW. + Note: Since the folders get called on non-gimple code as well as gimple code, we need to handle GIMPLE tuples as well as their corresponding tree equivalents. */ @@ -281,7 +282,7 @@ fit_double_type (unsigned HOST_WIDE_INT l1, HOST_WIDE_INT h1, tree force_fit_type_double (tree type, unsigned HOST_WIDE_INT low, HOST_WIDE_INT high, int overflowable, - bool overflowed, bool overflowed_const) + bool overflowed) { int sign_extended_type; bool overflow; @@ -294,7 +295,7 @@ force_fit_type_double (tree type, unsigned HOST_WIDE_INT low, overflow = fit_double_type (low, high, &low, &high, type); /* If we need to set overflow flags, return a new unshared node. */ - if (overflowed || overflowed_const || overflow) + if (overflowed || overflow) { if (overflowed || overflowable < 0 @@ -1607,8 +1608,7 @@ int_const_binop (enum tree_code code, tree arg1, tree arg2, int notrunc) else t = force_fit_type_double (TREE_TYPE (arg1), low, hi, 1, ((!uns || is_sizetype) && overflow) - | TREE_OVERFLOW (arg1) | TREE_OVERFLOW (arg2), - false); + | TREE_OVERFLOW (arg1) | TREE_OVERFLOW (arg2)); return t; } @@ -1884,8 +1884,7 @@ fold_convert_const_int_from_int (tree type, tree arg1) (TREE_INT_CST_HIGH (arg1) < 0 && (TYPE_UNSIGNED (type) < TYPE_UNSIGNED (TREE_TYPE (arg1)))) - | TREE_OVERFLOW (arg1), - false); + | TREE_OVERFLOW (arg1)); return t; } @@ -1964,8 +1963,7 @@ fold_convert_const_int_from_real (enum tree_code code, tree type, tree arg1) REAL_VALUE_TO_INT (&low, &high, r); t = force_fit_type_double (type, low, high, -1, - overflow | TREE_OVERFLOW (arg1), - false); + overflow | TREE_OVERFLOW (arg1)); return t; } @@ -6143,7 +6141,7 @@ fold_div_compare (enum tree_code code, tree type, tree arg0, tree arg1) TREE_INT_CST_HIGH (arg1), &lpart, &hpart, unsigned_p); prod = force_fit_type_double (TREE_TYPE (arg00), lpart, hpart, - -1, overflow, false); + -1, overflow); neg_overflow = false; if (unsigned_p) @@ -6159,8 +6157,7 @@ fold_div_compare (enum tree_code code, tree type, tree arg0, tree arg1) TREE_INT_CST_HIGH (tmp), &lpart, &hpart, unsigned_p); hi = force_fit_type_double (TREE_TYPE (arg00), lpart, hpart, - -1, overflow | TREE_OVERFLOW (prod), - false); + -1, overflow | TREE_OVERFLOW (prod)); } else if (tree_int_cst_sgn (arg01) >= 0) { @@ -6596,8 +6593,7 @@ fold_sign_changed_comparison (enum tree_code code, tree type, if (TREE_CODE (arg1) == INTEGER_CST) arg1 = force_fit_type_double (inner_type, TREE_INT_CST_LOW (arg1), TREE_INT_CST_HIGH (arg1), 0, - TREE_OVERFLOW (arg1), - false); + TREE_OVERFLOW (arg1)); else arg1 = fold_convert (inner_type, arg1); @@ -7531,8 +7527,7 @@ fold_unary (enum tree_code code, tree type, tree op0) { tem = force_fit_type_double (type, TREE_INT_CST_LOW (and1), TREE_INT_CST_HIGH (and1), 0, - TREE_OVERFLOW (and1), - false); + TREE_OVERFLOW (and1)); return fold_build2 (BIT_AND_EXPR, type, fold_convert (type, and0), tem); } @@ -13045,8 +13040,7 @@ fold_negate_const (tree arg0, tree type) &low, &high); t = force_fit_type_double (type, low, high, 1, (overflow | TREE_OVERFLOW (arg0)) - && !TYPE_UNSIGNED (type), - false); + && !TYPE_UNSIGNED (type)); break; } @@ -13091,8 +13085,7 @@ fold_abs_const (tree arg0, tree type) TREE_INT_CST_HIGH (arg0), &low, &high); t = force_fit_type_double (type, low, high, -1, - overflow | TREE_OVERFLOW (arg0), - false); + overflow | TREE_OVERFLOW (arg0)); } break; @@ -13122,8 +13115,7 @@ fold_not_const (tree arg0, tree type) t = force_fit_type_double (type, ~TREE_INT_CST_LOW (arg0), ~TREE_INT_CST_HIGH (arg0), 0, - TREE_OVERFLOW (arg0), - false); + TREE_OVERFLOW (arg0)); return t; } diff --git a/gcc/tree.h b/gcc/tree.h index 6ba24abb71f..cbb47cc8489 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -1,6 +1,6 @@ /* Front-end tree definitions for GNU compiler. Copyright (C) 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of GCC. @@ -4315,7 +4315,7 @@ extern tree fold_abs_const (tree, tree); extern tree fold_indirect_ref_1 (tree, tree); extern tree force_fit_type_double (tree, unsigned HOST_WIDE_INT, HOST_WIDE_INT, - int, bool, bool); + int, bool); extern int fit_double_type (unsigned HOST_WIDE_INT, HOST_WIDE_INT, unsigned HOST_WIDE_INT *, HOST_WIDE_INT *, tree);