From f96bd2bfc1221ff6c2f2e1356e48147e0ff505bd Mon Sep 17 00:00:00 2001 From: sayle Date: Thu, 11 Jan 2007 16:03:10 +0000 Subject: [PATCH] * builtins.c (expand_builtin_pow, expand_builtin_powi, fold_builtin_cabs, fold_builtin_sqrt, fold_builtin_trunc, fold_builtin_floor, fold_builtin_ceil, fold_builtin_round, fold_builtin_int_int_roundingfn, fold_builtin_bitop, fold_builtin_bswap, real_constp, fold_builtin_pow, fold_builtin_powi, fold_builtin_signbit, fold_builtin_copysign, do_mpfr_arg1, do_mpfr_arg2, do_mpfr_arg3, do_mpfr_sincos): Replace uses of the macro TREE_CONSTANT_OVERFLOW with TREE_OVERFLOW. * convert.c (convert_to_pointer): Likewise. * expr.c (highest_pow2_factor, expand_expr_real_1): Likewise. * fold-const.c (force_fit_type, fold_negate_expr, int_const_binop, const_binop, fold_convert_const_int_from_int, fold_convert_const_int_from_real, fold_convert_const_real_from_real, sign_bit_p, optimize_minmax_comparison, extract_muldiv_1, fold_div_compare, fold_sign_changed_comparison, fold_unary, fold_comparison, fold_binary, multiple_of_p, tree_Expr_non_zero_p, fold_negate_const, fold_abs_const, fold_not_const): Likewise. * print-tree.c (print_node_brief, print_node): Likewise. * stor-layout.c (place_field, layout_type): Likewise. * tree-chrec.c (keep_cast): Likewise. * tree.c (build_vector, build_real, build_real_from_int_cst, build_complex): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120678 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 26 ++++++++++++++ gcc/builtins.c | 56 +++++++++++++++--------------- gcc/convert.c | 5 +-- gcc/expr.c | 8 ++--- gcc/fold-const.c | 101 +++++++++++++++++++----------------------------------- gcc/print-tree.c | 6 ++-- gcc/stor-layout.c | 6 ++-- gcc/tree-chrec.c | 7 ++-- gcc/tree.c | 16 +++------ 9 files changed, 110 insertions(+), 121 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 90cafb8..7b7a60a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,31 @@ 2007-01-11 Roger Sayle + * builtins.c (expand_builtin_pow, expand_builtin_powi, + fold_builtin_cabs, fold_builtin_sqrt, fold_builtin_trunc, + fold_builtin_floor, fold_builtin_ceil, fold_builtin_round, + fold_builtin_int_int_roundingfn, fold_builtin_bitop, + fold_builtin_bswap, real_constp, fold_builtin_pow, + fold_builtin_powi, fold_builtin_signbit, fold_builtin_copysign, + do_mpfr_arg1, do_mpfr_arg2, do_mpfr_arg3, do_mpfr_sincos): Replace + uses of the macro TREE_CONSTANT_OVERFLOW with TREE_OVERFLOW. + * convert.c (convert_to_pointer): Likewise. + * expr.c (highest_pow2_factor, expand_expr_real_1): Likewise. + * fold-const.c (force_fit_type, fold_negate_expr, int_const_binop, + const_binop, fold_convert_const_int_from_int, + fold_convert_const_int_from_real, + fold_convert_const_real_from_real, sign_bit_p, + optimize_minmax_comparison, extract_muldiv_1, fold_div_compare, + fold_sign_changed_comparison, fold_unary, fold_comparison, + fold_binary, multiple_of_p, tree_Expr_non_zero_p, + fold_negate_const, fold_abs_const, fold_not_const): Likewise. + * print-tree.c (print_node_brief, print_node): Likewise. + * stor-layout.c (place_field, layout_type): Likewise. + * tree-chrec.c (keep_cast): Likewise. + * tree.c (build_vector, build_real, build_real_from_int_cst, + build_complex): Likewise. + +2007-01-11 Roger Sayle + * tree.h (TREE_CONSTANT_OVERFLOW): Obsolete. For the time being, treat TREE_CONSTANT_OVERFLOW as a synonym of TREE_OVERFLOW. diff --git a/gcc/builtins.c b/gcc/builtins.c index ad85034..a823c6a 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -1,6 +1,7 @@ /* Expand builtin functions. Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 + Free Software Foundation, Inc. This file is part of GCC. @@ -2688,7 +2689,7 @@ expand_builtin_pow (tree exp, rtx target, rtx subtarget) arg1 = TREE_VALUE (TREE_CHAIN (arglist)); if (TREE_CODE (arg1) != REAL_CST - || TREE_CONSTANT_OVERFLOW (arg1)) + || TREE_OVERFLOW (arg1)) return expand_builtin_mathfn_2 (exp, target, subtarget); /* Handle constant exponents. */ @@ -2821,7 +2822,7 @@ expand_builtin_powi (tree exp, rtx target, rtx subtarget) /* Handle constant power. */ if (TREE_CODE (arg1) == INTEGER_CST - && ! TREE_CONSTANT_OVERFLOW (arg1)) + && !TREE_OVERFLOW (arg1)) { HOST_WIDE_INT n = TREE_INT_CST_LOW (arg1); @@ -7013,8 +7014,8 @@ fold_builtin_cabs (tree arglist, tree type, tree fndecl) && TREE_CODE (arg) == COMPLEX_CST && TREE_CODE (TREE_REALPART (arg)) == REAL_CST && TREE_CODE (TREE_IMAGPART (arg)) == REAL_CST - && ! TREE_CONSTANT_OVERFLOW (TREE_REALPART (arg)) - && ! TREE_CONSTANT_OVERFLOW (TREE_IMAGPART (arg))) + && !TREE_OVERFLOW (TREE_REALPART (arg)) + && !TREE_OVERFLOW (TREE_IMAGPART (arg))) { REAL_VALUE_TYPE r, i; @@ -7092,7 +7093,7 @@ fold_builtin_sqrt (tree arglist, tree type) /* Optimize sqrt of constant value. */ if (TREE_CODE (arg) == REAL_CST - && ! TREE_CONSTANT_OVERFLOW (arg)) + && !TREE_OVERFLOW (arg)) { REAL_VALUE_TYPE r, x; @@ -7441,7 +7442,7 @@ fold_builtin_trunc (tree fndecl, tree arglist) /* Optimize trunc of constant value. */ arg = TREE_VALUE (arglist); - if (TREE_CODE (arg) == REAL_CST && ! TREE_CONSTANT_OVERFLOW (arg)) + if (TREE_CODE (arg) == REAL_CST && !TREE_OVERFLOW (arg)) { REAL_VALUE_TYPE r, x; tree type = TREE_TYPE (TREE_TYPE (fndecl)); @@ -7467,7 +7468,7 @@ fold_builtin_floor (tree fndecl, tree arglist) /* Optimize floor of constant value. */ arg = TREE_VALUE (arglist); - if (TREE_CODE (arg) == REAL_CST && ! TREE_CONSTANT_OVERFLOW (arg)) + if (TREE_CODE (arg) == REAL_CST && !TREE_OVERFLOW (arg)) { REAL_VALUE_TYPE x; @@ -7506,7 +7507,7 @@ fold_builtin_ceil (tree fndecl, tree arglist) /* Optimize ceil of constant value. */ arg = TREE_VALUE (arglist); - if (TREE_CODE (arg) == REAL_CST && ! TREE_CONSTANT_OVERFLOW (arg)) + if (TREE_CODE (arg) == REAL_CST && !TREE_OVERFLOW (arg)) { REAL_VALUE_TYPE x; @@ -7537,7 +7538,7 @@ fold_builtin_round (tree fndecl, tree arglist) /* Optimize round of constant value. */ arg = TREE_VALUE (arglist); - if (TREE_CODE (arg) == REAL_CST && ! TREE_CONSTANT_OVERFLOW (arg)) + if (TREE_CODE (arg) == REAL_CST && !TREE_OVERFLOW (arg)) { REAL_VALUE_TYPE x; @@ -7569,7 +7570,7 @@ fold_builtin_int_roundingfn (tree fndecl, tree arglist) /* Optimize lround of constant value. */ arg = TREE_VALUE (arglist); - if (TREE_CODE (arg) == REAL_CST && ! TREE_CONSTANT_OVERFLOW (arg)) + if (TREE_CODE (arg) == REAL_CST && !TREE_OVERFLOW (arg)) { const REAL_VALUE_TYPE x = TREE_REAL_CST (arg); @@ -7637,7 +7638,7 @@ fold_builtin_bitop (tree fndecl, tree arglist) /* Optimize for constant argument. */ arg = TREE_VALUE (arglist); - if (TREE_CODE (arg) == INTEGER_CST && ! TREE_CONSTANT_OVERFLOW (arg)) + if (TREE_CODE (arg) == INTEGER_CST && !TREE_OVERFLOW (arg)) { HOST_WIDE_INT hi, width, result; unsigned HOST_WIDE_INT lo; @@ -7729,7 +7730,7 @@ fold_builtin_bswap (tree fndecl, tree arglist) /* Optimize constant value. */ arg = TREE_VALUE (arglist); - if (TREE_CODE (arg) == INTEGER_CST && ! TREE_CONSTANT_OVERFLOW (arg)) + if (TREE_CODE (arg) == INTEGER_CST && !TREE_OVERFLOW (arg)) { HOST_WIDE_INT hi, width, r_hi = 0; unsigned HOST_WIDE_INT lo, r_lo = 0; @@ -7786,7 +7787,7 @@ real_dconstp (tree expr, const REAL_VALUE_TYPE *value) STRIP_NOPS (expr); return ((TREE_CODE (expr) == REAL_CST - && ! TREE_CONSTANT_OVERFLOW (expr) + && !TREE_OVERFLOW (expr) && REAL_VALUES_EQUAL (TREE_REAL_CST (expr), *value)) || (TREE_CODE (expr) == COMPLEX_CST && real_dconstp (TREE_REALPART (expr), value) @@ -7968,7 +7969,7 @@ fold_builtin_pow (tree fndecl, tree arglist, tree type) return omit_one_operand (type, build_real (type, dconst1), arg1); if (TREE_CODE (arg1) == REAL_CST - && ! TREE_CONSTANT_OVERFLOW (arg1)) + && !TREE_OVERFLOW (arg1)) { REAL_VALUE_TYPE cint; REAL_VALUE_TYPE c; @@ -8027,7 +8028,7 @@ fold_builtin_pow (tree fndecl, tree arglist, tree type) { /* Attempt to evaluate pow at compile-time. */ if (TREE_CODE (arg0) == REAL_CST - && ! TREE_CONSTANT_OVERFLOW (arg0)) + && !TREE_OVERFLOW (arg0)) { REAL_VALUE_TYPE x; bool inexact; @@ -8131,7 +8132,7 @@ fold_builtin_powi (tree fndecl ATTRIBUTE_UNUSED, tree arglist, tree type) /* Evaluate powi at compile-time. */ if (TREE_CODE (arg0) == REAL_CST - && ! TREE_CONSTANT_OVERFLOW (arg0)) + && !TREE_OVERFLOW (arg0)) { REAL_VALUE_TYPE x; x = TREE_REAL_CST (arg0); @@ -8819,7 +8820,7 @@ fold_builtin_signbit (tree fndecl, tree arglist) /* If ARG is a compile-time constant, determine the result. */ if (TREE_CODE (arg) == REAL_CST - && !TREE_CONSTANT_OVERFLOW (arg)) + && !TREE_OVERFLOW (arg)) { REAL_VALUE_TYPE c; @@ -8861,8 +8862,8 @@ fold_builtin_copysign (tree fndecl, tree arglist, tree type) /* If ARG1 and ARG2 are compile-time constants, determine the result. */ if (TREE_CODE (arg1) == REAL_CST && TREE_CODE (arg2) == REAL_CST - && !TREE_CONSTANT_OVERFLOW (arg1) - && !TREE_CONSTANT_OVERFLOW (arg2)) + && !TREE_OVERFLOW (arg1) + && !TREE_OVERFLOW (arg2)) { REAL_VALUE_TYPE c1, c2; @@ -11739,7 +11740,7 @@ do_mpfr_arg1 (tree arg, tree type, int (*func)(mpfr_ptr, mpfr_srcptr, mp_rnd_t), /* To proceed, MPFR must exactly represent the target floating point format, which only happens when the target base equals two. */ if (REAL_MODE_FORMAT (TYPE_MODE (type))->b == 2 - && TREE_CODE (arg) == REAL_CST && ! TREE_CONSTANT_OVERFLOW (arg)) + && TREE_CODE (arg) == REAL_CST && !TREE_OVERFLOW (arg)) { const REAL_VALUE_TYPE *const ra = &TREE_REAL_CST (arg); @@ -11781,8 +11782,8 @@ do_mpfr_arg2 (tree arg1, tree arg2, tree type, /* To proceed, MPFR must exactly represent the target floating point format, which only happens when the target base equals two. */ if (REAL_MODE_FORMAT (TYPE_MODE (type))->b == 2 - && TREE_CODE (arg1) == REAL_CST && ! TREE_CONSTANT_OVERFLOW (arg1) - && TREE_CODE (arg2) == REAL_CST && ! TREE_CONSTANT_OVERFLOW (arg2)) + && TREE_CODE (arg1) == REAL_CST && !TREE_OVERFLOW (arg1) + && TREE_CODE (arg2) == REAL_CST && !TREE_OVERFLOW (arg2)) { const REAL_VALUE_TYPE *const ra1 = &TREE_REAL_CST (arg1); const REAL_VALUE_TYPE *const ra2 = &TREE_REAL_CST (arg2); @@ -11826,9 +11827,9 @@ do_mpfr_arg3 (tree arg1, tree arg2, tree arg3, tree type, /* To proceed, MPFR must exactly represent the target floating point format, which only happens when the target base equals two. */ if (REAL_MODE_FORMAT (TYPE_MODE (type))->b == 2 - && TREE_CODE (arg1) == REAL_CST && ! TREE_CONSTANT_OVERFLOW (arg1) - && TREE_CODE (arg2) == REAL_CST && ! TREE_CONSTANT_OVERFLOW (arg2) - && TREE_CODE (arg3) == REAL_CST && ! TREE_CONSTANT_OVERFLOW (arg3)) + && TREE_CODE (arg1) == REAL_CST && !TREE_OVERFLOW (arg1) + && TREE_CODE (arg2) == REAL_CST && !TREE_OVERFLOW (arg2) + && TREE_CODE (arg3) == REAL_CST && !TREE_OVERFLOW (arg3)) { const REAL_VALUE_TYPE *const ra1 = &TREE_REAL_CST (arg1); const REAL_VALUE_TYPE *const ra2 = &TREE_REAL_CST (arg2); @@ -11874,7 +11875,8 @@ do_mpfr_sincos (tree arg, tree arg_sinp, tree arg_cosp) /* To proceed, MPFR must exactly represent the target floating point format, which only happens when the target base equals two. */ if (REAL_MODE_FORMAT (TYPE_MODE (type))->b == 2 - && TREE_CODE (arg) == REAL_CST && ! TREE_CONSTANT_OVERFLOW (arg)) + && TREE_CODE (arg) == REAL_CST + && !TREE_OVERFLOW (arg)) { const REAL_VALUE_TYPE *const ra = &TREE_REAL_CST (arg); diff --git a/gcc/convert.c b/gcc/convert.c index 11d8492..771401e 100644 --- a/gcc/convert.c +++ b/gcc/convert.c @@ -1,6 +1,7 @@ /* Utility routines for data type conversion for GCC. Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1997, 1998, - 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 + Free Software Foundation, Inc. This file is part of GCC. @@ -47,7 +48,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), - TREE_CONSTANT_OVERFLOW (expr)); + false); switch (TREE_CODE (TREE_TYPE (expr))) { diff --git a/gcc/expr.c b/gcc/expr.c index 943a4c4..ec0306f 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -1,7 +1,7 @@ /* Convert tree expression to rtl instructions, for GNU compiler. Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, - Inc. + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 + Free Software Foundation, Inc. This file is part of GCC. @@ -6301,7 +6301,7 @@ highest_pow2_factor (tree exp) a MIN_EXPR, or a MAX_EXPR. If the constant overflows, we have an erroneous program, so return BIGGEST_ALIGNMENT to avoid any later ICE. */ - if (TREE_CONSTANT_OVERFLOW (exp)) + if (TREE_OVERFLOW (exp)) return BIGGEST_ALIGNMENT; else { @@ -6969,7 +6969,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, simplified by validate_replace_rtx during virtual register instantiation, which can result in unrecognizable insns. Avoid this by forcing all overflows into registers. */ - if (TREE_CONSTANT_OVERFLOW (exp) + if (TREE_OVERFLOW (exp) && modifier != EXPAND_INITIALIZER) temp = force_reg (mode, temp); diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 9f116b5..3a3fe36 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -41,7 +41,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 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 and TREE_CONSTANT_OVERFLOW as appropriate. + TREE_OVERFLOW as appropriate. 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 @@ -275,9 +275,6 @@ fit_double_type (unsigned HOST_WIDE_INT l1, HOST_WIDE_INT h1, OVERFLOWED is nonzero, or OVERFLOWABLE is >0 and signed overflow occurs or OVERFLOWABLE is <0 and any overflow occurs - We set TREE_CONSTANT_OVERFLOWED if, - CONST_OVERFLOWED is nonzero - or we set TREE_OVERFLOWED. We return a new tree node for the extended double-int. The node is shared if no overflow flags are set. */ @@ -308,18 +305,6 @@ force_fit_type_double (tree type, unsigned HOST_WIDE_INT low, TREE_INT_CST_HIGH (t) = high; TREE_TYPE (t) = type; TREE_OVERFLOW (t) = 1; - TREE_CONSTANT_OVERFLOW (t) = 1; - - return t; - } - else if (overflowed_const) - { - tree t = make_node (INTEGER_CST); - TREE_INT_CST_LOW (t) = low; - TREE_INT_CST_HIGH (t) = high; - TREE_TYPE (t) = type; - TREE_CONSTANT_OVERFLOW (t) = 1; - return t; } } @@ -1115,16 +1100,16 @@ fold_negate_expr (tree t) case INTEGER_CST: tem = fold_negate_const (t, type); - if (! TREE_OVERFLOW (tem) + if (!TREE_OVERFLOW (tem) || TYPE_UNSIGNED (type) - || ! flag_trapv) + || !flag_trapv) return tem; break; case REAL_CST: tem = fold_negate_const (t, type); /* Two's complement FP formats, such as c4x, may overflow. */ - if (! TREE_OVERFLOW (tem) || ! flag_trapping_math) + if (!TREE_OVERFLOW (tem) || !flag_trapping_math) return tem; break; @@ -1530,8 +1515,8 @@ int_const_binop (enum tree_code code, tree arg1, tree arg2, int notrunc) case EXACT_DIV_EXPR: /* This is a shortcut for a common special case. */ if (int2h == 0 && (HOST_WIDE_INT) int2l > 0 - && ! TREE_CONSTANT_OVERFLOW (arg1) - && ! TREE_CONSTANT_OVERFLOW (arg2) + && !TREE_OVERFLOW (arg1) + && !TREE_OVERFLOW (arg2) && int1h == 0 && (HOST_WIDE_INT) int1l >= 0) { if (code == CEIL_DIV_EXPR) @@ -1565,8 +1550,8 @@ int_const_binop (enum tree_code code, tree arg1, tree arg2, int notrunc) case FLOOR_MOD_EXPR: case CEIL_MOD_EXPR: /* This is a shortcut for a common special case. */ if (int2h == 0 && (HOST_WIDE_INT) int2l > 0 - && ! TREE_CONSTANT_OVERFLOW (arg1) - && ! TREE_CONSTANT_OVERFLOW (arg2) + && !TREE_OVERFLOW (arg1) + && !TREE_OVERFLOW (arg2) && int1h == 0 && (HOST_WIDE_INT) int1l >= 0) { if (code == CEIL_MOD_EXPR) @@ -1617,20 +1602,13 @@ int_const_binop (enum tree_code code, tree arg1, tree arg2, int notrunc) { t = copy_node (t); TREE_OVERFLOW (t) = 1; - TREE_CONSTANT_OVERFLOW (t) = 1; - } - else if (TREE_CONSTANT_OVERFLOW (arg1) | TREE_CONSTANT_OVERFLOW (arg2)) - { - t = copy_node (t); - TREE_CONSTANT_OVERFLOW (t) = 1; } } else t = force_fit_type_double (TREE_TYPE (arg1), low, hi, 1, ((!uns || is_sizetype) && overflow) | TREE_OVERFLOW (arg1) | TREE_OVERFLOW (arg2), - TREE_CONSTANT_OVERFLOW (arg1) - | TREE_CONSTANT_OVERFLOW (arg2)); + false); return t; } @@ -1731,10 +1709,6 @@ const_binop (enum tree_code code, tree arg1, tree arg2, int notrunc) t = build_real (type, result); TREE_OVERFLOW (t) = TREE_OVERFLOW (arg1) | TREE_OVERFLOW (arg2); - TREE_CONSTANT_OVERFLOW (t) - = TREE_OVERFLOW (t) - | TREE_CONSTANT_OVERFLOW (arg1) - | TREE_CONSTANT_OVERFLOW (arg2); return t; } @@ -1911,7 +1885,7 @@ fold_convert_const_int_from_int (tree type, tree arg1) && (TYPE_UNSIGNED (type) < TYPE_UNSIGNED (TREE_TYPE (arg1)))) | TREE_OVERFLOW (arg1), - TREE_CONSTANT_OVERFLOW (arg1)); + false); return t; } @@ -1991,7 +1965,7 @@ fold_convert_const_int_from_real (enum tree_code code, tree type, tree arg1) t = force_fit_type_double (type, low, high, -1, overflow | TREE_OVERFLOW (arg1), - TREE_CONSTANT_OVERFLOW (arg1)); + false); return t; } @@ -2008,8 +1982,6 @@ fold_convert_const_real_from_real (tree type, tree arg1) t = build_real (type, value); TREE_OVERFLOW (t) = TREE_OVERFLOW (arg1); - TREE_CONSTANT_OVERFLOW (t) - = TREE_OVERFLOW (t) | TREE_CONSTANT_OVERFLOW (arg1); return t; } @@ -3696,7 +3668,7 @@ sign_bit_p (tree exp, tree val) /* Tree VAL must be an integer constant. */ if (TREE_CODE (val) != INTEGER_CST - || TREE_CONSTANT_OVERFLOW (val)) + || TREE_OVERFLOW (val)) return NULL_TREE; width = TYPE_PRECISION (t); @@ -5347,9 +5319,9 @@ optimize_minmax_comparison (enum tree_code code, tree type, tree op0, tree op1) /* If something does not permit us to optimize, return the original tree. */ if ((op_code != MIN_EXPR && op_code != MAX_EXPR) || TREE_CODE (comp_const) != INTEGER_CST - || TREE_CONSTANT_OVERFLOW (comp_const) + || TREE_OVERFLOW (comp_const) || TREE_CODE (minmax_const) != INTEGER_CST - || TREE_CONSTANT_OVERFLOW (minmax_const)) + || TREE_OVERFLOW (minmax_const)) return NULL_TREE; /* Now handle all the various comparison codes. We only handle EQ_EXPR @@ -5526,7 +5498,7 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type) possible later conversion to our or some other type. */ if ((t2 = fold_convert (TREE_TYPE (op0), c)) != 0 && TREE_CODE (t2) == INTEGER_CST - && ! TREE_CONSTANT_OVERFLOW (t2) + && !TREE_OVERFLOW (t2) && (0 != (t1 = extract_muldiv (op0, t2, code, code == MULT_EXPR ? ctype : NULL_TREE)))) @@ -5587,7 +5559,7 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type) const_binop (LSHIFT_EXPR, size_one_node, op1, 0))) - && ! TREE_OVERFLOW (t1)) + && !TREE_OVERFLOW (t1)) return extract_muldiv (build2 (tcode == LSHIFT_EXPR ? MULT_EXPR : FLOOR_DIV_EXPR, ctype, fold_convert (ctype, op0), t1), @@ -5704,7 +5676,7 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type) if (tcode == code && 0 != (t1 = const_binop (MULT_EXPR, fold_convert (ctype, op1), fold_convert (ctype, c), 0)) - && ! TREE_OVERFLOW (t1)) + && !TREE_OVERFLOW (t1)) return fold_build2 (tcode, ctype, fold_convert (ctype, op0), t1); /* If these operations "cancel" each other, we have the main @@ -6188,7 +6160,7 @@ fold_div_compare (enum tree_code code, tree type, tree arg0, tree arg1) &lpart, &hpart, unsigned_p); hi = force_fit_type_double (TREE_TYPE (arg00), lpart, hpart, -1, overflow | TREE_OVERFLOW (prod), - TREE_CONSTANT_OVERFLOW (prod)); + false); } else if (tree_int_cst_sgn (arg01) >= 0) { @@ -6625,7 +6597,7 @@ fold_sign_changed_comparison (enum tree_code code, tree type, arg1 = force_fit_type_double (inner_type, TREE_INT_CST_LOW (arg1), TREE_INT_CST_HIGH (arg1), 0, TREE_OVERFLOW (arg1), - TREE_CONSTANT_OVERFLOW (arg1)); + false); else arg1 = fold_convert (inner_type, arg1); @@ -7560,7 +7532,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), - TREE_CONSTANT_OVERFLOW (and1)); + false); return fold_build2 (BIT_AND_EXPR, type, fold_convert (type, and0), tem); } @@ -8285,7 +8257,7 @@ fold_comparison (enum tree_code code, tree type, tree op0, tree op1) && 0 != (tem = const_binop (TREE_CODE (arg0) == PLUS_EXPR ? MINUS_EXPR : PLUS_EXPR, arg1, TREE_OPERAND (arg0, 1), 0)) - && ! TREE_CONSTANT_OVERFLOW (tem)) + && !TREE_OVERFLOW (tem)) return fold_build2 (code, type, TREE_OPERAND (arg0, 0), tem); /* Likewise, we can simplify a comparison of a real constant with @@ -8297,7 +8269,7 @@ fold_comparison (enum tree_code code, tree type, tree op0, tree op1) && TREE_CODE (TREE_OPERAND (arg0, 0)) == REAL_CST && 0 != (tem = const_binop (MINUS_EXPR, TREE_OPERAND (arg0, 0), arg1, 0)) - && ! TREE_CONSTANT_OVERFLOW (tem)) + && !TREE_OVERFLOW (tem)) return fold_build2 (swap_tree_comparison (code), type, TREE_OPERAND (arg0, 1), tem); @@ -9541,7 +9513,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1) tree arg11 = TREE_VALUE (TREE_CHAIN (TREE_OPERAND (arg1, 1))); if (TREE_CODE (arg11) == REAL_CST - && ! TREE_CONSTANT_OVERFLOW (arg11) + && !TREE_OVERFLOW (arg11) && operand_equal_p (arg0, arg10, 0)) { tree powfn = TREE_OPERAND (TREE_OPERAND (arg1, 0), 0); @@ -9566,7 +9538,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1) tree arg01 = TREE_VALUE (TREE_CHAIN (TREE_OPERAND (arg0, 1))); if (TREE_CODE (arg01) == REAL_CST - && ! TREE_CONSTANT_OVERFLOW (arg01) + && !TREE_OVERFLOW (arg01) && operand_equal_p (arg1, arg00, 0)) { tree powfn = TREE_OPERAND (TREE_OPERAND (arg0, 0), 0); @@ -10208,7 +10180,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1) tree arg00 = TREE_VALUE (TREE_OPERAND (arg0, 1)); tree arg01 = TREE_VALUE (TREE_CHAIN (TREE_OPERAND (arg0, 1))); if (TREE_CODE (arg01) == REAL_CST - && ! TREE_CONSTANT_OVERFLOW (arg01) + && !TREE_OVERFLOW (arg01) && operand_equal_p (arg1, arg00, 0)) { tree powfn = TREE_OPERAND (TREE_OPERAND (arg0, 0), 0); @@ -10367,7 +10339,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1) if (code == TRUNC_MOD_EXPR && !TYPE_UNSIGNED (type) && TREE_CODE (arg1) == INTEGER_CST - && !TREE_CONSTANT_OVERFLOW (arg1) + && !TREE_OVERFLOW (arg1) && TREE_INT_CST_HIGH (arg1) < 0 && !flag_trapv /* Avoid this transformation if C is INT_MIN, i.e. C == -C. */ @@ -10781,7 +10753,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1) ? MINUS_EXPR : PLUS_EXPR, fold_convert (TREE_TYPE (arg0), arg1), TREE_OPERAND (arg0, 1), 0)) - && ! TREE_CONSTANT_OVERFLOW (tem)) + && !TREE_OVERFLOW (tem)) return fold_build2 (code, type, TREE_OPERAND (arg0, 0), tem); /* Similarly for a NEGATE_EXPR. */ @@ -10789,7 +10761,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1) && TREE_CODE (arg1) == INTEGER_CST && 0 != (tem = negate_expr (arg1)) && TREE_CODE (tem) == INTEGER_CST - && ! TREE_CONSTANT_OVERFLOW (tem)) + && !TREE_OVERFLOW (tem)) return fold_build2 (code, type, TREE_OPERAND (arg0, 0), tem); /* Similarly for a BIT_XOR_EXPR; X ^ C1 == C2 is X == (C1 ^ C2). */ @@ -11293,7 +11265,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1) unsigned int width = TYPE_PRECISION (arg1_type); if (TREE_CODE (arg1) == INTEGER_CST - && ! TREE_CONSTANT_OVERFLOW (arg1) + && !TREE_OVERFLOW (arg1) && width <= 2 * HOST_BITS_PER_WIDE_INT && (INTEGRAL_TYPE_P (arg1_type) || POINTER_TYPE_P (arg1_type))) { @@ -11452,7 +11424,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1) && ! TREE_SIDE_EFFECTS (arg0) && (0 != (tem = negate_expr (arg1))) && TREE_CODE (tem) == INTEGER_CST - && ! TREE_CONSTANT_OVERFLOW (tem)) + && !TREE_OVERFLOW (tem)) return fold_build2 (TRUTH_ANDIF_EXPR, type, build2 (GE_EXPR, type, TREE_OPERAND (arg0, 0), tem), @@ -12516,7 +12488,7 @@ multiple_of_p (tree type, tree top, tree bottom) const_binop (LSHIFT_EXPR, size_one_node, op1, 0))) - && ! TREE_OVERFLOW (t1)) + && !TREE_OVERFLOW (t1)) return multiple_of_p (type, t1, bottom); } return 0; @@ -12872,10 +12844,7 @@ tree_expr_nonzero_p (tree t) return tree_expr_nonzero_p (TREE_OPERAND (t, 0)); case INTEGER_CST: - /* We used to test for !integer_zerop here. This does not work correctly - if TREE_CONSTANT_OVERFLOW (t). */ - return (TREE_INT_CST_LOW (t) != 0 - || TREE_INT_CST_HIGH (t) != 0); + return !integer_zerop (t); case PLUS_EXPR: if (!TYPE_UNSIGNED (type) && !flag_wrapv) @@ -13077,7 +13046,7 @@ fold_negate_const (tree arg0, tree type) t = force_fit_type_double (type, low, high, 1, (overflow | TREE_OVERFLOW (arg0)) && !TYPE_UNSIGNED (type), - TREE_CONSTANT_OVERFLOW (arg0)); + false); break; } @@ -13123,7 +13092,7 @@ fold_abs_const (tree arg0, tree type) &low, &high); t = force_fit_type_double (type, low, high, -1, overflow | TREE_OVERFLOW (arg0), - TREE_CONSTANT_OVERFLOW (arg0)); + false); } break; @@ -13154,7 +13123,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), - TREE_CONSTANT_OVERFLOW (arg0)); + false); return t; } diff --git a/gcc/print-tree.c b/gcc/print-tree.c index a73247d..ab4ae60 100644 --- a/gcc/print-tree.c +++ b/gcc/print-tree.c @@ -1,6 +1,6 @@ /* Prints out tree in human readable form - GCC Copyright (C) 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of GCC. @@ -115,7 +115,7 @@ print_node_brief (FILE *file, const char *prefix, tree node, int indent) /* We might as well always print the value of an integer or real. */ if (TREE_CODE (node) == INTEGER_CST) { - if (TREE_CONSTANT_OVERFLOW (node)) + if (TREE_OVERFLOW (node)) fprintf (file, " overflow"); fprintf (file, " "); @@ -701,7 +701,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent) switch (TREE_CODE (node)) { case INTEGER_CST: - if (TREE_CONSTANT_OVERFLOW (node)) + if (TREE_OVERFLOW (node)) fprintf (file, " overflow"); fprintf (file, " "); diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index c1c81c3..313d169 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -1,6 +1,6 @@ /* C-compiler utilities for types and variables storage layout Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1996, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of GCC. @@ -1195,7 +1195,7 @@ place_field (record_layout_info rli, tree field) if (DECL_SIZE (field) == 0) /* Do nothing. */; else if (TREE_CODE (DECL_SIZE (field)) != INTEGER_CST - || TREE_CONSTANT_OVERFLOW (DECL_SIZE (field))) + || TREE_OVERFLOW (DECL_SIZE (field))) { rli->offset = size_binop (PLUS_EXPR, rli->offset, @@ -1821,7 +1821,7 @@ layout_type (tree type) && TREE_CODE (TYPE_SIZE_UNIT (element)) == INTEGER_CST /* If TYPE_SIZE_UNIT overflowed, then it is certainly larger than TYPE_ALIGN_UNIT. */ - && !TREE_CONSTANT_OVERFLOW (TYPE_SIZE_UNIT (element)) + && !TREE_OVERFLOW (TYPE_SIZE_UNIT (element)) && !integer_zerop (TYPE_SIZE_UNIT (element)) && compare_tree_int (TYPE_SIZE_UNIT (element), TYPE_ALIGN_UNIT (element)) < 0) diff --git a/gcc/tree-chrec.c b/gcc/tree-chrec.c index 01d0bf9..66738d3 100644 --- a/gcc/tree-chrec.c +++ b/gcc/tree-chrec.c @@ -1,5 +1,5 @@ /* Chains of recurrences. - Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Contributed by Sebastian Pop This file is part of GCC. @@ -1293,10 +1293,7 @@ keep_cast: /* Don't propagate overflows. */ if (CONSTANT_CLASS_P (res)) - { - TREE_CONSTANT_OVERFLOW (res) = 0; - TREE_OVERFLOW (res) = 0; - } + TREE_OVERFLOW (res) = 0; /* But reject constants that don't fit in their type after conversion. This can happen if TYPE_MIN_VALUE or TYPE_MAX_VALUE are not the diff --git a/gcc/tree.c b/gcc/tree.c index a3577c4..ea462f0 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -1,6 +1,6 @@ /* Language-independent node constructors for parse phase of GNU compiler. Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of GCC. @@ -997,7 +997,7 @@ tree build_vector (tree type, tree vals) { tree v = make_node (VECTOR_CST); - int over1 = 0, over2 = 0; + int over = 0; tree link; TREE_VECTOR_CST_ELTS (v) = vals; @@ -1012,13 +1012,10 @@ build_vector (tree type, tree vals) if (!CONSTANT_CLASS_P (value)) continue; - over1 |= TREE_OVERFLOW (value); - over2 |= TREE_CONSTANT_OVERFLOW (value); + over |= TREE_OVERFLOW (value); } - TREE_OVERFLOW (v) = over1; - TREE_CONSTANT_OVERFLOW (v) = over2; - + TREE_OVERFLOW (v) = over; return v; } @@ -1115,7 +1112,7 @@ build_real (tree type, REAL_VALUE_TYPE d) TREE_TYPE (v) = type; TREE_REAL_CST_PTR (v) = dp; - TREE_OVERFLOW (v) = TREE_CONSTANT_OVERFLOW (v) = overflow; + TREE_OVERFLOW (v) = overflow; return v; } @@ -1149,7 +1146,6 @@ build_real_from_int_cst (tree type, tree i) v = build_real (type, real_value_from_int_cst (type, i)); TREE_OVERFLOW (v) |= overflow; - TREE_CONSTANT_OVERFLOW (v) |= overflow; return v; } @@ -1198,8 +1194,6 @@ build_complex (tree type, tree real, tree imag) TREE_IMAGPART (t) = imag; TREE_TYPE (t) = type ? type : build_complex_type (TREE_TYPE (real)); TREE_OVERFLOW (t) = TREE_OVERFLOW (real) | TREE_OVERFLOW (imag); - TREE_CONSTANT_OVERFLOW (t) - = TREE_CONSTANT_OVERFLOW (real) | TREE_CONSTANT_OVERFLOW (imag); return t; } -- 2.7.4