This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH/RFC] Death to TREE_CONSTANT_OVERFLOW


The following pair of patches perform the major steps in obsoleting the
macro TREE_CONSTANT_OVERFLOW and its need for a bit in expression tree
nodes.  Currently, GCC maintains two "overflow" bits on each constant
expression tree node, TREE_OVERFLOW and TREE_CONSTANT_OVERFLOW.  The
difference in semantics between these two fields has historically been
used to track whether or not a diagnostic has been emitted by the C/C++
front-end.  After several years of effort to unify these fields, and with
the recent constant overflow warning patches by Manuel, we've now reached
the point that these two fields are completely synonymous, and there's no
longer any reason for the C front-end to maintain this aspect of state in
the middle-end's tree representation.  Indeed few middle-end contributors
fully understood the difference between TREE_CONSTANT_OVERFLOW and
TREE_OVERFLOW and examination of the source shows they've been used and
misused interchangeably.

Attached below are two patches, the first is a simple tweak to tree.h that
makes TREE_CONSTANT_OVERFLOW a synonym for TREE_OVERFLOW.  With this
change alone, i686-pc-linux-gnu can be fully bootstrapped, all default
languages including Ada, and regression tested with a top-level "make -k
check" with no new failures.  This demonstrates/confirms that the
distinction is no longer necessary, and serves as a "transition state"
whilst the tree is transitioned such that all uses of
TREE_CONSTANT_OVERFLOW are replaced with TREE_OVERFLOW.  Once this
transition is complete, the definition of TREE_CONSTANT_OVERFLOW can be
completely removed from tree.h.

To start the ball rolling, the second patch below does precisely this for
all uses of TREE_CONSTANT_OVERFLOW in the middle-end (the main users being
fold-const.c and builtins.c).  This patch has also been bootstrapped and
regression tested on i686-pc-linux-gnu, all languages including Ada, on
top of the first tree.h patch with no new failures.

Rather than commit both patches under my own authority without warning, I
thought it far more polite to propose these changes here to give folks a
"heads up", and the opportunity to complain or plan for this transition.
For the time being TREE_CONSTANT_OVERFLOW will still exist, so pending
branch merges and tree-ssa optimization passes that refer to it shouldn't
have a problem.  But ultimately, once all the front-ends have been weaned
this macro will disappear (possibly even poisoned).

Thoughts, comments or objections?  If there isn't a outcry, I propose to
commit both patches to mainline in a day or two.  If the C/C++ front-end
maintainers notice a problem on Plum-Hall or other testsuite not covered
by the dejagnu testsuite I'm happy to hold-off on this patch, until that
issue is resolved.  However, I don't expect a problem, as recent
improvements to our overflow diagnostics have made them better than
they've ever been.

Ok?


2007-01-09  Roger Sayle  <roger@eyesopen.com>

        * tree.h (TREE_CONSTANT_OVERFLOW): Obsolete.  For the time being,
        treat TREE_CONSTANT_OVERFLOW as a synonym of TREE_OVERFLOW.


2007-01-09  Roger Sayle  <roger@eyesopen.com>

        * 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,
        fold_builtin_object_size, 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.

Attachment: patchc.txt
Description: Text document

Attachment: patchc2.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]