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]

Re: [RFC][4.4] Conversion of tree.h STRIP_* macros into static inline functions


On Dec 11, 2007 8:47 PM, Simon Baldwin <simonb@google.com> wrote:
> The attached file, gzipped because it exceeds 100Kb, is a patch that
> converts tree.h STRIP_* macros into static inline functions.  The patch
> diff assumes that
>
>   http://gcc.gnu.org/ml/gcc-patches/2007-11/msg01675.html
>
> has been applied to revision 130472 trunk or similar, but doesn't
> actually rely on any of that reorganization patch.  It should, then,
> apply to an unreorganized tree.h, albeit with considerable fuzz.
>
> Inlined below is the patch's introductory text and first file diff.
>
> ----------
>
> Turn assorted STRIP_* operations in tree.h from macros into inline
> functions, allowing for better type safety and debuggability with gdb,
> and for more natural usage from some client code.  Fix call sites as
> appropriate.
>
> This is a maintainability patch, with no runtime effects.  Targetted for
> gcc 4.4, rather than 4.3.
>
> Tested with bootstrap and regression tests for C and C++ on linux i386.

Middle-end changes require bootstrapping and testing all default languages
which include Fortran, ObjC and Java.  I would even say you should add Ada
to that mix.  (You also changed languages that you didn't bootstrap /
test after all)

Richard.

> gcc/Changelog
> 2007-12-07  Simon Baldwin  <simonb@google.com>
>
>         * tree-flow.h (tree_ssa_useless_type_conversion,
>         useless_type_conversion_p): Added const-correctness to arguments.
>         * tree-ssa.c (tree_ssa_useless_type_conversion,
>         useless_type_conversion_p, useless_type_conversion_p_1): Ditto; also
>         added temporary TREE_CONST_CAST to arguments passed to lang hooks.
>         * tree.h (STRIP_NOPS): Converted from macro to inline function.
>         (STRIP_SIGN_NOPS): Ditto.
>         (STRIP_TYPE_NOPS): Ditto.
>         (SSTRIP_USELESS_TYPE_CONVERSION): Ditto.
>         * alias.c (get_alias_set): Update call site(s) for STRIP_NOPS,
>         STRIP_SIGN_NOPS, STRIP_TYPE_NOPS, and STRIP_USELESS_TYPE_CONVERSION.
>         * builtins.c (c_strlen): Ditto.
>         (expand_builtin_memmove_args): Ditto.
>         (fold_builtin_constant_p): Ditto.
>         (fold_builtin_expect): Ditto.
>         (fold_builtin_cabs): Ditto.
>         (fold_builtin_bswap): Ditto.
>         (fold_builtin_memset): Ditto.
>         (fold_builtin_memory_op): Ditto.
>         (fold_builtin_logb): Ditto.
>         (fold_builtin_significand): Ditto.
>         (fold_builtin_frexp): Ditto.
>         (fold_builtin_load_exponent): Ditto.
>         (fold_builtin_modf): Ditto.
>         (default_expand_builtin): Ditto.
>         (expand_builtin_object_size): Ditto.
>         (expand_builtin_memory_chk): Ditto.
>         (fold_builtin_object_size): Ditto.
>         (do_mpfr_arg1): Ditto.
>         (do_mpfr_arg2): Ditto.
>         (do_mpfr_arg3): Ditto.
>         (do_mpfr_sincos): Ditto.
>         (do_mpfr_bessel_n): Ditto.
>         (do_mpfr_remquo): Ditto.
>         (do_mpfr_lgamma_r): Ditto.
>         * c-common.c (check_case_value): Ditto.
>         * c-decl.c (grokdeclarator): Ditto.
>         * c-format.c (check_format_arg): Ditto.
>         (check_format_types): Ditto.
>         * c-typeck.c (array_to_pointer_conversion): Ditto.
>         (function_to_pointer_conversion): Ditto.
>         (default_function_array_conversion): Ditto.
>         (default_conversion): Ditto.
>         (build_function_call): Ditto.
>         (convert_arguments): Ditto.
>         (build_modify_expr): Ditto.
>         (convert_for_assignment): Ditto.
>         (store_init_value): Ditto.
>         (digest_init): Ditto.
>         (build_asm_expr): Ditto.
>         (build_binary_op): Ditto.
>         * except.c (output_ttype): Ditto.
>         * expr.c (optimize_bitfield_assignment_op): Ditto.
>         (string_constant): Ditto.
>         (do_store_flag): Ditto.
>         * fold-const.c (negate_expr_p): Ditto.
>         (negate_expr): Ditto.
>         (split_tree): Ditto.
>         (const_binop): Ditto.
>         (operand_equal_p): Ditto.
>         (operand_equal_for_comparison_p): Ditto.
>         (decode_field_reference): Ditto.
>         (range_binop): Ditto.
>         (fold_cond_expr_with_comparison): Ditto.
>         (optimize_minmax_comparison): Ditto.
>         (reorder_operands_p): Ditto.
>         (try_move_mult_to_index): Ditto.
>         (fold_unary): Ditto.
>         (fold_comparison): Ditto.
>         (get_pointer_modulus_and_residue): Ditto.
>         (fold_binary): Ditto.
>         (fold_ternary): Ditto.
>         (fold_build_cleanup_point_expr): Ditto.
>         (fold_indirect_ref_1): Ditto.
>         * gimplify.c (get_name): Ditto.
>         (gimplify_conversion): Ditto.
>         (gimplify_compound_lval): Ditto.
>         (gimplify_expr): Ditto.
>         * omp-low.c (expand_omp_parallel): Ditto.
>         * tree-affine.c (tree_to_aff_combination): Ditto.
>         * tree-cfg.c (gimplify_build3): Ditto.
>         (gimplify_build2): Ditto.
>         (gimplify_build1): Ditto.
>         * tree-complex.c (expand_complex_div_wide): Ditto.
>         * tree-data-ref.c (split_constant_offset): Ditto.
>         (canonicalize_base_object_address): Ditto.
>         * tree-dfa.c (remove_referenced_var): Ditto.
>         (get_ref_base_and_extent): Ditto.
>         * tree-inline.c (copy_body_r): Ditto.
>         (setup_one_parameter): Ditto.
>         (declare_return_variable): Ditto.
>         * tree-object-size.c (collect_object_sizes_for): Ditto.
>         (check_for_plus_in_loops_1): Ditto.
>         (check_for_plus_in_loops): Ditto.
>         * tree-scalar-evolution.c (follow_ssa_edge_in_rhs): Ditto.
>         * tree-sra.c (generate_element_init_1): Ditto.
>         * tree-ssa-ccp.c (maybe_fold_offset_to_reference): Ditto.
>         (maybe_fold_stmt_indirect): Ditto.
>         (get_maxval_strlen): Ditto.
>         (ccp_fold_builtin): Ditto.
>         (fold_stmt): Ditto.
>         (fold_stmt_inplace): Ditto.
>         * tree-ssa-dom.c (record_equivalences_from_stmt): Ditto.
>         * tree-ssa-loop-ivopts.c (strip_offset_1): Ditto.
>         (constant_multiple_of): Ditto.
>         (force_expr_to_var_cost): Ditto.
>         (difference_cost): Ditto.
>         * tree-ssa-loop-niter.c (refine_bounds_using_guard): Ditto.
>         (bound_difference): Ditto.
>         * tree-ssa-pre.c (phi_translate_1): Ditto.
>         (make_values_for_stmt): Ditto.
>         * tree-ssa-propagate.c (stmt_makes_single_load): Ditto.
>         (stmt_makes_single_store): Ditto.
>         * tree-ssa-sccvn.c (simplify_unary_expression): Ditto.
>         (visit_use): Ditto.
>         * tree-ssa-structalias.c (find_func_aliases): Ditto.
>         * tree-ssa.c (delete_tree_ssa): Ditto.
>         (useless_type_conversion_p_1): Ditto.
>         (types_compatible_p): Ditto.
>         * tree-tailcall.c (process_assignment): Ditto.
>         (find_tail_calls): Ditto.
>         * tree-vect-analyze.c (vect_equal_offsets): Ditto.
>         * tree-vrp.c (compare_values_warnv): Ditto.
>         * tree.c (make_tree_vec_stat): Ditto.
>         (integer_zerop): Ditto.
>         (integer_all_onesp): Ditto.
>         (integer_pow2p): Ditto.
>         (tree_log2): Ditto.
>         (tree_floor_log2): Ditto.
>         (real_zerop): Ditto.
>         (real_onep): Ditto.
>         (real_twop): Ditto.
>         (get_callee_fndecl): Ditto.
>         (initializer_zerop): Ditto.
>         * varasm.c (output_constructor): Ditto.
>
> gcc/ada/Changelog
> 2007-12-07  Simon Baldwin  <simonb@google.com>
>
>         * utils.c (split_plus): Update call site(s) for STRIP_NOPS,
>         STRIP_SIGN_NOPS, STRIP_TYPE_NOPS, and STRIP_USELESS_TYPE_CONVERSION.
>
> gcc/config/Changelog
> 2007-12-07  Simon Baldwin  <simonb@google.com>
>
>         * rs6000/rs6000.c (rs6000_expand_binop_builtin): Update call site(s)
>         for STRIP_NOPS, STRIP_SIGN_NOPS, STRIP_TYPE_NOPS, and
>         STRIP_USELESS_TYPE_CONVERSION.
>         (rs6000_expand_ternop_builtin): Ditto.
>         (altivec_expand_dst_builtin): Ditto.
>         (altivec_expand_builtin): Ditto.
>         * sparc/sparc.c (sparc_fold_builtin): Ditto.
>
> gcc/cp/Changelog
> 2007-12-07  Simon Baldwin  <simonb@google.com>
>
>         * call.c (null_ptr_cst_p): Update call site(s) for STRIP_NOPS,
>         STRIP_SIGN_NOPS, STRIP_TYPE_NOPS, and STRIP_USELESS_TYPE_CONVERSION.
>         * class.c (check_bitfield_decl): Ditto.
>         * decl.c (compute_array_index_type): Ditto.
>         (build_enumerator): Ditto.
>         * decl2.c (mark_vtable_entries): Ditto.
>         (constrain_visibility_for_template): Ditto.
>         * pt.c (convert_nontype_argument): Ditto.
>         * semantics.c (finish_asm_stmt): Ditto.
>         * tree.c (handle_init_priority_attribute): Ditto.
>         * typeck.c (string_conv_p): Ditto.
>         (build_binary_op): Ditto.
>         (build_reinterpret_cast_1): Ditto.
>
> gcc/fortran/Changelog
> 2007-12-07  Simon Baldwin  <simonb@google.com>
>
>         * trans-array.c (gfc_array_allocate): Update call site(s) for
>         STRIP_NOPS, STRIP_SIGN_NOPS, STRIP_TYPE_NOPS, and
>         STRIP_USELESS_TYPE_CONVERSION.
>         (gfc_array_deallocate): Ditto.
>         (gfc_trans_dealloc_allocated): Ditto.
>         * trans-expr.c (gfc_conv_expr_reference): Ditto.
>         * trans-intrinsic.c (gfc_conv_intrinsic_isnan): Ditto.
>         * trans.c (gfc_build_array_ref): Ditto.
>         (gfc_generate_module_code): Ditto.
>
> gcc/java/Changelog
> 2007-12-07  Simon Baldwin  <simonb@google.com>
>
>         * except.c (maybe_start_try): Update call site(s) for STRIP_NOPS,
>         STRIP_SIGN_NOPS, STRIP_TYPE_NOPS, and STRIP_USELESS_TYPE_CONVERSION.
>         * lang.c (java_get_callee_fndecl): Ditto.
>
> gcc/objc/Changelog
> 2007-12-07  Simon Baldwin  <simonb@google.com>
>
>         * objc-act.c (receiver_is_class_object): Update call site(s) for
>         STRIP_NOPS, STRIP_SIGN_NOPS, STRIP_TYPE_NOPS, and
>         STRIP_USELESS_TYPE_CONVERSION.
>
>
> diff -rcp gcc/gcc/ada/utils.c gcc_2/gcc/ada/utils.c
> *** gcc/gcc/ada/utils.c Tue Nov 27 12:55:32 2007
> --- gcc_2/gcc/ada/utils.c       Thu Dec  6 16:39:12 2007
> *************** split_plus (tree in, tree *pvar)
> *** 1199,1205 ****
>        potential for constant or plus/minus discovery. We need to be careful
>        to always return and set *pvar to bitsizetype trees, but it's worth
>        the effort.  */
> !   STRIP_NOPS (in);
>
>     *pvar = convert (bitsizetype, in);
>
> --- 1199,1205 ----
>        potential for constant or plus/minus discovery. We need to be careful
>        to always return and set *pvar to bitsizetype trees, but it's worth
>        the effort.  */
> !   in = STRIP_NOPS (in);
>
>     *pvar = convert (bitsizetype, in);
>
> ...
>
>


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