gcc/gcc/tree-ssa-pre.c

4035 lines
113 KiB
C
Raw Normal View History

/* SSA-PRE for trees.
re PR middle-end/30391 (ICE at -O1 with conditional expressions and GIMPLE_MODIFY_STMT) PR middle-end/30391 * tree.c (expr_align): Handle MODIFY_EXPR. GIMPLE_MODIFY_STMT should be unreachable. (build2_stat): Allow construction of MODIFY_EXPR at any time. For the time being redirect GIMPLE_MODIFY_STMT to the new (renamed) build_gimple_modify_stmt_stat. (build2_gimple_stat): Rename to... (build_gimple_modify_stmt_stat): Now longer take a CODE argument. Always build a GIMPLE_MODIFY_STMT node. * tree.h (build2_gimple, build2_gimple_stat): Delete. (build_gimple_modify_stmt, build_gimple_modify_stmt_stat): New declarations. * tree-cfg.c (factor_computed_gotos, tree_merge_blocks, gimplify_val): Use build_gimple_modify_stmt instead of build2_gimple. * tree-complex.c (set_component_ssa_name, expand_complex_move, expand_complex_div_wide): Likewise. * tree-ssa-dom.c (record_equivalences_from_stmt): Likewise. * tree-ssa-loop-im.c (schedule_sm): Likewise. * tree-ssa-loop-ivopts.c (rewrite_use_nonlinear_expr): Likewise. * tree-ssa-loop-manip.c (create_iv): Likewise. * tree-ssa-phiopt.c (conditional_replacement, minmax_replacement, abs_replacement): Likewise. * tree-ssa-pre.c (create_expression_by_pieces, poolify_modify_stmt, realify_fake_stores): Likewise. * builtins.c (std_expand_builtin_va_start): Build a MODIFY_EXPR node rather than a GIMPLE_MODIFY_STMT node. (std_gimpify_va_arg_expr, expand_builtin_va_copy, fold_builtin_memset, fold_builtin_memory_op, do_mpfr_sincos): Likewise. (integer_valued_real_p): Handle MODIFY_EXPR, not GIMPLE_MODIFY_STMT. * expr.c (expand_expr_real_1): Handle both MODIFY_EXPR and GIMPLE_MODIFY_STMT. * gfortran.dg/pr30391-1.f90: New test case. From-SVN: r122030
2007-02-16 04:38:22 +01:00
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Contributed by Daniel Berlin <dan@dberlin.org> and Steven Bosscher
2006-07-04 23:23:03 +02:00
<stevenb@suse.de>
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
2005-06-25 04:02:01 +02:00
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "ggc.h"
#include "tree.h"
#include "basic-block.h"
#include "diagnostic.h"
#include "tree-inline.h"
#include "tree-flow.h"
#include "tree-gimple.h"
#include "tree-dump.h"
#include "timevar.h"
#include "fibheap.h"
#include "hashtab.h"
#include "tree-iterator.h"
#include "real.h"
#include "alloc-pool.h"
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
#include "obstack.h"
#include "tree-pass.h"
#include "flags.h"
#include "bitmap.h"
#include "langhooks.h"
#include "cfgloop.h"
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
#include "tree-ssa-sccvn.h"
/* TODO:
2006-07-04 23:23:03 +02:00
1. Avail sets can be shared by making an avail_find_leader that
walks up the dominator tree and looks in those avail sets.
This might affect code optimality, it's unclear right now.
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
2. Strength reduction can be performed by anticipating expressions
we can repair later on.
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
3. We can do back-substitution or smarter value numbering to catch
commutative expressions split up over multiple statements.
2006-07-04 23:23:03 +02:00
*/
/* For ease of terminology, "expression node" in the below refers to
every expression node but GIMPLE_MODIFY_STMT, because GIMPLE_MODIFY_STMT's
represent the actual statement containing the expressions we care about,
and we cache the value number by putting it in the expression. */
/* Basic algorithm
2006-07-04 23:23:03 +02:00
First we walk the statements to generate the AVAIL sets, the
EXP_GEN sets, and the tmp_gen sets. EXP_GEN sets represent the
generation of values/expressions by a given block. We use them
when computing the ANTIC sets. The AVAIL sets consist of
SSA_NAME's that represent values, so we know what values are
available in what blocks. AVAIL is a forward dataflow problem. In
SSA, values are never killed, so we don't need a kill set, or a
fixpoint iteration, in order to calculate the AVAIL sets. In
traditional parlance, AVAIL sets tell us the downsafety of the
expressions/values.
2006-07-04 23:23:03 +02:00
Next, we generate the ANTIC sets. These sets represent the
anticipatable expressions. ANTIC is a backwards dataflow
problem. An expression is anticipatable in a given block if it could
be generated in that block. This means that if we had to perform
an insertion in that block, of the value of that expression, we
could. Calculating the ANTIC sets requires phi translation of
expressions, because the flow goes backwards through phis. We must
iterate to a fixpoint of the ANTIC sets, because we have a kill
set. Even in SSA form, values are not live over the entire
function, only from their definition point onwards. So we have to
remove values from the ANTIC set once we go past the definition
point of the leaders that make them up.
compute_antic/compute_antic_aux performs this computation.
Third, we perform insertions to make partially redundant
expressions fully redundant.
An expression is partially redundant (excluding partial
anticipation) if:
1. It is AVAIL in some, but not all, of the predecessors of a
given block.
2. It is ANTIC in all the predecessors.
In order to make it fully redundant, we insert the expression into
the predecessors where it is not available, but is ANTIC.
For the partial anticipation case, we only perform insertion if it
is partially anticipated in some block, and fully available in all
of the predecessors.
insert/insert_aux/do_regular_insertion/do_partial_partial_insertion
performs these steps.
Fourth, we eliminate fully redundant expressions.
This is a simple statement walk that replaces redundant
calculations with the now available values. */
/* Representations of value numbers:
Value numbers are represented using the "value handle" approach.
This means that each SSA_NAME (and for other reasons to be
disclosed in a moment, expression nodes) has a value handle that
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
can be retrieved through get_value_handle. This value handle *is*
the value number of the SSA_NAME. You can pointer compare the
value handles for equivalence purposes.
For debugging reasons, the value handle is internally more than
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
just a number, it is a VALUE_HANDLE named "VH.x", where x is a
unique number for each value number in use. This allows
expressions with SSA_NAMES replaced by value handles to still be
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
pretty printed in a sane way. They simply print as "VH.3 *
VH.5", etc.
Expression nodes have value handles associated with them as a
cache. Otherwise, we'd have to look them up again in the hash
table This makes significant difference (factor of two or more) on
some test cases. They can be thrown away after the pass is
finished. */
2006-07-04 23:23:03 +02:00
/* Representation of expressions on value numbers:
In some portions of this code, you will notice we allocate "fake"
analogues to the expression we are value numbering, and replace the
operands with the values of the expression. Since we work on
values, and not just names, we canonicalize expressions to value
2006-07-04 23:23:03 +02:00
expressions for use in the ANTIC sets, the EXP_GEN set, etc.
This is theoretically unnecessary, it just saves a bunch of
repeated get_value_handle and find_leader calls in the remainder of
the code, trading off temporary memory usage for speed. The tree
nodes aren't actually creating more garbage, since they are
allocated in a special pools which are thrown away at the end of
2006-07-04 23:23:03 +02:00
this pass.
All of this also means that if you print the EXP_GEN or ANTIC sets,
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
you will see "VH.5 + VH.7" in the set, instead of "a_55 +
b_66" or something. The only thing that actually cares about
seeing the value leaders is phi translation, and it needs to be
able to find the leader for a value in an arbitrary block, so this
"value expression" form is perfect for it (otherwise you'd do
get_value_handle->find_leader->translate->get_value_handle->find_leader).*/
/* Representation of sets:
There are currently two types of sets used, hopefully to be unified soon.
The AVAIL sets do not need to be sorted in any particular order,
and thus, are simply represented as two bitmaps, one that keeps
track of values present in the set, and one that keeps track of
expressions present in the set.
2006-07-04 23:23:03 +02:00
The other sets are represented as doubly linked lists kept in topological
order, with an optional supporting bitmap of values present in the
set. The sets represent values, and the elements can be values or
expressions. The elements can appear in different sets, but each
element can only appear once in each set.
Since each node in the set represents a value, we also want to be
able to map expression, set pairs to something that tells us
whether the value is present is a set. We use a per-set bitmap for
that. The value handles also point to a linked list of the
expressions they represent via a tree annotation. This is mainly
useful only for debugging, since we don't do identity lookups. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Next global expression id number. */
static unsigned int next_expression_id;
/* Mapping from expression to id number we can use in bitmap sets. */
static VEC(tree, heap) *expressions;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Allocate an expression id for EXPR. */
static inline unsigned int
alloc_expression_id (tree expr)
{
tree_ann_common_t ann;
ann = get_tree_common_ann (expr);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Make sure we won't overflow. */
gcc_assert (next_expression_id + 1 > next_expression_id);
ann->aux = XNEW (unsigned int);
* ((unsigned int *)ann->aux) = next_expression_id++;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
VEC_safe_push (tree, heap, expressions, expr);
return next_expression_id - 1;
}
/* Return the expression id for tree EXPR. */
static inline unsigned int
get_expression_id (tree expr)
{
tree_ann_common_t ann = tree_common_ann (expr);
gcc_assert (ann);
gcc_assert (ann->aux);
return *((unsigned int *)ann->aux);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
}
2006-07-04 23:23:03 +02:00
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Return the existing expression id for EXPR, or create one if one
does not exist yet. */
2006-07-04 23:23:03 +02:00
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
static inline unsigned int
get_or_alloc_expression_id (tree expr)
{
tree_ann_common_t ann = tree_common_ann (expr);
if (ann == NULL || !ann->aux)
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
return alloc_expression_id (expr);
return get_expression_id (expr);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
}
/* Return the expression that has expression id ID */
static inline tree
expression_for_id (unsigned int id)
{
return VEC_index (tree, expressions, id);
}
2006-07-04 23:23:03 +02:00
/* Free the expression id field in all of our expressions,
and then destroy the expressions array. */
static void
clear_expression_ids (void)
{
int i;
tree expr;
for (i = 0; VEC_iterate (tree, expressions, i, expr); i++)
{
free (tree_common_ann (expr)->aux);
tree_common_ann (expr)->aux = NULL;
}
VEC_free (tree, heap, expressions);
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
static bool in_fre = false;
/* An unordered bitmap set. One bitmap tracks values, the other,
expressions. */
typedef struct bitmap_set
{
bitmap expressions;
bitmap values;
} *bitmap_set_t;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
#define FOR_EACH_EXPR_ID_IN_SET(set, id, bi) \
EXECUTE_IF_SET_IN_BITMAP(set->expressions, 0, id, bi)
/* Sets that we need to keep track of. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
typedef struct bb_bitmap_sets
{
/* The EXP_GEN set, which represents expressions/values generated in
a basic block. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_set_t exp_gen;
/* The PHI_GEN set, which represents PHI results generated in a
basic block. */
bitmap_set_t phi_gen;
/* The TMP_GEN set, which represents results/temporaries generated
in a basic block. IE the LHS of an expression. */
bitmap_set_t tmp_gen;
/* The AVAIL_OUT set, which represents which values are available in
a given basic block. */
bitmap_set_t avail_out;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
/* The ANTIC_IN set, which represents which values are anticipatable
in a given basic block. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_set_t antic_in;
/* The PA_IN set, which represents which values are
partially anticipatable in a given basic block. */
bitmap_set_t pa_in;
/* The NEW_SETS set, which is used during insertion to augment the
AVAIL_OUT set of blocks with the new insertions performed during
the current iteration. */
bitmap_set_t new_sets;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
/* True if we have visited this block during ANTIC calculation. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
unsigned int visited:1;
/* True we have deferred processing this block during ANTIC
calculation until its successor is processed. */
unsigned int deferred : 1;
} *bb_value_sets_t;
#define EXP_GEN(BB) ((bb_value_sets_t) ((BB)->aux))->exp_gen
#define PHI_GEN(BB) ((bb_value_sets_t) ((BB)->aux))->phi_gen
#define TMP_GEN(BB) ((bb_value_sets_t) ((BB)->aux))->tmp_gen
#define AVAIL_OUT(BB) ((bb_value_sets_t) ((BB)->aux))->avail_out
#define ANTIC_IN(BB) ((bb_value_sets_t) ((BB)->aux))->antic_in
#define PA_IN(BB) ((bb_value_sets_t) ((BB)->aux))->pa_in
#define NEW_SETS(BB) ((bb_value_sets_t) ((BB)->aux))->new_sets
#define BB_VISITED(BB) ((bb_value_sets_t) ((BB)->aux))->visited
#define BB_DEFERRED(BB) ((bb_value_sets_t) ((BB)->aux))->deferred
/* Maximal set of values, used to initialize the ANTIC problem, which
is an intersection problem. */
static bitmap_set_t maximal_set;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Basic block list in postorder. */
static int *postorder;
/* This structure is used to keep track of statistics on what
optimization PRE was able to perform. */
static struct
{
/* The number of RHS computations eliminated by PRE. */
int eliminations;
/* The number of new expressions/temporaries generated by PRE. */
int insertions;
/* The number of inserts found due to partial anticipation */
int pa_insert;
/* The number of new PHI nodes added by PRE. */
int phis;
2006-07-04 23:23:03 +02:00
/* The number of values found constant. */
int constified;
2006-07-04 23:23:03 +02:00
} pre_stats;
static bool do_partial_partial;
static tree bitmap_find_leader (bitmap_set_t, tree);
static void bitmap_value_insert_into_set (bitmap_set_t, tree);
static void bitmap_value_replace_in_set (bitmap_set_t, tree);
static void bitmap_set_copy (bitmap_set_t, bitmap_set_t);
static bool bitmap_set_contains_value (bitmap_set_t, tree);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
static void bitmap_insert_into_set (bitmap_set_t, tree);
static bitmap_set_t bitmap_set_new (void);
static bool is_undefined_value (tree);
static tree create_expression_by_pieces (basic_block, tree, tree);
static tree find_or_generate_expression (basic_block, tree, tree);
/* We can add and remove elements and entries to and from sets
and hash tables, so we use alloc pools for them. */
static alloc_pool bitmap_set_pool;
static alloc_pool binary_node_pool;
static alloc_pool unary_node_pool;
static alloc_pool reference_node_pool;
static alloc_pool comparison_node_pool;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
static alloc_pool modify_expr_node_pool;
bitmap.h (struct bitmap_obstack): New obstack type. * bitmap.h (struct bitmap_obstack): New obstack type. (struct bitmap_head_def): Replace using_obstack with obstack pointer. (bitmap_default_obstack): New. (bitmap_initialize): Make inline, does not do allocation. (bitmap_release_memory): Remove. (bitmap_obstack_initialize, bitmap_obstack_release): Declare. (bitmap_obstack_alloc, bitmap_malloc_alloc, bitmap_gc_alloc, bitmap_obstack_free, bitmap_malloc_free): Declare. (BITMAP_OBSTACK_ALLOC, BITMAP_GGC_ALLOC, BITMAP_XMALLOC): Adjust. (BITMAP_FREE): Replace with ... (BITMAP_OBSTACK_FREE): ... this. (BITMAP_XFREE): Adjust. (BITMAP_INIT_ONCE): Remove. * bitmap.c (bitmap_obstack, bitmap_obstack_init, bitmap_free: Remove. (bitmap_default_obstack): New. (bitmap_elem_to_freelist): Adjust. (bitmap_element_allocate): Adjust. Break initialization into ... (bitmap_obstack_initialize): ... here. (bitmap_release_memory): Replace with ... (bitmap_obstack_release): ... this. (bitmap_obstack_alloc, bitmap_malloc_alloc, bitmap_gc_alloc, bitmap_obstack_free, bitmap_malloc_free): New. (bitmap_ior_and_compl, bitmap_ior_and_compl_into): Use bitmap_initialize. (bitmap_initialize): Move to bitmap.h. * gengtype.c (open_base_files): Add obstack.h to ifiles. * Makefile.in (BASIC_BLOCK_H, REGS_H): Add obstack.h. * basic-block.h (INIT_REG_SET): Allocate from reg_obstack. (INITIALIZE_REG_SET): Remove. (FREE_REG_SET): Use BITMAP_OBSTACK_FREE. (INIT_ONCE_REG_SET, MAX_REGNO_REG_SET): Remove. (flow_obstack): Do not declare. (reg_obstack): Declare. * regs.h: Include obstack.h. * tree-optimize.c (tree_rest_of_compilation): Initialize and release bitmap obstack here. * bb-reorder.c: #include regs, not basic-block. (fix_crossing_conditional_branches): Allocate regsets from reg_obstack. * bt-load.c: Do not inlude bitmap.h, sbitmap.h, basic-block.h or obstack.h. * caller-save.c: Include regs.h earlier. * cfg.c: Do not include basic-block.h or obstack.h. (reg_obstack): Define. * cfganal.c: Include obstack.h * cfgcleanyp.c: Do not include basic-block.h. Include regs.h earlier. * cfglayout.c: Do not include obstack.h. (flow_obstack): Remove declaration. (cfg_layout_duplicate_bb): Use reg_obstack. * cfgloop.c, cfgloopanal.c, cfgloopmanip.c: Include obstack.h. * cfgrtl.c (rtl_split_block): Use reg_obstack. (force_nonfallthru_and_redirect, rtl_split_edge): Likewise. (safe_insert_insn_on_edge): Use OBSTACK_ALLOC_REG_SET, adjust. (cfg_layout_split_edge): Use reg_obstack. * cse.c: Include regs.h earlier. * ddg.c: Do not include basic-block.h. * dominance.c: Inlude obstack.h. * flow.c (update_life_info): Use OBSTACK_ALLOC_REG_SET, adjust. (calculate_global_regs_live): Likewise. (allocate_bb_life_data): Use reg_obstack. (init_propagate_block_info): Use OBSTACK_ALLOC_REGSET. * global.c: Do not include basic-block.h. (build_insn_chain): Use OBSTACK_ALLOC_REG_SET, adjust. * graph.c: Include obstack.h. * haifa-sched.c: Do not include basic-block.h. * ifcvt.c: Use OBSTACK_ALLOC_REG_SET, adjust. * local-alloc.c: Do not include basic-block.h. * loop-init.c, loop-invariant.c: Include obstack.h. * loop-iv.c: Likewise. (simplify_using_initial_values): Use OBSTACK_ALLOC_REG_SET, adjust. * loop-unroll.c, loop-unswitch.c: Inlude obstack.h. * modulo-sched.c: Do not include basic-block.h. * passes.c (rest_of_handle_final): Do not call regset_release_memory. * ra-debug.c: Include regs.h earlier. Do not include basic-block.h. * recog.c (peephole2_optimize): Use OBSTACK_ALLOC_REG_SET, adjust. * regclass.c (init_reg_sets): Do not call INIT_ONCE_REG_SET. (allocate_reg_info): Do not call MAX_REGNO_REG_SET. (regset_release_memory): Remove. * resource.c: Do not include basic-block.h. * rtlanal.c: Do not include basic-block.h. * sbitmap.c: Include obstack.h. * sched-deps.c: Do not include basic-block.h. (reg_pending_sets_head, reg_pending_clobbers_head, reg_pending_uses_head): Remove. (init_deps_global): Use OBSTACK_ALLOC_REG_SET. * sched-ebb.c: Do not include basic-block.h. * sched-rgn.c: Likewise. * tree-if-conv.c (get_loop_body_in_if_conv_order): Use BITMAP_XFREE. * tree-outof-ssa.c (perform_edge_inserts): Use BITMAP_XFREE. * tree-sra.c (decide_instantiations): Adjust bitmap initialization. * tree-ssa-dce.c: Include obstack.h. * tree-ssa-pre.c (grand_bitmap_obstack): Make a bitmap_obstack. (value_insert_into_set_bitmap): Remove useless bitmap_clear. (bitmap_set_new): Likewise. (init_pre): Initialize bitmap obstack. (fini_pre): Release bitmap obstack. * tree-ssanames.c (ssa_names_to_rewrite): Make static. (marked_for_rewrite_p): ssa_names_to_rewrite is never NULL. (mark_for_rewrite, unmark_for_rewrite): Likewise. (marked_ssa_names): Likewise. (init_ssanames): Use BITMAP_XMALLOC. (fini_ssanames): Use BITMAP_XFREE. * web.c: Include obstack.h From-SVN: r91009
2004-11-22 13:23:59 +01:00
static bitmap_obstack grand_bitmap_obstack;
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
/* We can't use allocation pools to hold temporary CALL_EXPR objects, since
they are not of fixed size. Instead, use an obstack. */
static struct obstack temp_call_expr_obstack;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
/* To avoid adding 300 temporary variables when we only need one, we
only create one temporary variable, on demand, and build ssa names
off that. We do have to change the variable if the types don't
match the current variable's type. */
static tree pretemp;
static tree storetemp;
static tree prephitemp;
tree-into-ssa.c (set_livein_block): Fix typo in comment. * tree-into-ssa.c (set_livein_block): Fix typo in comment. (rewrite_ssa_into_ssa): Start iterating over SSA names at 1. Release SSA names that have been re-renamed. * tree-phinodes.c (make_phi_node): Set same TREE_TYPE as the variable. * tree-ssa-alias.c (init_alias_info): If aliases have been computed before, clear existing alias information. (create_name_tags): Do no fixup PT_ANYTHING pointers. If the new name tag for a pointer is different than the one it had before, mark the old tag for renaming. (replace_may_alias): New function. (group_aliases): Call it. (setup_pointers_and_addressables): Always call get_tmt_for. (maybe_create_global_var): Don't create .GLOBAL_VAR more than once. (set_pt_anything): New local function. (set_pt_malloc): New local function. (merge_pointed_to_info): Don't merge pointed-to variables from the original pointer if the destination is pointing to an unknown location. (add_pointed_to_expr): Call set_pt_anything and set_pt_malloc. (add_pointed_to_var): Do not add a variable to the points-to set if the pointer is already pointing to anywhere. (collect_points_to_info_r): If the defining statement is a PHI node, only merge pointed-to information if the argument has already been visited. (get_tmt_for): Only create a new tag if the pointer didn't have one already. (dump_alias_info): Emit more information. (dump_points_to_info_for): Likewise. * tree-ssa-dom.c (redirect_edges_and_update_ssa_graph): Don't try to get the annotation of an SSA_NAME. * tree-ssa-operands.c (add_stmt_operand): Only check for empty alias sets when checking is enabled. * tree-ssa-pre.c (need_eh_cleanup): New local variable. (eliminate): Mark basic blocks that will need EH information cleaned up. (init_pre): Split ENTRY_BLOCK->0 if block 0 has more than one predecessor. Initialize need_eh_cleanup. (fini_pre): Call tree_purge_all_dead_eh_edges and cleanup_tree_cfg if needed. Free need_eh_cleanup. * tree-ssa.c (verify_ssa_name): New function. (verify_def): Call it. Re-arrange to avoid printing too many error messages. (verify_use): Likewise. (verify_phi_args): Likewise. (verify_flow_insensitive_alias_info): New function. (verify_flow_sensitive_alias_info): New function. (verify_alias_info): New function. (verify_ssa): Call verify_alias_info. Clear TREE_VISITED on all the SSA_NAMEs before scanning the program. Re-arrange to avoid printing too many error messages. * tree-ssanames.c (make_ssa_name): Clear SSA_NAME_IN_FREE_LIST. (release_ssa_name): Never release a default definition. (release_defs): New function. * tree.h: Declare it. * tree-ssa-dce.c (remove_dead_stmt): Call it. * tree-ssa.c (walk_use_def_chains_1): Add new argument IS_DFS. If true, do a depth-first search. Do a breadht-first search, otherwise. (walk_use_def_chains): Add new argument IS_DFS. Update all users. * tree-flow.h (walk_use_def_chains): Update prototype. From-SVN: r85052
2004-07-22 18:39:49 +02:00
/* Set of blocks with statements that have had its EH information
cleaned up. */
static bitmap need_eh_cleanup;
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
/* Which expressions have been seen during a given phi translation. */
static bitmap seen_during_translate;
/* The phi_translate_table caches phi translations for a given
expression and predecessor. */
static htab_t phi_translate_table;
/* A three tuple {e, pred, v} used to cache phi translations in the
phi_translate_table. */
typedef struct expr_pred_trans_d
{
/* The expression. */
tree e;
/* The predecessor block along which we translated the expression. */
basic_block pred;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
/* vuses associated with the expression. */
VEC (tree, gc) *vuses;
/* The value that resulted from the translation. */
tree v;
/* The hashcode for the expression, pred pair. This is cached for
speed reasons. */
hashval_t hashcode;
} *expr_pred_trans_t;
/* Return the hash value for a phi translation table entry. */
static hashval_t
expr_pred_trans_hash (const void *p)
{
const expr_pred_trans_t ve = (expr_pred_trans_t) p;
return ve->hashcode;
}
/* Return true if two phi translation table entries are the same.
P1 and P2 should point to the expr_pred_trans_t's to be compared.*/
static int
expr_pred_trans_eq (const void *p1, const void *p2)
{
const expr_pred_trans_t ve1 = (expr_pred_trans_t) p1;
const expr_pred_trans_t ve2 = (expr_pred_trans_t) p2;
basic_block b1 = ve1->pred;
basic_block b2 = ve2->pred;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
int i;
tree vuse1;
2006-07-04 23:23:03 +02:00
/* If they are not translations for the same basic block, they can't
be equal. */
if (b1 != b2)
return false;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
/* If they are for the same basic block, determine if the
2006-07-04 23:23:03 +02:00
expressions are equal. */
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
if (!expressions_equal_p (ve1->e, ve2->e))
return false;
/* Make sure the vuses are equivalent. */
if (ve1->vuses == ve2->vuses)
return true;
2006-07-04 23:23:03 +02:00
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
if (VEC_length (tree, ve1->vuses) != VEC_length (tree, ve2->vuses))
return false;
for (i = 0; VEC_iterate (tree, ve1->vuses, i, vuse1); i++)
{
if (VEC_index (tree, ve2->vuses, i) != vuse1)
return false;
}
return true;
}
/* Search in the phi translation table for the translation of
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
expression E in basic block PRED with vuses VUSES.
Return the translated value, if found, NULL otherwise. */
static inline tree
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
phi_trans_lookup (tree e, basic_block pred, VEC (tree, gc) *vuses)
{
void **slot;
struct expr_pred_trans_d ept;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
ept.e = e;
ept.pred = pred;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
ept.vuses = vuses;
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
ept.hashcode = iterative_hash_expr (e, (unsigned long) pred);
slot = htab_find_slot_with_hash (phi_translate_table, &ept, ept.hashcode,
NO_INSERT);
if (!slot)
return NULL;
else
return ((expr_pred_trans_t) *slot)->v;
}
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
/* Add the tuple mapping from {expression E, basic block PRED, vuses VUSES} to
value V, to the phi translation table. */
static inline void
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
phi_trans_add (tree e, tree v, basic_block pred, VEC (tree, gc) *vuses)
{
void **slot;
tree-tailcall.c (find_tail_calls): Use XNEW. * tree-tailcall.c (find_tail_calls): Use XNEW. * tree-ssa-dom.c (allocate_edge_info): Use XCNEW. (free_all_edge_infos): Use explicit cast to convert from void * *. (vrp_free): Likewise. (dom_opt_finalize_block): Likewise. (record_equivalences_from_incoming_edge): Likewise. (thread_across_edge): Likewise. Use XCNEWVEC. (record_cond): Use XCNEW. (record_conditions): Use XNEWVEC. (record_edge_info): Use XCNEWVEC. (lookup_avail_expr): Use XNEW. (record_range): Likewise. Use GGC_NEW. * tree-nested.c (var_map_hash): Use explicit cast to convert * from void *. (var_map_eq): Likewise. (lookup_field_for_decl): Likewise. (convert_nonlocal_reference): Likewise. (convert_local_reference): Likewise. (convert_nl_goto_reference): Likewise. (convert_nl_goto_receiver): Likewise. (convert_call_expr): Likewise. (convert_tramp_reference): Likewise. (lookup_tramp_for_decl): Likewise.Use GGC_NEW. (convert_nl_goto_reference): Likewise. (lookup_field_for_decl): Use GGC_NEW. (create_nesting_tree): Use GGC_CNEW. * tree-ssa-phiopt.c (blocks_in_phiopt_order): Use XNEWVEC. * tree-ssa-alias.c (init_alias_info): Use XCNEW. (create_alias_map_for): Likewise. (setup_pointers_and_addressables): Use XCNEWVEC. (get_ptr_info): Use GGC_NEW. (used_part_map_eq): Use explicit cast to convert from void *. (up_lookup): Likewise. (up_insert): Use XNEW. (get_or_create_used_part_for): Use XCNEW. (get_tmt_for): Likewise. * tree-ssa-operands.c (ssa_operand_alloc): Use GGC_NEW. * tree-ssa-pre.c (phi_trans_add): Use XNEW. (bitmap_set_new): Use explicit cast to convert from void *. (set_new): Likewise. (insert_into_set): Likewise. (pool_copy_list): Likewise. (phi_translate): Likewise. (create_value_expr_from): Likewise. (insert_aux): Use XCNEWVEC. (compute_avail): Use XNEWVEC. * tree-ssa-live.c (calculate_live_on_entry): Likewise. (sort_coalesce_list): Likewise. (build_tree_conflict_graph): Use XCNEWVEC. * tree-ssa-dce.c (tree_dce_init): Use XNEWVEC. * tree-ssa-copy.c (init_copy_prop): Likewise. (fini_copy_prop): Likewise. * tree-ssa-uncprop.c (associate_equivalences_with_edges): Use * XNEW and XCNEWVEC. (record_equiv): Use XNEW. (uncprop_into_successor_phis): Use explicit cast to convert * from void *. (uncprop_initialize_block): Likewise. From-SVN: r108747
2005-12-18 10:26:53 +01:00
expr_pred_trans_t new_pair = XNEW (struct expr_pred_trans_d);
new_pair->e = e;
new_pair->pred = pred;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
new_pair->vuses = vuses;
new_pair->v = v;
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
new_pair->hashcode = iterative_hash_expr (e, (unsigned long) pred);
slot = htab_find_slot_with_hash (phi_translate_table, new_pair,
new_pair->hashcode, INSERT);
if (*slot)
free (*slot);
*slot = (void *) new_pair;
}
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Return true if V is a value expression that represents itself.
In our world, this is *only* non-value handles. */
static inline bool
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
constant_expr_p (tree v)
{
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
return TREE_CODE (v) != VALUE_HANDLE &&
(TREE_CODE (v) == FIELD_DECL || is_gimple_min_invariant (v));
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Add expression E to the expression set of value V. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
void
add_to_value (tree v, tree e)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Constants have no expression sets. */
if (constant_expr_p (v))
return;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (VALUE_HANDLE_EXPR_SET (v) == NULL)
VALUE_HANDLE_EXPR_SET (v) = bitmap_set_new ();
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_insert_into_set (VALUE_HANDLE_EXPR_SET (v), e);
}
/* Create a new bitmap set and return it. */
2006-07-04 23:23:03 +02:00
static bitmap_set_t
bitmap_set_new (void)
{
tree-tailcall.c (find_tail_calls): Use XNEW. * tree-tailcall.c (find_tail_calls): Use XNEW. * tree-ssa-dom.c (allocate_edge_info): Use XCNEW. (free_all_edge_infos): Use explicit cast to convert from void * *. (vrp_free): Likewise. (dom_opt_finalize_block): Likewise. (record_equivalences_from_incoming_edge): Likewise. (thread_across_edge): Likewise. Use XCNEWVEC. (record_cond): Use XCNEW. (record_conditions): Use XNEWVEC. (record_edge_info): Use XCNEWVEC. (lookup_avail_expr): Use XNEW. (record_range): Likewise. Use GGC_NEW. * tree-nested.c (var_map_hash): Use explicit cast to convert * from void *. (var_map_eq): Likewise. (lookup_field_for_decl): Likewise. (convert_nonlocal_reference): Likewise. (convert_local_reference): Likewise. (convert_nl_goto_reference): Likewise. (convert_nl_goto_receiver): Likewise. (convert_call_expr): Likewise. (convert_tramp_reference): Likewise. (lookup_tramp_for_decl): Likewise.Use GGC_NEW. (convert_nl_goto_reference): Likewise. (lookup_field_for_decl): Use GGC_NEW. (create_nesting_tree): Use GGC_CNEW. * tree-ssa-phiopt.c (blocks_in_phiopt_order): Use XNEWVEC. * tree-ssa-alias.c (init_alias_info): Use XCNEW. (create_alias_map_for): Likewise. (setup_pointers_and_addressables): Use XCNEWVEC. (get_ptr_info): Use GGC_NEW. (used_part_map_eq): Use explicit cast to convert from void *. (up_lookup): Likewise. (up_insert): Use XNEW. (get_or_create_used_part_for): Use XCNEW. (get_tmt_for): Likewise. * tree-ssa-operands.c (ssa_operand_alloc): Use GGC_NEW. * tree-ssa-pre.c (phi_trans_add): Use XNEW. (bitmap_set_new): Use explicit cast to convert from void *. (set_new): Likewise. (insert_into_set): Likewise. (pool_copy_list): Likewise. (phi_translate): Likewise. (create_value_expr_from): Likewise. (insert_aux): Use XCNEWVEC. (compute_avail): Use XNEWVEC. * tree-ssa-live.c (calculate_live_on_entry): Likewise. (sort_coalesce_list): Likewise. (build_tree_conflict_graph): Use XCNEWVEC. * tree-ssa-dce.c (tree_dce_init): Use XNEWVEC. * tree-ssa-copy.c (init_copy_prop): Likewise. (fini_copy_prop): Likewise. * tree-ssa-uncprop.c (associate_equivalences_with_edges): Use * XNEW and XCNEWVEC. (record_equiv): Use XNEW. (uncprop_into_successor_phis): Use explicit cast to convert * from void *. (uncprop_initialize_block): Likewise. From-SVN: r108747
2005-12-18 10:26:53 +01:00
bitmap_set_t ret = (bitmap_set_t) pool_alloc (bitmap_set_pool);
ret->expressions = BITMAP_ALLOC (&grand_bitmap_obstack);
ret->values = BITMAP_ALLOC (&grand_bitmap_obstack);
return ret;
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Remove an expression EXPR from a bitmapped set. */
static void
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_remove_from_set (bitmap_set_t set, tree expr)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
tree val = get_value_handle (expr);
2006-07-04 23:23:03 +02:00
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * targhooks.c (default_unwind_emit, default_scalar_mode_supported_p): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * timevar.c (timevar_push, timevar_pop, timevar_start, timevar_stop): Likewise. * toplev.c (default_pch_valid_p): Likewise. * tracer.c (tail_duplicate): Likewise. * tree-alias-common.c (get_alias_var_decl, get_values_from_constructor, create_alias_var, delete_alias_vars, empty_points_to_set, same_points_to_set, ptr_may_alias_var): Likewise. * tree.c (tree_size, make_node_stat, copy_node_stat, build_int_cst_wide, integer_all_onesp, list_length, chainon, tree_node_structure, type_contains_placeholder_p, substitute_in_expr, substitute_placeholder_in_expr, tabilize_reference_1, build0_stat, build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p, lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr, build_method_type_directly, decl_type_context, get_callee_fndecl, get_set_constructor_bits, build_vector_type_for_mode, int_cst_value, tree_fold_gcd): Likewise. * tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges, make_cond_expr_edges, group_case_labels, tree_merge_blocks, cleanup_control_expr_graph, find_taken_edge, find_taken_edge_switch_expr, phi_alternatives_equal, is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt, stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate, tree_split_edge, tree_verify_flow_info, thread_jumps, tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise. * tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly, chrec_fold_multiply_poly_poly): Likewise. * tree-complex.c (extract_component, expand_complex_division, expand_complex_comparison, expand_complex_operations_1, build_replicated_const, expand_vector_operations_1): Likewise. * tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector, build_classic_dir_vector): Likewise. * tree-dfa.c (compute_immediate_uses_for_phi, compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann, create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region, record_in_finally_tree, replace_goto_queue_1, maybe_record_in_goto_queue, verify_norecord_switch_expr, do_return_redirection): Likewise. * tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr, add_to_dst_predicate_list, find_phi_replacement_condition, replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order): Likewise. * tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r, initialize_inlined_parameters, declare_return_variable, estimate_num_insns_1, expand_call_inline, expand_calls_inline, optimize_inline_calls, copy_tree_r): Likewise. * tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt, ssa_rewrite_stmt, rewrite_into_ssa): Likewise. * tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after, tsi_split_statement_list_after, tsi_split_statement_list_before): Likewise. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-nested.c (create_tmp_var_for, lookup_field_for_decl, lookup_tramp_for_decl, convert_all_function_calls): Likewise. * tree-optimize.c (tree_rest_of_compilation): Likewise. * tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi, coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis, free_temp_expr_table, add_dependance, finish_expr, rewrite_trees): Likewise. * tree-phinodes.c (resize_phi_node, add_phi_arg, remove_all_phi_nodes_for): Likewise. * tree-pretty-print.c (op_prio, print_call_name): Likewise. * tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise. * tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree, sra_elt_eq, sra_walk_expr, instantiate_missing_elements, generate_one_element_ref, generate_element_copy, generate_element_zero, scalarize_copy, scalarize_init, scalarize_ldst): Likewise. * tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p, add_may_alias, add_pointed_to_expr, add_pointed_to_var, collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise. * tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise. * tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value, set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment, widen_bitfield, ccp_fold_builtin): Likewise. * tree-ssa-copy.c (may_propagate_copy, merge_alias_info, replace_exp_1, propagate_tree_value): Likewise. * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise. * tree-ssa-dce.c (set_control_dependence_map_bit, find_control_dependence, find_pdom, mark_operand_necessary, mark_stmt_if_obviously_necessary, mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise. * tree-ssa-dom.c (dom_opt_initialize_block_local_data, simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis, eliminate_redundant_computations, avail_expr_eq): Likewise. * tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p, duplicate_blocks): Likewise. * tree-ssa-loop-im.c (for_each_index, set_level, is_call_clobbered_ref): Likewise. * tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos, stmt_after_increment, set_iv, contains_abnormal_ssa_name_p, find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates, peel_address, ptr_difference_cost, may_replace_final_value, determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer, rewrite_use, rewrite_uses): Likewise. * tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa, check_loop_closed_ssa_use): Likewise. * tree-ssanames.c (make_ssa_name): Likewise. * tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses, finalize_ssa_v_must_defs, finalize_ssa_stmt_operands, get_stmt_operands, get_expr_operands, get_asm_expr_operands, get_indirect_ref_operands, add_stmt_operand): Likewise. * tree-ssa-pre.c (value_exists_in_set_bitmap, value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set, phi_translate, valid_in_set, compute_antic, find_or_generate_expression, create_expression_by_pieces, insert_aux, create_value_expr_from, eliminate): Likewise. * tree-ssa-propagate.c (cfg_blocks_get): Likewise. * tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges): Likewise. * tree-tailcall.c (independent_of_stmt_p, adjust_return_value, eliminate_tail_call): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_align_data_ref, vect_create_data_ref, vect_create_destination_var, vect_get_vec_def_for_operand, vect_finish_stmt_generation, vect_transform_stmt, vect_transform_loop_bound, vect_transform_loop, vect_analyze_operations): Likewise. * tree-vn.c (vn_compute, set_value_handle, get_value_handle): Likewise. * tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr, get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start, bsi_after_labels, bsi_last): Likewise. * tree-ssa-live.c (var_union, change_partition_var, create_ssa_var_map, calculate_live_on_entry, root_var_init, type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce): Likewise. * tree-ssa-live.h (partition_is_global, live_entry_blocks, tpa_find_tree): Likewise. (register_ssa_partition_check): Declare. (register_ssa_partition): use it. * tree-ssa-live.c: Include errors.h. (register_ssa_partition_check): New. * tree-ssa-operands.c: Include errors.h. * Makefile.in (tree-ssa-operands.o): Depend on errors.h. Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com> From-SVN: r87223
2004-09-09 09:54:12 +02:00
gcc_assert (val);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (!constant_expr_p (val))
{
bitmap_clear_bit (set->values, VALUE_HANDLE_ID (val));
bitmap_clear_bit (set->expressions, get_expression_id (expr));
}
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Insert an expression EXPR into a bitmapped set. */
static void
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_insert_into_set (bitmap_set_t set, tree expr)
{
tree val = get_value_handle (expr);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
gcc_assert (val);
if (!constant_expr_p (val))
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_set_bit (set->values, VALUE_HANDLE_ID (val));
bitmap_set_bit (set->expressions, get_or_alloc_expression_id (expr));
}
}
/* Copy a bitmapped set ORIG, into bitmapped set DEST. */
static void
bitmap_set_copy (bitmap_set_t dest, bitmap_set_t orig)
{
bitmap_copy (dest->expressions, orig->expressions);
bitmap_copy (dest->values, orig->values);
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Free memory used up by SET. */
static void
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_set_free (bitmap_set_t set)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
BITMAP_FREE (set->expressions);
BITMAP_FREE (set->values);
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* A comparison function for use in qsort to top sort a bitmap set. Simply
subtracts value handle ids, since they are created in topo-order. */
static int
vh_compare (const void *pa, const void *pb)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
const tree vha = get_value_handle (*((const tree *)pa));
const tree vhb = get_value_handle (*((const tree *)pb));
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* This can happen when we constify things. */
if (constant_expr_p (vha))
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (constant_expr_p (vhb))
return -1;
return -1;
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
else if (constant_expr_p (vhb))
return 1;
return VALUE_HANDLE_ID (vha) - VALUE_HANDLE_ID (vhb);
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Generate an topological-ordered array of bitmap set SET. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
static VEC(tree, heap) *
sorted_array_from_bitmap_set (bitmap_set_t set)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
unsigned int i;
bitmap_iterator bi;
VEC(tree, heap) *result = NULL;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
FOR_EACH_EXPR_ID_IN_SET (set, i, bi)
VEC_safe_push (tree, heap, result, expression_for_id (i));
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
qsort (VEC_address (tree, result), VEC_length (tree, result),
sizeof (tree), vh_compare);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
return result;
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Perform bitmapped set operation DEST &= ORIG. */
static void
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_set_and (bitmap_set_t dest, bitmap_set_t orig)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_iterator bi;
unsigned int i;
if (dest != orig)
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
{
bitmap temp = BITMAP_ALLOC (&grand_bitmap_obstack);
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
bitmap_and_into (dest->values, orig->values);
bitmap_copy (temp, dest->expressions);
EXECUTE_IF_SET_IN_BITMAP (temp, 0, i, bi)
{
tree expr = expression_for_id (i);
tree val = get_value_handle (expr);
if (!bitmap_bit_p (dest->values, VALUE_HANDLE_ID (val)))
bitmap_clear_bit (dest->expressions, i);
}
BITMAP_FREE (temp);
}
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Subtract all values and expressions contained in ORIG from DEST. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
static bitmap_set_t
bitmap_set_subtract (bitmap_set_t dest, bitmap_set_t orig)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_set_t result = bitmap_set_new ();
bitmap_iterator bi;
unsigned int i;
2006-07-04 23:23:03 +02:00
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_and_compl (result->expressions, dest->expressions,
orig->expressions);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
FOR_EACH_EXPR_ID_IN_SET (result, i, bi)
{
tree expr = expression_for_id (i);
tree val = get_value_handle (expr);
bitmap_set_bit (result->values, VALUE_HANDLE_ID (val));
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
return result;
}
/* Subtract all the values in bitmap set B from bitmap set A. */
static void
bitmap_set_subtract_values (bitmap_set_t a, bitmap_set_t b)
{
unsigned int i;
bitmap_iterator bi;
bitmap temp = BITMAP_ALLOC (&grand_bitmap_obstack);
bitmap_copy (temp, a->expressions);
EXECUTE_IF_SET_IN_BITMAP (temp, 0, i, bi)
{
tree expr = expression_for_id (i);
if (bitmap_set_contains_value (b, get_value_handle (expr)))
bitmap_remove_from_set (a, expr);
}
BITMAP_FREE (temp);
}
/* Return true if bitmapped set SET contains the value VAL. */
static bool
bitmap_set_contains_value (bitmap_set_t set, tree val)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (constant_expr_p (val))
return true;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (!set || bitmap_empty_p (set->expressions))
return false;
return bitmap_bit_p (set->values, VALUE_HANDLE_ID (val));
}
static inline bool
bitmap_set_contains_expr (bitmap_set_t set, tree expr)
{
return bitmap_bit_p (set->expressions, get_expression_id (expr));
}
/* Replace an instance of value LOOKFOR with expression EXPR in SET. */
static void
bitmap_set_replace_value (bitmap_set_t set, tree lookfor, tree expr)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_set_t exprset;
unsigned int i;
bitmap_iterator bi;
if (constant_expr_p (lookfor))
return;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (!bitmap_set_contains_value (set, lookfor))
return;
/* The number of expressions having a given value is usually
significantly less than the total number of expressions in SET.
Thus, rather than check, for each expression in SET, whether it
has the value LOOKFOR, we walk the reverse mapping that tells us
what expressions have a given value, and see if any of those
expressions are in our set. For large testcases, this is about
5-10x faster than walking the bitmap. If this is somehow a
significant lose for some cases, we can choose which set to walk
based on the set size. */
exprset = VALUE_HANDLE_EXPR_SET (lookfor);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
FOR_EACH_EXPR_ID_IN_SET (exprset, i, bi)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (bitmap_bit_p (set->expressions, i))
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_clear_bit (set->expressions, i);
bitmap_set_bit (set->expressions, get_expression_id (expr));
return;
}
}
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Return true if two bitmap sets are equal. */
static bool
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_set_equal (bitmap_set_t a, bitmap_set_t b)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
return bitmap_equal_p (a->values, b->values);
}
/* Replace an instance of EXPR's VALUE with EXPR in SET if it exists,
and add it otherwise. */
static void
bitmap_value_replace_in_set (bitmap_set_t set, tree expr)
{
tree val = get_value_handle (expr);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (bitmap_set_contains_value (set, val))
bitmap_set_replace_value (set, val, expr);
else
bitmap_insert_into_set (set, expr);
}
/* Insert EXPR into SET if EXPR's value is not already present in
SET. */
static void
bitmap_value_insert_into_set (bitmap_set_t set, tree expr)
{
tree val = get_value_handle (expr);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (constant_expr_p (val))
return;
2006-07-04 23:23:03 +02:00
if (!bitmap_set_contains_value (set, val))
bitmap_insert_into_set (set, expr);
}
/* Print out SET to OUTFILE. */
static void
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
print_bitmap_set (FILE *outfile, bitmap_set_t set,
const char *setname, int blockindex)
{
fprintf (outfile, "%s[%d] := { ", setname, blockindex);
if (set)
{
bool first = true;
bitmap.c (bitmap_print): Make bitno unsigned. * bitmap.c (bitmap_print): Make bitno unsigned. * bt-load.c (clear_btr_from_live_range, btr_def_live_range): Likewise. * caller-save.c (save_call_clobbered_regs): Likewise. * cfganal.c (compute_dominance_frontiers_1): Likewise. * cfgcleanup.c (thread_jump): Likewise. * cfgrtl.c (safe_insert_insn_on_edge): Likewise. * conflict.c (conflict_graph_compute): Likewise. * ddg.c (add_deps_for_use): Likewise. * df.c (df_refs_update): Likewise. * except.c (remove_eh_handler): Likewise. * flow.c (verify_local_live_at_start, update_life_info, initialize_uninitialized_subregs, propagate_one_insn, free_propagate_block_info, propagate_block, find_use_as_address, reg_set_to_hard_reg_set): Likewise. * gcse.c (clear_modify_mem_tables): Likewise. * global.c (global_conflicts, build_insn_chain): Likewise. * ifcvt.c (dead_or_predicable): Likewise. * local-alloc.c (update_equiv_regs): Likewise. * loop.c (load_mems): Likewise. * ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Likewise. * ra-rewrite.c (reloads_to_loads, rewrite_program2, actual_spill): Likewise. * reload1.c (order_regs_for_reload, finish_spills): Likewise. * sched-deps.c (sched_analyze_insn, free_deps): Likewise. * sched-rgn.c (propagate_deps * tree-cfg.c (tree_purge_all_dead_eh_edges): Likewise. * tree-dfa.c (dump_dfa_stats tree-into-ssa.c (compute_global_livein, insert_phi_nodes, insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags): Likewise. * tree-outof-ssa.c (coalesce_ssa_name, coalesce_vars, free_temp_expr_table, find_replaceable_exprs): Likewise. * tree-sra.c (scan_function, scalarize_parms): Likewise. * tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape, compute_flow_sensitive_aliasing, maybe_create_global_var): Likewise. * tree-ssa-dce.c (mark_control_dependent_edges_necessary): Likewise. * tree-ssa-live.c (new_tree_live_info, live_worklist, calculate_live_on_entry, calculate_live_on_exit, compare_pairs, sort_coalesce_list, build_tree_conflict_graph, dump_live_info tree-ssa-loop-manip.c (add_exit_phis_var): Likewise. tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops, add_call_read_ops): Likewise. * tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Likewise. * tree-ssa-live.h (num_var_partitions): Return unsigned. From-SVN: r90053
2004-11-04 09:41:16 +01:00
unsigned i;
bitmap.h (EXECUTE_IF_SET_IN_BITMAP, [...]): Changed to iterator style. * bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP, EXECUTE_IF_AND_IN_BITMAP): Changed to iterator style. (bitmap_iterator): New type. (bmp_iter_common_next_1, bmp_iter_single_next_1, bmp_iter_single_init, bmp_iter_end_p, bmp_iter_single_next, bmp_iter_and_not_next_1, bmp_iter_and_not_init, bmp_iter_and_not_next, bmp_iter_and_next_1, bmp_iter_and_init, bmp_iter_and_next): New functions. * basic-block.h (EXECUTE_IF_SET_IN_REG_SET, EXECUTE_IF_AND_COMPL_IN_REG_SET, EXECUTE_IF_AND_IN_REG_SET): Changed to use iterator-style EXECUTE_IF_IN_BITMAP macros. * bitmap.c (bitmap_print): Ditto. * bt-load.c (clear_btr_from_live_range, add_btr_to_live_range, btr_def_live_range): Ditto. * cfganal.c (compute_dominance_frontiers_1) Ditto. * cgraphunit.c (convert_UIDs_in_bitmap, cgraph_characterize_statics): Ditto. * ddg.c (build_inter_loop_deps): Ditto. * df.c (FOR_EACH_BB_IN_BITMAP, df_bb_reg_info_compute, df_refs_update): Ditto. * except.c (remove_eh_handler): Ditto. * flow.c (reg_set_to_hard_reg_set): Ditto. * gcse.c (clear_modify_mem_tables): Ditto. * global.c (build_insn_chain): Ditto. * ifcvt.c (dead_or_predicable): Ditto. * loop-invariant.c (get_inv_cost, set_move_mark, move_invariant_reg): Ditto. * ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Ditto. * ra-rewrite.c (reloads_to_loads, rewrite_program2, detect_web_parts_to_rebuild, delete_useless_defs, actual_spill): Ditto. * tree-cfg.c (allocate_ssa_names, tree_duplicate_sese_region, tree_purge_all_dead_eh_edges): Ditto. * tree-into-ssa.c (compute_global_livein, insert_phi_nodes, insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags, rewrite_ssa_into_ssa): Ditto. * tree-outof-ssa.c (find_replaceable_exprs): Ditto. * tree-sra.c (scan_function, decide_instantiations, scalarize_parms): Ditto. * tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape, compute_flow_sensitive_aliasing, maybe_create_global_var, dump_points_to_info_for): Ditto. * tree-ssa-dce.c (EXECUTE_IF_CONTROL_DEPENDENT): Ditto. * tree-ssa-dse.c (dse_finalize_block): Ditto. * tree-ssa-live.c (live_worklist, calculate_live_on_entry, calculate_live_on_exit, build_tree_conflict_graph, dump_live_info): Ditto. * tree-ssa-loop-ivopts.c (find_induction_variables, find_interesting_uses, add_old_ivs_candidates, alloc_use_cost_map, determine_use_iv_costs, determine_set_costs, find_best_candidate, set_cost_up_to, create_new_ivs, remove_unused_ivs, free_loop_data): Ditto. * tree-ssa-loop-manip.c (add_exit_phis_var, add_exit_phis): Ditto. * tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops, add_call_read_ops): Ditto. * tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Ditto. From-SVN: r88145
2004-09-26 21:53:13 +02:00
bitmap_iterator bi;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
FOR_EACH_EXPR_ID_IN_SET (set, i, bi)
bitmap.h (EXECUTE_IF_SET_IN_BITMAP, [...]): Changed to iterator style. * bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP, EXECUTE_IF_AND_IN_BITMAP): Changed to iterator style. (bitmap_iterator): New type. (bmp_iter_common_next_1, bmp_iter_single_next_1, bmp_iter_single_init, bmp_iter_end_p, bmp_iter_single_next, bmp_iter_and_not_next_1, bmp_iter_and_not_init, bmp_iter_and_not_next, bmp_iter_and_next_1, bmp_iter_and_init, bmp_iter_and_next): New functions. * basic-block.h (EXECUTE_IF_SET_IN_REG_SET, EXECUTE_IF_AND_COMPL_IN_REG_SET, EXECUTE_IF_AND_IN_REG_SET): Changed to use iterator-style EXECUTE_IF_IN_BITMAP macros. * bitmap.c (bitmap_print): Ditto. * bt-load.c (clear_btr_from_live_range, add_btr_to_live_range, btr_def_live_range): Ditto. * cfganal.c (compute_dominance_frontiers_1) Ditto. * cgraphunit.c (convert_UIDs_in_bitmap, cgraph_characterize_statics): Ditto. * ddg.c (build_inter_loop_deps): Ditto. * df.c (FOR_EACH_BB_IN_BITMAP, df_bb_reg_info_compute, df_refs_update): Ditto. * except.c (remove_eh_handler): Ditto. * flow.c (reg_set_to_hard_reg_set): Ditto. * gcse.c (clear_modify_mem_tables): Ditto. * global.c (build_insn_chain): Ditto. * ifcvt.c (dead_or_predicable): Ditto. * loop-invariant.c (get_inv_cost, set_move_mark, move_invariant_reg): Ditto. * ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Ditto. * ra-rewrite.c (reloads_to_loads, rewrite_program2, detect_web_parts_to_rebuild, delete_useless_defs, actual_spill): Ditto. * tree-cfg.c (allocate_ssa_names, tree_duplicate_sese_region, tree_purge_all_dead_eh_edges): Ditto. * tree-into-ssa.c (compute_global_livein, insert_phi_nodes, insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags, rewrite_ssa_into_ssa): Ditto. * tree-outof-ssa.c (find_replaceable_exprs): Ditto. * tree-sra.c (scan_function, decide_instantiations, scalarize_parms): Ditto. * tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape, compute_flow_sensitive_aliasing, maybe_create_global_var, dump_points_to_info_for): Ditto. * tree-ssa-dce.c (EXECUTE_IF_CONTROL_DEPENDENT): Ditto. * tree-ssa-dse.c (dse_finalize_block): Ditto. * tree-ssa-live.c (live_worklist, calculate_live_on_entry, calculate_live_on_exit, build_tree_conflict_graph, dump_live_info): Ditto. * tree-ssa-loop-ivopts.c (find_induction_variables, find_interesting_uses, add_old_ivs_candidates, alloc_use_cost_map, determine_use_iv_costs, determine_set_costs, find_best_candidate, set_cost_up_to, create_new_ivs, remove_unused_ivs, free_loop_data): Ditto. * tree-ssa-loop-manip.c (add_exit_phis_var, add_exit_phis): Ditto. * tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops, add_call_read_ops): Ditto. * tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Ditto. From-SVN: r88145
2004-09-26 21:53:13 +02:00
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
tree expr = expression_for_id (i);
if (!first)
fprintf (outfile, ", ");
first = false;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
print_generic_expr (outfile, expr, 0);
2006-07-04 23:23:03 +02:00
bitmap.h (EXECUTE_IF_SET_IN_BITMAP, [...]): Changed to iterator style. * bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP, EXECUTE_IF_AND_IN_BITMAP): Changed to iterator style. (bitmap_iterator): New type. (bmp_iter_common_next_1, bmp_iter_single_next_1, bmp_iter_single_init, bmp_iter_end_p, bmp_iter_single_next, bmp_iter_and_not_next_1, bmp_iter_and_not_init, bmp_iter_and_not_next, bmp_iter_and_next_1, bmp_iter_and_init, bmp_iter_and_next): New functions. * basic-block.h (EXECUTE_IF_SET_IN_REG_SET, EXECUTE_IF_AND_COMPL_IN_REG_SET, EXECUTE_IF_AND_IN_REG_SET): Changed to use iterator-style EXECUTE_IF_IN_BITMAP macros. * bitmap.c (bitmap_print): Ditto. * bt-load.c (clear_btr_from_live_range, add_btr_to_live_range, btr_def_live_range): Ditto. * cfganal.c (compute_dominance_frontiers_1) Ditto. * cgraphunit.c (convert_UIDs_in_bitmap, cgraph_characterize_statics): Ditto. * ddg.c (build_inter_loop_deps): Ditto. * df.c (FOR_EACH_BB_IN_BITMAP, df_bb_reg_info_compute, df_refs_update): Ditto. * except.c (remove_eh_handler): Ditto. * flow.c (reg_set_to_hard_reg_set): Ditto. * gcse.c (clear_modify_mem_tables): Ditto. * global.c (build_insn_chain): Ditto. * ifcvt.c (dead_or_predicable): Ditto. * loop-invariant.c (get_inv_cost, set_move_mark, move_invariant_reg): Ditto. * ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Ditto. * ra-rewrite.c (reloads_to_loads, rewrite_program2, detect_web_parts_to_rebuild, delete_useless_defs, actual_spill): Ditto. * tree-cfg.c (allocate_ssa_names, tree_duplicate_sese_region, tree_purge_all_dead_eh_edges): Ditto. * tree-into-ssa.c (compute_global_livein, insert_phi_nodes, insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags, rewrite_ssa_into_ssa): Ditto. * tree-outof-ssa.c (find_replaceable_exprs): Ditto. * tree-sra.c (scan_function, decide_instantiations, scalarize_parms): Ditto. * tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape, compute_flow_sensitive_aliasing, maybe_create_global_var, dump_points_to_info_for): Ditto. * tree-ssa-dce.c (EXECUTE_IF_CONTROL_DEPENDENT): Ditto. * tree-ssa-dse.c (dse_finalize_block): Ditto. * tree-ssa-live.c (live_worklist, calculate_live_on_entry, calculate_live_on_exit, build_tree_conflict_graph, dump_live_info): Ditto. * tree-ssa-loop-ivopts.c (find_induction_variables, find_interesting_uses, add_old_ivs_candidates, alloc_use_cost_map, determine_use_iv_costs, determine_set_costs, find_best_candidate, set_cost_up_to, create_new_ivs, remove_unused_ivs, free_loop_data): Ditto. * tree-ssa-loop-manip.c (add_exit_phis_var, add_exit_phis): Ditto. * tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops, add_call_read_ops): Ditto. * tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Ditto. From-SVN: r88145
2004-09-26 21:53:13 +02:00
fprintf (outfile, " (");
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
print_generic_expr (outfile, get_value_handle (expr), 0);
bitmap.h (EXECUTE_IF_SET_IN_BITMAP, [...]): Changed to iterator style. * bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP, EXECUTE_IF_AND_IN_BITMAP): Changed to iterator style. (bitmap_iterator): New type. (bmp_iter_common_next_1, bmp_iter_single_next_1, bmp_iter_single_init, bmp_iter_end_p, bmp_iter_single_next, bmp_iter_and_not_next_1, bmp_iter_and_not_init, bmp_iter_and_not_next, bmp_iter_and_next_1, bmp_iter_and_init, bmp_iter_and_next): New functions. * basic-block.h (EXECUTE_IF_SET_IN_REG_SET, EXECUTE_IF_AND_COMPL_IN_REG_SET, EXECUTE_IF_AND_IN_REG_SET): Changed to use iterator-style EXECUTE_IF_IN_BITMAP macros. * bitmap.c (bitmap_print): Ditto. * bt-load.c (clear_btr_from_live_range, add_btr_to_live_range, btr_def_live_range): Ditto. * cfganal.c (compute_dominance_frontiers_1) Ditto. * cgraphunit.c (convert_UIDs_in_bitmap, cgraph_characterize_statics): Ditto. * ddg.c (build_inter_loop_deps): Ditto. * df.c (FOR_EACH_BB_IN_BITMAP, df_bb_reg_info_compute, df_refs_update): Ditto. * except.c (remove_eh_handler): Ditto. * flow.c (reg_set_to_hard_reg_set): Ditto. * gcse.c (clear_modify_mem_tables): Ditto. * global.c (build_insn_chain): Ditto. * ifcvt.c (dead_or_predicable): Ditto. * loop-invariant.c (get_inv_cost, set_move_mark, move_invariant_reg): Ditto. * ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Ditto. * ra-rewrite.c (reloads_to_loads, rewrite_program2, detect_web_parts_to_rebuild, delete_useless_defs, actual_spill): Ditto. * tree-cfg.c (allocate_ssa_names, tree_duplicate_sese_region, tree_purge_all_dead_eh_edges): Ditto. * tree-into-ssa.c (compute_global_livein, insert_phi_nodes, insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags, rewrite_ssa_into_ssa): Ditto. * tree-outof-ssa.c (find_replaceable_exprs): Ditto. * tree-sra.c (scan_function, decide_instantiations, scalarize_parms): Ditto. * tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape, compute_flow_sensitive_aliasing, maybe_create_global_var, dump_points_to_info_for): Ditto. * tree-ssa-dce.c (EXECUTE_IF_CONTROL_DEPENDENT): Ditto. * tree-ssa-dse.c (dse_finalize_block): Ditto. * tree-ssa-live.c (live_worklist, calculate_live_on_entry, calculate_live_on_exit, build_tree_conflict_graph, dump_live_info): Ditto. * tree-ssa-loop-ivopts.c (find_induction_variables, find_interesting_uses, add_old_ivs_candidates, alloc_use_cost_map, determine_use_iv_costs, determine_set_costs, find_best_candidate, set_cost_up_to, create_new_ivs, remove_unused_ivs, free_loop_data): Ditto. * tree-ssa-loop-manip.c (add_exit_phis_var, add_exit_phis): Ditto. * tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops, add_call_read_ops): Ditto. * tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Ditto. From-SVN: r88145
2004-09-26 21:53:13 +02:00
fprintf (outfile, ") ");
}
}
fprintf (outfile, " }\n");
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
void debug_bitmap_set (bitmap_set_t);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
void
debug_bitmap_set (bitmap_set_t set)
{
print_bitmap_set (stderr, set, "debug", 0);
}
/* Print out the expressions that have VAL to OUTFILE. */
void
print_value_expressions (FILE *outfile, tree val)
{
if (VALUE_HANDLE_EXPR_SET (val))
{
char s[10];
sprintf (s, "VH.%04d", VALUE_HANDLE_ID (val));
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
print_bitmap_set (outfile, VALUE_HANDLE_EXPR_SET (val), s, 0);
}
}
void
debug_value_expressions (tree val)
{
print_value_expressions (stderr, val);
}
/* Return the folded version of T if T, when folded, is a gimple
2006-07-04 23:23:03 +02:00
min_invariant. Otherwise, return T. */
static tree
fully_constant_expression (tree t)
2006-07-04 23:23:03 +02:00
{
tree folded;
folded = fold (t);
if (folded && is_gimple_min_invariant (folded))
return folded;
return t;
}
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
/* Make a temporary copy of a CALL_EXPR object NODE. */
static tree
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
temp_copy_call_expr (tree node)
{
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
return (tree) obstack_copy (&temp_call_expr_obstack, node, tree_size (node));
}
/* Translate the vuses in the VUSES vector backwards through phi nodes
in PHIBLOCK, so that they have the value they would have in
BLOCK. */
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
static VEC(tree, gc) *
translate_vuses_through_block (VEC (tree, gc) *vuses,
basic_block phiblock,
basic_block block)
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
{
tree oldvuse;
VEC(tree, gc) *result = NULL;
int i;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
for (i = 0; VEC_iterate (tree, vuses, i, oldvuse); i++)
{
tree phi = SSA_NAME_DEF_STMT (oldvuse);
if (TREE_CODE (phi) == PHI_NODE
&& bb_for_stmt (phi) == phiblock)
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
{
edge e = find_edge (block, bb_for_stmt (phi));
if (e)
{
tree def = PHI_ARG_DEF (phi, e->dest_idx);
if (def != oldvuse)
{
if (!result)
result = VEC_copy (tree, gc, vuses);
VEC_replace (tree, result, i, def);
}
}
}
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* We avoid creating a new copy of the vuses unless something
actually changed, so result can be NULL. */
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
if (result)
{
sort_vuses (result);
return result;
}
return vuses;
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Like find_leader, but checks for the value existing in SET1 *or*
SET2. This is used to avoid making a set consisting of the union
of PA_IN and ANTIC_IN during insert. */
static inline tree
find_leader_in_sets (tree expr, bitmap_set_t set1, bitmap_set_t set2)
{
tree result;
result = bitmap_find_leader (set1, expr);
if (!result && set2)
result = bitmap_find_leader (set2, expr);
return result;
}
/* Translate EXPR using phis in PHIBLOCK, so that it has the values of
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
the phis in PRED. SEEN is a bitmap saying which expression we have
translated since we started translation of the toplevel expression.
Return NULL if we can't find a leader for each part of the
translated expression. */
static tree
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
phi_translate_1 (tree expr, bitmap_set_t set1, bitmap_set_t set2,
basic_block pred, basic_block phiblock, bitmap seen)
{
tree phitrans = NULL;
tree oldexpr = expr;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (expr == NULL)
return NULL;
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
if (constant_expr_p (expr))
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
return expr;
/* Phi translations of a given expression don't change. */
if (EXPR_P (expr) || GIMPLE_STMT_P (expr))
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
{
tree vh;
vh = get_value_handle (expr);
if (vh && TREE_CODE (vh) == VALUE_HANDLE)
phitrans = phi_trans_lookup (expr, pred, VALUE_HANDLE_VUSES (vh));
else
phitrans = phi_trans_lookup (expr, pred, NULL);
}
else
phitrans = phi_trans_lookup (expr, pred, NULL);
if (phitrans)
return phitrans;
2006-07-04 23:23:03 +02:00
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
/* Prevent cycles when we have recursively dependent leaders. This
can only happen when phi translating the maximal set. */
if (seen)
{
unsigned int expr_id = get_expression_id (expr);
if (bitmap_bit_p (seen, expr_id))
return NULL;
bitmap_set_bit (seen, expr_id);
}
switch (TREE_CODE_CLASS (TREE_CODE (expr)))
{
case tcc_expression:
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
return NULL;
case tcc_vl_exp:
{
if (TREE_CODE (expr) != CALL_EXPR)
return NULL;
else
{
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
tree oldfn = CALL_EXPR_FN (expr);
tree oldsc = CALL_EXPR_STATIC_CHAIN (expr);
tree newfn, newsc = NULL;
tree newexpr = NULL_TREE;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
tree vh = get_value_handle (expr);
bool invariantarg = false;
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
int i, nargs;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
VEC (tree, gc) *vuses = VALUE_HANDLE_VUSES (vh);
VEC (tree, gc) *tvuses;
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
newfn = phi_translate_1 (find_leader_in_sets (oldfn, set1, set2),
set1, set2, pred, phiblock, seen);
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
if (newfn == NULL)
return NULL;
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
if (newfn != oldfn)
{
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
newexpr = temp_copy_call_expr (expr);
CALL_EXPR_FN (newexpr) = get_value_handle (newfn);
}
if (oldsc)
{
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
newsc = phi_translate_1 (find_leader_in_sets (oldsc, set1, set2),
set1, set2, pred, phiblock, seen);
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
if (newsc == NULL)
return NULL;
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
if (newsc != oldsc)
{
if (!newexpr)
newexpr = temp_copy_call_expr (expr);
CALL_EXPR_STATIC_CHAIN (newexpr) = get_value_handle (newsc);
}
}
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
/* phi translate the argument list piece by piece. */
nargs = call_expr_nargs (expr);
for (i = 0; i < nargs; i++)
{
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
tree oldval = CALL_EXPR_ARG (expr, i);
tree newval;
if (oldval)
{
/* This may seem like a weird place for this
check, but it's actually the easiest place to
do it. We can't do it lower on in the
recursion because it's valid for pieces of a
component ref to be of AGGREGATE_TYPE, as long
as the outermost one is not.
To avoid *that* case, we have a check for
AGGREGATE_TYPE_P in insert_aux. However, that
check will *not* catch this case because here
it occurs in the argument list. */
if (AGGREGATE_TYPE_P (TREE_TYPE (oldval)))
return NULL;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
oldval = find_leader_in_sets (oldval, set1, set2);
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
newval = phi_translate_1 (oldval, set1, set2, pred,
phiblock, seen);
if (newval == NULL)
return NULL;
if (newval != oldval)
{
invariantarg |= is_gimple_min_invariant (newval);
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
if (!newexpr)
newexpr = temp_copy_call_expr (expr);
CALL_EXPR_ARG (newexpr, i) = get_value_handle (newval);
}
}
}
/* In case of new invariant args we might try to fold the call
again. */
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
if (invariantarg && !newsc)
{
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
tree tmp1 = build_call_array (TREE_TYPE (expr),
newfn, call_expr_nargs (newexpr),
CALL_EXPR_ARGP (newexpr));
tree tmp2 = fold (tmp1);
if (tmp2 != tmp1)
{
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
STRIP_TYPE_NOPS (tmp2);
if (is_gimple_min_invariant (tmp2))
return tmp2;
}
}
tvuses = translate_vuses_through_block (vuses, phiblock, pred);
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
if (vuses != tvuses && ! newexpr)
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
newexpr = temp_copy_call_expr (expr);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
if (newexpr)
{
newexpr->base.ann = NULL;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
vn_lookup_or_add_with_vuses (newexpr, tvuses);
expr = newexpr;
}
phi_trans_add (oldexpr, expr, pred, tvuses);
}
}
return expr;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
case tcc_declaration:
{
VEC (tree, gc) * oldvuses = NULL;
VEC (tree, gc) * newvuses = NULL;
oldvuses = VALUE_HANDLE_VUSES (get_value_handle (expr));
if (oldvuses)
newvuses = translate_vuses_through_block (oldvuses, phiblock,
pred);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
if (oldvuses != newvuses)
vn_lookup_or_add_with_vuses (expr, newvuses);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
phi_trans_add (oldexpr, expr, pred, newvuses);
}
return expr;
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
case tcc_reference:
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
{
tree oldop0 = TREE_OPERAND (expr, 0);
tree oldop1 = NULL;
tree newop0;
tree newop1 = NULL;
tree oldop2 = NULL;
tree newop2 = NULL;
tree oldop3 = NULL;
tree newop3 = NULL;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
tree newexpr;
VEC (tree, gc) * oldvuses = NULL;
VEC (tree, gc) * newvuses = NULL;
if (TREE_CODE (expr) != INDIRECT_REF
&& TREE_CODE (expr) != COMPONENT_REF
&& TREE_CODE (expr) != ARRAY_REF)
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
return NULL;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
oldop0 = find_leader_in_sets (oldop0, set1, set2);
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
newop0 = phi_translate_1 (oldop0, set1, set2, pred, phiblock, seen);
if (newop0 == NULL)
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
return NULL;
2006-07-04 23:23:03 +02:00
if (TREE_CODE (expr) == ARRAY_REF)
{
oldop1 = TREE_OPERAND (expr, 1);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
oldop1 = find_leader_in_sets (oldop1, set1, set2);
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
newop1 = phi_translate_1 (oldop1, set1, set2, pred, phiblock, seen);
2006-07-04 23:23:03 +02:00
if (newop1 == NULL)
return NULL;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
oldop2 = TREE_OPERAND (expr, 2);
if (oldop2)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
oldop2 = find_leader_in_sets (oldop2, set1, set2);
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
newop2 = phi_translate_1 (oldop2, set1, set2, pred, phiblock, seen);
2006-07-04 23:23:03 +02:00
if (newop2 == NULL)
return NULL;
}
oldop3 = TREE_OPERAND (expr, 3);
if (oldop3)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
oldop3 = find_leader_in_sets (oldop3, set1, set2);
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
newop3 = phi_translate_1 (oldop3, set1, set2, pred, phiblock, seen);
2006-07-04 23:23:03 +02:00
if (newop3 == NULL)
return NULL;
}
}
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
oldvuses = VALUE_HANDLE_VUSES (get_value_handle (expr));
if (oldvuses)
newvuses = translate_vuses_through_block (oldvuses, phiblock,
pred);
2006-07-04 23:23:03 +02:00
if (newop0 != oldop0 || newvuses != oldvuses
2006-07-04 23:23:03 +02:00
|| newop1 != oldop1
|| newop2 != oldop2
|| newop3 != oldop3)
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
{
tree t;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
newexpr = (tree) pool_alloc (reference_node_pool);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
memcpy (newexpr, expr, tree_size (expr));
TREE_OPERAND (newexpr, 0) = get_value_handle (newop0);
if (TREE_CODE (expr) == ARRAY_REF)
{
TREE_OPERAND (newexpr, 1) = get_value_handle (newop1);
if (newop2)
TREE_OPERAND (newexpr, 2) = get_value_handle (newop2);
if (newop3)
TREE_OPERAND (newexpr, 3) = get_value_handle (newop3);
}
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
t = fully_constant_expression (newexpr);
if (t != newexpr)
{
pool_free (reference_node_pool, newexpr);
newexpr = t;
}
else
{
newexpr->base.ann = NULL;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
vn_lookup_or_add_with_vuses (newexpr, newvuses);
}
expr = newexpr;
}
phi_trans_add (oldexpr, expr, pred, newvuses);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
}
return expr;
break;
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
case tcc_binary:
case tcc_comparison:
{
tree oldop1 = TREE_OPERAND (expr, 0);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
tree oldval1 = oldop1;
tree oldop2 = TREE_OPERAND (expr, 1);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
tree oldval2 = oldop2;
tree newop1;
tree newop2;
tree newexpr;
2006-07-04 23:23:03 +02:00
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
oldop1 = find_leader_in_sets (oldop1, set1, set2);
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
newop1 = phi_translate_1 (oldop1, set1, set2, pred, phiblock, seen);
if (newop1 == NULL)
return NULL;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
oldop2 = find_leader_in_sets (oldop2, set1, set2);
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
newop2 = phi_translate_1 (oldop2, set1, set2, pred, phiblock, seen);
if (newop2 == NULL)
return NULL;
if (newop1 != oldop1 || newop2 != oldop2)
{
tree t;
tree-tailcall.c (find_tail_calls): Use XNEW. * tree-tailcall.c (find_tail_calls): Use XNEW. * tree-ssa-dom.c (allocate_edge_info): Use XCNEW. (free_all_edge_infos): Use explicit cast to convert from void * *. (vrp_free): Likewise. (dom_opt_finalize_block): Likewise. (record_equivalences_from_incoming_edge): Likewise. (thread_across_edge): Likewise. Use XCNEWVEC. (record_cond): Use XCNEW. (record_conditions): Use XNEWVEC. (record_edge_info): Use XCNEWVEC. (lookup_avail_expr): Use XNEW. (record_range): Likewise. Use GGC_NEW. * tree-nested.c (var_map_hash): Use explicit cast to convert * from void *. (var_map_eq): Likewise. (lookup_field_for_decl): Likewise. (convert_nonlocal_reference): Likewise. (convert_local_reference): Likewise. (convert_nl_goto_reference): Likewise. (convert_nl_goto_receiver): Likewise. (convert_call_expr): Likewise. (convert_tramp_reference): Likewise. (lookup_tramp_for_decl): Likewise.Use GGC_NEW. (convert_nl_goto_reference): Likewise. (lookup_field_for_decl): Use GGC_NEW. (create_nesting_tree): Use GGC_CNEW. * tree-ssa-phiopt.c (blocks_in_phiopt_order): Use XNEWVEC. * tree-ssa-alias.c (init_alias_info): Use XCNEW. (create_alias_map_for): Likewise. (setup_pointers_and_addressables): Use XCNEWVEC. (get_ptr_info): Use GGC_NEW. (used_part_map_eq): Use explicit cast to convert from void *. (up_lookup): Likewise. (up_insert): Use XNEW. (get_or_create_used_part_for): Use XCNEW. (get_tmt_for): Likewise. * tree-ssa-operands.c (ssa_operand_alloc): Use GGC_NEW. * tree-ssa-pre.c (phi_trans_add): Use XNEW. (bitmap_set_new): Use explicit cast to convert from void *. (set_new): Likewise. (insert_into_set): Likewise. (pool_copy_list): Likewise. (phi_translate): Likewise. (create_value_expr_from): Likewise. (insert_aux): Use XCNEWVEC. (compute_avail): Use XNEWVEC. * tree-ssa-live.c (calculate_live_on_entry): Likewise. (sort_coalesce_list): Likewise. (build_tree_conflict_graph): Use XCNEWVEC. * tree-ssa-dce.c (tree_dce_init): Use XNEWVEC. * tree-ssa-copy.c (init_copy_prop): Likewise. (fini_copy_prop): Likewise. * tree-ssa-uncprop.c (associate_equivalences_with_edges): Use * XNEW and XCNEWVEC. (record_equiv): Use XNEW. (uncprop_into_successor_phis): Use explicit cast to convert * from void *. (uncprop_initialize_block): Likewise. From-SVN: r108747
2005-12-18 10:26:53 +01:00
newexpr = (tree) pool_alloc (binary_node_pool);
memcpy (newexpr, expr, tree_size (expr));
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
TREE_OPERAND (newexpr, 0) = newop1 == oldop1 ? oldval1 : get_value_handle (newop1);
TREE_OPERAND (newexpr, 1) = newop2 == oldop2 ? oldval2 : get_value_handle (newop2);
t = fully_constant_expression (newexpr);
if (t != newexpr)
{
pool_free (binary_node_pool, newexpr);
newexpr = t;
}
else
{
newexpr->base.ann = NULL;
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
vn_lookup_or_add (newexpr);
}
expr = newexpr;
}
phi_trans_add (oldexpr, expr, pred, NULL);
}
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
return expr;
case tcc_unary:
{
tree oldop1 = TREE_OPERAND (expr, 0);
tree newop1;
tree newexpr;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
oldop1 = find_leader_in_sets (oldop1, set1, set2);
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
newop1 = phi_translate_1 (oldop1, set1, set2, pred, phiblock, seen);
if (newop1 == NULL)
return NULL;
if (newop1 != oldop1)
{
tree t;
tree-tailcall.c (find_tail_calls): Use XNEW. * tree-tailcall.c (find_tail_calls): Use XNEW. * tree-ssa-dom.c (allocate_edge_info): Use XCNEW. (free_all_edge_infos): Use explicit cast to convert from void * *. (vrp_free): Likewise. (dom_opt_finalize_block): Likewise. (record_equivalences_from_incoming_edge): Likewise. (thread_across_edge): Likewise. Use XCNEWVEC. (record_cond): Use XCNEW. (record_conditions): Use XNEWVEC. (record_edge_info): Use XCNEWVEC. (lookup_avail_expr): Use XNEW. (record_range): Likewise. Use GGC_NEW. * tree-nested.c (var_map_hash): Use explicit cast to convert * from void *. (var_map_eq): Likewise. (lookup_field_for_decl): Likewise. (convert_nonlocal_reference): Likewise. (convert_local_reference): Likewise. (convert_nl_goto_reference): Likewise. (convert_nl_goto_receiver): Likewise. (convert_call_expr): Likewise. (convert_tramp_reference): Likewise. (lookup_tramp_for_decl): Likewise.Use GGC_NEW. (convert_nl_goto_reference): Likewise. (lookup_field_for_decl): Use GGC_NEW. (create_nesting_tree): Use GGC_CNEW. * tree-ssa-phiopt.c (blocks_in_phiopt_order): Use XNEWVEC. * tree-ssa-alias.c (init_alias_info): Use XCNEW. (create_alias_map_for): Likewise. (setup_pointers_and_addressables): Use XCNEWVEC. (get_ptr_info): Use GGC_NEW. (used_part_map_eq): Use explicit cast to convert from void *. (up_lookup): Likewise. (up_insert): Use XNEW. (get_or_create_used_part_for): Use XCNEW. (get_tmt_for): Likewise. * tree-ssa-operands.c (ssa_operand_alloc): Use GGC_NEW. * tree-ssa-pre.c (phi_trans_add): Use XNEW. (bitmap_set_new): Use explicit cast to convert from void *. (set_new): Likewise. (insert_into_set): Likewise. (pool_copy_list): Likewise. (phi_translate): Likewise. (create_value_expr_from): Likewise. (insert_aux): Use XCNEWVEC. (compute_avail): Use XNEWVEC. * tree-ssa-live.c (calculate_live_on_entry): Likewise. (sort_coalesce_list): Likewise. (build_tree_conflict_graph): Use XCNEWVEC. * tree-ssa-dce.c (tree_dce_init): Use XNEWVEC. * tree-ssa-copy.c (init_copy_prop): Likewise. (fini_copy_prop): Likewise. * tree-ssa-uncprop.c (associate_equivalences_with_edges): Use * XNEW and XCNEWVEC. (record_equiv): Use XNEW. (uncprop_into_successor_phis): Use explicit cast to convert * from void *. (uncprop_initialize_block): Likewise. From-SVN: r108747
2005-12-18 10:26:53 +01:00
newexpr = (tree) pool_alloc (unary_node_pool);
memcpy (newexpr, expr, tree_size (expr));
TREE_OPERAND (newexpr, 0) = get_value_handle (newop1);
t = fully_constant_expression (newexpr);
if (t != newexpr)
{
pool_free (unary_node_pool, newexpr);
newexpr = t;
}
else
{
newexpr->base.ann = NULL;
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
vn_lookup_or_add (newexpr);
}
expr = newexpr;
}
phi_trans_add (oldexpr, expr, pred, NULL);
}
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
return expr;
case tcc_exceptional:
{
tree phi = NULL;
edge e;
tree def_stmt;
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * targhooks.c (default_unwind_emit, default_scalar_mode_supported_p): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * timevar.c (timevar_push, timevar_pop, timevar_start, timevar_stop): Likewise. * toplev.c (default_pch_valid_p): Likewise. * tracer.c (tail_duplicate): Likewise. * tree-alias-common.c (get_alias_var_decl, get_values_from_constructor, create_alias_var, delete_alias_vars, empty_points_to_set, same_points_to_set, ptr_may_alias_var): Likewise. * tree.c (tree_size, make_node_stat, copy_node_stat, build_int_cst_wide, integer_all_onesp, list_length, chainon, tree_node_structure, type_contains_placeholder_p, substitute_in_expr, substitute_placeholder_in_expr, tabilize_reference_1, build0_stat, build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p, lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr, build_method_type_directly, decl_type_context, get_callee_fndecl, get_set_constructor_bits, build_vector_type_for_mode, int_cst_value, tree_fold_gcd): Likewise. * tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges, make_cond_expr_edges, group_case_labels, tree_merge_blocks, cleanup_control_expr_graph, find_taken_edge, find_taken_edge_switch_expr, phi_alternatives_equal, is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt, stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate, tree_split_edge, tree_verify_flow_info, thread_jumps, tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise. * tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly, chrec_fold_multiply_poly_poly): Likewise. * tree-complex.c (extract_component, expand_complex_division, expand_complex_comparison, expand_complex_operations_1, build_replicated_const, expand_vector_operations_1): Likewise. * tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector, build_classic_dir_vector): Likewise. * tree-dfa.c (compute_immediate_uses_for_phi, compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann, create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region, record_in_finally_tree, replace_goto_queue_1, maybe_record_in_goto_queue, verify_norecord_switch_expr, do_return_redirection): Likewise. * tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr, add_to_dst_predicate_list, find_phi_replacement_condition, replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order): Likewise. * tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r, initialize_inlined_parameters, declare_return_variable, estimate_num_insns_1, expand_call_inline, expand_calls_inline, optimize_inline_calls, copy_tree_r): Likewise. * tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt, ssa_rewrite_stmt, rewrite_into_ssa): Likewise. * tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after, tsi_split_statement_list_after, tsi_split_statement_list_before): Likewise. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-nested.c (create_tmp_var_for, lookup_field_for_decl, lookup_tramp_for_decl, convert_all_function_calls): Likewise. * tree-optimize.c (tree_rest_of_compilation): Likewise. * tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi, coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis, free_temp_expr_table, add_dependance, finish_expr, rewrite_trees): Likewise. * tree-phinodes.c (resize_phi_node, add_phi_arg, remove_all_phi_nodes_for): Likewise. * tree-pretty-print.c (op_prio, print_call_name): Likewise. * tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise. * tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree, sra_elt_eq, sra_walk_expr, instantiate_missing_elements, generate_one_element_ref, generate_element_copy, generate_element_zero, scalarize_copy, scalarize_init, scalarize_ldst): Likewise. * tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p, add_may_alias, add_pointed_to_expr, add_pointed_to_var, collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise. * tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise. * tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value, set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment, widen_bitfield, ccp_fold_builtin): Likewise. * tree-ssa-copy.c (may_propagate_copy, merge_alias_info, replace_exp_1, propagate_tree_value): Likewise. * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise. * tree-ssa-dce.c (set_control_dependence_map_bit, find_control_dependence, find_pdom, mark_operand_necessary, mark_stmt_if_obviously_necessary, mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise. * tree-ssa-dom.c (dom_opt_initialize_block_local_data, simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis, eliminate_redundant_computations, avail_expr_eq): Likewise. * tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p, duplicate_blocks): Likewise. * tree-ssa-loop-im.c (for_each_index, set_level, is_call_clobbered_ref): Likewise. * tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos, stmt_after_increment, set_iv, contains_abnormal_ssa_name_p, find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates, peel_address, ptr_difference_cost, may_replace_final_value, determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer, rewrite_use, rewrite_uses): Likewise. * tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa, check_loop_closed_ssa_use): Likewise. * tree-ssanames.c (make_ssa_name): Likewise. * tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses, finalize_ssa_v_must_defs, finalize_ssa_stmt_operands, get_stmt_operands, get_expr_operands, get_asm_expr_operands, get_indirect_ref_operands, add_stmt_operand): Likewise. * tree-ssa-pre.c (value_exists_in_set_bitmap, value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set, phi_translate, valid_in_set, compute_antic, find_or_generate_expression, create_expression_by_pieces, insert_aux, create_value_expr_from, eliminate): Likewise. * tree-ssa-propagate.c (cfg_blocks_get): Likewise. * tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges): Likewise. * tree-tailcall.c (independent_of_stmt_p, adjust_return_value, eliminate_tail_call): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_align_data_ref, vect_create_data_ref, vect_create_destination_var, vect_get_vec_def_for_operand, vect_finish_stmt_generation, vect_transform_stmt, vect_transform_loop_bound, vect_transform_loop, vect_analyze_operations): Likewise. * tree-vn.c (vn_compute, set_value_handle, get_value_handle): Likewise. * tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr, get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start, bsi_after_labels, bsi_last): Likewise. * tree-ssa-live.c (var_union, change_partition_var, create_ssa_var_map, calculate_live_on_entry, root_var_init, type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce): Likewise. * tree-ssa-live.h (partition_is_global, live_entry_blocks, tpa_find_tree): Likewise. (register_ssa_partition_check): Declare. (register_ssa_partition): use it. * tree-ssa-live.c: Include errors.h. (register_ssa_partition_check): New. * tree-ssa-operands.c: Include errors.h. * Makefile.in (tree-ssa-operands.o): Depend on errors.h. Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com> From-SVN: r87223
2004-09-09 09:54:12 +02:00
gcc_assert (TREE_CODE (expr) == SSA_NAME);
def_stmt = SSA_NAME_DEF_STMT (expr);
if (TREE_CODE (def_stmt) == PHI_NODE
&& bb_for_stmt (def_stmt) == phiblock)
phi = def_stmt;
else
return expr;
2006-07-04 23:23:03 +02:00
e = find_edge (pred, bb_for_stmt (phi));
if (e)
{
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
tree val;
tree def = PHI_ARG_DEF (phi, e->dest_idx);
if (is_gimple_min_invariant (def))
return def;
if (is_undefined_value (def))
return NULL;
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
val = get_value_handle (def);
gcc_assert (val);
return def;
}
}
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
return expr;
default:
gcc_unreachable ();
}
}
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
/* Translate EXPR using phis in PHIBLOCK, so that it has the values of
the phis in PRED.
Return NULL if we can't find a leader for each part of the
translated expression. */
static tree
phi_translate (tree expr, bitmap_set_t set1, bitmap_set_t set2,
basic_block pred, basic_block phiblock)
{
bitmap_clear (seen_during_translate);
return phi_translate_1 (expr, set1, set2, pred, phiblock,
seen_during_translate);
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
}
/* For each expression in SET, translate the value handles through phi nodes
in PHIBLOCK using edge PHIBLOCK->PRED, and store the resulting
expressions in DEST. */
static void
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
phi_translate_set (bitmap_set_t dest, bitmap_set_t set, basic_block pred,
basic_block phiblock)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
VEC (tree, heap) *exprs;
tree expr;
int i;
if (!phi_nodes (phiblock))
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_set_copy (dest, set);
return;
}
2006-07-04 23:23:03 +02:00
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
exprs = sorted_array_from_bitmap_set (set);
for (i = 0; VEC_iterate (tree, exprs, i, expr); i++)
{
tree translated;
translated = phi_translate (expr, set, NULL, pred, phiblock);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
/* Don't add constants or empty translations to the cache, since
we won't look them up that way, or use the result, anyway. */
if (translated && !is_gimple_min_invariant (translated))
{
tree vh = get_value_handle (translated);
VEC (tree, gc) *vuses;
2006-07-04 23:23:03 +02:00
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
/* The value handle itself may also be an invariant, in
which case, it has no vuses. */
vuses = !is_gimple_min_invariant (vh)
? VALUE_HANDLE_VUSES (vh) : NULL;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
phi_trans_add (expr, translated, pred, vuses);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
}
if (translated != NULL)
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_value_insert_into_set (dest, translated);
2006-07-04 23:23:03 +02:00
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
VEC_free (tree, heap, exprs);
}
/* Find the leader for a value (i.e., the name representing that
value) in a given set, and return it. Return NULL if no leader is
found. */
static tree
bitmap_find_leader (bitmap_set_t set, tree val)
{
if (val == NULL)
return NULL;
2006-07-04 23:23:03 +02:00
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (constant_expr_p (val))
return val;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (bitmap_set_contains_value (set, val))
{
/* Rather than walk the entire bitmap of expressions, and see
whether any of them has the value we are looking for, we look
at the reverse mapping, which tells us the set of expressions
that have a given value (IE value->expressions with that
value) and see if any of those expressions are in our set.
The number of expressions per value is usually significantly
less than the number of expressions in the set. In fact, for
large testcases, doing it this way is roughly 5-10x faster
than walking the bitmap.
If this is somehow a significant lose for some cases, we can
2006-07-04 23:23:03 +02:00
choose which set to walk based on which set is smaller. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
unsigned int i;
bitmap_iterator bi;
bitmap_set_t exprset = VALUE_HANDLE_EXPR_SET (val);
2006-07-04 23:23:03 +02:00
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
EXECUTE_IF_AND_IN_BITMAP (exprset->expressions,
set->expressions, 0, i, bi)
return expression_for_id (i);
}
return NULL;
}
/* Determine if VALUE, a memory operation, is ANTIC_IN at the top of
BLOCK by seeing if it is not killed in the block. Note that we are
only determining whether there is a store that kills it. Because
of the order in which clean iterates over values, we are guaranteed
that altered operands will have caused us to be eliminated from the
ANTIC_IN set already. */
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
static bool
value_dies_in_block_x (tree vh, basic_block block)
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
{
int i;
tree vuse;
VEC (tree, gc) *vuses = VALUE_HANDLE_VUSES (vh);
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
/* Conservatively, a value dies if it's vuses are defined in this
block, unless they come from phi nodes (which are merge operations,
rather than stores. */
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
for (i = 0; VEC_iterate (tree, vuses, i, vuse); i++)
{
tree def = SSA_NAME_DEF_STMT (vuse);
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
if (bb_for_stmt (def) != block)
continue;
if (TREE_CODE (def) == PHI_NODE)
continue;
return true;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
}
return false;
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Determine if the expression EXPR is valid in SET1 U SET2.
ONLY SET2 CAN BE NULL.
This means that we have a leader for each part of the expression
(if it consists of values), or the expression is an SSA_NAME.
For loads/calls, we also see if the vuses are killed in this block.
NB: We never should run into a case where we have SSA_NAME +
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
SSA_NAME or SSA_NAME + value. The sets valid_in_sets is called on,
the ANTIC sets, will only ever have SSA_NAME's or value expressions
(IE VALUE1 + VALUE2, *VALUE1, VALUE1 < VALUE2) */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
#define union_contains_value(SET1, SET2, VAL) \
(bitmap_set_contains_value ((SET1), (VAL)) \
|| ((SET2) && bitmap_set_contains_value ((SET2), (VAL))))
static bool
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
valid_in_sets (bitmap_set_t set1, bitmap_set_t set2, tree expr,
basic_block block)
{
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
tree vh = get_value_handle (expr);
switch (TREE_CODE_CLASS (TREE_CODE (expr)))
{
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
case tcc_binary:
case tcc_comparison:
{
tree op1 = TREE_OPERAND (expr, 0);
tree op2 = TREE_OPERAND (expr, 1);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
return union_contains_value (set1, set2, op1)
&& union_contains_value (set1, set2, op2);
}
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
case tcc_unary:
{
tree op1 = TREE_OPERAND (expr, 0);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
return union_contains_value (set1, set2, op1);
}
2006-07-04 23:23:03 +02:00
case tcc_expression:
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
return false;
case tcc_vl_exp:
{
if (TREE_CODE (expr) == CALL_EXPR)
{
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
tree fn = CALL_EXPR_FN (expr);
tree sc = CALL_EXPR_STATIC_CHAIN (expr);
tree arg;
call_expr_arg_iterator iter;
/* Check the non-argument operands first. */
if (!union_contains_value (set1, set2, fn)
|| (sc && !union_contains_value (set1, set2, sc)))
return false;
/* Now check the operands. */
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
FOR_EACH_CALL_EXPR_ARG (arg, iter, expr)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (!union_contains_value (set1, set2, arg))
return false;
}
return !value_dies_in_block_x (vh, block);
}
return false;
}
2006-07-04 23:23:03 +02:00
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
case tcc_reference:
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
{
2006-07-04 23:23:03 +02:00
if (TREE_CODE (expr) == INDIRECT_REF
|| TREE_CODE (expr) == COMPONENT_REF
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
|| TREE_CODE (expr) == ARRAY_REF)
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
{
tree op0 = TREE_OPERAND (expr, 0);
gcc_assert (is_gimple_min_invariant (op0)
|| TREE_CODE (op0) == VALUE_HANDLE);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (!union_contains_value (set1, set2, op0))
return false;
if (TREE_CODE (expr) == ARRAY_REF)
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
{
tree op1 = TREE_OPERAND (expr, 1);
tree op2 = TREE_OPERAND (expr, 2);
tree op3 = TREE_OPERAND (expr, 3);
gcc_assert (is_gimple_min_invariant (op1)
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
|| TREE_CODE (op1) == VALUE_HANDLE);
if (!union_contains_value (set1, set2, op1))
return false;
gcc_assert (!op2 || is_gimple_min_invariant (op2)
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
|| TREE_CODE (op2) == VALUE_HANDLE);
if (op2
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
&& !union_contains_value (set1, set2, op2))
return false;
gcc_assert (!op3 || is_gimple_min_invariant (op3)
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
|| TREE_CODE (op3) == VALUE_HANDLE);
if (op3
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
&& !union_contains_value (set1, set2, op3))
return false;
}
return !value_dies_in_block_x (vh, block);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
}
}
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
return false;
case tcc_exceptional:
{
gcc_assert (TREE_CODE (expr) == SSA_NAME);
return bitmap_set_contains_expr (AVAIL_OUT (block), expr);
}
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
case tcc_declaration:
return !value_dies_in_block_x (vh, block);
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
default:
/* No other cases should be encountered. */
2006-07-04 23:23:03 +02:00
gcc_unreachable ();
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
}
}
/* Clean the set of expressions that are no longer valid in SET1 or
SET2. This means expressions that are made up of values we have no
leaders for in SET1 or SET2. This version is used for partial
anticipation, which means it is not valid in either ANTIC_IN or
PA_IN. */
static void
dependent_clean (bitmap_set_t set1, bitmap_set_t set2, basic_block block)
{
VEC (tree, heap) *exprs = sorted_array_from_bitmap_set (set1);
tree expr;
int i;
for (i = 0; VEC_iterate (tree, exprs, i, expr); i++)
{
if (!valid_in_sets (set1, set2, expr, block))
bitmap_remove_from_set (set1, expr);
}
VEC_free (tree, heap, exprs);
}
/* Clean the set of expressions that are no longer valid in SET. This
means expressions that are made up of values we have no leaders for
in SET. */
static void
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
clean (bitmap_set_t set, basic_block block)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
VEC (tree, heap) *exprs = sorted_array_from_bitmap_set (set);
tree expr;
int i;
for (i = 0; VEC_iterate (tree, exprs, i, expr); i++)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (!valid_in_sets (set, NULL, expr, block))
bitmap_remove_from_set (set, expr);
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
VEC_free (tree, heap, exprs);
}
static sbitmap has_abnormal_preds;
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* List of blocks that may have changed during ANTIC computation and
thus need to be iterated over. */
static sbitmap changed_blocks;
/* Decide whether to defer a block for a later iteration, or PHI
translate SOURCE to DEST using phis in PHIBLOCK. Return false if we
should defer the block, and true if we processed it. */
static bool
defer_or_phi_translate_block (bitmap_set_t dest, bitmap_set_t source,
basic_block block, basic_block phiblock)
{
if (!BB_VISITED (phiblock))
{
SET_BIT (changed_blocks, block->index);
BB_VISITED (block) = 0;
BB_DEFERRED (block) = 1;
return false;
}
else
phi_translate_set (dest, source, block, phiblock);
return true;
}
/* Compute the ANTIC set for BLOCK.
If succs(BLOCK) > 1 then
ANTIC_OUT[BLOCK] = intersection of ANTIC_IN[b] for all succ(BLOCK)
else if succs(BLOCK) == 1 then
ANTIC_OUT[BLOCK] = phi_translate (ANTIC_IN[succ(BLOCK)])
ANTIC_IN[BLOCK] = clean(ANTIC_OUT[BLOCK] U EXP_GEN[BLOCK] - TMP_GEN[BLOCK])
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
*/
static bool
compute_antic_aux (basic_block block, bool block_has_abnormal_pred_edge)
{
bool changed = false;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_set_t S, old, ANTIC_OUT;
bitmap_iterator bi;
unsigned int bii;
edge e;
edge_iterator ei;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
old = ANTIC_OUT = S = NULL;
BB_VISITED (block) = 1;
/* If any edges from predecessors are abnormal, antic_in is empty,
so do nothing. */
if (block_has_abnormal_pred_edge)
goto maybe_dump_sets;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
old = ANTIC_IN (block);
ANTIC_OUT = bitmap_set_new ();
/* If the block has no successors, ANTIC_OUT is empty. */
if (EDGE_COUNT (block->succs) == 0)
;
/* If we have one successor, we could have some phi nodes to
translate through. */
basic-block.h (single_succ_p, [...]): New inline functions. * basic-block.h (single_succ_p, single_pred_p, single_succ_edge, single_pred_edge, single_succ, single_pred): New inline functions. * bb-reorder.c (rotate_loop, find_traces_1_round, add_labels_and_missing_jumps, fix_up_fall_thru_edges, duplicate_computed_gotos): Use the single_succ/pred functions. * cfganal.c (forwarder_block_p): Ditto. * cfgbuild.c (compute_outgoing_frequencies): Ditto. * cfgcleanup.c (try_simplify_condjump, try_forward_edges, outgoing_edges_match, try_crossjump_to_edge, try_optimize_cfg, merge_seq_blocks): Ditto. * cfghooks.c (split_edge, tidy_fallthru_edges): Ditto. * cfglayout.c (fixup_reorder_chain): Ditto. * cfgloop.c (mark_single_exit_loops, update_latch_info, canonicalize_loop_headers, verify_loop_structure): Ditto. * cfgloopmanip.c (remove_path, unloop, loop_delete_branch_edge, mfb_update_loops, create_preheader, force_single_succ_latches, create_loop_notes): Ditto. * cfgrtl.c (rtl_can_merge_blocks, try_redirect_by_replacing_jump, force_nonfallthru_and_redirect, rtl_tidy_fallthru_edge, commit_one_edge_insertion, purge_dead_edges, cfg_layout_can_merge_blocks_p): Ditto. * except.c (sjlj_emit_function_enter): Ditto. * flow.c (init_propagate_block_info): Ditto. * function.c (thread_prologue_and_epilogue_insns): Ditto. * gcse.c (find_implicit_sets, bypass_conditional_jumps, insert_insn_end_bb): Ditto. * ifcvt.c (merge_if_block, find_if_block, find_if_case_1, find_if_case_2): Ditto. * lambda-code.c (perfect_nestify): Ditto. * lcm.c (optimize_mode_switching): Ditto. * loop-doloop.c (doloop_modify): Ditto. * loop-init.c (loop_optimizer_init): Ditto. * loop-iv.c (simplify_using_initial_values): Ditto. * loop-unroll.c (unroll_loop_runtime_iterations): Ditto. * loop-unswitch.c (unswitch_loop): Ditto. * modulo-sched.c (generate_prolog_epilog): Ditto. * predict.c (combine_predictions_for_insn, estimate_probability, tree_estimate_probability, last_basic_block_p, estimate_bb_frequencies): Ditto. * profile.c (branch_prob): Ditto. * regrename.c (copyprop_hardreg_forward): Ditto. * sched-rgn.c (is_cfg_nonregular, find_rgns, update_live): Ditto. * tracer.c (layout_superblocks): Ditto. * tree-cfg.c (tree_can_merge_blocks_p, tree_merge_blocks, cfg_remove_useless_stmts_bb, cleanup_control_flow, cleanup_control_expr_graph, disband_implicit_edges, tree_find_edge_insert_loc, bsi_commit_edge_inserts, tree_verify_flow_info, tree_make_forwarder_block, tree_forwarder_block_p, remove_forwarder_block, remove_forwarder_block_with_phi, merge_phi_nodes): Ditto. * tree-if-conv.c (tree_if_conversion): Ditto. * tree-mudflap.c (mf_build_check_statement_for): Ditto. * tree-ssa-dce.c (remove_dead_stmt): Ditto. * tree-ssa-dom.c (dom_opt_finalize_block): Ditto. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p, copy_loop_headers): Ditto. * tree-ssa-loop-im.c (loop_commit_inserts): Ditto. * tree-ssa-loop-ivopts.c (compute_phi_arg_on_exit): Ditto. * tree-ssa-loop-manip.c (split_loop_exit_edge, ip_normal_pos, lv_adjust_loop_entry_edge, tree_ssa_loop_version): Ditto. * tree-ssa-loop-niter.c (simplify_using_initial_conditions): Ditto. * tree-ssa-loop-unswitch.c (simplify_using_entry_checks): Ditto. * tree-ssa-phiopt.c (tree_ssa_phiopt, value_replacement): Ditto. * tree-ssa-pre.c (compute_antic_aux, insert_aux, init_pre): Ditto. * tree-ssa-threadupdate.c (redirect_edges): Ditto. * tree-tailcall.c (independent_of_stmt_p, find_tail_calls, eliminate_tail_call, tree_optimize_tail_calls_1): Ditto. * tree-vect-analyze.c (vect_analyze_loop_form): Ditto. * tree-vect-transform.c (vect_update_ivs_after_vectorizer): Ditto. * tree-vectorizer.c (slpeel_update_phi_nodes_for_guard, slpeel_add_loop_guard): Ditto. From-SVN: r96292
2005-03-11 10:05:12 +01:00
else if (single_succ_p (block))
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
basic_block succ_bb = single_succ (block);
/* We trade iterations of the dataflow equations for having to
phi translate the maximal set, which is incredibly slow
(since the maximal set often has 300+ members, even when you
have a small number of blocks).
Basically, we defer the computation of ANTIC for this block
until we have processed it's successor, which will inevitably
have a *much* smaller set of values to phi translate once
clean has been run on it.
The cost of doing this is that we technically perform more
iterations, however, they are lower cost iterations.
Timings for PRE on tramp3d-v4:
without maximal set fix: 11 seconds
with maximal set fix/without deferring: 26 seconds
with maximal set fix/with deferring: 11 seconds
*/
if (!defer_or_phi_translate_block (ANTIC_OUT, ANTIC_IN (succ_bb),
block, succ_bb))
{
changed = true;
goto maybe_dump_sets;
}
}
/* If we have multiple successors, we take the intersection of all of
them. Note that in the case of loop exit phi nodes, we may have
phis to translate through. */
else
{
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
VEC(basic_block, heap) * worklist;
size_t i;
basic_block bprime, first;
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
worklist = VEC_alloc (basic_block, heap, EDGE_COUNT (block->succs));
backport: basic-block.h: Include vec.h, errors.h. 2004-09-24 Ben Elliston <bje@au.ibm.com> Steven Bosscher <stevenb@suse.de> Andrew Pinski <pinskia@physics.uc.edu> Merge from edge-vector-branch: * basic-block.h: Include vec.h, errors.h. Instantiate a VEC(edge). (struct edge_def): Remove pred_next, succ_next members. (struct basic_block_def): Remove pred, succ members. Add preds and succs members of type VEC(edge). (FALLTHRU_EDGE): Redefine using EDGE_SUCC. (BRANCH_EDGE): Likewise. (EDGE_CRITICAL_P): Redefine using EDGE_COUNT. (EDGE_COUNT, EDGE_I, EDGE_PRED, EDGE_SUCC): New. (edge_iterator): New. (ei_start, ei_last, ei_end_p, ei_one_before_end_p): New. (ei_next, ei_prev, ei_edge, ei_safe_edge): Likewise. (FOR_EACH_EDGE): New. * bb-reorder.c (find_traces): Use FOR_EACH_EDGE and EDGE_* macros where applicable. (rotate_loop): Likewise. (find_traces_1_route): Likewise. (bb_to_key): Likewise. (connect_traces): Likewise. (copy_bb_p): Likewise. (find_rarely_executed_basic_blocks_and_crossing_edges): Likewise. (add_labels_and_missing_jumps): Likewise. (fix_up_fall_thru_edges): Likewise. (find_jump_block): Likewise. (fix_crossing_conditional_branches): Likewise. (fix_crossing_unconditional_branches): Likewise. (add_reg_crossing_jump_notes): Likewise. * bt-load.c (augment_live_range): Likewise. * cfg.c (clear_edges): Likewise. (unchecked_make_edge): Likewise. (cached_make_edge): Likewise. (make_single_succ_edge): Likewise. (remove_edge): Likewise. (redirect_edge_succ_nodup): Likewise. (check_bb_profile): Likewise. (dump_flow_info): Likewise. (alloc_aux_for_edges): Likewise. (clear_aux_for_edges): Likewise. (dump_cfg_bb_info): Likewise. * cfganal.c (forwarder_block_p): Likewise. (can_fallthru): Likewise. (could_fall_through): Likewise. (mark_dfs_back_edges): Likewise. (set_edge_can_fallthru_flag): Likewise. (find_unreachable_blocks): Likewise. (create_edge_list): Likewise. (verify_edge_list): Likewise. (add_noreturn_fake_exit_edges): Likewise. (connect_infinite_loops_to_exit): Likewise. (flow_reverse_top_sort_order_compute): Likewise. (flow_depth_first_order_compute): Likewise. (flow_preorder_transversal_compute): Likewise. (flow_dfs_compute_reverse_execute): Likewise. (dfs_enumerate_from): Likewise. (compute_dominance_frontiers_1): Likewise. * cfgbuild.c (make_edges): Likewise. (compute_outgoing_frequencies): Likewise. (find_many_sub_basic_blocks): Likewise. (find_sub_basic_blocks): Likewise. * cfgcleanup.c (try_simplify_condjump): Likewise. (thread_jump): Likewise. (try_forward_edges): Likewise. (merge_blocks_move): Likewise. (outgoing_edges_match): Likewise. (try_crossjump_to_edge): Likewise. (try_crossjump_bb): Likewise. (try_optimize_cfg): Likewise. (merge_seq_blocks): Likewise. * cfgexpand.c (expand_gimple_tailcall): Likewise. (expand_gimple_basic_block): Likewise. (construct_init_block): Likewise. (construct_exit_block): Likewise. * cfghooks.c (verify_flow_info): Likewise. (dump_bb): Likewise. (delete_basic_block): Likewise. (split_edge): Likewise. (merge_blocks): Likewise. (make_forwarder_block): Likewise. (tidy_fallthru_edges): Likewise. (can_duplicate_block_p): Likewise. (duplicate_block): Likewise. * cfglayout.c (fixup_reorder_chain): Likewise. (fixup_fallthru_exit_predecessor): Likewise. (can_copy_bbs_p): Likewise. (copy_bbs): Likewise. * cfgloop.c (flow_loops_cfg_dump): Likewise. (flow_loop_entry_edges_find): Likewise. (flow_loop_exit_edges_find): Likewise. (flow_loop_nodes_find): Likewise. (mark_single_exit_loops): Likewise. (flow_loop_pre_header_scan): Likewise. (flow_loop_pre_header_find): Likewise. (update_latch_info): Likewise. (canonicalize_loop_headers): Likewise. (flow_loops_find): Likewise. (get_loop_body_in_bfs_order): Likewise. (get_loop_exit_edges): Likewise. (num_loop_branches): Likewise. (verify_loop_structure): Likewise. (loop_latch_edge): Likewise. (loop_preheader_edge): Likewise. * cfgloopanal.c (mark_irreducible_loops): Likewise. (expected_loop_iterations): Likewise. * cfgloopmanip.c (remove_bbs): Likewise. (fix_bb_placement): Likewise. (fix_irreducible_loops): Likewise. (remove_path): Likewise. (scale_bbs_frequencies): Likewise. (loopify): Likewise. (unloop): Likewise. (fix_loop_placement): Likewise. (loop_delete_branch_edge): Likewise. (duplicate_loop_to_header_edge): Likewise. (mfb_keep_just): Likewise. (create_preheader): Likewise. (force_single_succ_latches): Likewise. (loop_split_edge_with): Likewise. (create_loop_notes): Likewise. * cfgrtl.c (rtl_split_block): Likewise. (rtl_merge_blocks): Likewise. (rtl_can_merge_blocks): Likewise. (try_redirect_by_replacing_jump): Likewise. (force_nonfallthru_and_redirect): Likewise. (rtl_tidy_fallthru_edge): Likewise. (commit_one_edge_insertion): Likewise. (commit_edge_insertions): Likewise. (commit_edge_insertions_watch_calls): Likewise. (rtl_verify_flow_info_1): Likewise. (rtl_verify_flow_info): Likewise. (purge_dead_edges): Likewise. (cfg_layout_redirect_edge_and_branch): Likewise. (cfg_layout_can_merge_blocks_p): Likewise. (rtl_flow_call_edges_add): Likewise. * cse.c (cse_cc_succs): Likewise. * df.c (hybrid_search): Likewise. * dominance.c (calc_dfs_tree_nonrec): Likewise. (calc_dfs_tree): Likewise. (calc_idoms): Likewise. (recount_dominator): Likewise. * domwalk.c (walk_dominator_tree): Likewise. * except.c (emit_to_new_bb_before): Likewise. (connect_post_landing_pads): Likewise. (sjlj_emit_function_enter): Likewise. (sjlj_emit_function_exit): Likewise. (finish_eh_generation): Likewise. * final.c (compute_alignments): Likewise. * flow.c (calculate_global_regs_live): Likewise. (initialize_uninitialized_subregs): Likewise. (init_propagate_block_info): Likewise. * function.c (thread_prologue_and_epilogue_insns): Likewise. * gcse.c (find_implicit_sets): Likewise. (bypass_block): Likewise. (bypass_conditional_jumps): Likewise. (compute_pre_data): Likewise. (insert_insn_end_bb): Likewise. (insert_store): Likewise. (remove_reachable_equiv_notes): Likewise. * global.c (global_conflicts): Likewise. (calculate_reg_pav): Likewise. * graph.c (print_rtl_graph_with_bb): Likewise. * ifcvt.c (mark_loop_exit_edges): Likewise. (merge_if_block): Likewise. (find_if_header): Likewise. (block_jumps_and_fallthru_p): Likewise. (find_if_block): Likewise. (find_cond_trap): Likewise. (block_has_only_trap): Likewise. (find_if_case1): Likewise. (find_if_case_2): Likewise. * lambda-code.c (lambda_loopnest_to_gcc_loopnest): Likewise. (perfect_nestify): Likewise. * lcm.c (compute_antinout_edge): Likewise. (compute_laterin): Likewise. (compute_available): Likewise. (compute_nearerout): Likewise. * loop-doloop.c (doloop_modify): Likewise. * loop-init.c (loop_optimizer_init): Likewise. * loop-invariant.c (find_exits): Likewise. * loop-iv.c (simplify_using_initial_values): Likewise. (check_simple_exit): Likewise. (find_simple_exit): Likewise. * loop-unroll.c (peel_loop_completely): Likewise. (unroll_loop_constant_iterations): Likewise. (unroll_loop_runtime_iterations): Likewise. * loop-unswitch.c (may_unswitch_on): Likewise. (unswitch_loop): Likewise. * modulo-sched.c (generate_prolog_epilog): Likewise. (sms_schedule): Likewise. * postreload-gcse.c (eliminate_partially_redundant_load): Likewise. * predict.c (can_predict_insn_p): Likewise. (set_even_probabilities): Likewise. (combine_predictions_for_bb): Likewise. (predict_loops): Likewise. (estimate_probability): Likewise. (tree_predict_by_opcode): Likewise. (tree_estimate_probability): Likewise. (last_basic_block_p): Likewise. (propagate_freq): Likewise. (estimate_loops_at_level): Likewise. (estimate_bb_frequencies): Likewise. * profile.c (instrument_edges): Likewise. (get_exec_counts): Likewise. (compute_branch_probabilities): Likewise. (branch_prob): Likewise. * ra-build.c (live_in): Likewise. * ra-rewrite.c (rewrite_program2): Likewise. * ra.c (reg_alloc): Likewise. * reg-stack.c (reg_to_stack): Likewise. (convert_regs_entry): Likewise. (compensate_edge): Likewise. (convert_regs_1): Likewise, (convert_regs_2): Likewise. (convert_regs): Likewise. * regrename.c (copyprop_hardreg_forward): Likewise. * reload1.c (fixup_abnormal_edges): Likewise. * sbitmap.c (sbitmap_intersection_of_succs): Likewise. (sbitmap_insersection_of_preds): Likewise. (sbitmap_union_of_succs): Likewise. (sbitmap_union_of_preds): Likewise. * sched-ebb.c (compute_jump_reg_dependencies): Likewise. (fix_basic_block_boundaries): Likewise. (sched_ebbs): Likewise. * sched-rgn.c (build_control_flow): Likewise. (find_rgns): Likewise. * tracer.c (find_best_successor): Likewise. (find_best_predecessor): Likewise. (tail_duplicate): Likewise. * tree-cfg.c (make_edges): Likewise. (make_ctrl_stmt_edges): Likewise. (make_goto_expr_edges): Likewise. (tree_can_merge_blocks_p): Likewise. (tree_merge_blocks): Likewise. (cfg_remove_useless_stmts_bb): Likewise. (remove_phi_nodes_and_edges_for_unreachable_block): Likewise. (tree_block_forwards_to): Likewise. (cleanup_control_expr_graph): Likewise. (find_taken_edge): Likewise. (dump_cfg_stats): Likewise. (tree_cfg2vcg): Likewise. (disband_implicit_edges): Likewise. (tree_find_edge_insert_loc): Likewise. (bsi_commit_edge_inserts): Likewise. (tree_split_edge): Likewise. (tree_verify_flow_info): Likewise. (tree_make_forwarder_block): Likewise. (tree_forwarder_block_p): Likewise. (thread_jumps): Likewise. (tree_try_redirect_by_replacing_jump): Likewise. (tree_split_block): Likewise. (add_phi_args_after_copy_bb): Likewise. (rewrite_to_new_ssa_names_bb): Likewise. (dump_function_to_file): Likewise. (print_pred_bbs): Likewise. (print_loop): Likewise. (tree_flow_call_edges_add): Likewise. (split_critical_edges): Likewise. (execute_warn_function_return): Likewise. (extract_true_false_edges_from_block): Likewise. * tree-if-conv.c (tree_if_conversion): Likewise. (if_convertable_bb_p): Likewise. (find_phi_replacement_condition): Likewise. (combine_blocks): Likewise. * tree-into-ssa.c (compute_global_livein): Likewise. (ssa_mark_phi_uses): Likewise. (ssa_rewrite_initialize_block): Likewise. (rewrite_add_phi_arguments): Likewise. (ssa_rewrite_phi_arguments): Likewise. (insert_phi_nodes_for): Likewise. (rewrite_into_ssa): Likewise. (rewrite_ssa_into_ssa): Likewise. * tree-mudflap.c (mf_build_check_statement_for): Likewise. * tree-outof-ssa.c (coalesce_abnormal_edges): Likewise. (rewrite_trees): Likewise. * tree-pretty-print.c (dump_bb_header): Likewise. (dump_implicit_edges): Likewise. * tree-sra.c (insert_edge_copies): Likewise. (find_obviously_necessary_stmts): Likewise. (remove_data_stmt): Likewise. * tree-ssa-dom.c (thread_across_edge): Likewise. (dom_opt_finalize_block): Likewise. (single_incoming_edge_ignoring_loop_edges): Likewise. (record_equivalences_from_incoming_edges): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-live.c (live_worklist): Likewise. (calculate_live_on_entry): Likewise. (calculate_live_on_exit): Likewise. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p): Likewise. (copy_loop_headers): Likewise. * tree-ssa-loop-im.c (loop_commit_inserts): Likewise. (fill_always_executed_in): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv): Likewise. * tree-ssa-loop-ivopts.c (find_interesting_uses): Likewise. (compute_phi_arg_on_exit): Likewise. * tree-ssa-loop-manip.c (add_exit_phis_edge): Likewise. (get_loops_exit): Likewise. (split_loop_exit_edge): Likewise. (ip_normal_pos): Likewise. * tree-ssa-loop-niter.c (simplify_using_initial_conditions): Likewise. * tree-ssa-phiopt.c (candidate_bb_for_phi_optimization): Likewise. (replace_phi_with_stmt): Likewise. (value_replacement): Likewise. * tree-ssa-pre.c (compute_antic_aux): Likewise. (insert_aux): Likewise. (init_pre): Likewise. * tree-ssa-propagate.c (simulate_stmt): Likewise. (simulate_block): Likewise. (ssa_prop_init): Likewise. * tree-ssa-threadupdate.c (thread_block): Likewise. (create_block_for_threading): Likewise. (remove_last_stmt_and_useless_edges): Likewise. * tree-ssa.c (verify_phi_args): Likewise. (verify_ssa): Likewise. * tree_tailcall.c (independent_of_stmt_p): Likewise. (find_tail_calls): Likewise. (eliminate_tail_call): Likewise. (tree_optimize_tail_calls_1): Likewise. * tree-vectorizer.c (vect_transform_loop): Likewise. * var-tracking.c (prologue_stack_adjust): Likewise. (vt_stack_adjustments): Likewise. (vt_find_locations): Likewise. * config/frv/frv.c (frv_ifcvt_modify_tests): Likewise. * config/i386/i386.c (ix86_pad_returns): Likewise. * config/ia64/ia64.c (ia64_expand_prologue): Likewise. * config/rs6000/rs6000.c (rs6000_emit_prologue): Likewise. Co-Authored-By: Andrew Pinski <pinskia@physics.uc.edu> Co-Authored-By: Steven Bosscher <stevenb@suse.de> From-SVN: r88222
2004-09-28 09:59:54 +02:00
FOR_EACH_EDGE (e, ei, block->succs)
VEC_quick_push (basic_block, worklist, e->dest);
first = VEC_index (basic_block, worklist, 0);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (phi_nodes (first))
{
bitmap_set_t from = ANTIC_IN (first);
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
if (!BB_VISITED (first))
from = maximal_set;
phi_translate_set (ANTIC_OUT, from, block, first);
}
else
{
if (!BB_VISITED (first))
bitmap_set_copy (ANTIC_OUT, maximal_set);
else
bitmap_set_copy (ANTIC_OUT, ANTIC_IN (first));
}
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
for (i = 1; VEC_iterate (basic_block, worklist, i, bprime); i++)
{
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
if (phi_nodes (bprime))
{
bitmap_set_t tmp = bitmap_set_new ();
bitmap_set_t from = ANTIC_IN (bprime);
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
if (!BB_VISITED (bprime))
from = maximal_set;
phi_translate_set (tmp, from, block, bprime);
bitmap_set_and (ANTIC_OUT, tmp);
bitmap_set_free (tmp);
}
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
else
{
if (!BB_VISITED (bprime))
bitmap_set_and (ANTIC_OUT, maximal_set);
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
else
bitmap_set_and (ANTIC_OUT, ANTIC_IN (bprime));
}
}
VEC_free (basic_block, heap, worklist);
}
/* Generate ANTIC_OUT - TMP_GEN. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
S = bitmap_set_subtract (ANTIC_OUT, TMP_GEN (block));
/* Start ANTIC_IN with EXP_GEN - TMP_GEN. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
ANTIC_IN (block) = bitmap_set_subtract (EXP_GEN (block),
TMP_GEN (block));
/* Then union in the ANTIC_OUT - TMP_GEN values,
to get ANTIC_OUT U EXP_GEN - TMP_GEN */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
FOR_EACH_EXPR_ID_IN_SET (S, bii, bi)
bitmap_value_insert_into_set (ANTIC_IN (block),
expression_for_id (bii));
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
clean (ANTIC_IN (block), block);
/* !old->expressions can happen when we deferred a block. */
if (!old->expressions || !bitmap_set_equal (old, ANTIC_IN (block)))
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
{
changed = true;
SET_BIT (changed_blocks, block->index);
FOR_EACH_EDGE (e, ei, block->preds)
SET_BIT (changed_blocks, e->src->index);
}
else
RESET_BIT (changed_blocks, block->index);
maybe_dump_sets:
if (dump_file && (dump_flags & TDF_DETAILS))
{
if (!BB_DEFERRED (block) || BB_VISITED (block))
{
if (ANTIC_OUT)
print_bitmap_set (dump_file, ANTIC_OUT, "ANTIC_OUT", block->index);
print_bitmap_set (dump_file, ANTIC_IN (block), "ANTIC_IN",
block->index);
if (S)
print_bitmap_set (dump_file, S, "S", block->index);
}
else
{
fprintf (dump_file,
"Block %d was deferred for a future iteration.\n",
block->index);
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
}
if (old)
bitmap_set_free (old);
if (S)
bitmap_set_free (S);
if (ANTIC_OUT)
bitmap_set_free (ANTIC_OUT);
return changed;
}
/* Compute PARTIAL_ANTIC for BLOCK.
If succs(BLOCK) > 1 then
PA_OUT[BLOCK] = value wise union of PA_IN[b] + all ANTIC_IN not
in ANTIC_OUT for all succ(BLOCK)
else if succs(BLOCK) == 1 then
PA_OUT[BLOCK] = phi_translate (PA_IN[succ(BLOCK)])
PA_IN[BLOCK] = dependent_clean(PA_OUT[BLOCK] - TMP_GEN[BLOCK]
- ANTIC_IN[BLOCK])
*/
static bool
compute_partial_antic_aux (basic_block block,
bool block_has_abnormal_pred_edge)
{
bool changed = false;
bitmap_set_t old_PA_IN;
bitmap_set_t PA_OUT;
edge e;
edge_iterator ei;
old_PA_IN = PA_OUT = NULL;
/* If any edges from predecessors are abnormal, antic_in is empty,
so do nothing. */
if (block_has_abnormal_pred_edge)
goto maybe_dump_sets;
old_PA_IN = PA_IN (block);
PA_OUT = bitmap_set_new ();
/* If the block has no successors, ANTIC_OUT is empty. */
if (EDGE_COUNT (block->succs) == 0)
;
/* If we have one successor, we could have some phi nodes to
translate through. Note that we can't phi translate across DFS
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
back edges in partial antic, because it uses a union operation on
the successors. For recurrences like IV's, we will end up
generating a new value in the set on each go around (i + 3 (VH.1)
VH.1 + 1 (VH.2), VH.2 + 1 (VH.3), etc), forever. */
else if (single_succ_p (block))
{
basic_block succ = single_succ (block);
if (!(single_succ_edge (block)->flags & EDGE_DFS_BACK))
phi_translate_set (PA_OUT, PA_IN (succ), block, succ);
}
/* If we have multiple successors, we take the union of all of
them. */
else
{
VEC(basic_block, heap) * worklist;
size_t i;
basic_block bprime;
worklist = VEC_alloc (basic_block, heap, EDGE_COUNT (block->succs));
FOR_EACH_EDGE (e, ei, block->succs)
{
if (e->flags & EDGE_DFS_BACK)
continue;
VEC_quick_push (basic_block, worklist, e->dest);
}
if (VEC_length (basic_block, worklist) > 0)
{
for (i = 0; VEC_iterate (basic_block, worklist, i, bprime); i++)
{
unsigned int i;
bitmap_iterator bi;
FOR_EACH_EXPR_ID_IN_SET (ANTIC_IN (bprime), i, bi)
bitmap_value_insert_into_set (PA_OUT,
expression_for_id (i));
if (phi_nodes (bprime))
{
bitmap_set_t pa_in = bitmap_set_new ();
phi_translate_set (pa_in, PA_IN (bprime), block, bprime);
FOR_EACH_EXPR_ID_IN_SET (pa_in, i, bi)
bitmap_value_insert_into_set (PA_OUT,
expression_for_id (i));
bitmap_set_free (pa_in);
}
else
FOR_EACH_EXPR_ID_IN_SET (PA_IN (bprime), i, bi)
bitmap_value_insert_into_set (PA_OUT,
expression_for_id (i));
}
}
VEC_free (basic_block, heap, worklist);
}
/* PA_IN starts with PA_OUT - TMP_GEN.
Then we subtract things from ANTIC_IN. */
PA_IN (block) = bitmap_set_subtract (PA_OUT, TMP_GEN (block));
/* For partial antic, we want to put back in the phi results, since
we will properly avoid making them partially antic over backedges. */
bitmap_ior_into (PA_IN (block)->values, PHI_GEN (block)->values);
bitmap_ior_into (PA_IN (block)->expressions, PHI_GEN (block)->expressions);
/* PA_IN[block] = PA_IN[block] - ANTIC_IN[block] */
bitmap_set_subtract_values (PA_IN (block), ANTIC_IN (block));
dependent_clean (PA_IN (block), ANTIC_IN (block), block);
if (!bitmap_set_equal (old_PA_IN, PA_IN (block)))
{
changed = true;
SET_BIT (changed_blocks, block->index);
FOR_EACH_EDGE (e, ei, block->preds)
SET_BIT (changed_blocks, e->src->index);
}
else
RESET_BIT (changed_blocks, block->index);
maybe_dump_sets:
if (dump_file && (dump_flags & TDF_DETAILS))
{
if (PA_OUT)
print_bitmap_set (dump_file, PA_OUT, "PA_OUT", block->index);
print_bitmap_set (dump_file, PA_IN (block), "PA_IN", block->index);
}
if (old_PA_IN)
bitmap_set_free (old_PA_IN);
if (PA_OUT)
bitmap_set_free (PA_OUT);
return changed;
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Compute ANTIC and partial ANTIC sets. */
static void
compute_antic (void)
{
bool changed = true;
int num_iterations = 0;
basic_block block;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
int i;
/* If any predecessor edges are abnormal, we punt, so antic_in is empty.
We pre-build the map of blocks with incoming abnormal edges here. */
has_abnormal_preds = sbitmap_alloc (last_basic_block);
sbitmap_zero (has_abnormal_preds);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
FOR_EACH_BB (block)
{
edge_iterator ei;
edge e;
FOR_EACH_EDGE (e, ei, block->preds)
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
{
e->flags &= ~EDGE_DFS_BACK;
if (e->flags & EDGE_ABNORMAL)
{
SET_BIT (has_abnormal_preds, block->index);
break;
}
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
BB_VISITED (block) = 0;
BB_DEFERRED (block) = 0;
/* While we are here, give empty ANTIC_IN sets to each block. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
ANTIC_IN (block) = bitmap_set_new ();
PA_IN (block) = bitmap_set_new ();
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* At the exit block we anticipate nothing. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
ANTIC_IN (EXIT_BLOCK_PTR) = bitmap_set_new ();
BB_VISITED (EXIT_BLOCK_PTR) = 1;
PA_IN (EXIT_BLOCK_PTR) = bitmap_set_new ();
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
changed_blocks = sbitmap_alloc (last_basic_block + 1);
sbitmap_ones (changed_blocks);
while (changed)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Starting iteration %d\n", num_iterations);
num_iterations++;
changed = false;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
for (i = 0; i < last_basic_block - NUM_FIXED_BLOCKS; i++)
{
if (TEST_BIT (changed_blocks, postorder[i]))
{
basic_block block = BASIC_BLOCK (postorder[i]);
changed |= compute_antic_aux (block,
TEST_BIT (has_abnormal_preds,
block->index));
}
}
/* Theoretically possible, but *highly* unlikely. */
gcc_assert (num_iterations < 50);
}
if (dump_file && (dump_flags & TDF_STATS))
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
fprintf (dump_file, "compute_antic required %d iterations\n",
num_iterations);
if (do_partial_partial)
{
sbitmap_ones (changed_blocks);
mark_dfs_back_edges ();
num_iterations = 0;
changed = true;
while (changed)
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Starting iteration %d\n", num_iterations);
num_iterations++;
changed = false;
for (i = 0; i < last_basic_block - NUM_FIXED_BLOCKS; i++)
{
if (TEST_BIT (changed_blocks, postorder[i]))
{
basic_block block = BASIC_BLOCK (postorder[i]);
changed
|= compute_partial_antic_aux (block,
TEST_BIT (has_abnormal_preds,
block->index));
}
}
/* Theoretically possible, but *highly* unlikely. */
gcc_assert (num_iterations < 50);
}
if (dump_file && (dump_flags & TDF_STATS))
fprintf (dump_file, "compute_partial_antic required %d iterations\n",
num_iterations);
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
sbitmap_free (has_abnormal_preds);
sbitmap_free (changed_blocks);
}
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
/* Return true if we can value number the call in STMT. This is true
if we have a pure or constant call. */
static bool
can_value_number_call (tree stmt)
{
tree call = get_call_expr_in (stmt);
if (call_expr_flags (call) & (ECF_PURE | ECF_CONST))
return true;
return false;
}
/* Return true if OP is an exception handler related operation, such as
FILTER_EXPRor EXC_PTR_EXPR. */
static bool
is_exception_related (tree op)
{
return TREE_CODE (op) == FILTER_EXPR || TREE_CODE (op) == EXC_PTR_EXPR;
}
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
/* Return true if OP is a tree which we can perform value numbering
on. */
static bool
can_value_number_operation (tree op)
{
return (UNARY_CLASS_P (op)
&& !is_exception_related (TREE_OPERAND (op, 0)))
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
|| BINARY_CLASS_P (op)
|| COMPARISON_CLASS_P (op)
|| REFERENCE_CLASS_P (op)
|| (TREE_CODE (op) == CALL_EXPR
&& can_value_number_call (op));
}
/* Return true if OP is a tree which we can perform PRE on
on. This may not match the operations we can value number, but in
a perfect world would. */
static bool
can_PRE_operation (tree op)
{
return UNARY_CLASS_P (op)
|| BINARY_CLASS_P (op)
|| COMPARISON_CLASS_P (op)
|| TREE_CODE (op) == INDIRECT_REF
|| TREE_CODE (op) == COMPONENT_REF
|| TREE_CODE (op) == CALL_EXPR
|| TREE_CODE (op) == ARRAY_REF;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
}
/* Inserted expressions are placed onto this worklist, which is used
for performing quick dead code elimination of insertions we made
that didn't turn out to be necessary. */
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
static VEC(tree,heap) *inserted_exprs;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
/* Pool allocated fake store expressions are placed onto this
worklist, which, after performing dead code elimination, is walked
to see which expressions need to be put into GC'able memory */
static VEC(tree, heap) *need_creation;
/* For COMPONENT_REF's and ARRAY_REF's, we can't have any intermediates for the
COMPONENT_REF or INDIRECT_REF or ARRAY_REF portion, because we'd end up with
trying to rename aggregates into ssa form directly, which is a no
no.
Thus, this routine doesn't create temporaries, it just builds a
single access expression for the array, calling
find_or_generate_expression to build the innermost pieces.
2006-07-04 23:23:03 +02:00
This function is a subroutine of create_expression_by_pieces, and
should not be called on it's own unless you really know what you
are doing.
*/
static tree
create_component_ref_by_pieces (basic_block block, tree expr, tree stmts)
{
tree genop = expr;
tree folded;
if (TREE_CODE (genop) == VALUE_HANDLE)
{
tree found = bitmap_find_leader (AVAIL_OUT (block), expr);
if (found)
return found;
}
2006-07-04 23:23:03 +02:00
if (TREE_CODE (genop) == VALUE_HANDLE)
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
{
bitmap_set_t exprset = VALUE_HANDLE_EXPR_SET (expr);
unsigned int firstbit = bitmap_first_set_bit (exprset->expressions);
genop = expression_for_id (firstbit);
}
switch TREE_CODE (genop)
{
case ARRAY_REF:
{
tree op0;
tree op1, op2, op3;
2006-07-04 23:23:03 +02:00
op0 = create_component_ref_by_pieces (block,
TREE_OPERAND (genop, 0),
stmts);
op1 = TREE_OPERAND (genop, 1);
if (TREE_CODE (op1) == VALUE_HANDLE)
op1 = find_or_generate_expression (block, op1, stmts);
op2 = TREE_OPERAND (genop, 2);
if (op2 && TREE_CODE (op2) == VALUE_HANDLE)
op2 = find_or_generate_expression (block, op2, stmts);
op3 = TREE_OPERAND (genop, 3);
if (op3 && TREE_CODE (op3) == VALUE_HANDLE)
op3 = find_or_generate_expression (block, op3, stmts);
2006-07-04 23:23:03 +02:00
folded = build4 (ARRAY_REF, TREE_TYPE (genop), op0, op1,
op2, op3);
return folded;
}
case COMPONENT_REF:
{
tree op0;
tree op1;
2006-07-04 23:23:03 +02:00
op0 = create_component_ref_by_pieces (block,
TREE_OPERAND (genop, 0),
stmts);
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
/* op1 should be a FIELD_DECL, which are represented by
themselves. */
op1 = TREE_OPERAND (genop, 1);
2006-07-04 23:23:03 +02:00
folded = fold_build3 (COMPONENT_REF, TREE_TYPE (genop), op0, op1,
NULL_TREE);
return folded;
}
break;
case INDIRECT_REF:
{
tree op1 = TREE_OPERAND (genop, 0);
tree genop1 = find_or_generate_expression (block, op1, stmts);
2006-07-04 23:23:03 +02:00
folded = fold_build1 (TREE_CODE (genop), TREE_TYPE (genop),
genop1);
return folded;
}
break;
case VAR_DECL:
case PARM_DECL:
case RESULT_DECL:
case SSA_NAME:
case STRING_CST:
return genop;
default:
2006-07-04 23:23:03 +02:00
gcc_unreachable ();
}
return NULL_TREE;
}
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
/* Find a leader for an expression, or generate one using
create_expression_by_pieces if it's ANTIC but
2006-07-04 23:23:03 +02:00
complex.
BLOCK is the basic_block we are looking for leaders in.
2006-07-04 23:23:03 +02:00
EXPR is the expression to find a leader or generate for.
STMTS is the statement list to put the inserted expressions on.
Returns the SSA_NAME of the LHS of the generated expression or the
leader. */
static tree
find_or_generate_expression (basic_block block, tree expr, tree stmts)
{
tree genop = bitmap_find_leader (AVAIL_OUT (block), expr);
lambda.h (lambda_vector_min_nz): Likewise. * lambda.h (lambda_vector_min_nz): Likewise. * langhooks.h (struct lang_hooks_for_types, struct lang_hooks): Likewise. * output.h (assemble_integer, this_is_asm_operands): Likewise. * tree.h: Likewise. * vec.h: Likewise. * tree-flow-inline.h (relink_imm_use): Use gcc_assert. * optabs.c (prepare_cmp_insn, emit_cmp_and_jump_insns): Reword comments to avoid 'abort'. Use gcc_assert as necessary. * opts.c (common_handle_option): Likewise. * pretty-print.c (pp_base_format_text): Likewise. * print-rtl.c (print_rtx): Likewise. * read-rtl.c (read_rtx_filename, read_rtx_1): Likewise. * regmove.c (try_auto_increment): Likewise. * reload.c (find_valid_class, find_reloads_toplev, find_equiv_reg): Likewise. * reload1.c (reload, forget_old_reloads_1, function_invariant_p, merge_assigned_reloads): Likewise. * tree-inline.c (inline_forbidden_p_1, estimate_num_insns_1): Likewise. * tree-optimize.c (execute_todo): Likewise. * tree-outof-ssa.c (eliminate_phi): Likewise. * tree-ssa-alias.c (add_pointed_to_expr): Likewise. * tree-ssa-ccp.c (maybe_fold_stmt_indirect): Likewise. * tree-ssa-operands.c (parse_ssa_operands, get_indirect_ref_operands, create_ssa_artficial_load_stmt): Likewise. * tree-ssa-pre.c (find_or_generate_expression): Likewise. * tree-ssanames.c (release_ssa_name): Likewise. * tree.c (int_bit_position, int_byte_position, tree_low_cst, walk_tree): Likewise. * tree-ssa-operands.c (verify_abort): Fold into .. (verify_imm_links): ... here. From-SVN: r98519
2005-04-21 20:05:34 +02:00
/* If it's still NULL, it must be a complex expression, so generate
it recursively. */
if (genop == NULL)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_set_t exprset = VALUE_HANDLE_EXPR_SET (expr);
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
bool handled = false;
bitmap_iterator bi;
unsigned int i;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
/* We will hit cases where we have SSA_NAME's in exprset before
other operations, because we may have come up with the SCCVN
value before getting to the RHS of the expression. */
FOR_EACH_EXPR_ID_IN_SET (exprset, i, bi)
{
genop = expression_for_id (i);
if (can_PRE_operation (genop))
{
handled = true;
genop = create_expression_by_pieces (block, genop, stmts);
break;
}
}
gcc_assert (handled);
}
return genop;
}
#define NECESSARY(stmt) stmt->base.asm_written_flag
/* Create an expression in pieces, so that we can handle very complex
2006-07-04 23:23:03 +02:00
expressions that may be ANTIC, but not necessary GIMPLE.
BLOCK is the basic block the expression will be inserted into,
EXPR is the expression to insert (in value form)
STMTS is a statement list to append the necessary insertions into.
lambda.h (lambda_vector_min_nz): Likewise. * lambda.h (lambda_vector_min_nz): Likewise. * langhooks.h (struct lang_hooks_for_types, struct lang_hooks): Likewise. * output.h (assemble_integer, this_is_asm_operands): Likewise. * tree.h: Likewise. * vec.h: Likewise. * tree-flow-inline.h (relink_imm_use): Use gcc_assert. * optabs.c (prepare_cmp_insn, emit_cmp_and_jump_insns): Reword comments to avoid 'abort'. Use gcc_assert as necessary. * opts.c (common_handle_option): Likewise. * pretty-print.c (pp_base_format_text): Likewise. * print-rtl.c (print_rtx): Likewise. * read-rtl.c (read_rtx_filename, read_rtx_1): Likewise. * regmove.c (try_auto_increment): Likewise. * reload.c (find_valid_class, find_reloads_toplev, find_equiv_reg): Likewise. * reload1.c (reload, forget_old_reloads_1, function_invariant_p, merge_assigned_reloads): Likewise. * tree-inline.c (inline_forbidden_p_1, estimate_num_insns_1): Likewise. * tree-optimize.c (execute_todo): Likewise. * tree-outof-ssa.c (eliminate_phi): Likewise. * tree-ssa-alias.c (add_pointed_to_expr): Likewise. * tree-ssa-ccp.c (maybe_fold_stmt_indirect): Likewise. * tree-ssa-operands.c (parse_ssa_operands, get_indirect_ref_operands, create_ssa_artficial_load_stmt): Likewise. * tree-ssa-pre.c (find_or_generate_expression): Likewise. * tree-ssanames.c (release_ssa_name): Likewise. * tree.c (int_bit_position, int_byte_position, tree_low_cst, walk_tree): Likewise. * tree-ssa-operands.c (verify_abort): Fold into .. (verify_imm_links): ... here. From-SVN: r98519
2005-04-21 20:05:34 +02:00
This function will die if we hit some value that shouldn't be
ANTIC but is (IE there is no leader for it, or its components).
This function may also generate expressions that are themselves
partially or fully redundant. Those that are will be either made
fully redundant during the next iteration of insert (for partially
redundant ones), or eliminated by eliminate (for fully redundant
ones). */
static tree
create_expression_by_pieces (basic_block block, tree expr, tree stmts)
{
tree temp, name;
tree folded, forced_stmts, newexpr;
tree v;
tree_stmt_iterator tsi;
switch (TREE_CODE_CLASS (TREE_CODE (expr)))
{
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
case tcc_vl_exp:
{
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
tree fn, sc;
tree genfn;
int i, nargs;
tree *buffer;
2006-07-04 23:23:03 +02:00
gcc_assert (TREE_CODE (expr) == CALL_EXPR);
2006-07-04 23:23:03 +02:00
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
fn = CALL_EXPR_FN (expr);
sc = CALL_EXPR_STATIC_CHAIN (expr);
genfn = find_or_generate_expression (block, fn, stmts);
2006-07-04 23:23:03 +02:00
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
nargs = call_expr_nargs (expr);
tree-ssa-alias-warnings.c (maybe_add_match): Cast according to the coding conventions. * tree-ssa-alias-warnings.c (maybe_add_match): Cast according to the coding conventions. (add_key): Likewise. * tree-ssa.c (init_tree_ssa): Use type safe memory macros. * tree-ssa-ccp.c (ccp_fold_builtin): Avoid using C++ keywords as variable names. * tree-ssa-coalesce.c (find_coalesce_pair): Use type safe memory macros. (add_cost_one_coalesce): Likewise. * tree-ssa-copy.c (merge_alias_info): Avoid using C++ keywords as variable names. Rename orig to orig_name for consistency. * tree-ssa-dom.c (dom_thread_across_edge): Cast according to the coding conventions. (cprop_into_successor_phis): Avoid using C++ keywords as variable names. (record_equivalences_from_stmt): Likewise. * tree-ssa-dse.c (dse_initialize_block_local_data): Cast according to the coding conventions. (memory_ssa_name_same): Likewise. (dse_optimize_stmt): Likewise. (dse_record_phis): Likewise. (dse_finalize_block): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Avoid using C++ keywords as variable names. (may_move_till): Cast according to the coding conventions. (force_move_till_expr): Avoid using C++ keywords as variable names. (force_move_till): Cast according to the coding conventions. (memref_hash): Likewise. (memref_eq): Likewise. (gather_mem_refs_stmt): Likewise. * tree-ssa-loop-ivopts.c (contains_abnormal_ssa_name_p): Avoid using C++ keywords as variable names. (idx_find_step): Cast according to the coding conventions. (idx_record_use): Likewise. (find_depends): Likewise. (prepare_decl_rtl): Likewise. (mbc_entry_hash): Likewise. (mbc_entry_eq): Likewise. * tree-ssa-loop-niter.c (SWAP): Use the correct the type for tmp. (simplify_replace_tree): Avoid using C++ keywords as variable names. (idx_infer_loop_bounds): Cast according to the coding conventions. * tree-ssa-loop-prefetch.c (idx_analyze_ref): Likewise. * tree-ssa-math-opts.c (occ_new ): Likwise. * tree-ssanames.c (duplicate_ssa_name_ptr_info): Use type safe memory macros. * tree-ssa-operands.c (add_def_op): Avoid using C++ keywords as variable names. (add_use_op): Likewise. (add_vop): Likewise. (add_vuse_op): Likewise. (add_vdef_op): Likewise. (get_expr_operands): Likewise. (push_stmt_changes): Use type safe memory macros. * tree-ssa-phiopt.c (replace_phi_edge_with_variable): Avoid using C++ keywords as variable names. (conditional_replacement): Likewise. (minmax_replacement): Likewise. (abs_replacement): Likewise. * tree-ssa-pre.c (create_expression_by_pieces): Cast according to the coding conventions. (insert_fake_stores): Avoid using C++ keywords as variable names. * tree-ssa-reassoc.c (add_to_ops_vec): Cast according to the coding conventions. * tree-ssa-structalias.c (heapvar_lookup): Likewise. (heapvar_insert): Use type safe memory macros. (new_var_info): Cast according to the coding conventions. (new_constraint): Likewise. (remove_preds_and_fake_succs): Use type safe memory macros. * tree-ssa-threadupdate.c (thread_block): Cast according to the coding conventions. (thread_single_edge): Likewise. From-SVN: r125504
2007-06-06 22:18:47 +02:00
buffer = (tree*) alloca (nargs * sizeof (tree));
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
for (i = 0; i < nargs; i++)
{
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
tree arg = CALL_EXPR_ARG (expr, i);
buffer[i] = find_or_generate_expression (block, arg, stmts);
}
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
folded = build_call_array (TREE_TYPE (expr), genfn, nargs, buffer);
if (sc)
CALL_EXPR_STATIC_CHAIN (folded) =
find_or_generate_expression (block, sc, stmts);
folded = fold (folded);
break;
}
break;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
case tcc_reference:
{
if (TREE_CODE (expr) == COMPONENT_REF
|| TREE_CODE (expr) == ARRAY_REF)
{
folded = create_component_ref_by_pieces (block, expr, stmts);
}
else
{
tree op1 = TREE_OPERAND (expr, 0);
tree genop1 = find_or_generate_expression (block, op1, stmts);
2006-07-04 23:23:03 +02:00
folded = fold_build1 (TREE_CODE (expr), TREE_TYPE (expr),
genop1);
}
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
break;
}
2006-07-04 23:23:03 +02:00
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
case tcc_binary:
case tcc_comparison:
{
tree op1 = TREE_OPERAND (expr, 0);
tree op2 = TREE_OPERAND (expr, 1);
tree genop1 = find_or_generate_expression (block, op1, stmts);
tree genop2 = find_or_generate_expression (block, op2, stmts);
2006-07-04 23:23:03 +02:00
folded = fold_build2 (TREE_CODE (expr), TREE_TYPE (expr),
genop1, genop2);
break;
}
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
case tcc_unary:
{
tree op1 = TREE_OPERAND (expr, 0);
tree genop1 = find_or_generate_expression (block, op1, stmts);
2006-07-04 23:23:03 +02:00
folded = fold_build1 (TREE_CODE (expr), TREE_TYPE (expr),
genop1);
break;
}
default:
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * targhooks.c (default_unwind_emit, default_scalar_mode_supported_p): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * timevar.c (timevar_push, timevar_pop, timevar_start, timevar_stop): Likewise. * toplev.c (default_pch_valid_p): Likewise. * tracer.c (tail_duplicate): Likewise. * tree-alias-common.c (get_alias_var_decl, get_values_from_constructor, create_alias_var, delete_alias_vars, empty_points_to_set, same_points_to_set, ptr_may_alias_var): Likewise. * tree.c (tree_size, make_node_stat, copy_node_stat, build_int_cst_wide, integer_all_onesp, list_length, chainon, tree_node_structure, type_contains_placeholder_p, substitute_in_expr, substitute_placeholder_in_expr, tabilize_reference_1, build0_stat, build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p, lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr, build_method_type_directly, decl_type_context, get_callee_fndecl, get_set_constructor_bits, build_vector_type_for_mode, int_cst_value, tree_fold_gcd): Likewise. * tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges, make_cond_expr_edges, group_case_labels, tree_merge_blocks, cleanup_control_expr_graph, find_taken_edge, find_taken_edge_switch_expr, phi_alternatives_equal, is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt, stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate, tree_split_edge, tree_verify_flow_info, thread_jumps, tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise. * tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly, chrec_fold_multiply_poly_poly): Likewise. * tree-complex.c (extract_component, expand_complex_division, expand_complex_comparison, expand_complex_operations_1, build_replicated_const, expand_vector_operations_1): Likewise. * tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector, build_classic_dir_vector): Likewise. * tree-dfa.c (compute_immediate_uses_for_phi, compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann, create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region, record_in_finally_tree, replace_goto_queue_1, maybe_record_in_goto_queue, verify_norecord_switch_expr, do_return_redirection): Likewise. * tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr, add_to_dst_predicate_list, find_phi_replacement_condition, replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order): Likewise. * tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r, initialize_inlined_parameters, declare_return_variable, estimate_num_insns_1, expand_call_inline, expand_calls_inline, optimize_inline_calls, copy_tree_r): Likewise. * tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt, ssa_rewrite_stmt, rewrite_into_ssa): Likewise. * tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after, tsi_split_statement_list_after, tsi_split_statement_list_before): Likewise. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-nested.c (create_tmp_var_for, lookup_field_for_decl, lookup_tramp_for_decl, convert_all_function_calls): Likewise. * tree-optimize.c (tree_rest_of_compilation): Likewise. * tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi, coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis, free_temp_expr_table, add_dependance, finish_expr, rewrite_trees): Likewise. * tree-phinodes.c (resize_phi_node, add_phi_arg, remove_all_phi_nodes_for): Likewise. * tree-pretty-print.c (op_prio, print_call_name): Likewise. * tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise. * tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree, sra_elt_eq, sra_walk_expr, instantiate_missing_elements, generate_one_element_ref, generate_element_copy, generate_element_zero, scalarize_copy, scalarize_init, scalarize_ldst): Likewise. * tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p, add_may_alias, add_pointed_to_expr, add_pointed_to_var, collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise. * tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise. * tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value, set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment, widen_bitfield, ccp_fold_builtin): Likewise. * tree-ssa-copy.c (may_propagate_copy, merge_alias_info, replace_exp_1, propagate_tree_value): Likewise. * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise. * tree-ssa-dce.c (set_control_dependence_map_bit, find_control_dependence, find_pdom, mark_operand_necessary, mark_stmt_if_obviously_necessary, mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise. * tree-ssa-dom.c (dom_opt_initialize_block_local_data, simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis, eliminate_redundant_computations, avail_expr_eq): Likewise. * tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p, duplicate_blocks): Likewise. * tree-ssa-loop-im.c (for_each_index, set_level, is_call_clobbered_ref): Likewise. * tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos, stmt_after_increment, set_iv, contains_abnormal_ssa_name_p, find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates, peel_address, ptr_difference_cost, may_replace_final_value, determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer, rewrite_use, rewrite_uses): Likewise. * tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa, check_loop_closed_ssa_use): Likewise. * tree-ssanames.c (make_ssa_name): Likewise. * tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses, finalize_ssa_v_must_defs, finalize_ssa_stmt_operands, get_stmt_operands, get_expr_operands, get_asm_expr_operands, get_indirect_ref_operands, add_stmt_operand): Likewise. * tree-ssa-pre.c (value_exists_in_set_bitmap, value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set, phi_translate, valid_in_set, compute_antic, find_or_generate_expression, create_expression_by_pieces, insert_aux, create_value_expr_from, eliminate): Likewise. * tree-ssa-propagate.c (cfg_blocks_get): Likewise. * tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges): Likewise. * tree-tailcall.c (independent_of_stmt_p, adjust_return_value, eliminate_tail_call): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_align_data_ref, vect_create_data_ref, vect_create_destination_var, vect_get_vec_def_for_operand, vect_finish_stmt_generation, vect_transform_stmt, vect_transform_loop_bound, vect_transform_loop, vect_analyze_operations): Likewise. * tree-vn.c (vn_compute, set_value_handle, get_value_handle): Likewise. * tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr, get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start, bsi_after_labels, bsi_last): Likewise. * tree-ssa-live.c (var_union, change_partition_var, create_ssa_var_map, calculate_live_on_entry, root_var_init, type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce): Likewise. * tree-ssa-live.h (partition_is_global, live_entry_blocks, tpa_find_tree): Likewise. (register_ssa_partition_check): Declare. (register_ssa_partition): use it. * tree-ssa-live.c: Include errors.h. (register_ssa_partition_check): New. * tree-ssa-operands.c: Include errors.h. * Makefile.in (tree-ssa-operands.o): Depend on errors.h. Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com> From-SVN: r87223
2004-09-09 09:54:12 +02:00
gcc_unreachable ();
}
/* Force the generated expression to be a sequence of GIMPLE
statements.
We have to call unshare_expr because force_gimple_operand may
modify the tree we pass to it. */
2006-07-04 23:23:03 +02:00
newexpr = force_gimple_operand (unshare_expr (folded), &forced_stmts,
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
false, NULL);
/* If we have any intermediate expressions to the value sets, add them
to the value sets and chain them on in the instruction stream. */
if (forced_stmts)
{
tsi = tsi_start (forced_stmts);
for (; !tsi_end_p (tsi); tsi_next (&tsi))
{
tree stmt = tsi_stmt (tsi);
tree forcedname = GIMPLE_STMT_OPERAND (stmt, 0);
tree forcedexpr = GIMPLE_STMT_OPERAND (stmt, 1);
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
tree val = vn_lookup_or_add (forcedexpr);
2006-07-04 23:23:03 +02:00
VEC_safe_push (tree, heap, inserted_exprs, stmt);
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
VN_INFO_GET (forcedname)->valnum = forcedname;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
vn_add (forcedname, val);
bitmap_value_replace_in_set (NEW_SETS (block), forcedname);
bitmap_value_replace_in_set (AVAIL_OUT (block), forcedname);
mark_symbols_for_renaming (stmt);
}
tsi = tsi_last (stmts);
tsi_link_after (&tsi, forced_stmts, TSI_CONTINUE_LINKING);
}
/* Build and insert the assignment of the end result to the temporary
that we will return. */
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
if (!pretemp || TREE_TYPE (expr) != TREE_TYPE (pretemp))
{
pretemp = create_tmp_var (TREE_TYPE (expr), "pretmp");
get_var_ann (pretemp);
}
temp = pretemp;
re PR c++/26757 (C++ front-end producing two DECLs with the same UID) 2006-05-23 Andrew MacLeod <amacleod@redhat.com> PR c++/26757 * tree-ssa-loop-im.c (determine_invariantness_stmt): Use add_referenced_var instead of add_referenced_tmp_var. * tree-complex.c (create_one_component_var): Use add_referenced_var. * tree-ssa-loop-manip.c (create_iv, tree_unroll_loop): Use add_referenced_var. * tree-tailcall.c (adjust_accumulator_values, adjust_return_value, tree_optimize_tail_calls_1): Use add_referenced_var. * tree-ssa-loop-ivopts.c (create_new_iv): Use add_referenced_var. * tree-ssa-alias.c (create_memory_tag, create_global_var, create_sft): Use add_referenced_var. * tree-if-conv.c (ifc_temp_var): Use add_referenced_var. * gimplify.c (force_gimple_operand): Use add_referenced_var. * tree-ssa-phiopt.c (conditional_replacement, abs_replacement): Use add_referenced_var. * tree-dfa.c (struct walk_state): Remove. (find_referenced_vars): Remove walk state and vars_found hash table. (make_rename_temp): Use add_referenced_var. (find_vars_r): Pass less parameters to add_referenced_var. (referenced_var_p): New. Is var in referenced_var hash table. (referenced_var_insert): Assert var isn't already in hash table. (add_referenced_var): Don't need walk_state parameter. Add var if it isn't already in the hash table. (add_referenced_tmp_var): Remove. (find_new_referenced_vars_1): Use add_referenced_var. * tree-ssa-pre.c (create_expression_by_pieces, insert_into_preds_of_block, insert_extra_phis, realify_fake_stores): Use add_referenced_var. * tree-vect-patterns.c (vect_pattern_recog_1): Use add_referenced_var. * lambda-code.c (lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, perfect_nestify): Use add_referenced_var. * tree-vect-transform.c (vect_create_addr_base_for_vector_ref, vect_create_data_ref_ptr, vect_create_destination_var, vect_init_vector, vect_build_loop_niters, vect_generate_tmps_on_preheader, vect_update_ivs_after_vectorizer, vect_gen_niters_for_prolog_loop, vect_create_cond_for_align_checks): Use add_referenced_var. * tree-outof-ssa.c (create_temp): Use add_referenced_var. * tree-flow.h (add_referenced_tmp_var): Remove prototype (add_referenced_var): Add prototype. * tree-ssa-structalias.c (get_constraint_for, intra_create_variable_infos): Use add_referenced_var. From-SVN: r114018
2006-05-23 16:07:21 +02:00
add_referenced_var (temp);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
re PR middle-end/28436 (accessing an element via a "pointer" on a vector does not cause vec_extract to be used) 2006-12-12 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/28436 * tree.h (DECL_COMPLEX_GIMPLE_REG_P): Rename to ... (DECL_GIMPLE_REG_P): This. * fold-const.c (fold_indirect_ref_1): Fold *(foo *)&vectorfoo into using BIT_FIELD_REF. * omp-low.c (omp_copy_decl_2): Use the renamed DECL_GIMPLE_REG_P. * tree-gimple.c (is_gimple_reg): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. * expr.c (get_inner_reference): Set the mode for BIT_FIELD_REF with vector types. * tree-flow-inline.h (var_can_have_subvars): Use the renamed DECL_GIMPLE_REG_P. * gimplify.c (internal_get_tmp_var): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. (gimplify_bind_expr): Likewise. (gimplify_function_tree): Likewise. * expmed.c: Include target.h. (extract_bit_field): For vector mode, try find a better mode first. If that fails use gen_lowpart (for vectors only). * tree-dfa.c (make_rename_temp): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. * tree-ssa-pre.c (create_expressions_by_pieces): Likewise. (insert_into_preds_of_block): Likewise. (insert_fake_stores): Create gimple register store_tmps for vector types. * tree-sra.c (sra_elt): New field, is_vector_lhs. (sra_walk_expr <case BIT_FIELD_REF>): For vector types that are the left hand side, set the element's is_vector_lhs to true. (instantiate_element): For vector types which were on the left hand size, set DECL_GIMPLE_REG_P to false. * tree-nested.c (create_tmp_var_for): Use the renamed DECL_GIMPLE_REG_P. * tree-inline.c (declare_return_variable): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. (copy_decl_to_var): Use the renamed DECL_GIMPLE_REG_P. (copy_result_decl_to_var): Likewise. * tree-vect-transform.c (vect_get_new_vect_var): For vector types, create a gimple register variable. (vect_permute_store_chain): Set DECL_GIMPLE_REG_P to true for the vect_inter_* temp variables. * Makefile.in (expmed.o): Update dependencies. 2006-12-12 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/28436 * gcc.c-torture/compile/vector-1.c: New test. * gcc.c-torture/compile/vector-2.c: New test. * gcc.c-torture/compile/vector-3.c: New test. From-SVN: r119801
2006-12-12 23:33:06 +01:00
if (TREE_CODE (TREE_TYPE (expr)) == COMPLEX_TYPE
|| TREE_CODE (TREE_TYPE (expr)) == VECTOR_TYPE)
DECL_GIMPLE_REG_P (temp) = 1;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
re PR middle-end/30391 (ICE at -O1 with conditional expressions and GIMPLE_MODIFY_STMT) PR middle-end/30391 * tree.c (expr_align): Handle MODIFY_EXPR. GIMPLE_MODIFY_STMT should be unreachable. (build2_stat): Allow construction of MODIFY_EXPR at any time. For the time being redirect GIMPLE_MODIFY_STMT to the new (renamed) build_gimple_modify_stmt_stat. (build2_gimple_stat): Rename to... (build_gimple_modify_stmt_stat): Now longer take a CODE argument. Always build a GIMPLE_MODIFY_STMT node. * tree.h (build2_gimple, build2_gimple_stat): Delete. (build_gimple_modify_stmt, build_gimple_modify_stmt_stat): New declarations. * tree-cfg.c (factor_computed_gotos, tree_merge_blocks, gimplify_val): Use build_gimple_modify_stmt instead of build2_gimple. * tree-complex.c (set_component_ssa_name, expand_complex_move, expand_complex_div_wide): Likewise. * tree-ssa-dom.c (record_equivalences_from_stmt): Likewise. * tree-ssa-loop-im.c (schedule_sm): Likewise. * tree-ssa-loop-ivopts.c (rewrite_use_nonlinear_expr): Likewise. * tree-ssa-loop-manip.c (create_iv): Likewise. * tree-ssa-phiopt.c (conditional_replacement, minmax_replacement, abs_replacement): Likewise. * tree-ssa-pre.c (create_expression_by_pieces, poolify_modify_stmt, realify_fake_stores): Likewise. * builtins.c (std_expand_builtin_va_start): Build a MODIFY_EXPR node rather than a GIMPLE_MODIFY_STMT node. (std_gimpify_va_arg_expr, expand_builtin_va_copy, fold_builtin_memset, fold_builtin_memory_op, do_mpfr_sincos): Likewise. (integer_valued_real_p): Handle MODIFY_EXPR, not GIMPLE_MODIFY_STMT. * expr.c (expand_expr_real_1): Handle both MODIFY_EXPR and GIMPLE_MODIFY_STMT. * gfortran.dg/pr30391-1.f90: New test case. From-SVN: r122030
2007-02-16 04:38:22 +01:00
newexpr = build_gimple_modify_stmt (temp, newexpr);
name = make_ssa_name (temp, newexpr);
GIMPLE_STMT_OPERAND (newexpr, 0) = name;
NECESSARY (newexpr) = 0;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
tsi = tsi_last (stmts);
tsi_link_after (&tsi, newexpr, TSI_CONTINUE_LINKING);
VEC_safe_push (tree, heap, inserted_exprs, newexpr);
/* All the symbols in NEWEXPR should be put into SSA form. */
mark_symbols_for_renaming (newexpr);
/* Add a value handle to the temporary.
The value may already exist in either NEW_SETS, or AVAIL_OUT, because
we are creating the expression by pieces, and this particular piece of
the expression may have been represented. There is no harm in replacing
here. */
v = get_value_handle (expr);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
vn_add (name, v);
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
VN_INFO_GET (name)->valnum = name;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
get_or_alloc_expression_id (name);
2006-07-04 23:23:03 +02:00
bitmap_value_replace_in_set (NEW_SETS (block), name);
bitmap_value_replace_in_set (AVAIL_OUT (block), name);
pre_stats.insertions++;
if (dump_file && (dump_flags & TDF_DETAILS))
2006-07-04 23:23:03 +02:00
{
fprintf (dump_file, "Inserted ");
print_generic_expr (dump_file, newexpr, 0);
fprintf (dump_file, " in predecessor %d\n", block->index);
}
return name;
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Insert the to-be-made-available values of expression EXPRNUM for each
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
predecessor, stored in AVAIL, into the predecessors of BLOCK, and
merge the result with a phi node, given the same value handle as
NODE. Return true if we have inserted new stuff. */
static bool
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
insert_into_preds_of_block (basic_block block, unsigned int exprnum,
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
tree *avail)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
tree expr = expression_for_id (exprnum);
tree val = get_value_handle (expr);
edge pred;
bool insertions = false;
bool nophi = false;
basic_block bprime;
tree eprime;
edge_iterator ei;
tree type = TREE_TYPE (avail[EDGE_PRED (block, 0)->src->index]);
tree temp;
2006-07-04 23:23:03 +02:00
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Found partial redundancy for expression ");
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
print_generic_expr (dump_file, expr, 0);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
fprintf (dump_file, " (");
print_generic_expr (dump_file, val, 0);
fprintf (dump_file, ")");
fprintf (dump_file, "\n");
}
/* Make sure we aren't creating an induction variable. */
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
if (block->loop_depth > 0 && EDGE_COUNT (block->preds) == 2
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
&& TREE_CODE_CLASS (TREE_CODE (expr)) != tcc_reference )
{
bool firstinsideloop = false;
bool secondinsideloop = false;
2006-07-04 23:23:03 +02:00
firstinsideloop = flow_bb_inside_loop_p (block->loop_father,
EDGE_PRED (block, 0)->src);
secondinsideloop = flow_bb_inside_loop_p (block->loop_father,
EDGE_PRED (block, 1)->src);
/* Induction variables only have one edge inside the loop. */
if (firstinsideloop ^ secondinsideloop)
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Skipping insertion of phi for partial redundancy: Looks like an induction variable\n");
nophi = true;
}
}
2006-07-04 23:23:03 +02:00
/* Make the necessary insertions. */
FOR_EACH_EDGE (pred, ei, block->preds)
{
tree stmts = alloc_stmt_list ();
tree builtexpr;
bprime = pred->src;
eprime = avail[bprime->index];
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
if (can_PRE_operation (eprime))
{
builtexpr = create_expression_by_pieces (bprime,
eprime,
stmts);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
gcc_assert (!(pred->flags & EDGE_ABNORMAL));
bsi_insert_on_edge (pred, stmts);
avail[bprime->index] = builtexpr;
insertions = true;
2006-07-04 23:23:03 +02:00
}
}
/* If we didn't want a phi node, and we made insertions, we still have
inserted new stuff, and thus return true. If we didn't want a phi node,
and didn't make insertions, we haven't added anything new, so return
false. */
if (nophi && insertions)
return true;
else if (nophi && !insertions)
return false;
/* Now build a phi for the new variable. */
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
if (!prephitemp || TREE_TYPE (prephitemp) != type)
{
prephitemp = create_tmp_var (type, "prephitmp");
get_var_ann (prephitemp);
}
temp = prephitemp;
re PR c++/26757 (C++ front-end producing two DECLs with the same UID) 2006-05-23 Andrew MacLeod <amacleod@redhat.com> PR c++/26757 * tree-ssa-loop-im.c (determine_invariantness_stmt): Use add_referenced_var instead of add_referenced_tmp_var. * tree-complex.c (create_one_component_var): Use add_referenced_var. * tree-ssa-loop-manip.c (create_iv, tree_unroll_loop): Use add_referenced_var. * tree-tailcall.c (adjust_accumulator_values, adjust_return_value, tree_optimize_tail_calls_1): Use add_referenced_var. * tree-ssa-loop-ivopts.c (create_new_iv): Use add_referenced_var. * tree-ssa-alias.c (create_memory_tag, create_global_var, create_sft): Use add_referenced_var. * tree-if-conv.c (ifc_temp_var): Use add_referenced_var. * gimplify.c (force_gimple_operand): Use add_referenced_var. * tree-ssa-phiopt.c (conditional_replacement, abs_replacement): Use add_referenced_var. * tree-dfa.c (struct walk_state): Remove. (find_referenced_vars): Remove walk state and vars_found hash table. (make_rename_temp): Use add_referenced_var. (find_vars_r): Pass less parameters to add_referenced_var. (referenced_var_p): New. Is var in referenced_var hash table. (referenced_var_insert): Assert var isn't already in hash table. (add_referenced_var): Don't need walk_state parameter. Add var if it isn't already in the hash table. (add_referenced_tmp_var): Remove. (find_new_referenced_vars_1): Use add_referenced_var. * tree-ssa-pre.c (create_expression_by_pieces, insert_into_preds_of_block, insert_extra_phis, realify_fake_stores): Use add_referenced_var. * tree-vect-patterns.c (vect_pattern_recog_1): Use add_referenced_var. * lambda-code.c (lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, perfect_nestify): Use add_referenced_var. * tree-vect-transform.c (vect_create_addr_base_for_vector_ref, vect_create_data_ref_ptr, vect_create_destination_var, vect_init_vector, vect_build_loop_niters, vect_generate_tmps_on_preheader, vect_update_ivs_after_vectorizer, vect_gen_niters_for_prolog_loop, vect_create_cond_for_align_checks): Use add_referenced_var. * tree-outof-ssa.c (create_temp): Use add_referenced_var. * tree-flow.h (add_referenced_tmp_var): Remove prototype (add_referenced_var): Add prototype. * tree-ssa-structalias.c (get_constraint_for, intra_create_variable_infos): Use add_referenced_var. From-SVN: r114018
2006-05-23 16:07:21 +02:00
add_referenced_var (temp);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
re PR middle-end/28436 (accessing an element via a "pointer" on a vector does not cause vec_extract to be used) 2006-12-12 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/28436 * tree.h (DECL_COMPLEX_GIMPLE_REG_P): Rename to ... (DECL_GIMPLE_REG_P): This. * fold-const.c (fold_indirect_ref_1): Fold *(foo *)&vectorfoo into using BIT_FIELD_REF. * omp-low.c (omp_copy_decl_2): Use the renamed DECL_GIMPLE_REG_P. * tree-gimple.c (is_gimple_reg): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. * expr.c (get_inner_reference): Set the mode for BIT_FIELD_REF with vector types. * tree-flow-inline.h (var_can_have_subvars): Use the renamed DECL_GIMPLE_REG_P. * gimplify.c (internal_get_tmp_var): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. (gimplify_bind_expr): Likewise. (gimplify_function_tree): Likewise. * expmed.c: Include target.h. (extract_bit_field): For vector mode, try find a better mode first. If that fails use gen_lowpart (for vectors only). * tree-dfa.c (make_rename_temp): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. * tree-ssa-pre.c (create_expressions_by_pieces): Likewise. (insert_into_preds_of_block): Likewise. (insert_fake_stores): Create gimple register store_tmps for vector types. * tree-sra.c (sra_elt): New field, is_vector_lhs. (sra_walk_expr <case BIT_FIELD_REF>): For vector types that are the left hand side, set the element's is_vector_lhs to true. (instantiate_element): For vector types which were on the left hand size, set DECL_GIMPLE_REG_P to false. * tree-nested.c (create_tmp_var_for): Use the renamed DECL_GIMPLE_REG_P. * tree-inline.c (declare_return_variable): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. (copy_decl_to_var): Use the renamed DECL_GIMPLE_REG_P. (copy_result_decl_to_var): Likewise. * tree-vect-transform.c (vect_get_new_vect_var): For vector types, create a gimple register variable. (vect_permute_store_chain): Set DECL_GIMPLE_REG_P to true for the vect_inter_* temp variables. * Makefile.in (expmed.o): Update dependencies. 2006-12-12 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/28436 * gcc.c-torture/compile/vector-1.c: New test. * gcc.c-torture/compile/vector-2.c: New test. * gcc.c-torture/compile/vector-3.c: New test. From-SVN: r119801
2006-12-12 23:33:06 +01:00
if (TREE_CODE (type) == COMPLEX_TYPE
|| TREE_CODE (type) == VECTOR_TYPE)
DECL_GIMPLE_REG_P (temp) = 1;
temp = create_phi_node (temp, block);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
2006-07-04 23:23:03 +02:00
NECESSARY (temp) = 0;
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
VN_INFO_GET (PHI_RESULT (temp))->valnum = PHI_RESULT (temp);
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
VEC_safe_push (tree, heap, inserted_exprs, temp);
FOR_EACH_EDGE (pred, ei, block->preds)
add_phi_arg (temp, avail[pred->src->index], pred);
2006-07-04 23:23:03 +02:00
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
vn_add (PHI_RESULT (temp), val);
2006-07-04 23:23:03 +02:00
/* The value should *not* exist in PHI_GEN, or else we wouldn't be doing
this insertion, since we test for the existence of this value in PHI_GEN
before proceeding with the partial redundancy checks in insert_aux.
2006-07-04 23:23:03 +02:00
The value may exist in AVAIL_OUT, in particular, it could be represented
by the expression we are trying to eliminate, in which case we want the
replacement to occur. If it's not existing in AVAIL_OUT, we want it
inserted there.
2006-07-04 23:23:03 +02:00
Similarly, to the PHI_GEN case, the value should not exist in NEW_SETS of
this block, because if it did, it would have existed in our dominator's
AVAIL_OUT, and would have been skipped due to the full redundancy check.
*/
bitmap_insert_into_set (PHI_GEN (block),
PHI_RESULT (temp));
2006-07-04 23:23:03 +02:00
bitmap_value_replace_in_set (AVAIL_OUT (block),
PHI_RESULT (temp));
bitmap_insert_into_set (NEW_SETS (block),
PHI_RESULT (temp));
2006-07-04 23:23:03 +02:00
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Created phi ");
print_generic_expr (dump_file, temp, 0);
fprintf (dump_file, " in block %d\n", block->index);
}
pre_stats.phis++;
return true;
}
2006-07-04 23:23:03 +02:00
/* Perform insertion of partially redundant values.
For BLOCK, do the following:
1. Propagate the NEW_SETS of the dominator into the current block.
2006-07-04 23:23:03 +02:00
If the block has multiple predecessors,
2a. Iterate over the ANTIC expressions for the block to see if
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
any of them are partially redundant.
2b. If so, insert them into the necessary predecessors to make
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
the expression fully redundant.
2c. Insert a new PHI merging the values of the predecessors.
2d. Insert the new PHI, and the new expressions, into the
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
NEW_SETS set.
3. Recursively call ourselves on the dominator children of BLOCK.
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
Steps 1, 2a, and 3 are done by insert_aux. 2b, 2c and 2d are done by
do_regular_insertion and do_partial_insertion.
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
*/
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
static bool
do_regular_insertion (basic_block block, basic_block dom)
{
bool new_stuff = false;
VEC (tree, heap) *exprs = sorted_array_from_bitmap_set (ANTIC_IN (block));
tree expr;
int i;
for (i = 0; VEC_iterate (tree, exprs, i, expr); i++)
{
if (can_PRE_operation (expr) && !AGGREGATE_TYPE_P (TREE_TYPE (expr)))
{
tree *avail;
tree val;
bool by_some = false;
bool cant_insert = false;
bool all_same = true;
tree first_s = NULL;
edge pred;
basic_block bprime;
tree eprime = NULL_TREE;
edge_iterator ei;
val = get_value_handle (expr);
if (bitmap_set_contains_value (PHI_GEN (block), val))
continue;
if (bitmap_set_contains_value (AVAIL_OUT (dom), val))
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Found fully redundant value\n");
continue;
}
avail = XCNEWVEC (tree, last_basic_block);
FOR_EACH_EDGE (pred, ei, block->preds)
{
tree vprime;
tree edoubleprime;
/* This can happen in the very weird case
that our fake infinite loop edges have caused a
critical edge to appear. */
if (EDGE_CRITICAL_P (pred))
{
cant_insert = true;
break;
}
bprime = pred->src;
eprime = phi_translate (expr, ANTIC_IN (block), NULL,
bprime, block);
/* eprime will generally only be NULL if the
value of the expression, translated
through the PHI for this predecessor, is
undefined. If that is the case, we can't
make the expression fully redundant,
because its value is undefined along a
predecessor path. We can thus break out
early because it doesn't matter what the
rest of the results are. */
if (eprime == NULL)
{
cant_insert = true;
break;
}
eprime = fully_constant_expression (eprime);
vprime = get_value_handle (eprime);
gcc_assert (vprime);
edoubleprime = bitmap_find_leader (AVAIL_OUT (bprime),
vprime);
if (edoubleprime == NULL)
{
avail[bprime->index] = eprime;
all_same = false;
}
else
{
avail[bprime->index] = edoubleprime;
by_some = true;
if (first_s == NULL)
first_s = edoubleprime;
else if (!operand_equal_p (first_s, edoubleprime,
0))
all_same = false;
}
}
/* If we can insert it, it's not the same value
already existing along every predecessor, and
it's defined by some predecessor, it is
partially redundant. */
if (!cant_insert && !all_same && by_some)
{
if (insert_into_preds_of_block (block, get_expression_id (expr),
avail))
new_stuff = true;
}
/* If all edges produce the same value and that value is
an invariant, then the PHI has the same value on all
edges. Note this. */
else if (!cant_insert && all_same && eprime
&& is_gimple_min_invariant (eprime)
&& !is_gimple_min_invariant (val))
{
unsigned int j;
bitmap_iterator bi;
bitmap_set_t exprset = VALUE_HANDLE_EXPR_SET (val);
FOR_EACH_EXPR_ID_IN_SET (exprset, j, bi)
{
tree expr = expression_for_id (j);
if (TREE_CODE (expr) == SSA_NAME)
{
vn_add (expr, eprime);
pre_stats.constified++;
}
}
}
free (avail);
}
}
VEC_free (tree, heap, exprs);
return new_stuff;
}
/* Perform insertion for partially anticipatable expressions. There
is only one case we will perform insertion for these. This case is
if the expression is partially anticipatable, and fully available.
In this case, we know that putting it earlier will enable us to
remove the later computation. */
static bool
do_partial_partial_insertion (basic_block block, basic_block dom)
{
bool new_stuff = false;
VEC (tree, heap) *exprs = sorted_array_from_bitmap_set (PA_IN (block));
tree expr;
int i;
for (i = 0; VEC_iterate (tree, exprs, i, expr); i++)
{
if (can_PRE_operation (expr) && !AGGREGATE_TYPE_P (TREE_TYPE (expr)))
{
tree *avail;
tree val;
bool by_all = true;
bool cant_insert = false;
edge pred;
basic_block bprime;
tree eprime = NULL_TREE;
edge_iterator ei;
val = get_value_handle (expr);
if (bitmap_set_contains_value (PHI_GEN (block), val))
continue;
if (bitmap_set_contains_value (AVAIL_OUT (dom), val))
continue;
avail = XCNEWVEC (tree, last_basic_block);
FOR_EACH_EDGE (pred, ei, block->preds)
{
tree vprime;
tree edoubleprime;
/* This can happen in the very weird case
that our fake infinite loop edges have caused a
critical edge to appear. */
if (EDGE_CRITICAL_P (pred))
{
cant_insert = true;
break;
}
bprime = pred->src;
eprime = phi_translate (expr, ANTIC_IN (block),
PA_IN (block),
bprime, block);
/* eprime will generally only be NULL if the
value of the expression, translated
through the PHI for this predecessor, is
undefined. If that is the case, we can't
make the expression fully redundant,
because its value is undefined along a
predecessor path. We can thus break out
early because it doesn't matter what the
rest of the results are. */
if (eprime == NULL)
{
cant_insert = true;
break;
}
eprime = fully_constant_expression (eprime);
vprime = get_value_handle (eprime);
gcc_assert (vprime);
edoubleprime = bitmap_find_leader (AVAIL_OUT (bprime),
vprime);
if (edoubleprime == NULL)
{
by_all = false;
break;
}
else
avail[bprime->index] = edoubleprime;
}
/* If we can insert it, it's not the same value
already existing along every predecessor, and
it's defined by some predecessor, it is
partially redundant. */
if (!cant_insert && by_all)
{
pre_stats.pa_insert++;
if (insert_into_preds_of_block (block, get_expression_id (expr),
avail))
new_stuff = true;
}
free (avail);
}
}
VEC_free (tree, heap, exprs);
return new_stuff;
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
static bool
insert_aux (basic_block block)
{
basic_block son;
bool new_stuff = false;
if (block)
{
basic_block dom;
dom = get_immediate_dominator (CDI_DOMINATORS, block);
if (dom)
tree-ssa.texi: Remove references to VDEF and add descriptions of V_MAY_DEF and V_MUST_DEF. * doc/tree-ssa.texi: Remove references to VDEF and add descriptions of V_MAY_DEF and V_MUST_DEF. * tree-dfa.c (dfa_stats_d): Add num_v_must_defs and rename num_vdefs to num_v_may_defs. (compute_immediate_uses_for_stmt): Rename occurences of vdef to v_may_def. (redirect_immediate_uses): Ditto. (dump_dfa_stats): Ditto. Also added code to dump num_v_must_defs. (collect_dfa_stats_r): Rename occurences of vdef to v_may_def. Also add code to sum up the number of v_must_defs. (vdefs_disappeared_p): Replace with... (v_may_defs_disappeared_p): This. (v_must_defs_disappeared_p): New function. (mark_new_vars_to_rename): Rename occurences of vdef to v_may_def. Also add code to mark new variables found in V_MUST_DEFs for renameing. * tree-flow.h (stmt_ann_d): Add v_must_def_ops and replace vdef_ops to v_may_def_ops. (get_vdef_ops): Replace with... (get_v_may_def_ops): This. * tree-flow-inline.h (get_vdef_ops): Replace with... (get_v_may_def_ops): This. (get_v_must_def_ops): New function. (get_vdef_result_ptr): Replace with... (get_v_may_def_result_ptr): This. (get_vdef_op_ptr): Ditto with... (get_v_may_def_op_ptr); This. (get_v_must_def_op_ptr): New function. * tree-into-ssa.c (mark_def_sites): Rename occurences of vdef to v_may_def. Also add code to mark statements with V_MUST_DEFs as definition sites. (rewrite_stmt): Rename occurences of vdef to v_may_def. Also add code to register new V_MUST_DEFs made by the statement. * tree-outof-ssa.c (VIRTUAL_PARTITION): Update comments. (check_replaceable): Rename occurences of vdef to v_may_def. Also add check for V_MUST_DEFs. (find_replaceable_in_bb): Ditto. * tree-pretty-print.c (dump_vops): Rename occurences of vdef to v_may_def. Also add code to dump V_MUST_DEFs. * tree-sra.c (mark_all_vdefs): Replace with... (mark_all_v_may_defs): This. (mark_all_v_must_defs): New function. (create_scalar_copies): Replace call to mark_all_vdefs with calls to mark_all_v_may_defs and mark_all_v_must_defs. (scalarize_structures): Rename occurences of vdef to v_may_def. Also add a check for V_MUST_DEFs. (scalarize_modify_expr): Rename occurences of vdef to v_may_def. * tree-ssa-alias.c (global_var): Update comment. (compute_may_aliases): Ditto. (compute_points_to_and_addr_escape): Rename occurences of vdef to v_may_def. Also add code to mark variables in V_MUST_DEF operands as being written to. (group_aliases): Update comment. (maybe_create_global_var): Ditto. * tree-ssa.c (verify_ssa): Rename occurences of vdef to v_may_def. Also add a check for V_MUST_DEFs on GIMPLE registers. (replace_immediate_uses): Rename occurences of vdef to v_may_def. * tree-ssa-ccp.c (visit_stmt): Rename occurences of vdef to v_may_def. Also add code to mark all V_MUST_DEF operands VARYING. (initialize): Ditto. (set_rhs): Rename occurences of vdef to v_may_def. Also add code to update SSA_NAMEs in V_MUST_DEFs. * tree-ssa-copy.c (cprop_into_stmt): Rename occurences of vdef to v_may_def. * tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Rename occurences of vdef to v_may_def. Also add code to mark statements with V_MUST_DEFs as necessary. (propagate_necessity): Rename occurences of vdef to v_may_def. * tree-ssa-dom.c (redirect_edges_and_update_ssa_graph): Rename occurences of vdef to v_may_def. Also add code to mark operands in V_MUST_DEFs for renaming. (eliminate_redundant_computations): Rename occurences of vdef to v_may_def. (record_equivalences_from_stmt): Rename occurences of vdef to v_may_def. Also add code to record VUSEs for V_MUST_DEFs. (optimize_stmt): Remove unnesessary variable vdefs. Update comment. (register_definitions_for_stmt): Rename occurences of vdef to v_may_def. Also add code to register definitions made with V_MUST_DEFs. * tree-ssa-dse.c (fix_stmt_vdefs): Replace with... (fix_stmt_v_may_defs): This. (fix_phi_uses): Rename occurences of vdef to v_may_def. (dse_optimize_stmt): Ditto. * tree-ssa-live.c (create_ssa_var_map): Rename occurences of vdef to v_may_def. Also add code to mark V_MUST_DEF operands as being used in virtual operators. * tree-ssa-loop.c (mark_defs_for_rewrite): Rename occurences of vdef to v_may_def. Also add code to mark V_MUST_DEF operands for renaming. * tree-ssa-operands.c (opf_kill_def): New flag for killing definitions. (build_vdefs): Renamed to... (build_v_may_defs): This. (build_v_must_defs): New variable. (voperands_d): Add v_must_def_ops and replace vdef_ops with v_may_def_ops. (append_vdef): Replace with... (append_v_may_def): This. (append_v_must_def): New function. (NUM_FREE): Increment for V_MUST_DEF (optype_freelist): Increment its size for V_MUST_DEF (allocate_vdef_optype): Replace with... (allocate_v_may_def_optype): This. (allocate_v_must_def_optype): New function. (free_vdefs): Replace with... (free_v_may_defs): This. (free_v_must_defs): New function. (remove_vdefs): Replace with... (remove_v_may_defs): This. (remove_v_must_defs): New function. (init_ssa_operands): Rename occurences of vdef to v_may_def. Also add code to initialize build_v_must_defs. (finalize_ssa_vdefs): Replace with... (finalize_ssa_v_may_defs): This. (finalize_ssa_vuses): Rename occurences of vdef to v_may_def. (finalize_ssa_v_must_defs): New function. (finalize_ssa_stmt_operands): Replace call to finalize_ssa_vdefs with calls to finalize_ssa_v_may_defs and finalize_ssa_v_must_defs. (verify_start_operands): Rename occurences of vdef to v_may_def. Also add check for build_v_must_defs. (get_stmt_operands): Rename occurences of vdef to v_may_def. Also add code to handle V_MUST_DEFs and to use opf_kill_def for killing definitions. (get_expr_operands): Update comment and use opf_kill_def for killing definitions. (add_stmt_operand): Replace code that appends VDEFs with code that appends V_MUST_DEFs when opf_kill_def is set and V_MAY_DEFs otherwise. (add_call_clobber_ops): Update comments. * tree-ssa-operands.h (vdef_optype_d): Replace with... (v_may_def_optype_d): This. (v_must_def_optype_d): New structure. (VDEF_OPS): Replace with... (V_MAY_DEF_OPS): This. (STMT_VDEF_OPS): Same with... (STMT_V_MAY_DEF_OPS): This. (NUM_VDEFS): And... (NUM_V_MAY_DEFS): This. (VDEF_RESULT_PTR): As well as... (V_MAY_DEF_RESULT_PTR): This. (VDEF_RESULT): Same goes for... (V_MAY_DEF_RESULT): This. (VDEF_OP_PTR): And... (V_MAY_DEF_OP_PTR): This. (VDEF_OP): And... (V_MAY_DEF_OP): This. (V_MUST_DEF_OPS): New macro. (STMT_V_MUST_DEF_OPS): Ditto. (NUM_V_MUST_DEFS): Ditto. (V_MUST_DEF_OP_PTR): Ditto. (V_MUST_DEF_OP): Ditto. (remove_vdefs): Replace signature with... (remove_v_may_defs): This. (remove_v_must_defs): New function signature. * tree-ssa-pre.c (subst_phis): Replace call to remove_vdefs with calls to remove_v_may_defs and remove_v_must_defs. (process_left_occs_and_kills): Rename occurences of vdef to v_may_def. Also add code that marks left occurences of operands in V_MUST_DEFs. * tree-tailcall.c (find_tail_calls): Rename occurences of vdef to v_may_def. Also add check for V_MUST_DEFs. (eliminate_tail_call):Rename occurences of vdef to v_may_def. testsuite: * gcc.dg/tree-ssa/20031015-1.c: Scan for V_MAY_DEF instead of VDEF. * gcc.dg/tree-ssa/20040517-1.c: Ditto. From-SVN: r82947
2004-06-10 23:41:08 +02:00
{
bitmap.c (bitmap_print): Make bitno unsigned. * bitmap.c (bitmap_print): Make bitno unsigned. * bt-load.c (clear_btr_from_live_range, btr_def_live_range): Likewise. * caller-save.c (save_call_clobbered_regs): Likewise. * cfganal.c (compute_dominance_frontiers_1): Likewise. * cfgcleanup.c (thread_jump): Likewise. * cfgrtl.c (safe_insert_insn_on_edge): Likewise. * conflict.c (conflict_graph_compute): Likewise. * ddg.c (add_deps_for_use): Likewise. * df.c (df_refs_update): Likewise. * except.c (remove_eh_handler): Likewise. * flow.c (verify_local_live_at_start, update_life_info, initialize_uninitialized_subregs, propagate_one_insn, free_propagate_block_info, propagate_block, find_use_as_address, reg_set_to_hard_reg_set): Likewise. * gcse.c (clear_modify_mem_tables): Likewise. * global.c (global_conflicts, build_insn_chain): Likewise. * ifcvt.c (dead_or_predicable): Likewise. * local-alloc.c (update_equiv_regs): Likewise. * loop.c (load_mems): Likewise. * ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Likewise. * ra-rewrite.c (reloads_to_loads, rewrite_program2, actual_spill): Likewise. * reload1.c (order_regs_for_reload, finish_spills): Likewise. * sched-deps.c (sched_analyze_insn, free_deps): Likewise. * sched-rgn.c (propagate_deps * tree-cfg.c (tree_purge_all_dead_eh_edges): Likewise. * tree-dfa.c (dump_dfa_stats tree-into-ssa.c (compute_global_livein, insert_phi_nodes, insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags): Likewise. * tree-outof-ssa.c (coalesce_ssa_name, coalesce_vars, free_temp_expr_table, find_replaceable_exprs): Likewise. * tree-sra.c (scan_function, scalarize_parms): Likewise. * tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape, compute_flow_sensitive_aliasing, maybe_create_global_var): Likewise. * tree-ssa-dce.c (mark_control_dependent_edges_necessary): Likewise. * tree-ssa-live.c (new_tree_live_info, live_worklist, calculate_live_on_entry, calculate_live_on_exit, compare_pairs, sort_coalesce_list, build_tree_conflict_graph, dump_live_info tree-ssa-loop-manip.c (add_exit_phis_var): Likewise. tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops, add_call_read_ops): Likewise. * tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Likewise. * tree-ssa-live.h (num_var_partitions): Return unsigned. From-SVN: r90053
2004-11-04 09:41:16 +01:00
unsigned i;
bitmap.h (EXECUTE_IF_SET_IN_BITMAP, [...]): Changed to iterator style. * bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP, EXECUTE_IF_AND_IN_BITMAP): Changed to iterator style. (bitmap_iterator): New type. (bmp_iter_common_next_1, bmp_iter_single_next_1, bmp_iter_single_init, bmp_iter_end_p, bmp_iter_single_next, bmp_iter_and_not_next_1, bmp_iter_and_not_init, bmp_iter_and_not_next, bmp_iter_and_next_1, bmp_iter_and_init, bmp_iter_and_next): New functions. * basic-block.h (EXECUTE_IF_SET_IN_REG_SET, EXECUTE_IF_AND_COMPL_IN_REG_SET, EXECUTE_IF_AND_IN_REG_SET): Changed to use iterator-style EXECUTE_IF_IN_BITMAP macros. * bitmap.c (bitmap_print): Ditto. * bt-load.c (clear_btr_from_live_range, add_btr_to_live_range, btr_def_live_range): Ditto. * cfganal.c (compute_dominance_frontiers_1) Ditto. * cgraphunit.c (convert_UIDs_in_bitmap, cgraph_characterize_statics): Ditto. * ddg.c (build_inter_loop_deps): Ditto. * df.c (FOR_EACH_BB_IN_BITMAP, df_bb_reg_info_compute, df_refs_update): Ditto. * except.c (remove_eh_handler): Ditto. * flow.c (reg_set_to_hard_reg_set): Ditto. * gcse.c (clear_modify_mem_tables): Ditto. * global.c (build_insn_chain): Ditto. * ifcvt.c (dead_or_predicable): Ditto. * loop-invariant.c (get_inv_cost, set_move_mark, move_invariant_reg): Ditto. * ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Ditto. * ra-rewrite.c (reloads_to_loads, rewrite_program2, detect_web_parts_to_rebuild, delete_useless_defs, actual_spill): Ditto. * tree-cfg.c (allocate_ssa_names, tree_duplicate_sese_region, tree_purge_all_dead_eh_edges): Ditto. * tree-into-ssa.c (compute_global_livein, insert_phi_nodes, insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags, rewrite_ssa_into_ssa): Ditto. * tree-outof-ssa.c (find_replaceable_exprs): Ditto. * tree-sra.c (scan_function, decide_instantiations, scalarize_parms): Ditto. * tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape, compute_flow_sensitive_aliasing, maybe_create_global_var, dump_points_to_info_for): Ditto. * tree-ssa-dce.c (EXECUTE_IF_CONTROL_DEPENDENT): Ditto. * tree-ssa-dse.c (dse_finalize_block): Ditto. * tree-ssa-live.c (live_worklist, calculate_live_on_entry, calculate_live_on_exit, build_tree_conflict_graph, dump_live_info): Ditto. * tree-ssa-loop-ivopts.c (find_induction_variables, find_interesting_uses, add_old_ivs_candidates, alloc_use_cost_map, determine_use_iv_costs, determine_set_costs, find_best_candidate, set_cost_up_to, create_new_ivs, remove_unused_ivs, free_loop_data): Ditto. * tree-ssa-loop-manip.c (add_exit_phis_var, add_exit_phis): Ditto. * tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops, add_call_read_ops): Ditto. * tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Ditto. From-SVN: r88145
2004-09-26 21:53:13 +02:00
bitmap_iterator bi;
bitmap_set_t newset = NEW_SETS (dom);
if (newset)
bitmap.h (EXECUTE_IF_SET_IN_BITMAP, [...]): Changed to iterator style. * bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP, EXECUTE_IF_AND_IN_BITMAP): Changed to iterator style. (bitmap_iterator): New type. (bmp_iter_common_next_1, bmp_iter_single_next_1, bmp_iter_single_init, bmp_iter_end_p, bmp_iter_single_next, bmp_iter_and_not_next_1, bmp_iter_and_not_init, bmp_iter_and_not_next, bmp_iter_and_next_1, bmp_iter_and_init, bmp_iter_and_next): New functions. * basic-block.h (EXECUTE_IF_SET_IN_REG_SET, EXECUTE_IF_AND_COMPL_IN_REG_SET, EXECUTE_IF_AND_IN_REG_SET): Changed to use iterator-style EXECUTE_IF_IN_BITMAP macros. * bitmap.c (bitmap_print): Ditto. * bt-load.c (clear_btr_from_live_range, add_btr_to_live_range, btr_def_live_range): Ditto. * cfganal.c (compute_dominance_frontiers_1) Ditto. * cgraphunit.c (convert_UIDs_in_bitmap, cgraph_characterize_statics): Ditto. * ddg.c (build_inter_loop_deps): Ditto. * df.c (FOR_EACH_BB_IN_BITMAP, df_bb_reg_info_compute, df_refs_update): Ditto. * except.c (remove_eh_handler): Ditto. * flow.c (reg_set_to_hard_reg_set): Ditto. * gcse.c (clear_modify_mem_tables): Ditto. * global.c (build_insn_chain): Ditto. * ifcvt.c (dead_or_predicable): Ditto. * loop-invariant.c (get_inv_cost, set_move_mark, move_invariant_reg): Ditto. * ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Ditto. * ra-rewrite.c (reloads_to_loads, rewrite_program2, detect_web_parts_to_rebuild, delete_useless_defs, actual_spill): Ditto. * tree-cfg.c (allocate_ssa_names, tree_duplicate_sese_region, tree_purge_all_dead_eh_edges): Ditto. * tree-into-ssa.c (compute_global_livein, insert_phi_nodes, insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags, rewrite_ssa_into_ssa): Ditto. * tree-outof-ssa.c (find_replaceable_exprs): Ditto. * tree-sra.c (scan_function, decide_instantiations, scalarize_parms): Ditto. * tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape, compute_flow_sensitive_aliasing, maybe_create_global_var, dump_points_to_info_for): Ditto. * tree-ssa-dce.c (EXECUTE_IF_CONTROL_DEPENDENT): Ditto. * tree-ssa-dse.c (dse_finalize_block): Ditto. * tree-ssa-live.c (live_worklist, calculate_live_on_entry, calculate_live_on_exit, build_tree_conflict_graph, dump_live_info): Ditto. * tree-ssa-loop-ivopts.c (find_induction_variables, find_interesting_uses, add_old_ivs_candidates, alloc_use_cost_map, determine_use_iv_costs, determine_set_costs, find_best_candidate, set_cost_up_to, create_new_ivs, remove_unused_ivs, free_loop_data): Ditto. * tree-ssa-loop-manip.c (add_exit_phis_var, add_exit_phis): Ditto. * tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops, add_call_read_ops): Ditto. * tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Ditto. From-SVN: r88145
2004-09-26 21:53:13 +02:00
{
/* Note that we need to value_replace both NEW_SETS, and
AVAIL_OUT. For both the case of NEW_SETS, the value may be
represented by some non-simple expression here that we want
to replace it with. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
FOR_EACH_EXPR_ID_IN_SET (newset, i, bi)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
tree expr = expression_for_id (i);
bitmap_value_replace_in_set (NEW_SETS (block), expr);
bitmap_value_replace_in_set (AVAIL_OUT (block), expr);
}
bitmap.h (EXECUTE_IF_SET_IN_BITMAP, [...]): Changed to iterator style. * bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP, EXECUTE_IF_AND_IN_BITMAP): Changed to iterator style. (bitmap_iterator): New type. (bmp_iter_common_next_1, bmp_iter_single_next_1, bmp_iter_single_init, bmp_iter_end_p, bmp_iter_single_next, bmp_iter_and_not_next_1, bmp_iter_and_not_init, bmp_iter_and_not_next, bmp_iter_and_next_1, bmp_iter_and_init, bmp_iter_and_next): New functions. * basic-block.h (EXECUTE_IF_SET_IN_REG_SET, EXECUTE_IF_AND_COMPL_IN_REG_SET, EXECUTE_IF_AND_IN_REG_SET): Changed to use iterator-style EXECUTE_IF_IN_BITMAP macros. * bitmap.c (bitmap_print): Ditto. * bt-load.c (clear_btr_from_live_range, add_btr_to_live_range, btr_def_live_range): Ditto. * cfganal.c (compute_dominance_frontiers_1) Ditto. * cgraphunit.c (convert_UIDs_in_bitmap, cgraph_characterize_statics): Ditto. * ddg.c (build_inter_loop_deps): Ditto. * df.c (FOR_EACH_BB_IN_BITMAP, df_bb_reg_info_compute, df_refs_update): Ditto. * except.c (remove_eh_handler): Ditto. * flow.c (reg_set_to_hard_reg_set): Ditto. * gcse.c (clear_modify_mem_tables): Ditto. * global.c (build_insn_chain): Ditto. * ifcvt.c (dead_or_predicable): Ditto. * loop-invariant.c (get_inv_cost, set_move_mark, move_invariant_reg): Ditto. * ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Ditto. * ra-rewrite.c (reloads_to_loads, rewrite_program2, detect_web_parts_to_rebuild, delete_useless_defs, actual_spill): Ditto. * tree-cfg.c (allocate_ssa_names, tree_duplicate_sese_region, tree_purge_all_dead_eh_edges): Ditto. * tree-into-ssa.c (compute_global_livein, insert_phi_nodes, insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags, rewrite_ssa_into_ssa): Ditto. * tree-outof-ssa.c (find_replaceable_exprs): Ditto. * tree-sra.c (scan_function, decide_instantiations, scalarize_parms): Ditto. * tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape, compute_flow_sensitive_aliasing, maybe_create_global_var, dump_points_to_info_for): Ditto. * tree-ssa-dce.c (EXECUTE_IF_CONTROL_DEPENDENT): Ditto. * tree-ssa-dse.c (dse_finalize_block): Ditto. * tree-ssa-live.c (live_worklist, calculate_live_on_entry, calculate_live_on_exit, build_tree_conflict_graph, dump_live_info): Ditto. * tree-ssa-loop-ivopts.c (find_induction_variables, find_interesting_uses, add_old_ivs_candidates, alloc_use_cost_map, determine_use_iv_costs, determine_set_costs, find_best_candidate, set_cost_up_to, create_new_ivs, remove_unused_ivs, free_loop_data): Ditto. * tree-ssa-loop-manip.c (add_exit_phis_var, add_exit_phis): Ditto. * tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops, add_call_read_ops): Ditto. * tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Ditto. From-SVN: r88145
2004-09-26 21:53:13 +02:00
}
basic-block.h (single_succ_p, [...]): New inline functions. * basic-block.h (single_succ_p, single_pred_p, single_succ_edge, single_pred_edge, single_succ, single_pred): New inline functions. * bb-reorder.c (rotate_loop, find_traces_1_round, add_labels_and_missing_jumps, fix_up_fall_thru_edges, duplicate_computed_gotos): Use the single_succ/pred functions. * cfganal.c (forwarder_block_p): Ditto. * cfgbuild.c (compute_outgoing_frequencies): Ditto. * cfgcleanup.c (try_simplify_condjump, try_forward_edges, outgoing_edges_match, try_crossjump_to_edge, try_optimize_cfg, merge_seq_blocks): Ditto. * cfghooks.c (split_edge, tidy_fallthru_edges): Ditto. * cfglayout.c (fixup_reorder_chain): Ditto. * cfgloop.c (mark_single_exit_loops, update_latch_info, canonicalize_loop_headers, verify_loop_structure): Ditto. * cfgloopmanip.c (remove_path, unloop, loop_delete_branch_edge, mfb_update_loops, create_preheader, force_single_succ_latches, create_loop_notes): Ditto. * cfgrtl.c (rtl_can_merge_blocks, try_redirect_by_replacing_jump, force_nonfallthru_and_redirect, rtl_tidy_fallthru_edge, commit_one_edge_insertion, purge_dead_edges, cfg_layout_can_merge_blocks_p): Ditto. * except.c (sjlj_emit_function_enter): Ditto. * flow.c (init_propagate_block_info): Ditto. * function.c (thread_prologue_and_epilogue_insns): Ditto. * gcse.c (find_implicit_sets, bypass_conditional_jumps, insert_insn_end_bb): Ditto. * ifcvt.c (merge_if_block, find_if_block, find_if_case_1, find_if_case_2): Ditto. * lambda-code.c (perfect_nestify): Ditto. * lcm.c (optimize_mode_switching): Ditto. * loop-doloop.c (doloop_modify): Ditto. * loop-init.c (loop_optimizer_init): Ditto. * loop-iv.c (simplify_using_initial_values): Ditto. * loop-unroll.c (unroll_loop_runtime_iterations): Ditto. * loop-unswitch.c (unswitch_loop): Ditto. * modulo-sched.c (generate_prolog_epilog): Ditto. * predict.c (combine_predictions_for_insn, estimate_probability, tree_estimate_probability, last_basic_block_p, estimate_bb_frequencies): Ditto. * profile.c (branch_prob): Ditto. * regrename.c (copyprop_hardreg_forward): Ditto. * sched-rgn.c (is_cfg_nonregular, find_rgns, update_live): Ditto. * tracer.c (layout_superblocks): Ditto. * tree-cfg.c (tree_can_merge_blocks_p, tree_merge_blocks, cfg_remove_useless_stmts_bb, cleanup_control_flow, cleanup_control_expr_graph, disband_implicit_edges, tree_find_edge_insert_loc, bsi_commit_edge_inserts, tree_verify_flow_info, tree_make_forwarder_block, tree_forwarder_block_p, remove_forwarder_block, remove_forwarder_block_with_phi, merge_phi_nodes): Ditto. * tree-if-conv.c (tree_if_conversion): Ditto. * tree-mudflap.c (mf_build_check_statement_for): Ditto. * tree-ssa-dce.c (remove_dead_stmt): Ditto. * tree-ssa-dom.c (dom_opt_finalize_block): Ditto. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p, copy_loop_headers): Ditto. * tree-ssa-loop-im.c (loop_commit_inserts): Ditto. * tree-ssa-loop-ivopts.c (compute_phi_arg_on_exit): Ditto. * tree-ssa-loop-manip.c (split_loop_exit_edge, ip_normal_pos, lv_adjust_loop_entry_edge, tree_ssa_loop_version): Ditto. * tree-ssa-loop-niter.c (simplify_using_initial_conditions): Ditto. * tree-ssa-loop-unswitch.c (simplify_using_entry_checks): Ditto. * tree-ssa-phiopt.c (tree_ssa_phiopt, value_replacement): Ditto. * tree-ssa-pre.c (compute_antic_aux, insert_aux, init_pre): Ditto. * tree-ssa-threadupdate.c (redirect_edges): Ditto. * tree-tailcall.c (independent_of_stmt_p, find_tail_calls, eliminate_tail_call, tree_optimize_tail_calls_1): Ditto. * tree-vect-analyze.c (vect_analyze_loop_form): Ditto. * tree-vect-transform.c (vect_update_ivs_after_vectorizer): Ditto. * tree-vectorizer.c (slpeel_update_phi_nodes_for_guard, slpeel_add_loop_guard): Ditto. From-SVN: r96292
2005-03-11 10:05:12 +01:00
if (!single_pred_p (block))
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
new_stuff |= do_regular_insertion (block, dom);
if (do_partial_partial)
new_stuff |= do_partial_partial_insertion (block, dom);
}
}
}
for (son = first_dom_son (CDI_DOMINATORS, block);
son;
son = next_dom_son (CDI_DOMINATORS, son))
{
new_stuff |= insert_aux (son);
}
return new_stuff;
}
/* Perform insertion of partially redundant values. */
static void
insert (void)
{
bool new_stuff = true;
basic_block bb;
int num_iterations = 0;
2006-07-04 23:23:03 +02:00
FOR_ALL_BB (bb)
NEW_SETS (bb) = bitmap_set_new ();
2006-07-04 23:23:03 +02:00
while (new_stuff)
{
num_iterations++;
new_stuff = false;
new_stuff = insert_aux (ENTRY_BLOCK_PTR);
}
if (num_iterations > 2 && dump_file && (dump_flags & TDF_STATS))
fprintf (dump_file, "insert required %d iterations\n", num_iterations);
}
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
/* Return true if VAR is an SSA variable with no defining statement in
this procedure, *AND* isn't a live-on-entry parameter. */
static bool
is_undefined_value (tree expr)
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
{
return (TREE_CODE (expr) == SSA_NAME
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
&& IS_EMPTY_STMT (SSA_NAME_DEF_STMT (expr))
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
/* PARM_DECLs and hard registers are always defined. */
&& TREE_CODE (SSA_NAME_VAR (expr)) != PARM_DECL);
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
}
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
/* Add OP to EXP_GEN (block), and possibly to the maximal set if it is
not defined by a phi node.
PHI nodes can't go in the maximal sets because they are not in
TMP_GEN, so it is possible to get into non-monotonic situations
during ANTIC calculation, because it will *add* bits. */
static void
add_to_exp_gen (basic_block block, tree op)
{
if (!in_fre)
{
if (TREE_CODE (op) == SSA_NAME && is_undefined_value (op))
return;
bitmap_value_insert_into_set (EXP_GEN (block), op);
if (TREE_CODE (op) != SSA_NAME
|| TREE_CODE (SSA_NAME_DEF_STMT (op)) != PHI_NODE)
bitmap_value_insert_into_set (maximal_set, op);
}
}
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
/* Given an SSA variable VAR and an expression EXPR, compute the value
number for EXPR and create a value handle (VAL) for it. If VAR and
EXPR are not the same, associate VAL with VAR. Finally, add VAR to
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
S1 and its value handle to S2, and to the maximal set if
ADD_TO_MAXIMAL is true.
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
VUSES represent the virtual use operands associated with EXPR (if
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
any). */
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
static inline void
lambda-code.c (gcc_loop_to_lambda_loop, [...]): Use generic operand interface. 2005-05-03 Andrew MacLeod <amacleod@redhat.com> * lambda-code.c (gcc_loop_to_lambda_loop, lambda_loopnest_to_gcc_loopnest, phi_loop_edge_uses_def, stmt_is_bumper_for_loop, perfect_nest_p, replace_uses_of_x_with_y): Use generic operand interface. * tree-data-ref.c (find_data_references_in_loop): Use generic interface. * tree-dfa.c (collect_dfa_stats_r, mark_new_vars_to_rename): Use generic operand interface. * tree-flow-inline.h (delink_imm_use, link_imm_use_to_list, link_imm_use, link_imm_use_stmt, relink_imm_use, relink_imm_use_stmt, next_safe_imm_use, has_zero_uses, has_single_use, single_imm_use, num_imm_uses): Use ssa_use_operand_t. (get_def_ops, get_use_ops, get_v_may_def_ops, get_vuse_ops, get_v_must_def_ops): Delete. (get_def_from_ptr, get_phi_result_ptr): Get def directly now. (get_use_op_ptr, get_def_op_ptr, get_v_may_def_result_ptr, get_v_may_def_op_ptr, get_vuse_op_ptr, get_v_must_def_result_ptr, get_v_must_def_kill_ptr): Delete. (delink_stmt_imm_use): Move and use new operand interface. (op_iter_next_use, op_iter_next_def, op_iter_next_tree, op_iter_init, op_iter_next_tree): Use new operand implementation. (clear_and_done_ssa_iter): New. Initialize a blank operand iterator. (op_iter_init_use, op_iter_init_def, op_iter_init_tree): Add iterator type check. (op_iter_next_mustdef, op_iter_next_maydef, op_iter_next_must_and_may_def): Delete. Replace with... (op_iter_next_maymustdef): New. Combine must and may next operations. (op_iter_init_maydef, op_iter_init_mustdef, op_iter_init_must_and_may_def): Use new interface. (single_ssa_tree_operand ): New. Process single operands only as trees. (single_ssa_use_operand): New. Process single operands only as uses. (single_ssa_def_operand): New. Process single operands only as defs. (zero_ssa_operands): New. Return TRUE if there are zero operands of the specified types. (num_ssa_operands): New. Count the number of specified operands. (compare_ssa_operands_equal): New. Compare two statements' operands. (single_phi_def): New. Return true if PHI has one def of the specified operand type. (op_iter_init_phiuse): New. Initialize the iterator for PHI arguments. (op_iter_init_phidef): New. Initialize the iterator for the PHI def. * tree-flow.h (struct immediate_use_iterator_d): Use ssa_use_operand_t. (struct stmt_ann_d): Operands field no longer require GTY(). (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Change prototype. * tree-into-ssa.c (mark_def_sites): Use SSA_OP_VMUSTKILL. * tree-outof-ssa.c (check_replaceable, find_replaceable_in_bb, dump_replaceable_exprs, rewrite_trees): Use generic interface. * tree-phinodes.c (make_phi_node, release_phi_node, resize_phi_node): Use use_operand_p instead of ssa_imm_use_t *. * tree-pretty-print.c (dump_vops): check if operands are active before dumping virtual operands. * tree-sra.c (sra_walk_function): Use ZERO_SSA_OPERANDS. * tree-ssa-ccp.c (likely_value): Use ZERO_SSA_OPERANDS. (ccp_fold): Use new interface. (ccp_visit_stmt): Remove unused variables and code. (convert_to_gimple_builtin): Insert statements before calling mark_new_vars_to_rename. * tree-ssa-copy.c (stmt_may_generate_copy): Use ZERO_SSA_OPERANDS. (copy_prop_visit_cond_stmt): Use generic interface. * tree-ssa-dom.c (struct expr_hash_elt): Use stmt pointer, not the annotation in table. (thread_across_edge): Use generic interface. (initialize_hash_element): Initialzie with stmt, not annotation. (eliminate_redundant_computations): Use generic interface. (record_equivalences_from_stmt): Pass stmt, not annotation. (avail_expr_hash, real_avail_expr_hash, avail_expr_eq): Use generic interface. * tree-ssa-dse.c (dse_optimize_stmt): Use ZERO_SSA_OPERANDS. * tree-ssa-loop-ivopts.c (find_invariants_stmt, find_interesting_uses_stmt, protect_loop_closed_ssa_form_use): Use generic operand interface. * tree-ssa-loop-niter.c (chain_of_csts_start, get_val_for): Use generic interface. * tree-ssa-loop-unswitch.c (tree_may_unswitch_on): Use Generic operand Interface. * tree-ssa-operands.c (struct opbuild_list_d): New. Operand build type. (build_defs, build_uses, build_v_may_defs, build_vuses, build_v_must_defs): Change type to struct opbuild_list_d. (ops_active): New. Operands active boolean. (operand_memory, operand_memory_index): New. Operand memory managers. (allocate_def_optype, allocate_use_optype, allocate_v_may_def_optype, allocate_vuse_optype, allocate_v_must_def_optype): Delete. (free_uses, free_defs, free_vuses, free_v_may_defs, free_v_must_defs): Change from functions to static variable list heads. (opbuild_initialize_virtual): New. Initialize a virtual build list. (opbuild_initialize_real): New. Initialize a virtual build list. (opbuild_free): New. Free a build list. (opbuild_num_elems): New. Number of items in a list. (opbuild_append_real): New. Add a real (tree *) operand. (opbuild_append_virtual): New. Add and sort a virtual (tree) operand. (opbuild_first): New. Return first element index in a list. (opbuild_next): New. Return next element in a list. (opbuild_elem_real): New. Return real element. (opbuild_elem_virtual): New. Return virtual element. (opbuild_elem_uid): New. Return UID of virtual element. (opbuild_clear): New. Reset an operand list. (opbuild_remove_elem): New. Remove an element form a list. (ssa_operands_active): New. Return true if operand cache is active. (init_ssa_operands, fini_ssa_operands): Initialize new implementation. (ssa_operand_alloc): New. Allocate memory from an operand chunk. (correct_use_link): Use use_operand_p. (finalize_ssa_uses, finalize_ssa_v_may_defs, finalize_ssa_defs, finalize_ssa_vuses, finalize_ssa_v_must_defs): New implmentation. (cleanup_v_may_defs): Use new implmentation. (finalize_ssa_stmt_operands, start_ssa_stmt_operands): New implementation. (append_def, append_use, append_v_may_def, append_vuse, append_v_must_def): Call opbuild_append routine instead of using varray. (build_ssa_operands): Simplify to simply use stmt, don't maintain a global parse_old_ops variable. (free_ssa_operands): New implementation. (update_stmt_operands): Move. Change argument to build_ssa_operands. (copy_virtual_operands): Move. New generic implementation. (create_ssa_artficial_load_stmt): Move. New implementation. (swap_tree_operands): Update for new implementation. (get_expr_operands): Add stmt parameter to calls to swap_tree_operands. (add_call_clobber_ops, add_call_read_ops): Initialize opbuild list rather than a varray. (verify_imm_links): Use use_operand_p. (dump_immediate_uses_for): If the immediate use variable is a virtual variable, show the virtual ops in the stmt. * tree-ssa-operands.h (def_operand_p): No longer a structure. (NULL_DEF_OPERAND_P): Now a #define. (def_optype_d, use_optype_d, v_def_use_operand_type, v_may_def_optype_d, vuse_operand_type, vuse_optype_d, v_must_def_optype_d): Delete. (def_optype_d, use_optype_d, maydef_optype_d, vuse_optype_d, mustdef_optype_d): New. Use Linked list representation. (SSA_OPERAND_MEMORY_SIZE): New. Size of operand memory chunk. (struct ssa_operand_memory_d): New. Allocated Chunk node. (struct stmt_operands_d): Change to new pointers that are not GTY. (STMT_USE_OPS, NUM_USES, SET_USE_OP, STMT_DEF_OPS, NUM_DEFS, SET_DEF_OP, STMT_V_MAY_DEF_OPS, NUM_V_MAY_DEFS, SET_V_MAY_DEF_RESULT, SET_V_MAY_DEF_OP, STMT_VUSE_OPS, NUM_VUSES, SET_VUSE_OP, STMT_V_MUST_DEF_OPS, NUM_V_MUST_DEFS, SET_V_MUST_DEF_RESULT, SET_V_MUST_DEF_KILL): Delete. (V_MAY_DEF_OPS, V_MAY_DEF_RESULT_PTR, V_MAY_DEF_RESULT, V_MAY_DEF_OP_PTR, V_MAY_DEF_OP): Rename to MAYDEF_*. (V_MUST_DEF_OPS, V_MUST_DEF_RESULT_PTR, V_MUST_DEF_RESULT, V_MUST_DEF_KILL_PTR, V_MUST_DEF_KILL): Rename to MUSTDEF_*. (enum ssa_op_iter_type): Operand iterator typechecking values. (struct ssa_operand_iterator_d): Use linked lists of operands. (SSA_OP_VMUSTDEFKILL): Rename to SSA_OP_VMUSTKILL. (FOR_EACH_SSA_MAYDEF_OPERAND, FOR_EACH_SSA_MUSTDEF_OPERAND, FOR_EACH_SSA_MUST_AND_MAY_DEF_OPERAND): Use op_iter_next_maymustdef. (FOR_EACH_PHI_ARG): New. Iterate over PHI arguments. (FOR_EACH_PHI_OR_STMT_USE): New. Iterate over PHI or stmt uses. (FOR_EACH_PHI_OR_STMT_DEF): New. Iterate over PHI or stmt defs. (SINGLE_SSA_TREE_OPERAND, SINGLE_SSA_USE_OPERAND, SINGLE_SSA_DEF_OPERAND, ZERO_SSA_OPERANDS, NUM_SSA_OPERANDS): New. * tree-ssa-opfinalize.h: New. Function templates for expansion. (FINALIZE_ALLOC): Expands into alloc_def, alloc_use, alloc_maydef, alloc_vuse, and alloc_mustdef. (FINALIZE_FUNC): Expands into finalize_ssa_def_ops, finalize_ssa_use_ops, finalize_ssa_v_may_def_ops, finalize_ssa_vuse_ops, and finalize_ssa_v_must_def_ops. * tree-ssa-pre.c (add_to_sets): Pass tree to vn_add. (create_value_expr_from): Use stmt not vuse_optype as a parameter. Pass stmt around. (compute_avail): Use generic iterator interface. * tree-ssa-propagate.c (first_vdef): Use generic operand interface. (stmt_makes_single_load, stmt_makes_single_store): Use ZERO_SSA_OPERANDS. * tree-ssa-sink.c (is_hidden_global_store): Use ZERO_SSA_OPERANDS. (statement_sink_location): Use generic interface. * tree-ssa.c (verify_ssa): Use %p in fprintf. Use generic interface. (delete_tree_ssa): Don't call release_defs. Call release_ssa_name and reset the immediate use link nodes. (stmt_references_memory_p): Use ZERO_SSA_OPERANDS. * tree-ssanames.c (make_ssa_name): Use use_operand_p. * tree-tailcall.c (find_tail_calls): Use ZERO_SSA_OPERANDS. (eliminate_tail_call): Use generic operand interface. * tree-vect-analyze.c (vect_analyze_data_refs): Use ZERO_SSA_OPERANDS. (vect_mark_relevant, vect_mark_stmts_to_be_vectorized): Use generic interface. * tree-vect-transform.c (update_vuses_to_preheader): Use generic interface. * tree-vectorizer.c (rename_variables_in_bb): Use generic interface. * tree-vn.c (struct val_expr_pair_d): Cache statment pointer instead of vuse_optype. (vn_compute, val_expr_pair_hash, vn_add, vn_lookup, vn_lookup_or_add): Use statement pointer instead of vuse_optype. Use generic interface. * tree-vrp.c (maybe_add_assert_expr): Use generic interface. (stmt_interesting_for_vrp, vrp_visit_stmt): Use ZERO_SSA_OPERANDS. * tree.h (struct ssa_imm_use_d): Renamed to ssa_use_operand_d. (tree_ssa_name, phi_arg_d): Use ssa_use_operand_d. * doc/tree-ssa.texi: Update documentation for operand interface. From-SVN: r99155
2005-05-03 14:19:56 +02:00
add_to_sets (tree var, tree expr, tree stmt, bitmap_set_t s1,
bitmap_set_t s2)
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
{
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
tree val;
val = vn_lookup_or_add_with_stmt (expr, stmt);
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
/* VAR and EXPR may be the same when processing statements for which
we are not computing value numbers (e.g., non-assignments, or
statements that make aliased stores). In those cases, we are
only interested in making VAR available as its own value. */
if (var != expr)
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
vn_add (var, val);
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
if (s1)
bitmap_insert_into_set (s1, var);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_value_insert_into_set (s2, var);
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
/* Find existing value expression that is the same as T,
and return it if it exists. */
static inline tree
find_existing_value_expr (tree t, tree stmt)
{
bitmap_iterator bi;
unsigned int bii;
tree vh;
bitmap_set_t exprset;
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
if (REFERENCE_CLASS_P (t) || TREE_CODE (t) == CALL_EXPR || DECL_P (t))
vh = vn_lookup_with_stmt (t, stmt);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
else
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
vh = vn_lookup (t);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (!vh)
return NULL;
exprset = VALUE_HANDLE_EXPR_SET (vh);
FOR_EACH_EXPR_ID_IN_SET (exprset, bii, bi)
{
tree efi = expression_for_id (bii);
if (expressions_equal_p (t, efi))
return efi;
}
return NULL;
}
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
/* Given a unary or binary expression EXPR, create and return a new
expression with the same structure as EXPR but with its operands
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
replaced with the value handles of each of the operands of EXPR.
VUSES represent the virtual use operands associated with EXPR (if
any). Insert EXPR's operands into the EXP_GEN set for BLOCK. */
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
static inline tree
create_value_expr_from (tree expr, basic_block block, tree stmt)
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
{
int i;
enum tree_code code = TREE_CODE (expr);
tree vexpr;
alloc_pool pool = NULL;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
tree efi;
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
gcc_assert (TREE_CODE_CLASS (code) == tcc_unary
|| TREE_CODE_CLASS (code) == tcc_binary
|| TREE_CODE_CLASS (code) == tcc_comparison
|| TREE_CODE_CLASS (code) == tcc_reference
|| TREE_CODE_CLASS (code) == tcc_expression
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
|| TREE_CODE_CLASS (code) == tcc_vl_exp
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
|| TREE_CODE_CLASS (code) == tcc_exceptional
|| TREE_CODE_CLASS (code) == tcc_declaration);
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
if (TREE_CODE_CLASS (code) == tcc_unary)
pool = unary_node_pool;
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
else if (TREE_CODE_CLASS (code) == tcc_reference)
pool = reference_node_pool;
else if (TREE_CODE_CLASS (code) == tcc_binary)
pool = binary_node_pool;
else if (TREE_CODE_CLASS (code) == tcc_comparison)
pool = comparison_node_pool;
2006-07-04 23:23:03 +02:00
else
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
gcc_assert (code == CALL_EXPR);
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
if (code == CALL_EXPR)
vexpr = temp_copy_call_expr (expr);
else
{
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
vexpr = (tree) pool_alloc (pool);
memcpy (vexpr, expr, tree_size (expr));
}
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
for (i = 0; i < TREE_OPERAND_LENGTH (expr); i++)
{
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
tree val = NULL_TREE;
tree op;
op = TREE_OPERAND (expr, i);
if (op == NULL_TREE)
continue;
/* Recursively value-numberize reference ops and tree lists. */
if (REFERENCE_CLASS_P (op))
{
tree tempop = create_value_expr_from (op, block, stmt);
op = tempop ? tempop : op;
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
val = vn_lookup_or_add_with_stmt (op, stmt);
}
2006-07-04 23:23:03 +02:00
else
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
{
val = vn_lookup_or_add (op);
}
if (TREE_CODE (op) != TREE_LIST)
add_to_exp_gen (block, op);
if (TREE_CODE (val) == VALUE_HANDLE)
TREE_TYPE (val) = TREE_TYPE (TREE_OPERAND (vexpr, i));
TREE_OPERAND (vexpr, i) = val;
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
efi = find_existing_value_expr (vexpr, stmt);
if (efi)
return efi;
get_or_alloc_expression_id (vexpr);
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
return vexpr;
}
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
/* Return a copy of NODE that is stored in the temporary alloc_pool's.
This is made recursively true, so that the operands are stored in
the pool as well. */
static tree
poolify_tree (tree node)
{
switch (TREE_CODE (node))
{
case INDIRECT_REF:
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
tree temp = (tree) pool_alloc (reference_node_pool);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
memcpy (temp, node, tree_size (node));
TREE_OPERAND (temp, 0) = poolify_tree (TREE_OPERAND (temp, 0));
return temp;
}
break;
case GIMPLE_MODIFY_STMT:
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
tree temp = (tree) pool_alloc (modify_expr_node_pool);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
memcpy (temp, node, tree_size (node));
GIMPLE_STMT_OPERAND (temp, 0) =
poolify_tree (GIMPLE_STMT_OPERAND (temp, 0));
GIMPLE_STMT_OPERAND (temp, 1) =
poolify_tree (GIMPLE_STMT_OPERAND (temp, 1));
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
return temp;
}
break;
case SSA_NAME:
case INTEGER_CST:
case STRING_CST:
case REAL_CST:
case PARM_DECL:
case VAR_DECL:
case RESULT_DECL:
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
return node;
default:
gcc_unreachable ();
}
}
static tree modify_expr_template;
/* Allocate a GIMPLE_MODIFY_STMT with TYPE, and operands OP1, OP2 in the
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
alloc pools and return it. */
static tree
poolify_modify_stmt (tree op1, tree op2)
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
{
if (modify_expr_template == NULL)
re PR middle-end/30391 (ICE at -O1 with conditional expressions and GIMPLE_MODIFY_STMT) PR middle-end/30391 * tree.c (expr_align): Handle MODIFY_EXPR. GIMPLE_MODIFY_STMT should be unreachable. (build2_stat): Allow construction of MODIFY_EXPR at any time. For the time being redirect GIMPLE_MODIFY_STMT to the new (renamed) build_gimple_modify_stmt_stat. (build2_gimple_stat): Rename to... (build_gimple_modify_stmt_stat): Now longer take a CODE argument. Always build a GIMPLE_MODIFY_STMT node. * tree.h (build2_gimple, build2_gimple_stat): Delete. (build_gimple_modify_stmt, build_gimple_modify_stmt_stat): New declarations. * tree-cfg.c (factor_computed_gotos, tree_merge_blocks, gimplify_val): Use build_gimple_modify_stmt instead of build2_gimple. * tree-complex.c (set_component_ssa_name, expand_complex_move, expand_complex_div_wide): Likewise. * tree-ssa-dom.c (record_equivalences_from_stmt): Likewise. * tree-ssa-loop-im.c (schedule_sm): Likewise. * tree-ssa-loop-ivopts.c (rewrite_use_nonlinear_expr): Likewise. * tree-ssa-loop-manip.c (create_iv): Likewise. * tree-ssa-phiopt.c (conditional_replacement, minmax_replacement, abs_replacement): Likewise. * tree-ssa-pre.c (create_expression_by_pieces, poolify_modify_stmt, realify_fake_stores): Likewise. * builtins.c (std_expand_builtin_va_start): Build a MODIFY_EXPR node rather than a GIMPLE_MODIFY_STMT node. (std_gimpify_va_arg_expr, expand_builtin_va_copy, fold_builtin_memset, fold_builtin_memory_op, do_mpfr_sincos): Likewise. (integer_valued_real_p): Handle MODIFY_EXPR, not GIMPLE_MODIFY_STMT. * expr.c (expand_expr_real_1): Handle both MODIFY_EXPR and GIMPLE_MODIFY_STMT. * gfortran.dg/pr30391-1.f90: New test case. From-SVN: r122030
2007-02-16 04:38:22 +01:00
modify_expr_template = build_gimple_modify_stmt (op1, op2);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
GIMPLE_STMT_OPERAND (modify_expr_template, 0) = op1;
GIMPLE_STMT_OPERAND (modify_expr_template, 1) = op2;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
return poolify_tree (modify_expr_template);
}
/* For each real store operation of the form
*a = <value> that we see, create a corresponding fake store of the
form storetmp_<version> = *a.
This enables AVAIL computation to mark the results of stores as
available. Without this, you'd need to do some computation to
mark the result of stores as ANTIC and AVAIL at all the right
points.
To save memory, we keep the store
statements pool allocated until we decide whether they are
necessary or not. */
static void
insert_fake_stores (void)
{
basic_block block;
FOR_ALL_BB (block)
{
block_stmt_iterator bsi;
for (bsi = bsi_start (block); !bsi_end_p (bsi); bsi_next (&bsi))
{
tree stmt = bsi_stmt (bsi);
/* We can't generate SSA names for stores that are complex
or aggregate. We also want to ignore things whose
virtual uses occur in abnormal phis. */
if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
&& TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 0)) == INDIRECT_REF
&& !AGGREGATE_TYPE_P (TREE_TYPE (GIMPLE_STMT_OPERAND (stmt, 0)))
&& TREE_CODE (TREE_TYPE (GIMPLE_STMT_OPERAND
(stmt, 0))) != COMPLEX_TYPE)
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
{
ssa_op_iter iter;
def_operand_p defp;
tree lhs = GIMPLE_STMT_OPERAND (stmt, 0);
tree rhs = GIMPLE_STMT_OPERAND (stmt, 1);
tree-ssa-alias-warnings.c (maybe_add_match): Cast according to the coding conventions. * tree-ssa-alias-warnings.c (maybe_add_match): Cast according to the coding conventions. (add_key): Likewise. * tree-ssa.c (init_tree_ssa): Use type safe memory macros. * tree-ssa-ccp.c (ccp_fold_builtin): Avoid using C++ keywords as variable names. * tree-ssa-coalesce.c (find_coalesce_pair): Use type safe memory macros. (add_cost_one_coalesce): Likewise. * tree-ssa-copy.c (merge_alias_info): Avoid using C++ keywords as variable names. Rename orig to orig_name for consistency. * tree-ssa-dom.c (dom_thread_across_edge): Cast according to the coding conventions. (cprop_into_successor_phis): Avoid using C++ keywords as variable names. (record_equivalences_from_stmt): Likewise. * tree-ssa-dse.c (dse_initialize_block_local_data): Cast according to the coding conventions. (memory_ssa_name_same): Likewise. (dse_optimize_stmt): Likewise. (dse_record_phis): Likewise. (dse_finalize_block): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Avoid using C++ keywords as variable names. (may_move_till): Cast according to the coding conventions. (force_move_till_expr): Avoid using C++ keywords as variable names. (force_move_till): Cast according to the coding conventions. (memref_hash): Likewise. (memref_eq): Likewise. (gather_mem_refs_stmt): Likewise. * tree-ssa-loop-ivopts.c (contains_abnormal_ssa_name_p): Avoid using C++ keywords as variable names. (idx_find_step): Cast according to the coding conventions. (idx_record_use): Likewise. (find_depends): Likewise. (prepare_decl_rtl): Likewise. (mbc_entry_hash): Likewise. (mbc_entry_eq): Likewise. * tree-ssa-loop-niter.c (SWAP): Use the correct the type for tmp. (simplify_replace_tree): Avoid using C++ keywords as variable names. (idx_infer_loop_bounds): Cast according to the coding conventions. * tree-ssa-loop-prefetch.c (idx_analyze_ref): Likewise. * tree-ssa-math-opts.c (occ_new ): Likwise. * tree-ssanames.c (duplicate_ssa_name_ptr_info): Use type safe memory macros. * tree-ssa-operands.c (add_def_op): Avoid using C++ keywords as variable names. (add_use_op): Likewise. (add_vop): Likewise. (add_vuse_op): Likewise. (add_vdef_op): Likewise. (get_expr_operands): Likewise. (push_stmt_changes): Use type safe memory macros. * tree-ssa-phiopt.c (replace_phi_edge_with_variable): Avoid using C++ keywords as variable names. (conditional_replacement): Likewise. (minmax_replacement): Likewise. (abs_replacement): Likewise. * tree-ssa-pre.c (create_expression_by_pieces): Cast according to the coding conventions. (insert_fake_stores): Avoid using C++ keywords as variable names. * tree-ssa-reassoc.c (add_to_ops_vec): Cast according to the coding conventions. * tree-ssa-structalias.c (heapvar_lookup): Likewise. (heapvar_insert): Use type safe memory macros. (new_var_info): Cast according to the coding conventions. (new_constraint): Likewise. (remove_preds_and_fake_succs): Use type safe memory macros. * tree-ssa-threadupdate.c (thread_block): Cast according to the coding conventions. (thread_single_edge): Likewise. From-SVN: r125504
2007-06-06 22:18:47 +02:00
tree new_tree;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
bool notokay = false;
FOR_EACH_SSA_DEF_OPERAND (defp, stmt, iter, SSA_OP_VIRTUAL_DEFS)
{
tree defvar = DEF_FROM_PTR (defp);
if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (defvar))
{
notokay = true;
break;
}
}
if (notokay)
continue;
if (!storetemp || TREE_TYPE (rhs) != TREE_TYPE (storetemp))
{
storetemp = create_tmp_var (TREE_TYPE (rhs), "storetmp");
re PR middle-end/28436 (accessing an element via a "pointer" on a vector does not cause vec_extract to be used) 2006-12-12 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/28436 * tree.h (DECL_COMPLEX_GIMPLE_REG_P): Rename to ... (DECL_GIMPLE_REG_P): This. * fold-const.c (fold_indirect_ref_1): Fold *(foo *)&vectorfoo into using BIT_FIELD_REF. * omp-low.c (omp_copy_decl_2): Use the renamed DECL_GIMPLE_REG_P. * tree-gimple.c (is_gimple_reg): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. * expr.c (get_inner_reference): Set the mode for BIT_FIELD_REF with vector types. * tree-flow-inline.h (var_can_have_subvars): Use the renamed DECL_GIMPLE_REG_P. * gimplify.c (internal_get_tmp_var): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. (gimplify_bind_expr): Likewise. (gimplify_function_tree): Likewise. * expmed.c: Include target.h. (extract_bit_field): For vector mode, try find a better mode first. If that fails use gen_lowpart (for vectors only). * tree-dfa.c (make_rename_temp): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. * tree-ssa-pre.c (create_expressions_by_pieces): Likewise. (insert_into_preds_of_block): Likewise. (insert_fake_stores): Create gimple register store_tmps for vector types. * tree-sra.c (sra_elt): New field, is_vector_lhs. (sra_walk_expr <case BIT_FIELD_REF>): For vector types that are the left hand side, set the element's is_vector_lhs to true. (instantiate_element): For vector types which were on the left hand size, set DECL_GIMPLE_REG_P to false. * tree-nested.c (create_tmp_var_for): Use the renamed DECL_GIMPLE_REG_P. * tree-inline.c (declare_return_variable): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. (copy_decl_to_var): Use the renamed DECL_GIMPLE_REG_P. (copy_result_decl_to_var): Likewise. * tree-vect-transform.c (vect_get_new_vect_var): For vector types, create a gimple register variable. (vect_permute_store_chain): Set DECL_GIMPLE_REG_P to true for the vect_inter_* temp variables. * Makefile.in (expmed.o): Update dependencies. 2006-12-12 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/28436 * gcc.c-torture/compile/vector-1.c: New test. * gcc.c-torture/compile/vector-2.c: New test. * gcc.c-torture/compile/vector-3.c: New test. From-SVN: r119801
2006-12-12 23:33:06 +01:00
if (TREE_CODE (TREE_TYPE (storetemp)) == VECTOR_TYPE)
DECL_GIMPLE_REG_P (storetemp) = 1;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
get_var_ann (storetemp);
}
tree-ssa-alias-warnings.c (maybe_add_match): Cast according to the coding conventions. * tree-ssa-alias-warnings.c (maybe_add_match): Cast according to the coding conventions. (add_key): Likewise. * tree-ssa.c (init_tree_ssa): Use type safe memory macros. * tree-ssa-ccp.c (ccp_fold_builtin): Avoid using C++ keywords as variable names. * tree-ssa-coalesce.c (find_coalesce_pair): Use type safe memory macros. (add_cost_one_coalesce): Likewise. * tree-ssa-copy.c (merge_alias_info): Avoid using C++ keywords as variable names. Rename orig to orig_name for consistency. * tree-ssa-dom.c (dom_thread_across_edge): Cast according to the coding conventions. (cprop_into_successor_phis): Avoid using C++ keywords as variable names. (record_equivalences_from_stmt): Likewise. * tree-ssa-dse.c (dse_initialize_block_local_data): Cast according to the coding conventions. (memory_ssa_name_same): Likewise. (dse_optimize_stmt): Likewise. (dse_record_phis): Likewise. (dse_finalize_block): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Avoid using C++ keywords as variable names. (may_move_till): Cast according to the coding conventions. (force_move_till_expr): Avoid using C++ keywords as variable names. (force_move_till): Cast according to the coding conventions. (memref_hash): Likewise. (memref_eq): Likewise. (gather_mem_refs_stmt): Likewise. * tree-ssa-loop-ivopts.c (contains_abnormal_ssa_name_p): Avoid using C++ keywords as variable names. (idx_find_step): Cast according to the coding conventions. (idx_record_use): Likewise. (find_depends): Likewise. (prepare_decl_rtl): Likewise. (mbc_entry_hash): Likewise. (mbc_entry_eq): Likewise. * tree-ssa-loop-niter.c (SWAP): Use the correct the type for tmp. (simplify_replace_tree): Avoid using C++ keywords as variable names. (idx_infer_loop_bounds): Cast according to the coding conventions. * tree-ssa-loop-prefetch.c (idx_analyze_ref): Likewise. * tree-ssa-math-opts.c (occ_new ): Likwise. * tree-ssanames.c (duplicate_ssa_name_ptr_info): Use type safe memory macros. * tree-ssa-operands.c (add_def_op): Avoid using C++ keywords as variable names. (add_use_op): Likewise. (add_vop): Likewise. (add_vuse_op): Likewise. (add_vdef_op): Likewise. (get_expr_operands): Likewise. (push_stmt_changes): Use type safe memory macros. * tree-ssa-phiopt.c (replace_phi_edge_with_variable): Avoid using C++ keywords as variable names. (conditional_replacement): Likewise. (minmax_replacement): Likewise. (abs_replacement): Likewise. * tree-ssa-pre.c (create_expression_by_pieces): Cast according to the coding conventions. (insert_fake_stores): Avoid using C++ keywords as variable names. * tree-ssa-reassoc.c (add_to_ops_vec): Cast according to the coding conventions. * tree-ssa-structalias.c (heapvar_lookup): Likewise. (heapvar_insert): Use type safe memory macros. (new_var_info): Cast according to the coding conventions. (new_constraint): Likewise. (remove_preds_and_fake_succs): Use type safe memory macros. * tree-ssa-threadupdate.c (thread_block): Cast according to the coding conventions. (thread_single_edge): Likewise. From-SVN: r125504
2007-06-06 22:18:47 +02:00
new_tree = poolify_modify_stmt (storetemp, lhs);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
tree-ssa-alias-warnings.c (maybe_add_match): Cast according to the coding conventions. * tree-ssa-alias-warnings.c (maybe_add_match): Cast according to the coding conventions. (add_key): Likewise. * tree-ssa.c (init_tree_ssa): Use type safe memory macros. * tree-ssa-ccp.c (ccp_fold_builtin): Avoid using C++ keywords as variable names. * tree-ssa-coalesce.c (find_coalesce_pair): Use type safe memory macros. (add_cost_one_coalesce): Likewise. * tree-ssa-copy.c (merge_alias_info): Avoid using C++ keywords as variable names. Rename orig to orig_name for consistency. * tree-ssa-dom.c (dom_thread_across_edge): Cast according to the coding conventions. (cprop_into_successor_phis): Avoid using C++ keywords as variable names. (record_equivalences_from_stmt): Likewise. * tree-ssa-dse.c (dse_initialize_block_local_data): Cast according to the coding conventions. (memory_ssa_name_same): Likewise. (dse_optimize_stmt): Likewise. (dse_record_phis): Likewise. (dse_finalize_block): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Avoid using C++ keywords as variable names. (may_move_till): Cast according to the coding conventions. (force_move_till_expr): Avoid using C++ keywords as variable names. (force_move_till): Cast according to the coding conventions. (memref_hash): Likewise. (memref_eq): Likewise. (gather_mem_refs_stmt): Likewise. * tree-ssa-loop-ivopts.c (contains_abnormal_ssa_name_p): Avoid using C++ keywords as variable names. (idx_find_step): Cast according to the coding conventions. (idx_record_use): Likewise. (find_depends): Likewise. (prepare_decl_rtl): Likewise. (mbc_entry_hash): Likewise. (mbc_entry_eq): Likewise. * tree-ssa-loop-niter.c (SWAP): Use the correct the type for tmp. (simplify_replace_tree): Avoid using C++ keywords as variable names. (idx_infer_loop_bounds): Cast according to the coding conventions. * tree-ssa-loop-prefetch.c (idx_analyze_ref): Likewise. * tree-ssa-math-opts.c (occ_new ): Likwise. * tree-ssanames.c (duplicate_ssa_name_ptr_info): Use type safe memory macros. * tree-ssa-operands.c (add_def_op): Avoid using C++ keywords as variable names. (add_use_op): Likewise. (add_vop): Likewise. (add_vuse_op): Likewise. (add_vdef_op): Likewise. (get_expr_operands): Likewise. (push_stmt_changes): Use type safe memory macros. * tree-ssa-phiopt.c (replace_phi_edge_with_variable): Avoid using C++ keywords as variable names. (conditional_replacement): Likewise. (minmax_replacement): Likewise. (abs_replacement): Likewise. * tree-ssa-pre.c (create_expression_by_pieces): Cast according to the coding conventions. (insert_fake_stores): Avoid using C++ keywords as variable names. * tree-ssa-reassoc.c (add_to_ops_vec): Cast according to the coding conventions. * tree-ssa-structalias.c (heapvar_lookup): Likewise. (heapvar_insert): Use type safe memory macros. (new_var_info): Cast according to the coding conventions. (new_constraint): Likewise. (remove_preds_and_fake_succs): Use type safe memory macros. * tree-ssa-threadupdate.c (thread_block): Cast according to the coding conventions. (thread_single_edge): Likewise. From-SVN: r125504
2007-06-06 22:18:47 +02:00
lhs = make_ssa_name (storetemp, new_tree);
GIMPLE_STMT_OPERAND (new_tree, 0) = lhs;
create_ssa_artificial_load_stmt (new_tree, stmt);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
tree-ssa-alias-warnings.c (maybe_add_match): Cast according to the coding conventions. * tree-ssa-alias-warnings.c (maybe_add_match): Cast according to the coding conventions. (add_key): Likewise. * tree-ssa.c (init_tree_ssa): Use type safe memory macros. * tree-ssa-ccp.c (ccp_fold_builtin): Avoid using C++ keywords as variable names. * tree-ssa-coalesce.c (find_coalesce_pair): Use type safe memory macros. (add_cost_one_coalesce): Likewise. * tree-ssa-copy.c (merge_alias_info): Avoid using C++ keywords as variable names. Rename orig to orig_name for consistency. * tree-ssa-dom.c (dom_thread_across_edge): Cast according to the coding conventions. (cprop_into_successor_phis): Avoid using C++ keywords as variable names. (record_equivalences_from_stmt): Likewise. * tree-ssa-dse.c (dse_initialize_block_local_data): Cast according to the coding conventions. (memory_ssa_name_same): Likewise. (dse_optimize_stmt): Likewise. (dse_record_phis): Likewise. (dse_finalize_block): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Avoid using C++ keywords as variable names. (may_move_till): Cast according to the coding conventions. (force_move_till_expr): Avoid using C++ keywords as variable names. (force_move_till): Cast according to the coding conventions. (memref_hash): Likewise. (memref_eq): Likewise. (gather_mem_refs_stmt): Likewise. * tree-ssa-loop-ivopts.c (contains_abnormal_ssa_name_p): Avoid using C++ keywords as variable names. (idx_find_step): Cast according to the coding conventions. (idx_record_use): Likewise. (find_depends): Likewise. (prepare_decl_rtl): Likewise. (mbc_entry_hash): Likewise. (mbc_entry_eq): Likewise. * tree-ssa-loop-niter.c (SWAP): Use the correct the type for tmp. (simplify_replace_tree): Avoid using C++ keywords as variable names. (idx_infer_loop_bounds): Cast according to the coding conventions. * tree-ssa-loop-prefetch.c (idx_analyze_ref): Likewise. * tree-ssa-math-opts.c (occ_new ): Likwise. * tree-ssanames.c (duplicate_ssa_name_ptr_info): Use type safe memory macros. * tree-ssa-operands.c (add_def_op): Avoid using C++ keywords as variable names. (add_use_op): Likewise. (add_vop): Likewise. (add_vuse_op): Likewise. (add_vdef_op): Likewise. (get_expr_operands): Likewise. (push_stmt_changes): Use type safe memory macros. * tree-ssa-phiopt.c (replace_phi_edge_with_variable): Avoid using C++ keywords as variable names. (conditional_replacement): Likewise. (minmax_replacement): Likewise. (abs_replacement): Likewise. * tree-ssa-pre.c (create_expression_by_pieces): Cast according to the coding conventions. (insert_fake_stores): Avoid using C++ keywords as variable names. * tree-ssa-reassoc.c (add_to_ops_vec): Cast according to the coding conventions. * tree-ssa-structalias.c (heapvar_lookup): Likewise. (heapvar_insert): Use type safe memory macros. (new_var_info): Cast according to the coding conventions. (new_constraint): Likewise. (remove_preds_and_fake_succs): Use type safe memory macros. * tree-ssa-threadupdate.c (thread_block): Cast according to the coding conventions. (thread_single_edge): Likewise. From-SVN: r125504
2007-06-06 22:18:47 +02:00
NECESSARY (new_tree) = 0;
VEC_safe_push (tree, heap, inserted_exprs, new_tree);
VEC_safe_push (tree, heap, need_creation, new_tree);
bsi_insert_after (&bsi, new_tree, BSI_NEW_STMT);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
}
}
}
}
/* Turn the pool allocated fake stores that we created back into real
GC allocated ones if they turned out to be necessary to PRE some
expressions. */
static void
realify_fake_stores (void)
{
unsigned int i;
tree stmt;
for (i = 0; VEC_iterate (tree, need_creation, i, stmt); i++)
{
if (NECESSARY (stmt))
{
block_stmt_iterator bsi;
re PR middle-end/30391 (ICE at -O1 with conditional expressions and GIMPLE_MODIFY_STMT) PR middle-end/30391 * tree.c (expr_align): Handle MODIFY_EXPR. GIMPLE_MODIFY_STMT should be unreachable. (build2_stat): Allow construction of MODIFY_EXPR at any time. For the time being redirect GIMPLE_MODIFY_STMT to the new (renamed) build_gimple_modify_stmt_stat. (build2_gimple_stat): Rename to... (build_gimple_modify_stmt_stat): Now longer take a CODE argument. Always build a GIMPLE_MODIFY_STMT node. * tree.h (build2_gimple, build2_gimple_stat): Delete. (build_gimple_modify_stmt, build_gimple_modify_stmt_stat): New declarations. * tree-cfg.c (factor_computed_gotos, tree_merge_blocks, gimplify_val): Use build_gimple_modify_stmt instead of build2_gimple. * tree-complex.c (set_component_ssa_name, expand_complex_move, expand_complex_div_wide): Likewise. * tree-ssa-dom.c (record_equivalences_from_stmt): Likewise. * tree-ssa-loop-im.c (schedule_sm): Likewise. * tree-ssa-loop-ivopts.c (rewrite_use_nonlinear_expr): Likewise. * tree-ssa-loop-manip.c (create_iv): Likewise. * tree-ssa-phiopt.c (conditional_replacement, minmax_replacement, abs_replacement): Likewise. * tree-ssa-pre.c (create_expression_by_pieces, poolify_modify_stmt, realify_fake_stores): Likewise. * builtins.c (std_expand_builtin_va_start): Build a MODIFY_EXPR node rather than a GIMPLE_MODIFY_STMT node. (std_gimpify_va_arg_expr, expand_builtin_va_copy, fold_builtin_memset, fold_builtin_memory_op, do_mpfr_sincos): Likewise. (integer_valued_real_p): Handle MODIFY_EXPR, not GIMPLE_MODIFY_STMT. * expr.c (expand_expr_real_1): Handle both MODIFY_EXPR and GIMPLE_MODIFY_STMT. * gfortran.dg/pr30391-1.f90: New test case. From-SVN: r122030
2007-02-16 04:38:22 +01:00
tree newstmt, tmp;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
/* Mark the temp variable as referenced */
add_referenced_var (SSA_NAME_VAR (GIMPLE_STMT_OPERAND (stmt, 0)));
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
2006-07-04 23:23:03 +02:00
/* Put the new statement in GC memory, fix up the
SSA_NAME_DEF_STMT on it, and then put it in place of
the old statement before the store in the IR stream
as a plain ssa name copy. */
bsi = bsi_for_stmt (stmt);
bsi_prev (&bsi);
re PR middle-end/30391 (ICE at -O1 with conditional expressions and GIMPLE_MODIFY_STMT) PR middle-end/30391 * tree.c (expr_align): Handle MODIFY_EXPR. GIMPLE_MODIFY_STMT should be unreachable. (build2_stat): Allow construction of MODIFY_EXPR at any time. For the time being redirect GIMPLE_MODIFY_STMT to the new (renamed) build_gimple_modify_stmt_stat. (build2_gimple_stat): Rename to... (build_gimple_modify_stmt_stat): Now longer take a CODE argument. Always build a GIMPLE_MODIFY_STMT node. * tree.h (build2_gimple, build2_gimple_stat): Delete. (build_gimple_modify_stmt, build_gimple_modify_stmt_stat): New declarations. * tree-cfg.c (factor_computed_gotos, tree_merge_blocks, gimplify_val): Use build_gimple_modify_stmt instead of build2_gimple. * tree-complex.c (set_component_ssa_name, expand_complex_move, expand_complex_div_wide): Likewise. * tree-ssa-dom.c (record_equivalences_from_stmt): Likewise. * tree-ssa-loop-im.c (schedule_sm): Likewise. * tree-ssa-loop-ivopts.c (rewrite_use_nonlinear_expr): Likewise. * tree-ssa-loop-manip.c (create_iv): Likewise. * tree-ssa-phiopt.c (conditional_replacement, minmax_replacement, abs_replacement): Likewise. * tree-ssa-pre.c (create_expression_by_pieces, poolify_modify_stmt, realify_fake_stores): Likewise. * builtins.c (std_expand_builtin_va_start): Build a MODIFY_EXPR node rather than a GIMPLE_MODIFY_STMT node. (std_gimpify_va_arg_expr, expand_builtin_va_copy, fold_builtin_memset, fold_builtin_memory_op, do_mpfr_sincos): Likewise. (integer_valued_real_p): Handle MODIFY_EXPR, not GIMPLE_MODIFY_STMT. * expr.c (expand_expr_real_1): Handle both MODIFY_EXPR and GIMPLE_MODIFY_STMT. * gfortran.dg/pr30391-1.f90: New test case. From-SVN: r122030
2007-02-16 04:38:22 +01:00
tmp = GIMPLE_STMT_OPERAND (bsi_stmt (bsi), 1);
newstmt = build_gimple_modify_stmt (GIMPLE_STMT_OPERAND (stmt, 0),
tmp);
SSA_NAME_DEF_STMT (GIMPLE_STMT_OPERAND (newstmt, 0)) = newstmt;
bsi_insert_before (&bsi, newstmt, BSI_SAME_STMT);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
bsi = bsi_for_stmt (stmt);
bsi_remove (&bsi, true);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
}
else
release_defs (stmt);
}
}
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
/* Given an SSA_NAME, see if SCCVN has a value number for it, and if
so, return the value handle for this value number, creating it if
necessary.
Return NULL if SCCVN has no info for us. */
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
static tree
get_sccvn_value (tree name)
{
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
if (TREE_CODE (name) == SSA_NAME
&& VN_INFO (name)->valnum != name
&& VN_INFO (name)->valnum != VN_TOP)
{
tree val = VN_INFO (name)->valnum;
bool is_invariant = is_gimple_min_invariant (val);
tree valvh = !is_invariant ? get_value_handle (val) : NULL_TREE;
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
/* We may end up with situations where SCCVN has chosen a
representative for the equivalence set that we have not
visited yet. In this case, just create the value handle for
it. */
if (!valvh && !is_invariant)
{
tree defstmt = SSA_NAME_DEF_STMT (val);
gcc_assert (VN_INFO (val)->valnum == val);
/* PHI nodes can't have vuses and attempts to iterate over
their VUSE operands will crash. */
if (TREE_CODE (defstmt) == PHI_NODE || IS_EMPTY_STMT (defstmt))
defstmt = NULL;
{
tree defstmt2 = SSA_NAME_DEF_STMT (name);
if (TREE_CODE (defstmt2) != PHI_NODE &&
!ZERO_SSA_OPERANDS (defstmt2, SSA_OP_ALL_VIRTUALS))
gcc_assert (defstmt);
}
valvh = vn_lookup_or_add_with_stmt (val, defstmt);
}
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "SCCVN says ");
print_generic_expr (dump_file, name, 0);
fprintf (dump_file, " value numbers to ");
if (valvh && !is_invariant)
{
print_generic_expr (dump_file, val, 0);
fprintf (dump_file, " (");
print_generic_expr (dump_file, valvh, 0);
fprintf (dump_file, ")\n");
}
else
print_generic_stmt (dump_file, val, 0);
}
if (valvh)
return valvh;
else
return val;
}
return NULL_TREE;
}
/* Create value handles for PHI in BLOCK. */
static void
make_values_for_phi (tree phi, basic_block block)
{
tree result = PHI_RESULT (phi);
/* We have no need for virtual phis, as they don't represent
actual computations. */
if (is_gimple_reg (result))
{
tree sccvnval = get_sccvn_value (result);
if (sccvnval)
{
vn_add (result, sccvnval);
bitmap_insert_into_set (PHI_GEN (block), result);
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
bitmap_value_insert_into_set (AVAIL_OUT (block), result);
}
else
add_to_sets (result, result, NULL,
PHI_GEN (block), AVAIL_OUT (block));
}
}
/* Return true if both the statement and the value handles have no
vuses, or both the statement and the value handle do have vuses.
Unlike SCCVN, PRE needs not only to know equivalence, but what the
actual vuses are so it can translate them through blocks. Thus,
we have to make a new value handle if the existing one has no
vuses but needs them. */
static bool
vuse_equiv (tree vh1, tree stmt)
{
bool stmt_has_vuses = !ZERO_SSA_OPERANDS (stmt, SSA_OP_VIRTUAL_USES);
return (VALUE_HANDLE_VUSES (vh1) && stmt_has_vuses)
|| (!VALUE_HANDLE_VUSES (vh1) && !stmt_has_vuses);
}
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
/* Create value handles for STMT in BLOCK. Return true if we handled
the statement. */
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
static bool
make_values_for_stmt (tree stmt, basic_block block)
{
tree lhs = GIMPLE_STMT_OPERAND (stmt, 0);
tree rhs = GIMPLE_STMT_OPERAND (stmt, 1);
tree valvh = NULL_TREE;
tree lhsval;
valvh = get_sccvn_value (lhs);
if (valvh)
{
vn_add (lhs, valvh);
bitmap_value_insert_into_set (AVAIL_OUT (block), lhs);
/* Shortcut for FRE. We have no need to create value expressions,
just want to know what values are available where. */
if (in_fre)
return true;
}
else if (in_fre)
{
/* For FRE, if SCCVN didn't find anything, we aren't going to
either, so just make up a new value number if necessary and
call it a day */
if (get_value_handle (lhs) == NULL)
vn_lookup_or_add (lhs);
bitmap_value_insert_into_set (AVAIL_OUT (block), lhs);
return true;
}
lhsval = valvh ? valvh : get_value_handle (lhs);
STRIP_USELESS_TYPE_CONVERSION (rhs);
if (can_value_number_operation (rhs)
&& (!lhsval || !is_gimple_min_invariant (lhsval)))
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
{
/* For value numberable operation, create a
duplicate expression with the operands replaced
with the value handles of the original RHS. */
tree newt = create_value_expr_from (rhs, block, stmt);
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
if (newt)
{
/* If we already have a value number for the LHS, reuse
it rather than creating a new one. */
if (lhsval && vuse_equiv (lhsval, stmt))
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
{
set_value_handle (newt, lhsval);
if (!is_gimple_min_invariant (lhsval))
add_to_value (lhsval, newt);
}
else
{
tree val = vn_lookup_or_add_with_stmt (newt, stmt);
vn_add (lhs, val);
}
add_to_exp_gen (block, newt);
}
bitmap_insert_into_set (TMP_GEN (block), lhs);
bitmap_value_insert_into_set (AVAIL_OUT (block), lhs);
return true;
}
else if ((TREE_CODE (rhs) == SSA_NAME
&& !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rhs))
|| is_gimple_min_invariant (rhs)
|| TREE_CODE (rhs) == ADDR_EXPR
|| TREE_INVARIANT (rhs)
|| DECL_P (rhs))
{
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
if (lhsval)
{
set_value_handle (rhs, lhsval);
if (!is_gimple_min_invariant (lhsval))
add_to_value (lhsval, rhs);
bitmap_insert_into_set (TMP_GEN (block), lhs);
bitmap_value_insert_into_set (AVAIL_OUT (block), lhs);
}
else
{
/* Compute a value number for the RHS of the statement
and add its value to the AVAIL_OUT set for the block.
Add the LHS to TMP_GEN. */
add_to_sets (lhs, rhs, stmt, TMP_GEN (block),
AVAIL_OUT (block));
}
/* None of the rest of these can be PRE'd. */
if (TREE_CODE (rhs) == SSA_NAME && !is_undefined_value (rhs))
add_to_exp_gen (block, rhs);
return true;
}
return false;
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
}
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
/* Compute the AVAIL set for all basic blocks.
This function performs value numbering of the statements in each basic
block. The AVAIL sets are built from information we glean while doing
this value numbering, since the AVAIL sets contain only one entry per
value.
2006-07-04 23:23:03 +02:00
AVAIL_IN[BLOCK] = AVAIL_OUT[dom(BLOCK)].
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
AVAIL_OUT[BLOCK] = AVAIL_IN[BLOCK] U PHI_GEN[BLOCK] U TMP_GEN[BLOCK]. */
static void
compute_avail (void)
{
basic_block block, son;
basic_block *worklist;
size_t sp = 0;
tree param;
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
/* For arguments with default definitions, we pretend they are
defined in the entry block. */
for (param = DECL_ARGUMENTS (current_function_decl);
param;
param = TREE_CHAIN (param))
{
Privatize SSA variables into gimple_df. * tree-flow-inline.h (gimple_in_ssa_p, gimple_aliases_computed_p, gimple_addressable_vars, gimple_call_clobbered_vars, gimple_referenced_vars, gimple_global_var, gimple_nonlocal_all): New accessors. (first_referenced_var): Update. (mark_stmt_modified): Update. (is_call_clobbered): Update. (mark_call_clobbered): Update. (clear_call_clobbered): Update. (mark_non_addressable): Update. * tree-vrp.c (get_value_range): Update. * tree-into-ssa.c (in_ssa_p): Kill. (get_default_def_for): Update. (rewrite_into_ssa): Update. * tree-complex.c (init_parameter_lattice_values): Update. (update_complex_assignment): Update. (update_parameter_components): Update. (expand_complex_libcall): Update. (expand_complex_operations_1): Update. * tree-tailcall.c (arg_needs_copy_p): Update. (add_virtual_phis): Update. (tree_optimize_tail_calls_1): Update. * tree-ssa-dse.c (memory_ssa_name_same): Update. * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Update. * tree-ssa-math-opts.c (execute_cse_reciprocals): Update. * tree-ssa-propagate.c (set_rhs): Update. * tree-ssa-alias.c (aliases_computed_p, call_clobbered_vars, addressable_vars, global_var):Kill. (set_initial_properties): Update. (init_alias_info): Update. (finalize_ref_all_pointers): Update. (setup_pointers_and_addressables): Update. (maybe_create_global_var): Update. (create_global_var): Update. (dump_points_to_info): Update. * function.h (struct gimple_df): Forward declare. (struct function): Add GIMPLE_DF field. * gimplify.c (force_gimple_operand): Update. * tree-dfa.c (referenced_vars, default_defs): KIll. (make_rename_temp): Update. (dump_variable): Update. (referenced_var_lookup): Update. (referenced_var_check_and_insert): Update. (default_def): Rename to ... (gimple_default_def): ... this one; accept cfun argument. (set_default_def): Update. * tree-cfgcleanup.c (modified_noreturn_calls): Kill. (cleanup_control_flow): Update. * tree-ssa-pre.c (compute_avail): Update * tree-ssa-live.c (calculate_live_on_entry): Update. * tree-ssa.c (verify_use): Update. (verify_call_clobbering): Update. (verify_call_clobbering): Update. (init_tree_ssa): Update. (delete_tree_ssa): Update. * tree-outof-ssa.c (coalesce_ssa_name): Update. (rewrite_out_of_ssa): Update. * tree-flow.h (gimple_df): New structure collecting dataflow variables. (FREE_SSANAMES, SSANAMES, MODIFIED_NORETURN_CALLS, DEFAULT_DEFS): New private accessors. (in_ssa_p, modified_noreturn_calls, referenced_vars, default_defs, ssa_names, global_var, nonlocal_all, call_clobbered_vars, addressable_vars, aliases_computed_p): Kill. (default_def): Rename to... (gimple_default_def): ... this one. (defaule_def_fn): Kill. (num_referenced_vars, ssa_names, num_ssa_names): Update. * tree-ssa-structalias.c (nonlocal_all): Kill. (get_constraint_exp_from_ssa_var): Update. (create_nonlocal_var): Update. (get_constraint_for): Update. (update_alias_info): Update. (find_global_initializers): Update. (intra_create_variable_infos): Update. (intra_create_variable_infos): (find_what_p_points_to): Update. (init_alias_heapvars): Update. * tree-cfg.c (remove_bb): Update. (gimplify_val): Update. * tree-ssa-reassoc.c (get_rank): Update. (init_reassoc): Update. * tree-ssanames.c: Do not include gt-tree-ssanames.h (ssa_names, free_ssanames): Kill. (init_ssanames): Update. (make_ssa_name): Update. (release_ssa_name): Update. (release_defs): Update. (replace_ssa_name_symbol): Update. * tree-ssa-operands.c (access_can_touch_variable): Update. (add_virtual_operand): Update. (add_call_clobber_ops): Update. (add_call_read_ops): Update. (get_call_expr_operands): Update. (get_asm_expr_operands): Update. From-SVN: r119294
2006-11-28 15:42:37 +01:00
if (gimple_default_def (cfun, param) != NULL)
{
Privatize SSA variables into gimple_df. * tree-flow-inline.h (gimple_in_ssa_p, gimple_aliases_computed_p, gimple_addressable_vars, gimple_call_clobbered_vars, gimple_referenced_vars, gimple_global_var, gimple_nonlocal_all): New accessors. (first_referenced_var): Update. (mark_stmt_modified): Update. (is_call_clobbered): Update. (mark_call_clobbered): Update. (clear_call_clobbered): Update. (mark_non_addressable): Update. * tree-vrp.c (get_value_range): Update. * tree-into-ssa.c (in_ssa_p): Kill. (get_default_def_for): Update. (rewrite_into_ssa): Update. * tree-complex.c (init_parameter_lattice_values): Update. (update_complex_assignment): Update. (update_parameter_components): Update. (expand_complex_libcall): Update. (expand_complex_operations_1): Update. * tree-tailcall.c (arg_needs_copy_p): Update. (add_virtual_phis): Update. (tree_optimize_tail_calls_1): Update. * tree-ssa-dse.c (memory_ssa_name_same): Update. * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Update. * tree-ssa-math-opts.c (execute_cse_reciprocals): Update. * tree-ssa-propagate.c (set_rhs): Update. * tree-ssa-alias.c (aliases_computed_p, call_clobbered_vars, addressable_vars, global_var):Kill. (set_initial_properties): Update. (init_alias_info): Update. (finalize_ref_all_pointers): Update. (setup_pointers_and_addressables): Update. (maybe_create_global_var): Update. (create_global_var): Update. (dump_points_to_info): Update. * function.h (struct gimple_df): Forward declare. (struct function): Add GIMPLE_DF field. * gimplify.c (force_gimple_operand): Update. * tree-dfa.c (referenced_vars, default_defs): KIll. (make_rename_temp): Update. (dump_variable): Update. (referenced_var_lookup): Update. (referenced_var_check_and_insert): Update. (default_def): Rename to ... (gimple_default_def): ... this one; accept cfun argument. (set_default_def): Update. * tree-cfgcleanup.c (modified_noreturn_calls): Kill. (cleanup_control_flow): Update. * tree-ssa-pre.c (compute_avail): Update * tree-ssa-live.c (calculate_live_on_entry): Update. * tree-ssa.c (verify_use): Update. (verify_call_clobbering): Update. (verify_call_clobbering): Update. (init_tree_ssa): Update. (delete_tree_ssa): Update. * tree-outof-ssa.c (coalesce_ssa_name): Update. (rewrite_out_of_ssa): Update. * tree-flow.h (gimple_df): New structure collecting dataflow variables. (FREE_SSANAMES, SSANAMES, MODIFIED_NORETURN_CALLS, DEFAULT_DEFS): New private accessors. (in_ssa_p, modified_noreturn_calls, referenced_vars, default_defs, ssa_names, global_var, nonlocal_all, call_clobbered_vars, addressable_vars, aliases_computed_p): Kill. (default_def): Rename to... (gimple_default_def): ... this one. (defaule_def_fn): Kill. (num_referenced_vars, ssa_names, num_ssa_names): Update. * tree-ssa-structalias.c (nonlocal_all): Kill. (get_constraint_exp_from_ssa_var): Update. (create_nonlocal_var): Update. (get_constraint_for): Update. (update_alias_info): Update. (find_global_initializers): Update. (intra_create_variable_infos): Update. (intra_create_variable_infos): (find_what_p_points_to): Update. (init_alias_heapvars): Update. * tree-cfg.c (remove_bb): Update. (gimplify_val): Update. * tree-ssa-reassoc.c (get_rank): Update. (init_reassoc): Update. * tree-ssanames.c: Do not include gt-tree-ssanames.h (ssa_names, free_ssanames): Kill. (init_ssanames): Update. (make_ssa_name): Update. (release_ssa_name): Update. (release_defs): Update. (replace_ssa_name_symbol): Update. * tree-ssa-operands.c (access_can_touch_variable): Update. (add_virtual_operand): Update. (add_call_clobber_ops): Update. (add_call_read_ops): Update. (get_call_expr_operands): Update. (get_asm_expr_operands): Update. From-SVN: r119294
2006-11-28 15:42:37 +01:00
tree def = gimple_default_def (cfun, param);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
vn_lookup_or_add (def);
if (!in_fre)
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
{
bitmap_insert_into_set (TMP_GEN (ENTRY_BLOCK_PTR), def);
bitmap_value_insert_into_set (maximal_set, def);
}
bitmap_value_insert_into_set (AVAIL_OUT (ENTRY_BLOCK_PTR), def);
}
}
/* Likewise for the static chain decl. */
if (cfun->static_chain_decl)
{
param = cfun->static_chain_decl;
Privatize SSA variables into gimple_df. * tree-flow-inline.h (gimple_in_ssa_p, gimple_aliases_computed_p, gimple_addressable_vars, gimple_call_clobbered_vars, gimple_referenced_vars, gimple_global_var, gimple_nonlocal_all): New accessors. (first_referenced_var): Update. (mark_stmt_modified): Update. (is_call_clobbered): Update. (mark_call_clobbered): Update. (clear_call_clobbered): Update. (mark_non_addressable): Update. * tree-vrp.c (get_value_range): Update. * tree-into-ssa.c (in_ssa_p): Kill. (get_default_def_for): Update. (rewrite_into_ssa): Update. * tree-complex.c (init_parameter_lattice_values): Update. (update_complex_assignment): Update. (update_parameter_components): Update. (expand_complex_libcall): Update. (expand_complex_operations_1): Update. * tree-tailcall.c (arg_needs_copy_p): Update. (add_virtual_phis): Update. (tree_optimize_tail_calls_1): Update. * tree-ssa-dse.c (memory_ssa_name_same): Update. * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Update. * tree-ssa-math-opts.c (execute_cse_reciprocals): Update. * tree-ssa-propagate.c (set_rhs): Update. * tree-ssa-alias.c (aliases_computed_p, call_clobbered_vars, addressable_vars, global_var):Kill. (set_initial_properties): Update. (init_alias_info): Update. (finalize_ref_all_pointers): Update. (setup_pointers_and_addressables): Update. (maybe_create_global_var): Update. (create_global_var): Update. (dump_points_to_info): Update. * function.h (struct gimple_df): Forward declare. (struct function): Add GIMPLE_DF field. * gimplify.c (force_gimple_operand): Update. * tree-dfa.c (referenced_vars, default_defs): KIll. (make_rename_temp): Update. (dump_variable): Update. (referenced_var_lookup): Update. (referenced_var_check_and_insert): Update. (default_def): Rename to ... (gimple_default_def): ... this one; accept cfun argument. (set_default_def): Update. * tree-cfgcleanup.c (modified_noreturn_calls): Kill. (cleanup_control_flow): Update. * tree-ssa-pre.c (compute_avail): Update * tree-ssa-live.c (calculate_live_on_entry): Update. * tree-ssa.c (verify_use): Update. (verify_call_clobbering): Update. (verify_call_clobbering): Update. (init_tree_ssa): Update. (delete_tree_ssa): Update. * tree-outof-ssa.c (coalesce_ssa_name): Update. (rewrite_out_of_ssa): Update. * tree-flow.h (gimple_df): New structure collecting dataflow variables. (FREE_SSANAMES, SSANAMES, MODIFIED_NORETURN_CALLS, DEFAULT_DEFS): New private accessors. (in_ssa_p, modified_noreturn_calls, referenced_vars, default_defs, ssa_names, global_var, nonlocal_all, call_clobbered_vars, addressable_vars, aliases_computed_p): Kill. (default_def): Rename to... (gimple_default_def): ... this one. (defaule_def_fn): Kill. (num_referenced_vars, ssa_names, num_ssa_names): Update. * tree-ssa-structalias.c (nonlocal_all): Kill. (get_constraint_exp_from_ssa_var): Update. (create_nonlocal_var): Update. (get_constraint_for): Update. (update_alias_info): Update. (find_global_initializers): Update. (intra_create_variable_infos): Update. (intra_create_variable_infos): (find_what_p_points_to): Update. (init_alias_heapvars): Update. * tree-cfg.c (remove_bb): Update. (gimplify_val): Update. * tree-ssa-reassoc.c (get_rank): Update. (init_reassoc): Update. * tree-ssanames.c: Do not include gt-tree-ssanames.h (ssa_names, free_ssanames): Kill. (init_ssanames): Update. (make_ssa_name): Update. (release_ssa_name): Update. (release_defs): Update. (replace_ssa_name_symbol): Update. * tree-ssa-operands.c (access_can_touch_variable): Update. (add_virtual_operand): Update. (add_call_clobber_ops): Update. (add_call_read_ops): Update. (get_call_expr_operands): Update. (get_asm_expr_operands): Update. From-SVN: r119294
2006-11-28 15:42:37 +01:00
if (gimple_default_def (cfun, param) != NULL)
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
{
Privatize SSA variables into gimple_df. * tree-flow-inline.h (gimple_in_ssa_p, gimple_aliases_computed_p, gimple_addressable_vars, gimple_call_clobbered_vars, gimple_referenced_vars, gimple_global_var, gimple_nonlocal_all): New accessors. (first_referenced_var): Update. (mark_stmt_modified): Update. (is_call_clobbered): Update. (mark_call_clobbered): Update. (clear_call_clobbered): Update. (mark_non_addressable): Update. * tree-vrp.c (get_value_range): Update. * tree-into-ssa.c (in_ssa_p): Kill. (get_default_def_for): Update. (rewrite_into_ssa): Update. * tree-complex.c (init_parameter_lattice_values): Update. (update_complex_assignment): Update. (update_parameter_components): Update. (expand_complex_libcall): Update. (expand_complex_operations_1): Update. * tree-tailcall.c (arg_needs_copy_p): Update. (add_virtual_phis): Update. (tree_optimize_tail_calls_1): Update. * tree-ssa-dse.c (memory_ssa_name_same): Update. * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Update. * tree-ssa-math-opts.c (execute_cse_reciprocals): Update. * tree-ssa-propagate.c (set_rhs): Update. * tree-ssa-alias.c (aliases_computed_p, call_clobbered_vars, addressable_vars, global_var):Kill. (set_initial_properties): Update. (init_alias_info): Update. (finalize_ref_all_pointers): Update. (setup_pointers_and_addressables): Update. (maybe_create_global_var): Update. (create_global_var): Update. (dump_points_to_info): Update. * function.h (struct gimple_df): Forward declare. (struct function): Add GIMPLE_DF field. * gimplify.c (force_gimple_operand): Update. * tree-dfa.c (referenced_vars, default_defs): KIll. (make_rename_temp): Update. (dump_variable): Update. (referenced_var_lookup): Update. (referenced_var_check_and_insert): Update. (default_def): Rename to ... (gimple_default_def): ... this one; accept cfun argument. (set_default_def): Update. * tree-cfgcleanup.c (modified_noreturn_calls): Kill. (cleanup_control_flow): Update. * tree-ssa-pre.c (compute_avail): Update * tree-ssa-live.c (calculate_live_on_entry): Update. * tree-ssa.c (verify_use): Update. (verify_call_clobbering): Update. (verify_call_clobbering): Update. (init_tree_ssa): Update. (delete_tree_ssa): Update. * tree-outof-ssa.c (coalesce_ssa_name): Update. (rewrite_out_of_ssa): Update. * tree-flow.h (gimple_df): New structure collecting dataflow variables. (FREE_SSANAMES, SSANAMES, MODIFIED_NORETURN_CALLS, DEFAULT_DEFS): New private accessors. (in_ssa_p, modified_noreturn_calls, referenced_vars, default_defs, ssa_names, global_var, nonlocal_all, call_clobbered_vars, addressable_vars, aliases_computed_p): Kill. (default_def): Rename to... (gimple_default_def): ... this one. (defaule_def_fn): Kill. (num_referenced_vars, ssa_names, num_ssa_names): Update. * tree-ssa-structalias.c (nonlocal_all): Kill. (get_constraint_exp_from_ssa_var): Update. (create_nonlocal_var): Update. (get_constraint_for): Update. (update_alias_info): Update. (find_global_initializers): Update. (intra_create_variable_infos): Update. (intra_create_variable_infos): (find_what_p_points_to): Update. (init_alias_heapvars): Update. * tree-cfg.c (remove_bb): Update. (gimplify_val): Update. * tree-ssa-reassoc.c (get_rank): Update. (init_reassoc): Update. * tree-ssanames.c: Do not include gt-tree-ssanames.h (ssa_names, free_ssanames): Kill. (init_ssanames): Update. (make_ssa_name): Update. (release_ssa_name): Update. (release_defs): Update. (replace_ssa_name_symbol): Update. * tree-ssa-operands.c (access_can_touch_variable): Update. (add_virtual_operand): Update. (add_call_clobber_ops): Update. (add_call_read_ops): Update. (get_call_expr_operands): Update. (get_asm_expr_operands): Update. From-SVN: r119294
2006-11-28 15:42:37 +01:00
tree def = gimple_default_def (cfun, param);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
vn_lookup_or_add (def);
if (!in_fre)
{
bitmap_insert_into_set (TMP_GEN (ENTRY_BLOCK_PTR), def);
bitmap_value_insert_into_set (maximal_set, def);
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bitmap_value_insert_into_set (AVAIL_OUT (ENTRY_BLOCK_PTR), def);
}
}
/* Allocate the worklist. */
tree-tailcall.c (find_tail_calls): Use XNEW. * tree-tailcall.c (find_tail_calls): Use XNEW. * tree-ssa-dom.c (allocate_edge_info): Use XCNEW. (free_all_edge_infos): Use explicit cast to convert from void * *. (vrp_free): Likewise. (dom_opt_finalize_block): Likewise. (record_equivalences_from_incoming_edge): Likewise. (thread_across_edge): Likewise. Use XCNEWVEC. (record_cond): Use XCNEW. (record_conditions): Use XNEWVEC. (record_edge_info): Use XCNEWVEC. (lookup_avail_expr): Use XNEW. (record_range): Likewise. Use GGC_NEW. * tree-nested.c (var_map_hash): Use explicit cast to convert * from void *. (var_map_eq): Likewise. (lookup_field_for_decl): Likewise. (convert_nonlocal_reference): Likewise. (convert_local_reference): Likewise. (convert_nl_goto_reference): Likewise. (convert_nl_goto_receiver): Likewise. (convert_call_expr): Likewise. (convert_tramp_reference): Likewise. (lookup_tramp_for_decl): Likewise.Use GGC_NEW. (convert_nl_goto_reference): Likewise. (lookup_field_for_decl): Use GGC_NEW. (create_nesting_tree): Use GGC_CNEW. * tree-ssa-phiopt.c (blocks_in_phiopt_order): Use XNEWVEC. * tree-ssa-alias.c (init_alias_info): Use XCNEW. (create_alias_map_for): Likewise. (setup_pointers_and_addressables): Use XCNEWVEC. (get_ptr_info): Use GGC_NEW. (used_part_map_eq): Use explicit cast to convert from void *. (up_lookup): Likewise. (up_insert): Use XNEW. (get_or_create_used_part_for): Use XCNEW. (get_tmt_for): Likewise. * tree-ssa-operands.c (ssa_operand_alloc): Use GGC_NEW. * tree-ssa-pre.c (phi_trans_add): Use XNEW. (bitmap_set_new): Use explicit cast to convert from void *. (set_new): Likewise. (insert_into_set): Likewise. (pool_copy_list): Likewise. (phi_translate): Likewise. (create_value_expr_from): Likewise. (insert_aux): Use XCNEWVEC. (compute_avail): Use XNEWVEC. * tree-ssa-live.c (calculate_live_on_entry): Likewise. (sort_coalesce_list): Likewise. (build_tree_conflict_graph): Use XCNEWVEC. * tree-ssa-dce.c (tree_dce_init): Use XNEWVEC. * tree-ssa-copy.c (init_copy_prop): Likewise. (fini_copy_prop): Likewise. * tree-ssa-uncprop.c (associate_equivalences_with_edges): Use * XNEW and XCNEWVEC. (record_equiv): Use XNEW. (uncprop_into_successor_phis): Use explicit cast to convert * from void *. (uncprop_initialize_block): Likewise. From-SVN: r108747
2005-12-18 10:26:53 +01:00
worklist = XNEWVEC (basic_block, n_basic_blocks);
/* Seed the algorithm by putting the dominator children of the entry
block on the worklist. */
for (son = first_dom_son (CDI_DOMINATORS, ENTRY_BLOCK_PTR);
son;
son = next_dom_son (CDI_DOMINATORS, son))
worklist[sp++] = son;
/* Loop until the worklist is empty. */
while (sp)
{
block_stmt_iterator bsi;
tree stmt, phi;
basic_block dom;
unsigned int stmt_uid = 1;
/* Pick a block from the worklist. */
block = worklist[--sp];
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
/* Initially, the set of available values in BLOCK is that of
its immediate dominator. */
dom = get_immediate_dominator (CDI_DOMINATORS, block);
if (dom)
bitmap_set_copy (AVAIL_OUT (block), AVAIL_OUT (dom));
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
/* Generate values for PHI nodes. */
for (phi = phi_nodes (block); phi; phi = PHI_CHAIN (phi))
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
make_values_for_phi (phi, block);
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
/* Now compute value numbers and populate value sets with all
the expressions computed in BLOCK. */
for (bsi = bsi_start (block); !bsi_end_p (bsi); bsi_next (&bsi))
{
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
stmt_ann_t ann;
lambda-code.c (gcc_loop_to_lambda_loop, [...]): Use generic operand interface. 2005-05-03 Andrew MacLeod <amacleod@redhat.com> * lambda-code.c (gcc_loop_to_lambda_loop, lambda_loopnest_to_gcc_loopnest, phi_loop_edge_uses_def, stmt_is_bumper_for_loop, perfect_nest_p, replace_uses_of_x_with_y): Use generic operand interface. * tree-data-ref.c (find_data_references_in_loop): Use generic interface. * tree-dfa.c (collect_dfa_stats_r, mark_new_vars_to_rename): Use generic operand interface. * tree-flow-inline.h (delink_imm_use, link_imm_use_to_list, link_imm_use, link_imm_use_stmt, relink_imm_use, relink_imm_use_stmt, next_safe_imm_use, has_zero_uses, has_single_use, single_imm_use, num_imm_uses): Use ssa_use_operand_t. (get_def_ops, get_use_ops, get_v_may_def_ops, get_vuse_ops, get_v_must_def_ops): Delete. (get_def_from_ptr, get_phi_result_ptr): Get def directly now. (get_use_op_ptr, get_def_op_ptr, get_v_may_def_result_ptr, get_v_may_def_op_ptr, get_vuse_op_ptr, get_v_must_def_result_ptr, get_v_must_def_kill_ptr): Delete. (delink_stmt_imm_use): Move and use new operand interface. (op_iter_next_use, op_iter_next_def, op_iter_next_tree, op_iter_init, op_iter_next_tree): Use new operand implementation. (clear_and_done_ssa_iter): New. Initialize a blank operand iterator. (op_iter_init_use, op_iter_init_def, op_iter_init_tree): Add iterator type check. (op_iter_next_mustdef, op_iter_next_maydef, op_iter_next_must_and_may_def): Delete. Replace with... (op_iter_next_maymustdef): New. Combine must and may next operations. (op_iter_init_maydef, op_iter_init_mustdef, op_iter_init_must_and_may_def): Use new interface. (single_ssa_tree_operand ): New. Process single operands only as trees. (single_ssa_use_operand): New. Process single operands only as uses. (single_ssa_def_operand): New. Process single operands only as defs. (zero_ssa_operands): New. Return TRUE if there are zero operands of the specified types. (num_ssa_operands): New. Count the number of specified operands. (compare_ssa_operands_equal): New. Compare two statements' operands. (single_phi_def): New. Return true if PHI has one def of the specified operand type. (op_iter_init_phiuse): New. Initialize the iterator for PHI arguments. (op_iter_init_phidef): New. Initialize the iterator for the PHI def. * tree-flow.h (struct immediate_use_iterator_d): Use ssa_use_operand_t. (struct stmt_ann_d): Operands field no longer require GTY(). (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Change prototype. * tree-into-ssa.c (mark_def_sites): Use SSA_OP_VMUSTKILL. * tree-outof-ssa.c (check_replaceable, find_replaceable_in_bb, dump_replaceable_exprs, rewrite_trees): Use generic interface. * tree-phinodes.c (make_phi_node, release_phi_node, resize_phi_node): Use use_operand_p instead of ssa_imm_use_t *. * tree-pretty-print.c (dump_vops): check if operands are active before dumping virtual operands. * tree-sra.c (sra_walk_function): Use ZERO_SSA_OPERANDS. * tree-ssa-ccp.c (likely_value): Use ZERO_SSA_OPERANDS. (ccp_fold): Use new interface. (ccp_visit_stmt): Remove unused variables and code. (convert_to_gimple_builtin): Insert statements before calling mark_new_vars_to_rename. * tree-ssa-copy.c (stmt_may_generate_copy): Use ZERO_SSA_OPERANDS. (copy_prop_visit_cond_stmt): Use generic interface. * tree-ssa-dom.c (struct expr_hash_elt): Use stmt pointer, not the annotation in table. (thread_across_edge): Use generic interface. (initialize_hash_element): Initialzie with stmt, not annotation. (eliminate_redundant_computations): Use generic interface. (record_equivalences_from_stmt): Pass stmt, not annotation. (avail_expr_hash, real_avail_expr_hash, avail_expr_eq): Use generic interface. * tree-ssa-dse.c (dse_optimize_stmt): Use ZERO_SSA_OPERANDS. * tree-ssa-loop-ivopts.c (find_invariants_stmt, find_interesting_uses_stmt, protect_loop_closed_ssa_form_use): Use generic operand interface. * tree-ssa-loop-niter.c (chain_of_csts_start, get_val_for): Use generic interface. * tree-ssa-loop-unswitch.c (tree_may_unswitch_on): Use Generic operand Interface. * tree-ssa-operands.c (struct opbuild_list_d): New. Operand build type. (build_defs, build_uses, build_v_may_defs, build_vuses, build_v_must_defs): Change type to struct opbuild_list_d. (ops_active): New. Operands active boolean. (operand_memory, operand_memory_index): New. Operand memory managers. (allocate_def_optype, allocate_use_optype, allocate_v_may_def_optype, allocate_vuse_optype, allocate_v_must_def_optype): Delete. (free_uses, free_defs, free_vuses, free_v_may_defs, free_v_must_defs): Change from functions to static variable list heads. (opbuild_initialize_virtual): New. Initialize a virtual build list. (opbuild_initialize_real): New. Initialize a virtual build list. (opbuild_free): New. Free a build list. (opbuild_num_elems): New. Number of items in a list. (opbuild_append_real): New. Add a real (tree *) operand. (opbuild_append_virtual): New. Add and sort a virtual (tree) operand. (opbuild_first): New. Return first element index in a list. (opbuild_next): New. Return next element in a list. (opbuild_elem_real): New. Return real element. (opbuild_elem_virtual): New. Return virtual element. (opbuild_elem_uid): New. Return UID of virtual element. (opbuild_clear): New. Reset an operand list. (opbuild_remove_elem): New. Remove an element form a list. (ssa_operands_active): New. Return true if operand cache is active. (init_ssa_operands, fini_ssa_operands): Initialize new implementation. (ssa_operand_alloc): New. Allocate memory from an operand chunk. (correct_use_link): Use use_operand_p. (finalize_ssa_uses, finalize_ssa_v_may_defs, finalize_ssa_defs, finalize_ssa_vuses, finalize_ssa_v_must_defs): New implmentation. (cleanup_v_may_defs): Use new implmentation. (finalize_ssa_stmt_operands, start_ssa_stmt_operands): New implementation. (append_def, append_use, append_v_may_def, append_vuse, append_v_must_def): Call opbuild_append routine instead of using varray. (build_ssa_operands): Simplify to simply use stmt, don't maintain a global parse_old_ops variable. (free_ssa_operands): New implementation. (update_stmt_operands): Move. Change argument to build_ssa_operands. (copy_virtual_operands): Move. New generic implementation. (create_ssa_artficial_load_stmt): Move. New implementation. (swap_tree_operands): Update for new implementation. (get_expr_operands): Add stmt parameter to calls to swap_tree_operands. (add_call_clobber_ops, add_call_read_ops): Initialize opbuild list rather than a varray. (verify_imm_links): Use use_operand_p. (dump_immediate_uses_for): If the immediate use variable is a virtual variable, show the virtual ops in the stmt. * tree-ssa-operands.h (def_operand_p): No longer a structure. (NULL_DEF_OPERAND_P): Now a #define. (def_optype_d, use_optype_d, v_def_use_operand_type, v_may_def_optype_d, vuse_operand_type, vuse_optype_d, v_must_def_optype_d): Delete. (def_optype_d, use_optype_d, maydef_optype_d, vuse_optype_d, mustdef_optype_d): New. Use Linked list representation. (SSA_OPERAND_MEMORY_SIZE): New. Size of operand memory chunk. (struct ssa_operand_memory_d): New. Allocated Chunk node. (struct stmt_operands_d): Change to new pointers that are not GTY. (STMT_USE_OPS, NUM_USES, SET_USE_OP, STMT_DEF_OPS, NUM_DEFS, SET_DEF_OP, STMT_V_MAY_DEF_OPS, NUM_V_MAY_DEFS, SET_V_MAY_DEF_RESULT, SET_V_MAY_DEF_OP, STMT_VUSE_OPS, NUM_VUSES, SET_VUSE_OP, STMT_V_MUST_DEF_OPS, NUM_V_MUST_DEFS, SET_V_MUST_DEF_RESULT, SET_V_MUST_DEF_KILL): Delete. (V_MAY_DEF_OPS, V_MAY_DEF_RESULT_PTR, V_MAY_DEF_RESULT, V_MAY_DEF_OP_PTR, V_MAY_DEF_OP): Rename to MAYDEF_*. (V_MUST_DEF_OPS, V_MUST_DEF_RESULT_PTR, V_MUST_DEF_RESULT, V_MUST_DEF_KILL_PTR, V_MUST_DEF_KILL): Rename to MUSTDEF_*. (enum ssa_op_iter_type): Operand iterator typechecking values. (struct ssa_operand_iterator_d): Use linked lists of operands. (SSA_OP_VMUSTDEFKILL): Rename to SSA_OP_VMUSTKILL. (FOR_EACH_SSA_MAYDEF_OPERAND, FOR_EACH_SSA_MUSTDEF_OPERAND, FOR_EACH_SSA_MUST_AND_MAY_DEF_OPERAND): Use op_iter_next_maymustdef. (FOR_EACH_PHI_ARG): New. Iterate over PHI arguments. (FOR_EACH_PHI_OR_STMT_USE): New. Iterate over PHI or stmt uses. (FOR_EACH_PHI_OR_STMT_DEF): New. Iterate over PHI or stmt defs. (SINGLE_SSA_TREE_OPERAND, SINGLE_SSA_USE_OPERAND, SINGLE_SSA_DEF_OPERAND, ZERO_SSA_OPERANDS, NUM_SSA_OPERANDS): New. * tree-ssa-opfinalize.h: New. Function templates for expansion. (FINALIZE_ALLOC): Expands into alloc_def, alloc_use, alloc_maydef, alloc_vuse, and alloc_mustdef. (FINALIZE_FUNC): Expands into finalize_ssa_def_ops, finalize_ssa_use_ops, finalize_ssa_v_may_def_ops, finalize_ssa_vuse_ops, and finalize_ssa_v_must_def_ops. * tree-ssa-pre.c (add_to_sets): Pass tree to vn_add. (create_value_expr_from): Use stmt not vuse_optype as a parameter. Pass stmt around. (compute_avail): Use generic iterator interface. * tree-ssa-propagate.c (first_vdef): Use generic operand interface. (stmt_makes_single_load, stmt_makes_single_store): Use ZERO_SSA_OPERANDS. * tree-ssa-sink.c (is_hidden_global_store): Use ZERO_SSA_OPERANDS. (statement_sink_location): Use generic interface. * tree-ssa.c (verify_ssa): Use %p in fprintf. Use generic interface. (delete_tree_ssa): Don't call release_defs. Call release_ssa_name and reset the immediate use link nodes. (stmt_references_memory_p): Use ZERO_SSA_OPERANDS. * tree-ssanames.c (make_ssa_name): Use use_operand_p. * tree-tailcall.c (find_tail_calls): Use ZERO_SSA_OPERANDS. (eliminate_tail_call): Use generic operand interface. * tree-vect-analyze.c (vect_analyze_data_refs): Use ZERO_SSA_OPERANDS. (vect_mark_relevant, vect_mark_stmts_to_be_vectorized): Use generic interface. * tree-vect-transform.c (update_vuses_to_preheader): Use generic interface. * tree-vectorizer.c (rename_variables_in_bb): Use generic interface. * tree-vn.c (struct val_expr_pair_d): Cache statment pointer instead of vuse_optype. (vn_compute, val_expr_pair_hash, vn_add, vn_lookup, vn_lookup_or_add): Use statement pointer instead of vuse_optype. Use generic interface. * tree-vrp.c (maybe_add_assert_expr): Use generic interface. (stmt_interesting_for_vrp, vrp_visit_stmt): Use ZERO_SSA_OPERANDS. * tree.h (struct ssa_imm_use_d): Renamed to ssa_use_operand_d. (tree_ssa_name, phi_arg_d): Use ssa_use_operand_d. * doc/tree-ssa.texi: Update documentation for operand interface. From-SVN: r99155
2005-05-03 14:19:56 +02:00
ssa_op_iter iter;
tree op;
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
stmt = bsi_stmt (bsi);
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
ann = stmt_ann (stmt);
2006-07-04 23:23:03 +02:00
ann->uid = stmt_uid++;
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
/* For regular value numbering, we are only interested in
assignments of the form X_i = EXPR, where EXPR represents
an "interesting" computation, it has no volatile operands
and X_i doesn't flow through an abnormal edge. */
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
if (TREE_CODE (stmt) == RETURN_EXPR
&& !ann->has_volatile_ops)
{
tree realstmt = stmt;
tree lhs;
tree rhs;
stmt = TREE_OPERAND (stmt, 0);
if (stmt && TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
{
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
lhs = GIMPLE_STMT_OPERAND (stmt, 0);
rhs = GIMPLE_STMT_OPERAND (stmt, 1);
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
if (TREE_CODE (lhs) == SSA_NAME
&& is_gimple_min_invariant (VN_INFO (lhs)->valnum))
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "SCCVN says ");
print_generic_expr (dump_file, lhs, 0);
fprintf (dump_file, " value numbers to ");
print_generic_stmt (dump_file, VN_INFO (lhs)->valnum,
0);
}
vn_add (lhs, VN_INFO (lhs)->valnum);
continue;
}
if (TREE_CODE (rhs) == SSA_NAME)
add_to_exp_gen (block, rhs);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
FOR_EACH_SSA_TREE_OPERAND (op, realstmt, iter, SSA_OP_DEF)
add_to_sets (op, op, NULL, TMP_GEN (block),
AVAIL_OUT (block));
}
continue;
}
else if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
&& !ann->has_volatile_ops
&& TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 0)) == SSA_NAME
&& !SSA_NAME_OCCURS_IN_ABNORMAL_PHI
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
(GIMPLE_STMT_OPERAND (stmt, 0)))
{
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
if (make_values_for_stmt (stmt, block))
continue;
}
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
/* For any other statement that we don't recognize, simply
make the names generated by the statement available in
AVAIL_OUT and TMP_GEN. */
lambda-code.c (gcc_loop_to_lambda_loop, [...]): Use generic operand interface. 2005-05-03 Andrew MacLeod <amacleod@redhat.com> * lambda-code.c (gcc_loop_to_lambda_loop, lambda_loopnest_to_gcc_loopnest, phi_loop_edge_uses_def, stmt_is_bumper_for_loop, perfect_nest_p, replace_uses_of_x_with_y): Use generic operand interface. * tree-data-ref.c (find_data_references_in_loop): Use generic interface. * tree-dfa.c (collect_dfa_stats_r, mark_new_vars_to_rename): Use generic operand interface. * tree-flow-inline.h (delink_imm_use, link_imm_use_to_list, link_imm_use, link_imm_use_stmt, relink_imm_use, relink_imm_use_stmt, next_safe_imm_use, has_zero_uses, has_single_use, single_imm_use, num_imm_uses): Use ssa_use_operand_t. (get_def_ops, get_use_ops, get_v_may_def_ops, get_vuse_ops, get_v_must_def_ops): Delete. (get_def_from_ptr, get_phi_result_ptr): Get def directly now. (get_use_op_ptr, get_def_op_ptr, get_v_may_def_result_ptr, get_v_may_def_op_ptr, get_vuse_op_ptr, get_v_must_def_result_ptr, get_v_must_def_kill_ptr): Delete. (delink_stmt_imm_use): Move and use new operand interface. (op_iter_next_use, op_iter_next_def, op_iter_next_tree, op_iter_init, op_iter_next_tree): Use new operand implementation. (clear_and_done_ssa_iter): New. Initialize a blank operand iterator. (op_iter_init_use, op_iter_init_def, op_iter_init_tree): Add iterator type check. (op_iter_next_mustdef, op_iter_next_maydef, op_iter_next_must_and_may_def): Delete. Replace with... (op_iter_next_maymustdef): New. Combine must and may next operations. (op_iter_init_maydef, op_iter_init_mustdef, op_iter_init_must_and_may_def): Use new interface. (single_ssa_tree_operand ): New. Process single operands only as trees. (single_ssa_use_operand): New. Process single operands only as uses. (single_ssa_def_operand): New. Process single operands only as defs. (zero_ssa_operands): New. Return TRUE if there are zero operands of the specified types. (num_ssa_operands): New. Count the number of specified operands. (compare_ssa_operands_equal): New. Compare two statements' operands. (single_phi_def): New. Return true if PHI has one def of the specified operand type. (op_iter_init_phiuse): New. Initialize the iterator for PHI arguments. (op_iter_init_phidef): New. Initialize the iterator for the PHI def. * tree-flow.h (struct immediate_use_iterator_d): Use ssa_use_operand_t. (struct stmt_ann_d): Operands field no longer require GTY(). (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Change prototype. * tree-into-ssa.c (mark_def_sites): Use SSA_OP_VMUSTKILL. * tree-outof-ssa.c (check_replaceable, find_replaceable_in_bb, dump_replaceable_exprs, rewrite_trees): Use generic interface. * tree-phinodes.c (make_phi_node, release_phi_node, resize_phi_node): Use use_operand_p instead of ssa_imm_use_t *. * tree-pretty-print.c (dump_vops): check if operands are active before dumping virtual operands. * tree-sra.c (sra_walk_function): Use ZERO_SSA_OPERANDS. * tree-ssa-ccp.c (likely_value): Use ZERO_SSA_OPERANDS. (ccp_fold): Use new interface. (ccp_visit_stmt): Remove unused variables and code. (convert_to_gimple_builtin): Insert statements before calling mark_new_vars_to_rename. * tree-ssa-copy.c (stmt_may_generate_copy): Use ZERO_SSA_OPERANDS. (copy_prop_visit_cond_stmt): Use generic interface. * tree-ssa-dom.c (struct expr_hash_elt): Use stmt pointer, not the annotation in table. (thread_across_edge): Use generic interface. (initialize_hash_element): Initialzie with stmt, not annotation. (eliminate_redundant_computations): Use generic interface. (record_equivalences_from_stmt): Pass stmt, not annotation. (avail_expr_hash, real_avail_expr_hash, avail_expr_eq): Use generic interface. * tree-ssa-dse.c (dse_optimize_stmt): Use ZERO_SSA_OPERANDS. * tree-ssa-loop-ivopts.c (find_invariants_stmt, find_interesting_uses_stmt, protect_loop_closed_ssa_form_use): Use generic operand interface. * tree-ssa-loop-niter.c (chain_of_csts_start, get_val_for): Use generic interface. * tree-ssa-loop-unswitch.c (tree_may_unswitch_on): Use Generic operand Interface. * tree-ssa-operands.c (struct opbuild_list_d): New. Operand build type. (build_defs, build_uses, build_v_may_defs, build_vuses, build_v_must_defs): Change type to struct opbuild_list_d. (ops_active): New. Operands active boolean. (operand_memory, operand_memory_index): New. Operand memory managers. (allocate_def_optype, allocate_use_optype, allocate_v_may_def_optype, allocate_vuse_optype, allocate_v_must_def_optype): Delete. (free_uses, free_defs, free_vuses, free_v_may_defs, free_v_must_defs): Change from functions to static variable list heads. (opbuild_initialize_virtual): New. Initialize a virtual build list. (opbuild_initialize_real): New. Initialize a virtual build list. (opbuild_free): New. Free a build list. (opbuild_num_elems): New. Number of items in a list. (opbuild_append_real): New. Add a real (tree *) operand. (opbuild_append_virtual): New. Add and sort a virtual (tree) operand. (opbuild_first): New. Return first element index in a list. (opbuild_next): New. Return next element in a list. (opbuild_elem_real): New. Return real element. (opbuild_elem_virtual): New. Return virtual element. (opbuild_elem_uid): New. Return UID of virtual element. (opbuild_clear): New. Reset an operand list. (opbuild_remove_elem): New. Remove an element form a list. (ssa_operands_active): New. Return true if operand cache is active. (init_ssa_operands, fini_ssa_operands): Initialize new implementation. (ssa_operand_alloc): New. Allocate memory from an operand chunk. (correct_use_link): Use use_operand_p. (finalize_ssa_uses, finalize_ssa_v_may_defs, finalize_ssa_defs, finalize_ssa_vuses, finalize_ssa_v_must_defs): New implmentation. (cleanup_v_may_defs): Use new implmentation. (finalize_ssa_stmt_operands, start_ssa_stmt_operands): New implementation. (append_def, append_use, append_v_may_def, append_vuse, append_v_must_def): Call opbuild_append routine instead of using varray. (build_ssa_operands): Simplify to simply use stmt, don't maintain a global parse_old_ops variable. (free_ssa_operands): New implementation. (update_stmt_operands): Move. Change argument to build_ssa_operands. (copy_virtual_operands): Move. New generic implementation. (create_ssa_artficial_load_stmt): Move. New implementation. (swap_tree_operands): Update for new implementation. (get_expr_operands): Add stmt parameter to calls to swap_tree_operands. (add_call_clobber_ops, add_call_read_ops): Initialize opbuild list rather than a varray. (verify_imm_links): Use use_operand_p. (dump_immediate_uses_for): If the immediate use variable is a virtual variable, show the virtual ops in the stmt. * tree-ssa-operands.h (def_operand_p): No longer a structure. (NULL_DEF_OPERAND_P): Now a #define. (def_optype_d, use_optype_d, v_def_use_operand_type, v_may_def_optype_d, vuse_operand_type, vuse_optype_d, v_must_def_optype_d): Delete. (def_optype_d, use_optype_d, maydef_optype_d, vuse_optype_d, mustdef_optype_d): New. Use Linked list representation. (SSA_OPERAND_MEMORY_SIZE): New. Size of operand memory chunk. (struct ssa_operand_memory_d): New. Allocated Chunk node. (struct stmt_operands_d): Change to new pointers that are not GTY. (STMT_USE_OPS, NUM_USES, SET_USE_OP, STMT_DEF_OPS, NUM_DEFS, SET_DEF_OP, STMT_V_MAY_DEF_OPS, NUM_V_MAY_DEFS, SET_V_MAY_DEF_RESULT, SET_V_MAY_DEF_OP, STMT_VUSE_OPS, NUM_VUSES, SET_VUSE_OP, STMT_V_MUST_DEF_OPS, NUM_V_MUST_DEFS, SET_V_MUST_DEF_RESULT, SET_V_MUST_DEF_KILL): Delete. (V_MAY_DEF_OPS, V_MAY_DEF_RESULT_PTR, V_MAY_DEF_RESULT, V_MAY_DEF_OP_PTR, V_MAY_DEF_OP): Rename to MAYDEF_*. (V_MUST_DEF_OPS, V_MUST_DEF_RESULT_PTR, V_MUST_DEF_RESULT, V_MUST_DEF_KILL_PTR, V_MUST_DEF_KILL): Rename to MUSTDEF_*. (enum ssa_op_iter_type): Operand iterator typechecking values. (struct ssa_operand_iterator_d): Use linked lists of operands. (SSA_OP_VMUSTDEFKILL): Rename to SSA_OP_VMUSTKILL. (FOR_EACH_SSA_MAYDEF_OPERAND, FOR_EACH_SSA_MUSTDEF_OPERAND, FOR_EACH_SSA_MUST_AND_MAY_DEF_OPERAND): Use op_iter_next_maymustdef. (FOR_EACH_PHI_ARG): New. Iterate over PHI arguments. (FOR_EACH_PHI_OR_STMT_USE): New. Iterate over PHI or stmt uses. (FOR_EACH_PHI_OR_STMT_DEF): New. Iterate over PHI or stmt defs. (SINGLE_SSA_TREE_OPERAND, SINGLE_SSA_USE_OPERAND, SINGLE_SSA_DEF_OPERAND, ZERO_SSA_OPERANDS, NUM_SSA_OPERANDS): New. * tree-ssa-opfinalize.h: New. Function templates for expansion. (FINALIZE_ALLOC): Expands into alloc_def, alloc_use, alloc_maydef, alloc_vuse, and alloc_mustdef. (FINALIZE_FUNC): Expands into finalize_ssa_def_ops, finalize_ssa_use_ops, finalize_ssa_v_may_def_ops, finalize_ssa_vuse_ops, and finalize_ssa_v_must_def_ops. * tree-ssa-pre.c (add_to_sets): Pass tree to vn_add. (create_value_expr_from): Use stmt not vuse_optype as a parameter. Pass stmt around. (compute_avail): Use generic iterator interface. * tree-ssa-propagate.c (first_vdef): Use generic operand interface. (stmt_makes_single_load, stmt_makes_single_store): Use ZERO_SSA_OPERANDS. * tree-ssa-sink.c (is_hidden_global_store): Use ZERO_SSA_OPERANDS. (statement_sink_location): Use generic interface. * tree-ssa.c (verify_ssa): Use %p in fprintf. Use generic interface. (delete_tree_ssa): Don't call release_defs. Call release_ssa_name and reset the immediate use link nodes. (stmt_references_memory_p): Use ZERO_SSA_OPERANDS. * tree-ssanames.c (make_ssa_name): Use use_operand_p. * tree-tailcall.c (find_tail_calls): Use ZERO_SSA_OPERANDS. (eliminate_tail_call): Use generic operand interface. * tree-vect-analyze.c (vect_analyze_data_refs): Use ZERO_SSA_OPERANDS. (vect_mark_relevant, vect_mark_stmts_to_be_vectorized): Use generic interface. * tree-vect-transform.c (update_vuses_to_preheader): Use generic interface. * tree-vectorizer.c (rename_variables_in_bb): Use generic interface. * tree-vn.c (struct val_expr_pair_d): Cache statment pointer instead of vuse_optype. (vn_compute, val_expr_pair_hash, vn_add, vn_lookup, vn_lookup_or_add): Use statement pointer instead of vuse_optype. Use generic interface. * tree-vrp.c (maybe_add_assert_expr): Use generic interface. (stmt_interesting_for_vrp, vrp_visit_stmt): Use ZERO_SSA_OPERANDS. * tree.h (struct ssa_imm_use_d): Renamed to ssa_use_operand_d. (tree_ssa_name, phi_arg_d): Use ssa_use_operand_d. * doc/tree-ssa.texi: Update documentation for operand interface. From-SVN: r99155
2005-05-03 14:19:56 +02:00
FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_DEF)
add_to_sets (op, op, NULL, TMP_GEN (block), AVAIL_OUT (block));
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
lambda-code.c (gcc_loop_to_lambda_loop, [...]): Use generic operand interface. 2005-05-03 Andrew MacLeod <amacleod@redhat.com> * lambda-code.c (gcc_loop_to_lambda_loop, lambda_loopnest_to_gcc_loopnest, phi_loop_edge_uses_def, stmt_is_bumper_for_loop, perfect_nest_p, replace_uses_of_x_with_y): Use generic operand interface. * tree-data-ref.c (find_data_references_in_loop): Use generic interface. * tree-dfa.c (collect_dfa_stats_r, mark_new_vars_to_rename): Use generic operand interface. * tree-flow-inline.h (delink_imm_use, link_imm_use_to_list, link_imm_use, link_imm_use_stmt, relink_imm_use, relink_imm_use_stmt, next_safe_imm_use, has_zero_uses, has_single_use, single_imm_use, num_imm_uses): Use ssa_use_operand_t. (get_def_ops, get_use_ops, get_v_may_def_ops, get_vuse_ops, get_v_must_def_ops): Delete. (get_def_from_ptr, get_phi_result_ptr): Get def directly now. (get_use_op_ptr, get_def_op_ptr, get_v_may_def_result_ptr, get_v_may_def_op_ptr, get_vuse_op_ptr, get_v_must_def_result_ptr, get_v_must_def_kill_ptr): Delete. (delink_stmt_imm_use): Move and use new operand interface. (op_iter_next_use, op_iter_next_def, op_iter_next_tree, op_iter_init, op_iter_next_tree): Use new operand implementation. (clear_and_done_ssa_iter): New. Initialize a blank operand iterator. (op_iter_init_use, op_iter_init_def, op_iter_init_tree): Add iterator type check. (op_iter_next_mustdef, op_iter_next_maydef, op_iter_next_must_and_may_def): Delete. Replace with... (op_iter_next_maymustdef): New. Combine must and may next operations. (op_iter_init_maydef, op_iter_init_mustdef, op_iter_init_must_and_may_def): Use new interface. (single_ssa_tree_operand ): New. Process single operands only as trees. (single_ssa_use_operand): New. Process single operands only as uses. (single_ssa_def_operand): New. Process single operands only as defs. (zero_ssa_operands): New. Return TRUE if there are zero operands of the specified types. (num_ssa_operands): New. Count the number of specified operands. (compare_ssa_operands_equal): New. Compare two statements' operands. (single_phi_def): New. Return true if PHI has one def of the specified operand type. (op_iter_init_phiuse): New. Initialize the iterator for PHI arguments. (op_iter_init_phidef): New. Initialize the iterator for the PHI def. * tree-flow.h (struct immediate_use_iterator_d): Use ssa_use_operand_t. (struct stmt_ann_d): Operands field no longer require GTY(). (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Change prototype. * tree-into-ssa.c (mark_def_sites): Use SSA_OP_VMUSTKILL. * tree-outof-ssa.c (check_replaceable, find_replaceable_in_bb, dump_replaceable_exprs, rewrite_trees): Use generic interface. * tree-phinodes.c (make_phi_node, release_phi_node, resize_phi_node): Use use_operand_p instead of ssa_imm_use_t *. * tree-pretty-print.c (dump_vops): check if operands are active before dumping virtual operands. * tree-sra.c (sra_walk_function): Use ZERO_SSA_OPERANDS. * tree-ssa-ccp.c (likely_value): Use ZERO_SSA_OPERANDS. (ccp_fold): Use new interface. (ccp_visit_stmt): Remove unused variables and code. (convert_to_gimple_builtin): Insert statements before calling mark_new_vars_to_rename. * tree-ssa-copy.c (stmt_may_generate_copy): Use ZERO_SSA_OPERANDS. (copy_prop_visit_cond_stmt): Use generic interface. * tree-ssa-dom.c (struct expr_hash_elt): Use stmt pointer, not the annotation in table. (thread_across_edge): Use generic interface. (initialize_hash_element): Initialzie with stmt, not annotation. (eliminate_redundant_computations): Use generic interface. (record_equivalences_from_stmt): Pass stmt, not annotation. (avail_expr_hash, real_avail_expr_hash, avail_expr_eq): Use generic interface. * tree-ssa-dse.c (dse_optimize_stmt): Use ZERO_SSA_OPERANDS. * tree-ssa-loop-ivopts.c (find_invariants_stmt, find_interesting_uses_stmt, protect_loop_closed_ssa_form_use): Use generic operand interface. * tree-ssa-loop-niter.c (chain_of_csts_start, get_val_for): Use generic interface. * tree-ssa-loop-unswitch.c (tree_may_unswitch_on): Use Generic operand Interface. * tree-ssa-operands.c (struct opbuild_list_d): New. Operand build type. (build_defs, build_uses, build_v_may_defs, build_vuses, build_v_must_defs): Change type to struct opbuild_list_d. (ops_active): New. Operands active boolean. (operand_memory, operand_memory_index): New. Operand memory managers. (allocate_def_optype, allocate_use_optype, allocate_v_may_def_optype, allocate_vuse_optype, allocate_v_must_def_optype): Delete. (free_uses, free_defs, free_vuses, free_v_may_defs, free_v_must_defs): Change from functions to static variable list heads. (opbuild_initialize_virtual): New. Initialize a virtual build list. (opbuild_initialize_real): New. Initialize a virtual build list. (opbuild_free): New. Free a build list. (opbuild_num_elems): New. Number of items in a list. (opbuild_append_real): New. Add a real (tree *) operand. (opbuild_append_virtual): New. Add and sort a virtual (tree) operand. (opbuild_first): New. Return first element index in a list. (opbuild_next): New. Return next element in a list. (opbuild_elem_real): New. Return real element. (opbuild_elem_virtual): New. Return virtual element. (opbuild_elem_uid): New. Return UID of virtual element. (opbuild_clear): New. Reset an operand list. (opbuild_remove_elem): New. Remove an element form a list. (ssa_operands_active): New. Return true if operand cache is active. (init_ssa_operands, fini_ssa_operands): Initialize new implementation. (ssa_operand_alloc): New. Allocate memory from an operand chunk. (correct_use_link): Use use_operand_p. (finalize_ssa_uses, finalize_ssa_v_may_defs, finalize_ssa_defs, finalize_ssa_vuses, finalize_ssa_v_must_defs): New implmentation. (cleanup_v_may_defs): Use new implmentation. (finalize_ssa_stmt_operands, start_ssa_stmt_operands): New implementation. (append_def, append_use, append_v_may_def, append_vuse, append_v_must_def): Call opbuild_append routine instead of using varray. (build_ssa_operands): Simplify to simply use stmt, don't maintain a global parse_old_ops variable. (free_ssa_operands): New implementation. (update_stmt_operands): Move. Change argument to build_ssa_operands. (copy_virtual_operands): Move. New generic implementation. (create_ssa_artficial_load_stmt): Move. New implementation. (swap_tree_operands): Update for new implementation. (get_expr_operands): Add stmt parameter to calls to swap_tree_operands. (add_call_clobber_ops, add_call_read_ops): Initialize opbuild list rather than a varray. (verify_imm_links): Use use_operand_p. (dump_immediate_uses_for): If the immediate use variable is a virtual variable, show the virtual ops in the stmt. * tree-ssa-operands.h (def_operand_p): No longer a structure. (NULL_DEF_OPERAND_P): Now a #define. (def_optype_d, use_optype_d, v_def_use_operand_type, v_may_def_optype_d, vuse_operand_type, vuse_optype_d, v_must_def_optype_d): Delete. (def_optype_d, use_optype_d, maydef_optype_d, vuse_optype_d, mustdef_optype_d): New. Use Linked list representation. (SSA_OPERAND_MEMORY_SIZE): New. Size of operand memory chunk. (struct ssa_operand_memory_d): New. Allocated Chunk node. (struct stmt_operands_d): Change to new pointers that are not GTY. (STMT_USE_OPS, NUM_USES, SET_USE_OP, STMT_DEF_OPS, NUM_DEFS, SET_DEF_OP, STMT_V_MAY_DEF_OPS, NUM_V_MAY_DEFS, SET_V_MAY_DEF_RESULT, SET_V_MAY_DEF_OP, STMT_VUSE_OPS, NUM_VUSES, SET_VUSE_OP, STMT_V_MUST_DEF_OPS, NUM_V_MUST_DEFS, SET_V_MUST_DEF_RESULT, SET_V_MUST_DEF_KILL): Delete. (V_MAY_DEF_OPS, V_MAY_DEF_RESULT_PTR, V_MAY_DEF_RESULT, V_MAY_DEF_OP_PTR, V_MAY_DEF_OP): Rename to MAYDEF_*. (V_MUST_DEF_OPS, V_MUST_DEF_RESULT_PTR, V_MUST_DEF_RESULT, V_MUST_DEF_KILL_PTR, V_MUST_DEF_KILL): Rename to MUSTDEF_*. (enum ssa_op_iter_type): Operand iterator typechecking values. (struct ssa_operand_iterator_d): Use linked lists of operands. (SSA_OP_VMUSTDEFKILL): Rename to SSA_OP_VMUSTKILL. (FOR_EACH_SSA_MAYDEF_OPERAND, FOR_EACH_SSA_MUSTDEF_OPERAND, FOR_EACH_SSA_MUST_AND_MAY_DEF_OPERAND): Use op_iter_next_maymustdef. (FOR_EACH_PHI_ARG): New. Iterate over PHI arguments. (FOR_EACH_PHI_OR_STMT_USE): New. Iterate over PHI or stmt uses. (FOR_EACH_PHI_OR_STMT_DEF): New. Iterate over PHI or stmt defs. (SINGLE_SSA_TREE_OPERAND, SINGLE_SSA_USE_OPERAND, SINGLE_SSA_DEF_OPERAND, ZERO_SSA_OPERANDS, NUM_SSA_OPERANDS): New. * tree-ssa-opfinalize.h: New. Function templates for expansion. (FINALIZE_ALLOC): Expands into alloc_def, alloc_use, alloc_maydef, alloc_vuse, and alloc_mustdef. (FINALIZE_FUNC): Expands into finalize_ssa_def_ops, finalize_ssa_use_ops, finalize_ssa_v_may_def_ops, finalize_ssa_vuse_ops, and finalize_ssa_v_must_def_ops. * tree-ssa-pre.c (add_to_sets): Pass tree to vn_add. (create_value_expr_from): Use stmt not vuse_optype as a parameter. Pass stmt around. (compute_avail): Use generic iterator interface. * tree-ssa-propagate.c (first_vdef): Use generic operand interface. (stmt_makes_single_load, stmt_makes_single_store): Use ZERO_SSA_OPERANDS. * tree-ssa-sink.c (is_hidden_global_store): Use ZERO_SSA_OPERANDS. (statement_sink_location): Use generic interface. * tree-ssa.c (verify_ssa): Use %p in fprintf. Use generic interface. (delete_tree_ssa): Don't call release_defs. Call release_ssa_name and reset the immediate use link nodes. (stmt_references_memory_p): Use ZERO_SSA_OPERANDS. * tree-ssanames.c (make_ssa_name): Use use_operand_p. * tree-tailcall.c (find_tail_calls): Use ZERO_SSA_OPERANDS. (eliminate_tail_call): Use generic operand interface. * tree-vect-analyze.c (vect_analyze_data_refs): Use ZERO_SSA_OPERANDS. (vect_mark_relevant, vect_mark_stmts_to_be_vectorized): Use generic interface. * tree-vect-transform.c (update_vuses_to_preheader): Use generic interface. * tree-vectorizer.c (rename_variables_in_bb): Use generic interface. * tree-vn.c (struct val_expr_pair_d): Cache statment pointer instead of vuse_optype. (vn_compute, val_expr_pair_hash, vn_add, vn_lookup, vn_lookup_or_add): Use statement pointer instead of vuse_optype. Use generic interface. * tree-vrp.c (maybe_add_assert_expr): Use generic interface. (stmt_interesting_for_vrp, vrp_visit_stmt): Use ZERO_SSA_OPERANDS. * tree.h (struct ssa_imm_use_d): Renamed to ssa_use_operand_d. (tree_ssa_name, phi_arg_d): Use ssa_use_operand_d. * doc/tree-ssa.texi: Update documentation for operand interface. From-SVN: r99155
2005-05-03 14:19:56 +02:00
FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_USE)
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
{
add_to_sets (op, op, NULL, NULL , AVAIL_OUT (block));
if (TREE_CODE (op) == SSA_NAME || can_PRE_operation (op))
add_to_exp_gen (block, op);
}
}
/* Put the dominator children of BLOCK on the worklist of blocks
to compute available sets for. */
for (son = first_dom_son (CDI_DOMINATORS, block);
son;
son = next_dom_son (CDI_DOMINATORS, son))
worklist[sp++] = son;
}
free (worklist);
}
/* Eliminate fully redundant computations. */
static void
eliminate (void)
{
basic_block b;
FOR_EACH_BB (b)
{
block_stmt_iterator i;
2006-07-04 23:23:03 +02:00
for (i = bsi_start (b); !bsi_end_p (i); bsi_next (&i))
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
{
tree stmt = bsi_stmt (i);
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
/* Lookup the RHS of the expression, see if we have an
available computation for it. If so, replace the RHS with
the available computation. */
if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
&& TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 0)) == SSA_NAME
&& TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)) != SSA_NAME
&& !is_gimple_min_invariant (GIMPLE_STMT_OPERAND (stmt, 1))
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
&& !stmt_ann (stmt)->has_volatile_ops)
{
tree lhs = GIMPLE_STMT_OPERAND (stmt, 0);
tree *rhs_p = &GIMPLE_STMT_OPERAND (stmt, 1);
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
tree sprime;
sprime = bitmap_find_leader (AVAIL_OUT (b),
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
get_value_handle (lhs));
2006-07-04 23:23:03 +02:00
if (sprime
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
&& sprime != lhs
&& (TREE_CODE (*rhs_p) != SSA_NAME
|| may_propagate_copy (*rhs_p, sprime)))
{
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * targhooks.c (default_unwind_emit, default_scalar_mode_supported_p): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * timevar.c (timevar_push, timevar_pop, timevar_start, timevar_stop): Likewise. * toplev.c (default_pch_valid_p): Likewise. * tracer.c (tail_duplicate): Likewise. * tree-alias-common.c (get_alias_var_decl, get_values_from_constructor, create_alias_var, delete_alias_vars, empty_points_to_set, same_points_to_set, ptr_may_alias_var): Likewise. * tree.c (tree_size, make_node_stat, copy_node_stat, build_int_cst_wide, integer_all_onesp, list_length, chainon, tree_node_structure, type_contains_placeholder_p, substitute_in_expr, substitute_placeholder_in_expr, tabilize_reference_1, build0_stat, build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p, lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr, build_method_type_directly, decl_type_context, get_callee_fndecl, get_set_constructor_bits, build_vector_type_for_mode, int_cst_value, tree_fold_gcd): Likewise. * tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges, make_cond_expr_edges, group_case_labels, tree_merge_blocks, cleanup_control_expr_graph, find_taken_edge, find_taken_edge_switch_expr, phi_alternatives_equal, is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt, stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate, tree_split_edge, tree_verify_flow_info, thread_jumps, tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise. * tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly, chrec_fold_multiply_poly_poly): Likewise. * tree-complex.c (extract_component, expand_complex_division, expand_complex_comparison, expand_complex_operations_1, build_replicated_const, expand_vector_operations_1): Likewise. * tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector, build_classic_dir_vector): Likewise. * tree-dfa.c (compute_immediate_uses_for_phi, compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann, create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region, record_in_finally_tree, replace_goto_queue_1, maybe_record_in_goto_queue, verify_norecord_switch_expr, do_return_redirection): Likewise. * tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr, add_to_dst_predicate_list, find_phi_replacement_condition, replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order): Likewise. * tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r, initialize_inlined_parameters, declare_return_variable, estimate_num_insns_1, expand_call_inline, expand_calls_inline, optimize_inline_calls, copy_tree_r): Likewise. * tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt, ssa_rewrite_stmt, rewrite_into_ssa): Likewise. * tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after, tsi_split_statement_list_after, tsi_split_statement_list_before): Likewise. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-nested.c (create_tmp_var_for, lookup_field_for_decl, lookup_tramp_for_decl, convert_all_function_calls): Likewise. * tree-optimize.c (tree_rest_of_compilation): Likewise. * tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi, coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis, free_temp_expr_table, add_dependance, finish_expr, rewrite_trees): Likewise. * tree-phinodes.c (resize_phi_node, add_phi_arg, remove_all_phi_nodes_for): Likewise. * tree-pretty-print.c (op_prio, print_call_name): Likewise. * tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise. * tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree, sra_elt_eq, sra_walk_expr, instantiate_missing_elements, generate_one_element_ref, generate_element_copy, generate_element_zero, scalarize_copy, scalarize_init, scalarize_ldst): Likewise. * tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p, add_may_alias, add_pointed_to_expr, add_pointed_to_var, collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise. * tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise. * tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value, set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment, widen_bitfield, ccp_fold_builtin): Likewise. * tree-ssa-copy.c (may_propagate_copy, merge_alias_info, replace_exp_1, propagate_tree_value): Likewise. * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise. * tree-ssa-dce.c (set_control_dependence_map_bit, find_control_dependence, find_pdom, mark_operand_necessary, mark_stmt_if_obviously_necessary, mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise. * tree-ssa-dom.c (dom_opt_initialize_block_local_data, simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis, eliminate_redundant_computations, avail_expr_eq): Likewise. * tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p, duplicate_blocks): Likewise. * tree-ssa-loop-im.c (for_each_index, set_level, is_call_clobbered_ref): Likewise. * tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos, stmt_after_increment, set_iv, contains_abnormal_ssa_name_p, find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates, peel_address, ptr_difference_cost, may_replace_final_value, determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer, rewrite_use, rewrite_uses): Likewise. * tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa, check_loop_closed_ssa_use): Likewise. * tree-ssanames.c (make_ssa_name): Likewise. * tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses, finalize_ssa_v_must_defs, finalize_ssa_stmt_operands, get_stmt_operands, get_expr_operands, get_asm_expr_operands, get_indirect_ref_operands, add_stmt_operand): Likewise. * tree-ssa-pre.c (value_exists_in_set_bitmap, value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set, phi_translate, valid_in_set, compute_antic, find_or_generate_expression, create_expression_by_pieces, insert_aux, create_value_expr_from, eliminate): Likewise. * tree-ssa-propagate.c (cfg_blocks_get): Likewise. * tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges): Likewise. * tree-tailcall.c (independent_of_stmt_p, adjust_return_value, eliminate_tail_call): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_align_data_ref, vect_create_data_ref, vect_create_destination_var, vect_get_vec_def_for_operand, vect_finish_stmt_generation, vect_transform_stmt, vect_transform_loop_bound, vect_transform_loop, vect_analyze_operations): Likewise. * tree-vn.c (vn_compute, set_value_handle, get_value_handle): Likewise. * tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr, get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start, bsi_after_labels, bsi_last): Likewise. * tree-ssa-live.c (var_union, change_partition_var, create_ssa_var_map, calculate_live_on_entry, root_var_init, type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce): Likewise. * tree-ssa-live.h (partition_is_global, live_entry_blocks, tpa_find_tree): Likewise. (register_ssa_partition_check): Declare. (register_ssa_partition): use it. * tree-ssa-live.c: Include errors.h. (register_ssa_partition_check): New. * tree-ssa-operands.c: Include errors.h. * Makefile.in (tree-ssa-operands.o): Depend on errors.h. Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com> From-SVN: r87223
2004-09-09 09:54:12 +02:00
gcc_assert (sprime != *rhs_p);
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Replaced ");
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
print_generic_expr (dump_file, *rhs_p, 0);
fprintf (dump_file, " with ");
print_generic_expr (dump_file, sprime, 0);
fprintf (dump_file, " in ");
print_generic_stmt (dump_file, stmt, 0);
}
2006-07-04 23:23:03 +02:00
if (TREE_CODE (sprime) == SSA_NAME)
NECESSARY (SSA_NAME_DEF_STMT (sprime)) = 1;
/* We need to make sure the new and old types actually match,
which may require adding a simple cast, which fold_convert
will do for us. */
if (TREE_CODE (*rhs_p) != SSA_NAME
&& !useless_type_conversion_p (TREE_TYPE (*rhs_p),
TREE_TYPE (sprime)))
sprime = fold_convert (TREE_TYPE (*rhs_p), sprime);
2006-07-04 23:23:03 +02:00
pre_stats.eliminations++;
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
propagate_tree_value (rhs_p, sprime);
lambda-code.c (lambda_loopnest_to_gcc_loopnest): Use update_stmt. 2005-04-05 Andrew MacLeod <amacleod@redhat.com> * lambda-code.c (lambda_loopnest_to_gcc_loopnest): Use update_stmt. Use immediate use iterator. (stmt_is_bumper_for_loop): Use immediate use iterator. * predict.c (strip_builtin_expect): Use update_stmt. * tree-cfg.c (update_modified_stmts): New. Call update_stmt_if_modified on all elements of a STATEMENT_LIST. (bsi_insert_before, bsi_insert_after): Call update_modified_stmts. (bsi_remove): Remove imm_use links and mark the stmt as modified. (bsi_replace): Mark stmt as modified and the update it. * tree-complex.c (update_complex_assignment): Call mark_stmt_modified. (expand_complex_libcal): Call update_stmt. (expand_complex_comparison): Call mark_stmt_modified. (expand_complex_operations_1): Call update_stmt_if_modified. (expand_vector_operations_1): Call mark_stmt_modified. * tree-dfa.c (compute_immediate_uses, free_df_for_stmt, free_df, compute_immediate_uses_for_phi, compute_immediate_uses_for_stmt, add_immediate_use, redirect_immediate_use, redirect_immediate_uses, dump_immediate_uses, debug_immediate_uses, dump_immediate_uses_for, debug_immediate_uses_for): Delete. (mark_new_vars_to_rename): Call update_stmt. * tree-dump.c (dump_option_value_in): Add "stmtaddr". * tree-flow-inline.h (modify_stmt): Rename to mark_stmt_modified. Ignore PHI nodes. (unmodify_stmt): Delete. (update_stmt): New. Force an update of a stmt. (update_stmt_if_modified): update a stmt if it is out of date. (get_stmt_operands): Verify stmt is NOT modified. (stmt_modified_p): Update comment. (delink_imm_use): Remove a use node from its immuse list. (link_imm_use_to_list): Link a use node to a specific list. (link_imm_use): Link a node to the correct list. (set_ssa_use_from_ptr): Set a use node to a specific value, and insert it in the correct list, if appropriate. (link_imm_use_stmt): Link a use node, and set the stmt pointer. (relink_imm_use): Link a use node in place of another node in a list. (relink_imm_use_stmt): LInk a node in place of another node, and set the stmt pointer. (end_safe_imm_use_traverse): New. Terminate a safe immuse iterator. (end_safe_imm_use_p): New. Check for the end of a safe immuse iterator. (first_safe_imm_use): New. Initialize a safe immuse iterator. (next_safe_imm_use): New. Proceed to next safe immuse iterator value. (end_readonly_imm_use_p): New. Check for end of a fast immuse iterator. (first_readonly_imm_use): New. Initialize a fast immuse iterator. (next_readonly_imm_use): New. Get the next fast immuse iterator value. (has_zero_uses): New. Return true if there are no uses of a var. (has_single_use): New. Return true if there is only a single use of a variable. (single_imm_use): New. Return the simgle immediate use. (num_imm_uses): New. Return the number of immediate uses. (get_v_must_def_ops): Use is now a pointer. (use_operand_p, get_v_may_def_op_ptr, get_vuse_op_ptr, get_v_must_def_kill_ptr, get_phi_arg_def_ptr): Return the address of the use node. (get_immediate_uses, num_immediate_uses, immediate_use): Delete. (delink_stmt_imm_use): Delink all immuses from a stmt. (phi_arg_index_from_use): New. Return a phi arg index for a use. * tree-flow.h (struct dataflow_d): Delete. (immediate_use_iterator_d): New. Immediate use iterator struct. (FOR_EACH_IMM_USE_FAST): New. Macro for read only immuse iteration. (FOR_EACH_IMM_USE_SAFE): New. Macro for write-safe immuse iteration. (BREAK_FROM_SAFE_IMM_USE): New. Macro for earlyu exit from write-safe iteration. (struct stmt_ann_d): Remove dataflow_t from struct. * tree-if-conv.c (tree_if_conversion). Don't call free_df. (if_convertible_phi_p): Use FAST immuse iterator. (if_convertible_loop_p): Don't call compute_immediate_uses. (replace_phi_with_cond_modify_expr): Call update_stmt. * tree-into-ssa.c (mark_def_sites, ssa_mark_def_sites): Call update_stmt_if_modified. (rewrite_all_into_ssa): Initialize ssa operands. * tree-loop-linear.c (linear_transform_loops): Don't call free_df or compute_immediate_uses. * tree-optimize.c (execute_todo): Call verify_ssa whenever the ssa_property is available. (execute_one_pass): Change parameters passed to execute_todo. * tree-outof-ssa.c (rewrite_trees): Don't call modify_stmt. (remove_ssa_form): Call fini_ssa_operands. (insert_backedge_copies): Delete call to modify_stmt. * tree-phinodes.c (make_phi_node): Initialize use nodes. (release_phi_node): Delink any use nodes before releasing. (resize_phi_node): Relink any use nodes. (remove_phi_arg_num): Delink the use node. (remove_phi_node): Release the ssa_name AFTER releasing the phi node. (remove_all_phi_nodes_for): Release phi node first. * tree-pretty-print.c (dump_generic_node): Print stmt address. * tree-sra.c (mark_all_v_defs): Call update_stmt_if_modified. (scalarize_use, scalarize_copy): Call update_stmt. * tree-ssa-alias.c (compute_may_aliases): Update all modified stmts. (compute_points_to_and_addr_escape): Call mark_stmt_modified. * tree-ssa-cpp.c (need_imm_uses_for): Delete. (ccp_initialize): Remove call to compute_immediate_uses. (substitute_and_fold, execute_fold_all_builtins): Call update_stmt. * tree-ssa-dom.c (tree_ssa_dominator_optimize): Update all modified stmts. (simplify_cond_and_lookup_avail_expr): Call mark_stmt_modified. (simplify_switch_and_lookup_avail_expr): Call mark_stmt_modified. (eliminate_redundant_computations): Call mark_stmt_modified. (cprop_operand): Call mark_stmt_modified. (optimize_stmt): Call update_stmt_if_modified and mark_stmt_modified. * tree-ssa-dse.c (fix_phi_uses, fix_stmt_v_may_defs): Delete. (dse_optimize_stmt): Use new immuse interface. (tree_ssa_dse): Remove calls to compute_immediate_uses and free_df. * tree-ssa-forwprop.c (need_imm_uses_for): Delete. (substitute_single_use_vars): Use new immuse interface. (tree_ssa_forward_propagate_single_use_vars): Remove calls to free_df and compute_immediate_uses. * tree-ssa-loop-im.c (single_reachable_address): Use new immuse interface. (rewrite_mem_refs): Call update_stmt. (determine_lsm): Remove call to compute_imm_uses and free_df. * tree-ssa-loop-ivcanon.c (create_canonical_iv): Call update_stmt. (try_unroll_loop_completely): Call update_stmt. * tree-ssa-loop-ivopts.c (rewrite_address_base): Call update_stmt. (rewrite_use_compare): Call update_stmt. (compute_phi_arg_on_exit): Insert each stmt before trying to process. (rewrite_use) : Call update_stmt. * tree-ssa-loop-manip.c (verify_loop_closed_ssa): Add arg to call. * tree-ssa-loop-unswitch.c (tree_unswitch_single_loop): Call update_stmt. * tree-ssa-operands.c (NULL_USE_OPERAND_P): Remove declaration. (allocate_use_optype, allocate_vuse_optype): Adjust allocation size. (free_uses, free_vuses, free_v_may_defs, free_v_must_defs): Delink use nodes. (initialize_vuse_operand): New. Initialize a vuse operand. (initialize_v_may_def_operand): New. Initialize a maydef operand. (initialize_v_must_def_operand): New. Initialize a mustdef operand. (finalize_ssa_defs): Use stmt parameter. (correct_use_link): Ensure a use node is in the correct list, and has the correct stmt pointer. (finalize_ssa_uses, finalize_ssa_v_may_defs, finalize_ssa_vuses, finalize_ssa_v_must_defs): Also initialize use nodes. (finalize_ssa_stmt_operands): Pass extra stmt operands. (build_ssa_operands): Seperate parsing from final operand construction. (parse_ssa_operands): New. Parse entry point for operand building. (swap_tree_operands): New. Swap 2 tree operands. (update_stmt_operands): Ranamed from get_stmt_operands. Always builds operands. (get_expr_operands): Call swap_tree_operands when needed. (copy_virtual_operands): Use initialize routines for virtual use ops. (create_ssa_artficial_load_stmt): Add extra stmt parameter. (verify_abort): New. Issue imm_use error. (verify_imm_links): New Verify imm_use links for a var. (dump_immediate_uses_for): New. Dump imm_uses for a var to file. (dump_immediate_uses): New. Dump imm_uses for all vars to file. (debug_immediate_uses): New. Dump imm_uses for all vars to stderr. (debug_immediate_uses_for): New. Dump imm_uses for a var to stderr. * tree-ssa-operands.h (struct use_operand_ptr): Delete. (NULL_USE_OPERAND_P) Define. (use_optype_d, v_def_use_operand_type, vuse_optype_d): Add immediate use node. (struct vuse_operand_type): New struct. (SET_USE): Call set_ssa_use_from_ptr. (USE_STMT): Define. (PHI_ARG_INDEX_FROM_USE): Define. * tree-ssa-phiopt.c (replace_phi_edge_with_variable): Set the phi argument via SET_USE, not PHI_ARG_DEF_TREE. * tree-ssa-pre.c (eliminate): Call update_stmt. * tree-ssa-propagate.c (cfg_blocks_get): Use imm_use iterators. Don't call free_df. * tree-ssa-sink.c (all_immediate_uses_same_place): Use imm_use iterator. (nearest_common_dominator_of_uses): Use imm_use iterator. (statement_sink_location): Use imm_use iterator and interface. (execute_sink_code): Don't call compute_immediate_uses or free-df. * tree-ssa-threadupdate.c (create_edge_and_update_destination_phis): Use PHI_ARG_DEF, not PHI_ARG_DEF_TREE. * tree-ssa.c (verify_use, verify_phi_args): Verify some imm_use info. (verify_ssa): Ensure no stmt is marked modify after optimization pass if new parameter is true. (init_tree_ssa): Don't initialize operand cache here. (delete_tree_ssa): Don't destroy operand cache here. (propagate_into_addr): Pass in a use pointer, return true if anything was changed. (replace_immediate_uses): Use imm_use iterator, call update_stmt. (check_phi_redundancy): Use imm_use iterator. (kill_redundant_phi_nodes): Don't call compute_immediate_uses or free_df. * tree-ssanames.c (make_ssa_name): Initialize imm_use node. (release_ssa_name): Delink node and all elements in its imm_use list. * tree-tailcall.c (adjust_return_value): Call update_stmt. * tree-vect-analyze.c (vect_stmt_relevant_p): Use imm_use iterator. * tree-vectorizer.c (need_imm_uses_for): Delete. (vectorize_loops): Dont call compute_immediate_uses or free_df. * tree.h (struct ssa_imm_use_d): Define. (SSA_NAME_IMM_USE_NODE): Define. (struct tree_ssa_name): Add imm_use node. (PHI_DF): Delete. (PHI_ARG_IMM_USE_NODE): Define. (struct phi_arg_d): Add imm_use node. (struct tree_phi_node): Remove struct dataflow_d element. (TDF_STMTADDR): Define. From-SVN: r97648
2005-04-05 21:05:20 +02:00
update_stmt (stmt);
tree-into-ssa.c (set_livein_block): Fix typo in comment. * tree-into-ssa.c (set_livein_block): Fix typo in comment. (rewrite_ssa_into_ssa): Start iterating over SSA names at 1. Release SSA names that have been re-renamed. * tree-phinodes.c (make_phi_node): Set same TREE_TYPE as the variable. * tree-ssa-alias.c (init_alias_info): If aliases have been computed before, clear existing alias information. (create_name_tags): Do no fixup PT_ANYTHING pointers. If the new name tag for a pointer is different than the one it had before, mark the old tag for renaming. (replace_may_alias): New function. (group_aliases): Call it. (setup_pointers_and_addressables): Always call get_tmt_for. (maybe_create_global_var): Don't create .GLOBAL_VAR more than once. (set_pt_anything): New local function. (set_pt_malloc): New local function. (merge_pointed_to_info): Don't merge pointed-to variables from the original pointer if the destination is pointing to an unknown location. (add_pointed_to_expr): Call set_pt_anything and set_pt_malloc. (add_pointed_to_var): Do not add a variable to the points-to set if the pointer is already pointing to anywhere. (collect_points_to_info_r): If the defining statement is a PHI node, only merge pointed-to information if the argument has already been visited. (get_tmt_for): Only create a new tag if the pointer didn't have one already. (dump_alias_info): Emit more information. (dump_points_to_info_for): Likewise. * tree-ssa-dom.c (redirect_edges_and_update_ssa_graph): Don't try to get the annotation of an SSA_NAME. * tree-ssa-operands.c (add_stmt_operand): Only check for empty alias sets when checking is enabled. * tree-ssa-pre.c (need_eh_cleanup): New local variable. (eliminate): Mark basic blocks that will need EH information cleaned up. (init_pre): Split ENTRY_BLOCK->0 if block 0 has more than one predecessor. Initialize need_eh_cleanup. (fini_pre): Call tree_purge_all_dead_eh_edges and cleanup_tree_cfg if needed. Free need_eh_cleanup. * tree-ssa.c (verify_ssa_name): New function. (verify_def): Call it. Re-arrange to avoid printing too many error messages. (verify_use): Likewise. (verify_phi_args): Likewise. (verify_flow_insensitive_alias_info): New function. (verify_flow_sensitive_alias_info): New function. (verify_alias_info): New function. (verify_ssa): Call verify_alias_info. Clear TREE_VISITED on all the SSA_NAMEs before scanning the program. Re-arrange to avoid printing too many error messages. * tree-ssanames.c (make_ssa_name): Clear SSA_NAME_IN_FREE_LIST. (release_ssa_name): Never release a default definition. (release_defs): New function. * tree.h: Declare it. * tree-ssa-dce.c (remove_dead_stmt): Call it. * tree-ssa.c (walk_use_def_chains_1): Add new argument IS_DFS. If true, do a depth-first search. Do a breadht-first search, otherwise. (walk_use_def_chains): Add new argument IS_DFS. Update all users. * tree-flow.h (walk_use_def_chains): Update prototype. From-SVN: r85052
2004-07-22 18:39:49 +02:00
/* If we removed EH side effects from the statement, clean
its EH information. */
if (maybe_clean_or_replace_eh_stmt (stmt, stmt))
tree-into-ssa.c (set_livein_block): Fix typo in comment. * tree-into-ssa.c (set_livein_block): Fix typo in comment. (rewrite_ssa_into_ssa): Start iterating over SSA names at 1. Release SSA names that have been re-renamed. * tree-phinodes.c (make_phi_node): Set same TREE_TYPE as the variable. * tree-ssa-alias.c (init_alias_info): If aliases have been computed before, clear existing alias information. (create_name_tags): Do no fixup PT_ANYTHING pointers. If the new name tag for a pointer is different than the one it had before, mark the old tag for renaming. (replace_may_alias): New function. (group_aliases): Call it. (setup_pointers_and_addressables): Always call get_tmt_for. (maybe_create_global_var): Don't create .GLOBAL_VAR more than once. (set_pt_anything): New local function. (set_pt_malloc): New local function. (merge_pointed_to_info): Don't merge pointed-to variables from the original pointer if the destination is pointing to an unknown location. (add_pointed_to_expr): Call set_pt_anything and set_pt_malloc. (add_pointed_to_var): Do not add a variable to the points-to set if the pointer is already pointing to anywhere. (collect_points_to_info_r): If the defining statement is a PHI node, only merge pointed-to information if the argument has already been visited. (get_tmt_for): Only create a new tag if the pointer didn't have one already. (dump_alias_info): Emit more information. (dump_points_to_info_for): Likewise. * tree-ssa-dom.c (redirect_edges_and_update_ssa_graph): Don't try to get the annotation of an SSA_NAME. * tree-ssa-operands.c (add_stmt_operand): Only check for empty alias sets when checking is enabled. * tree-ssa-pre.c (need_eh_cleanup): New local variable. (eliminate): Mark basic blocks that will need EH information cleaned up. (init_pre): Split ENTRY_BLOCK->0 if block 0 has more than one predecessor. Initialize need_eh_cleanup. (fini_pre): Call tree_purge_all_dead_eh_edges and cleanup_tree_cfg if needed. Free need_eh_cleanup. * tree-ssa.c (verify_ssa_name): New function. (verify_def): Call it. Re-arrange to avoid printing too many error messages. (verify_use): Likewise. (verify_phi_args): Likewise. (verify_flow_insensitive_alias_info): New function. (verify_flow_sensitive_alias_info): New function. (verify_alias_info): New function. (verify_ssa): Call verify_alias_info. Clear TREE_VISITED on all the SSA_NAMEs before scanning the program. Re-arrange to avoid printing too many error messages. * tree-ssanames.c (make_ssa_name): Clear SSA_NAME_IN_FREE_LIST. (release_ssa_name): Never release a default definition. (release_defs): New function. * tree.h: Declare it. * tree-ssa-dce.c (remove_dead_stmt): Call it. * tree-ssa.c (walk_use_def_chains_1): Add new argument IS_DFS. If true, do a depth-first search. Do a breadht-first search, otherwise. (walk_use_def_chains): Add new argument IS_DFS. Update all users. * tree-flow.h (walk_use_def_chains): Update prototype. From-SVN: r85052
2004-07-22 18:39:49 +02:00
{
bitmap_set_bit (need_eh_cleanup,
bb_for_stmt (stmt)->index);
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, " Removed EH side effects.\n");
}
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
}
}
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
}
}
}
/* Borrow a bit of tree-ssa-dce.c for the moment.
XXX: In 4.1, we should be able to just run a DCE pass after PRE, though
this may be a bit faster, and we may want critical edges kept split. */
/* If OP's defining statement has not already been determined to be necessary,
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
mark that statement necessary. Return the stmt, if it is newly
2006-07-04 23:23:03 +02:00
necessary. */
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
static inline tree
mark_operand_necessary (tree op)
{
tree stmt;
gcc_assert (op);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
if (TREE_CODE (op) != SSA_NAME)
return NULL;
stmt = SSA_NAME_DEF_STMT (op);
gcc_assert (stmt);
if (NECESSARY (stmt)
|| IS_EMPTY_STMT (stmt))
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
return NULL;
NECESSARY (stmt) = 1;
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
return stmt;
}
/* Because we don't follow exactly the standard PRE algorithm, and decide not
to insert PHI nodes sometimes, and because value numbering of casts isn't
perfect, we sometimes end up inserting dead code. This simple DCE-like
pass removes any insertions we made that weren't actually used. */
static void
remove_dead_inserted_code (void)
{
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
VEC(tree,heap) *worklist = NULL;
int i;
tree t;
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
worklist = VEC_alloc (tree, heap, VEC_length (tree, inserted_exprs));
for (i = 0; VEC_iterate (tree, inserted_exprs, i, t); i++)
{
if (NECESSARY (t))
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
VEC_quick_push (tree, worklist, t);
}
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
while (VEC_length (tree, worklist) > 0)
{
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
t = VEC_pop (tree, worklist);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
/* PHI nodes are somewhat special in that each PHI alternative has
data and control dependencies. All the statements feeding the
PHI node's arguments are always necessary. */
if (TREE_CODE (t) == PHI_NODE)
{
int k;
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
VEC_reserve (tree, heap, worklist, PHI_NUM_ARGS (t));
for (k = 0; k < PHI_NUM_ARGS (t); k++)
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
{
tree arg = PHI_ARG_DEF (t, k);
if (TREE_CODE (arg) == SSA_NAME)
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
{
arg = mark_operand_necessary (arg);
if (arg)
VEC_quick_push (tree, worklist, arg);
}
}
}
else
{
/* Propagate through the operands. Examine all the USE, VUSE and
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
VDEF operands in this statement. Mark all the statements
which feed this statement's uses as necessary. */
ssa_op_iter iter;
tree use;
[multiple changes] 2006-12-11 Diego Novillo <dnovillo@redhat.com> * doc/tree-ssa.texi: Update documentation for virtual operands and the use of push_stmt_changes/pop_stmt_changes. * doc/invoke.texi: Remove documentation for params global-var-threshold. Update documentation on max-aliased-vops. * tree-into-ssa.c: Cleanup comments, variables and spacing in various functions. (regs_to_rename): Declare. (mem_syms_to_rename): Declare. (dump_update_ssa): Declare. (debug_update_ssa): Declare. (dump_names_replaced_by): Declare. (debug_names_replaced_by): Declare. (dump_def_blocks): Declare. (debug_def_blocks): Declare. (dump_defs_stack): Declare. (debug_defs_stack): Declare. (dump_currdefs): Declare. (debug_currdefs): Declare. (mark_def_sites): Do not handle virtual operands. (compute_idf): Rename from find_idf. Update users. (register_new_def): Make local. Convert second argument to 'tree'. Use BLOCK_DEFS_STACK directly. If pushing a non-register, also push the underlying symbol. (rewrite_stmt): Do not handle virtual operands. (dump_tree_ssa): Call dump_def_blocks, dump_defs_stack, dump_currdefs and dump_tree_ssa_stats. (dump_tree_ssa_stats): Also dump REPL_TBL. (replace_use): Remove. Update all users to call SET_USE instead. (rewrite_blocks): Move code to free memory to fini_ssa_renamer. (mark_def_site_blocks): Move initialization code to init_ssa_renamer. (init_ssa_renamer): New. (fini_ssa_renamer): New. (rewrite_into_ssa): Call them. (prepare_block_for_update): Process SSA_OP_ALL_USES first and SSA_OP_ALL_DEFS later. Do not process virtual operands separately. (dump_update_ssa): Call dump_decl_set. (init_update_ssa): Initialize regs_to_rename and mem_syms_to_rename. Call init_ssa_renamer. (delete_update_ssa): Call fini_ssa_renamer. Free blocks_with_phis_to_rewrite. (mark_sym_for_renaming): If the variable has sub-variables, also mark them. If the variable belongs to a partition, also mark it. (mark_set_for_renaming): Call mark_sym_for_renaming on every symbol in the set. (switch_virtuals_to_full_rewrite): Call mark_set_for_renaming. (update_ssa): Separate syms_to_rename into regs_to_rename and mem_syms_to_rename. * tree-dump.c (dump_options): Add TDF_MEMSYMS. * tree-pretty-print.c (debug_generic_expr): Add TDF_MEMSYMS. (debug_generic_stmt): Likewise. (debug_tree_chain): Likewise. (dump_symbols): New. (dump_generic_node): Check for TDF_MEMSYMS. Handle MEMORY_PARTITION_TAG. If the statement references memory and TDF_MEMSYMS is given, call dump_symbols. Indicate default names with (D). (dump_vops): Update for new virtual operator format. * tree.c (init_ttree): Add MEMORY_PARTITION_TAG to tree_contains_struct. (tree_code_size): Handle MEMORY_PARTITION_TAG. (tree_node_structure): Likewise. (needs_to_live_in_memory): Handle SSA names. * tree.h (MTAG_P): Likewise. (struct tree_memory_partition_tag): Declare. (MPT_SYMBOLS): Define. (union tree_node): Add field 'mpt'. * treestruct.def (TS_MEMORY_PARTITION_TAG): Define. * tree.def (MEMORY_PARTITION_TAG): Define. * tree-pass.h (TDF_MEMSYMS): Define. * params.h (GLOBAL_VAR_THRESHOLD): Remove. * tree-ssa-alias.c: Include pointer-set.h (struct alias_map_d): Remove fields total_alias_vops, grouped_p and may_aliases. Update all users. (struct mp_info_def): Declare. (mp_info_t): New type. (get_smt_for): Rename from get_tmt_for. Update all users. (add_may_alias): Add argument ALREADY_ADDED. If given, use it to avoid adding duplicate entries to alias sets. (replace_may_alias): Remove. Update all users. (total_alias_vops_cmp): Remove. Update all users. (group_aliases_into): Remove. Update all users. (tree_pointer_compare): Remove. Update all users. (compact_name_tags): Remove. Update all users. (group_aliases): Remove. Update all users. (mark_non_addressable): Move from tree-flow-inline.h. Remove the symbol from the partition holding it, if needed. (dump_mp_info): New. (debug_mp_info): New. (sort_mp_info): New. (create_partition_for): New. (rewrite_alias_set_for): New. (compute_memory_partitions): New. (compute_may_aliases): Call it. (init_alias_info): If computing aliases for the first time, mark every memory symbol for renaming. (have_common_aliases_p): New. (compute_flow_insensitive_aliasing): Call it. (setup_pointers_and_addressables): Do not cache num_referenced_vars. For register promoted symbols, mark their former partition for renaming. (maybe_create_global_var): Only create .GLOBAL_VAR if there are no call-clobbered variables and a mix of pure and non-pure functions were found. (may_alias_p): Tidy comments. (create_tag_raw): Remove unused variable new_type. (dump_alias_info): call dump_memory_partitions. (dump_points_to_info_for): Call dump_decl_set. (may_be_aliased): Tidy comments and formatting. * timevar.def (TV_MEMORY_PARTITIONING): Define. * tree-vectorizer.c (vect_memsyms_to_rename): Rename from vect_vnames_to_rename. Set DECL_UIDs instead of SSA name versions in it. (slpeel_update_phi_nodes_for_guard1): Ignore memory PHIs. * tree-vect-transform.c (vect_transform_loop): Call mark_set_for_renaming with vect_memsyms_to_rename. * tree-flow-inline.h (zero_imm_uses_p): New. (memory_partition): New. (set_memory_partition): New. (factoring_name_p): New. (symbol_mem_tag): New. Update every function that used to access the annotation directly. (set_symbol_mem_tag): Likewise. * tree-ssa-copy.c (may_propagate_copy): Allow copies between a partition and a symbol as long as the symbol belongs to the partition. (merge_alias_info): Ignore merge requests when memory partitions are involved. * tree-ssa.c (verify_ssa_name): Check that default definitions have empty defining statements. (verify_use): Remove argument IS_VIRTUAL. Don't call verify_ssa_name. (verify_phi_args): Call verify_ssa_name. (verify_flow_insensitive_alias_info): Handle MPTs. (verify_flow_sensitive_alias_info): Likewise. (verify_name_tags): Likewise. (verify_call_clobbering): Likewise. (verify_ssa): Check for VOPs only after aliasing information is available. Check virtuals and real operands separately. Call verify_ssa_name on every operand. (stmt_references_memory_p): Move to tree-ssa-operands.c. (walk_use_def_chains_1): Guard against NULL PHI arguments. * tree-ssa-operands.c (stmt_references_memory_p): Move from tree-ssa.c. (get_mpt_for): New. (dump_memory_partitions): New. (debug_memory_partitions): New. * tree-flow.h (struct var_ann_d): Add field mpt. (struct stmt_ann_d): Add bitfield references_memory. * Makefile.in (tree-ssa-structalias.o): Include pointer-set.h (tree-ssa-alias.o): Likewise. * tree-ssa-structalias.c: (update_alias_info): Use STORED_SYMS to determine which variables are being written to by the store operation. * tree-ssa-structalias.h (struct alias_info) <total_alias_vops>: Remove. Update all users. <written_vars>: Change to a pointer set. Update all users. <dereferenced_ptrs_store>: Likewise. <dereferenced_ptrs_load>: Likewise. (NUM_REFERENCES): Remove. Update all users. (NUM_REFERENCES_CLEAR): Remove. Update all users. (NUM_REFERENCES_INC): Remove. Update all users. (NUM_REFERENCES_SET): Remove. Update all users. * params.def (PARAM_GLOBAL_VAR_THRESHOLD): Remove. Update all users. (PARAM_MAX_ALIASED_VOPS): Set to 10. * tree-ssanames.c (make_ssa_name): Initialize SSA_NAME_IS_DEFAULT_DEF to 0. 2006-12-11 Aldy Hernandez <aldyh@redhat.com> * tree-ssa-dse.c (aggregate_vardecl_d): New. (dse_global_data): Add aggregate_vardecl field. (dse_possible_dead_store_p): New. Add prev_defvar variable. Allow immediate uses and previous immediate uses to differ if they are setting different parts of the whole. (get_aggregate_vardecl): New. (dse_record_partial_aggregate_store): New. (dse_whole_aggregate_clobbered_p): New. (dse_partial_kill_p): New. (dse_optimize_stmt): Abstract code checking a possible dead store into new function dse_possible_dead_store_p(). Call dse_maybe_record_aggregate_store(). When checking whether a STMT and its USE_STMT refer to the same memory address, check also for partial kills that clobber the whole. Move some variable definitions to the block where they are used. (aggregate_vardecl_hash): New. (aggregate_vardecl_eq): New. (aggregate_vardecl_free): New. (aggregate_whole_store_p): New. (tree_ssa_dse): Initialize and free aggregate_vardecl. Mark which aggregate stores we care about. 2006-12-11 Andrew Macleod <amacleod@redhat.com> * tree-ssa-operands.h (struct vuse_element_d): Declare. (vuse_element_t): Declare. (struct vuse_vec_d): Declare. (vuse_vec_p): Declare. (VUSE_VECT_NUM_ELEM): Define. (VUSE_VECT_ELEMENT_NC): Define. (VUSE_ELEMENT_PTR_NC): Define. (VUSE_ELEMENT_VAR_NC): Define. (VUSE_VECT_ELEMENT): Define. (VUSE_ELEMENT_PTR): Define. (VUSE_ELEMENT_VAR): Define. (struct maydef_optype_d) <use_var>: Remove. <use_ptr>: Remove. <usev>: Add. (struct vuse_optype_d) <kill_var>: Remove. <use_ptr>: Remove. <usev>: Add. (struct mustdef_optype_d) <kill_var>: Remove. <use_ptr>: Remove. <usev>: Add. (VUSE_OP_PTR): Add argument. Use VUSE_ELEMENT_PTR. (VUSE_OP): Add argument. Use VUSE_ELEMENT_PTR. (VUSE_NUM): Define. (VUSE_VECT): Define. (MAYDEF_OP_PTR): Add argument. Use VUSE_OP_PTR. (MAYDEF_OP): Add argument. Use VUSE_OP. (MAYDEF_NUM): Define. (MAYDEF_VECT): Define. (MUSTDEF_KILL_PTR): Use VUSE_OP_PTR. (MUSTDEF_KILL): Use VUSE_OP. (MUSTDEF_NUM): Define. (MUSTDEF_VECT): Define. (realloc_maydef): Declare. (realloc_vuse): Declare. (struct ssa_operand_iterator_d) <vuse_index>: Add. <mayuse_index>: Add. (LOADED_SYMS): Define. (STORED_SYMS): Define. (FOR_EACH_SSA_MUSTDEF_OPERAND): Call op_iter_next_mustdef. * tree-into-ssa.c: Adapt for multi-operand V_MAY_DEF and VUSE operators. * tree-pretty-print.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-flow-inline.h: Likewise. (op_iter_next_mustdef): New. * tree-ssa-operands.c: Likewise. (ALLOC_OPTYPE): Remove. Update all users. (alloc_def): New. (alloc_use): New. (alloc_maydef): New. (alloc_vuse): New. (alloc_mustdef): New. (realloc_maydef): New. (realloc_vuse): New. 2006-12-11 Aldy Hernandez <aldyh@redhat.com> * tree-ssa-operands.c: Remove build_v_must_defs. (init_ssa_operands): Delete build_v_must_defs. (finalize_ssa_v_must_def_ops): Remove. (finalize_ssa_v_must_defs): Remove. (finalize_ssa_stmt_operands): Do not call finalize_ssa_v_must_defs. (start_ssa_stmt_operands): Do not check build_v_must_defs. (append_v_must_def): Delete. (copy_virtual_operands): Do not copy V_MUST_DEFs. (get_modify_expr_operands): Remove reference to V_MUST_DEF from comment. Remove opf_kill_def. (build_ssa_operands): Remove references to v_must_defs. (copy_virtual_operands): Same. (copy_virtual_operands): Same. (fini_ssa_operands): Same. (free_ssa_operands): Same. (add_mustdef_op): Remove. Remove mustdef_optype_p. (alloc_mustdef): Remove. Remove references to V_MUST_DEFs in comment at top of file. (get_expr_operands): Remove opf_kill_def. (opf_kill_def): Remove. (add_virtual_operand): Remove opf_kill_def. (get_indirect_ref_operands): Same. (get_tmr_operands): Same. * tree-vectorizer.c (rename_variables_in_bb): Remove SSA_OP_ALL_KILLS. * tree-ssa-loop-manip.c (find_uses_to_rename_stmt): Remove SSA_OP_ALL_KILLS. (check_loop_closed_ssa_stmt): Same. * tree-ssa.c (verify_def): Remove V_MUST_DEF from comment. (verify_use): Same. (verify_ssa): Remove V_MUST_DEFs traces. (verify_ssa): Remove SSA_OP_ALL_KILLS. * tree-into-ssa.c (mark_def_sites): Change SSA_OP_VMUSTDEF to SSA_OP_VMAYDEF. (rewrite_update_stmt): Remove SSA_OP_VIRTUAL_KILLS. (rewrite_stmt): Remove SSA_OP_ALL_KILLS. * tree-ssa-operands.h (struct stmt_operands_d): Remove V_MUST_DEF references. (MUSTDEF_OPS): Remove. (SSA_OP_VMUSTDEF): Remove. (FOR_EACH_SSA_MUSTDEF_OPERAND): Remove. (struct mustdef_optype_d): Remove. Remove mustdef_optype_p. (struct stmt_operands_d): Remove mustdef_ops. (ssa_operand_iterator_d): Remove mustdefs and mustkills. (SSA_OP_VIRTUAL_DEFS): Remove SSA_OP_VMUSTDEF. (MUSTDEF_RESULT_PTR): Remove. (MUSTDEF_RESULT): Remove. (MUSTDEF_KILL_PTR): Remove. (MUSTDEF_KILL): Remove. (MUSTDEF_NUM): Remove. (MUSTDEF_VECT): Remove. (SSA_OP_VIRTUAL_KILLS): Remove. (SSA_OP_ALL_VIRTUALS): Remove SSA_OP_VIRTUAL_KILLS. (SSA_OP_VMUSTKILL): Remove. (SSA_OP_ALL_KILLS): Remove. (SSA_OP_ALL_OPERANDS): Remove SSA_OP_ALL_KILLS. * tree-flow-inline.h (op_iter_init_def): Remove SSA_OP_VIRTUAL_KILLS. (delink_stmt_imm_use): Remove SSA_OP_ALL_KILLS. * tree-ssa-pre.c (compute_rvuse_and_antic_safe): Remove SSA_OP_VIRTUAL_KILLS. * tree-ssa-loop-im.c (determine_max_movement): Remove SSA_OP_VIRTUAL_KILLS. (gather_mem_refs_stmt): Same. (gather_mem_refs_stmt): Same. * tree-ssa-dce.c (mark_really_necessary_kill_operand_phis): Delete. (perform_tree_ssa_dce): Remove call to mark_really_necessary_kill_operand_phis. * tree-flow-inline.h (op_iter_init): Remove setting of mustdefs and mustkills. (op_iter_next_use): Do not check mustkills. (op_iter_next_def): Do not check mustdefs. (op_iter_next_tree): Do not check mustkills or mustdefs. (clear_and_done_ssa_iter): Do not set mustdefs or mustkills. (op_iter_next_maymustdef): Do not check mustkills. (op_iter_init_must_and_may_def): Remove SSA_OP_VMUSTKILL. (op_iter_init_mustdef): Remove. * tree-ssa-live.c (create_ssa_var_map): Change SSA_OP_VMUSTDEF to SSA_OP_VMAYDEF. * tree-ssa-dse.c (dse_optimize_stmt): Remove SSA_OP_VMUSTDEF. * tree-ssa-ccp.c: Remove V_MUST_DEF traces from comments. (visit_assignment): Same. * tree-ssa-copy.c (copy_prop_visit_assignment): Same. * tree-sra.c (mark_all_v_defs_1): Remove V_MUST_DEF from comment. * tree-outof-ssa.c (check_replaceable): Remove SSA_OP_VMUSTDEF. * tree-pretty-print.c (dump_vops): Remove printing of V_MUST_DEF. Remove kill_p variable. * tree-dfa.c (struct dfa_stats_d): Remove num_v_must_defs. (dump_dfa_stats): Remove code related to V_MUST_DEFs. (collect_dfa_stats_r): Do not set num_v_must_defs. (mark_new_vars_to_rename): Remove v_must_defs_{before,after} code. * tree-into-ssa.c (mark_def_sites): Change SSA_OP_VMUSTKILL to SSA_OP_VMAYUSE. * tree-ssa-pre.c (compute_rvuse_and_antic_safe): Remove SSA_OP_VMUSTDEF and SSA_OP_VMUSTKILL. * tree-ssa-propagate.c (stmt_makes_single_store): Remove SSA_OP_VMUSTDEF. From-SVN: r119760
2006-12-12 02:48:51 +01:00
/* The operands of VDEF expressions are also needed as they
represent potential definitions that may reach this
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
statement (VDEF operands allow us to follow def-def
links). */
FOR_EACH_SSA_TREE_OPERAND (use, t, iter, SSA_OP_ALL_USES)
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
{
tree n = mark_operand_necessary (use);
if (n)
VEC_safe_push (tree, heap, worklist, n);
}
}
}
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
for (i = 0; VEC_iterate (tree, inserted_exprs, i, t); i++)
{
if (!NECESSARY (t))
{
block_stmt_iterator bsi;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Removing unnecessary insertion:");
print_generic_stmt (dump_file, t, 0);
}
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
if (TREE_CODE (t) == PHI_NODE)
{
remove_phi_node (t, NULL, true);
}
else
{
bsi = bsi_for_stmt (t);
tree-cfg.c (bsi_replace): Rename final argument from PRESERVE_EH_INFO to UPDATE_EH_INFO. * tree-cfg.c (bsi_replace): Rename final argument from PRESERVE_EH_INFO to UPDATE_EH_INFO. Fix typo in last change (stmt -> orig_stmt). * tree-eh.c (verify_eh_throw_stmt_node): New function. (bsi_remove): Add new argument. Remove EH information if requested. (verify_eh_throw_table_statements): New function. (bsi_remove): Add new argument REMOVE_EH_INFO. All callers updated. * tree-optimize.c (execute_free_cfg_annotations): Verify the EH throw statement table after removing annotations. * except.h (verify_eh_throw_table_statements): Prototype. * tree-flow.h (bsi_remove): Update prototype. * tree-vrp.c (remove_range_assertions): Add new argument to bsi_remove call. * tree-ssa-loop-im.c (move_computations_stmt): Likewise. * tree-complex.c (expand_complex_div_wide): Likewise. * tree-ssa-threadupdate.c (remove_ctrl_stmt_and_useless_edges): Likewise * tree-tailcall.c (eliminate_tailcall): Likewise. * tree-ssa-dse.c (dse_optimize_stmt): Likewise. * tree-ssa-loop-ivopts.c (remove_statement): Likewise. * tree-nrv.c (tree_nrv): Likewise. * tree-vectorizer.c (slpeel_make_loop_iterate_ntimes): Likewise. * tree-if-conv.c (tree_if_convert_cond_expr): Likewise. (combine_blocks): Likewise. * tree-ssa-phiopt.c (replace_phi_edge_with_variable): Likewise. * tree-cfgcleanup.c (cleanup_ctrl_expr_graph): Likewise. (cleanup_control_flow): Likewise. (remove_forwarder_block): Likewise. * tree-ssa-pre.c (remove_dead_inserted_code): Likewise. * tree-sra.c (sra_replace): Likewise. * tree-ssa-forwprop.c (forward_propagate_into_cond): Likewise. (forward_propagate_single_use_vars): Likewise. * tree-ssa-dce.c (remove_dead_stmt): Likewise. * tree-inline.c (expand_call_inline): Likewise. * tree-vect-transform.c (vect_transform_loop): Likewise. * tree-outof-ssa.c (rewrite_trees): Likewise. * tree-cfg.c (make_goto_expr_edges): Likewise. (cleanup_dead_labels): Likewise. (tree_merge_blocks, remove_bb, disband_implicit_edges): Likewise. (bsi_move_before, bsi_move_after): Likewise. (bsi_move_to_bb_end, try_redirect_by_replacing_jump): Likewise (tree_redirect_edge_and_branch, tree_split_block): Likewise. From-SVN: r109421
2006-01-06 18:50:26 +01:00
bsi_remove (&bsi, true);
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
release_defs (t);
}
}
}
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
VEC_free (tree, heap, worklist);
}
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
/* Initialize data structures used by PRE. */
static void
init_pre (bool do_fre)
{
basic_block bb;
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
next_expression_id = 0;
expressions = NULL;
in_fre = do_fre;
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
inserted_exprs = NULL;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
need_creation = NULL;
pretemp = NULL_TREE;
storetemp = NULL_TREE;
prephitemp = NULL_TREE;
if (!do_fre)
loop_optimizer_init (LOOPS_NORMAL);
connect_infinite_loops_to_exit ();
memset (&pre_stats, 0, sizeof (pre_stats));
postorder = XNEWVEC (int, n_basic_blocks - NUM_FIXED_BLOCKS);
post_order_compute (postorder, false, false);
FOR_ALL_BB (bb)
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
bb->aux = xcalloc (1, sizeof (struct bb_bitmap_sets));
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
calculate_dominance_info (CDI_POST_DOMINATORS);
calculate_dominance_info (CDI_DOMINATORS);
bitmap_obstack_initialize (&grand_bitmap_obstack);
phi_translate_table = htab_create (5110, expr_pred_trans_hash,
expr_pred_trans_eq, free);
seen_during_translate = BITMAP_ALLOC (&grand_bitmap_obstack);
bitmap_set_pool = create_alloc_pool ("Bitmap sets",
sizeof (struct bitmap_set), 30);
binary_node_pool = create_alloc_pool ("Binary tree nodes",
tree_code_size (PLUS_EXPR), 30);
unary_node_pool = create_alloc_pool ("Unary tree nodes",
tree_code_size (NEGATE_EXPR), 30);
reference_node_pool = create_alloc_pool ("Reference tree nodes",
tree_code_size (ARRAY_REF), 30);
comparison_node_pool = create_alloc_pool ("Comparison tree nodes",
tree_code_size (EQ_EXPR), 30);
modify_expr_node_pool = create_alloc_pool ("GIMPLE_MODIFY_STMT nodes",
tree_code_size (GIMPLE_MODIFY_STMT),
30);
obstack_init (&temp_call_expr_obstack);
modify_expr_template = NULL;
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
FOR_ALL_BB (bb)
{
EXP_GEN (bb) = bitmap_set_new ();
PHI_GEN (bb) = bitmap_set_new ();
TMP_GEN (bb) = bitmap_set_new ();
AVAIL_OUT (bb) = bitmap_set_new ();
}
maximal_set = in_fre ? NULL : bitmap_set_new ();
bitmap.h (BITMAP_XMALLOC, [...]): Remove. * bitmap.h (BITMAP_XMALLOC, BITMAP_XFREE): Remove. * bb-reorder.c (duplicate_computed_gotos): Use BITMAP_ALLOC and BITMAP_FREE. * bt-load.c (btr_def_live_range, combine_btr_defs, migrate_btr_def, migrate_btr_defs): Likewise. * cfgcleanup.c (thread_jump): Likewise. * cfgloop.c (get_loop_body_in_bfs_order): Likewise. * df.c (df_insn_table_realloc, df_bitmaps_alloc, df_bitmaps_free, df_alloc, df_free, df_du_chain_create, df_bb_rd_local_compute, df_rd_local_compute, df_reg_info_compute): Likewise. * dominance.c (init_dom_info, free_dom_info): Likewise. * flow.c (init_propagate_block_info, free_propagate_block_info): Likewise. * gcse.c (alloc_gcse_mem, free_gcse_mem): Likewise. * global.c (allocate_bb_info, free_bb_info, calculate_reg_pav, modify_reg_pav): Likewise. * loop-invariant.c (find_defs, find_invariant_insn, find_invariants, free_inv_motion_data): Likewise. * predict.c (tree_predict_by_opcode, estimate_bb_frequencies): Likewise. * stmt.c (expand_case): Likewise. * tree-cfg.c (tree_duplicate_sese_region): Likewise. * tree-dfa.c (mark_new_vars_to_rename): Likewise. * tree-if-conv.c (get_loop_body_in_if_conv_order): Likewise. * tree-into-ssa.c (insert_phi_nodes_for, def_blocks_free, get_def_blocks_for, mark_def_site_blocks, rewrite_into_ssa, rewrite_ssa_into_ssa): Likewise. * tree-optimize.c (tree_rest_of_compilation): Likewise. * tree-outof-ssa.c (new_temp_expr_table, free_temp_expr_table, analyze_edges_for_bb, perform_edge_inserts): Likewise. * tree-scalar-evolution.c (scev_initialize, scev_finalize): Likewise. * tree-sra.c (tree_sra): Likewise. * tree-ssa-alias.c (init_alias_info, delete_alias_info): Likewise. * tree-ssa-ccp.c (ccp_fold_builtin): Likewise. * tree-ssa-dce.c (tree_dce_init, tree_dce_done): Likewise. * tree-ssa-dom.c (tree_ssa_dominator_optimize): Likewise. * tree-ssa-dse.c (tree_ssa_dse): Likewise. * tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_var): Likewise. * tree-ssa-live.c (new_tree_live_info, delete_tree_live_info, calculate_live_on_entry, calculate_live_on_exit, build_tree_conflict_graph): Likewise. * tree-ssa-loop-ivopts.c (tree_ssa_iv_optimize_init, record_use, record_important_candidates, set_use_iv_cost, find_depends, determine_use_iv_costs, iv_ca_new, iv_ca_free, free_loop_data, tree_ssa_iv_optimize_finalize): Likewise. * tree-ssa-loop-manip.c (add_exit_phis_var, get_loops_exit, find_uses_to_rename_use, rewrite_into_loop_closed_ssa, tree_duplicate_loop_to_header_edge): Likewise. * tree-ssa-pre.c (init_pre, fini_pre): Likewise. * tree-ssa.c (verify_flow_insensitive_alias_info, verify_name_tags, verify_ssa, init_tree_ssa, delete_tree_ssa): Likewise. * tree-ssanames.c (marked_ssa_names, init_ssanames, fini_ssanames): Likewise. * tree-vectorizer.c (slpeel_tree_peel_loop_to_edge): Likewise. From-SVN: r95172
2005-02-17 17:19:49 +01:00
need_eh_cleanup = BITMAP_ALLOC (NULL);
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
}
/* Deallocate data structures used by PRE. */
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
static void
tree-vrp.c (execute_vrp): Do not check whether current_loops == NULL. * tree-vrp.c (execute_vrp): Do not check whether current_loops == NULL. * tree-chrec.c (evolution_function_is_invariant_rec_p): Ditto. * ifcvt.c (if_convert): Ditto. * tree-ssa-threadupdate.c (thread_block): Ditto. (thread_through_all_blocks): Ditto. Assert that loops were analysed. * tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa, verify_loop_closed_ssa): Check number_of_loops instead of current_loops. * predict.c (tree_estimate_probability): Ditto. * tree-if-conv.c (main_tree_if_conversion): Ditto. * tree-ssa-loop-ch.c (copy_loop_headers): Ditto. * modulo-sched.c (sms_schedule): Ditto. * tree-scalar-evolution.c (scev_const_prop): Ditto. (scev_finalize): Do not do anything if scev analysis was not initialized. * cfgloopanal.c (mark_irreducible_loops): Do not check whether current_loops == NULL. (mark_loop_exit_edges): Check number_of_loops instead of current_loops. * loop-init.c (loop_optimizer_init): Do not free current_loops when there are no loops. (loop_optimizer_finalize): Assert that loops were analyzed. (rtl_move_loop_invariants, rtl_unswitch, rtl_unroll_and_peel_loops, rtl_doloop): Check number_of_loops instead of current_loops. * tree-ssa-loop.c (tree_loop_optimizer_init): Do not check whether current_loops == NULL. (tree_ssa_loop_init, tree_ssa_loop_im, tree_ssa_loop_unswitch, gate_tree_vectorize tree_linear_transform, check_data_deps, tree_ssa_loop_ivcanon, tree_ssa_empty_loop, tree_ssa_loop_bounds, tree_complete_unroll, tree_ssa_loop_prefetch, tree_ssa_loop_ivopts): Check number_of_loops instead of current_loops. (tree_ssa_loop_done): Do not check whether current_loops == NULL. * tree-ssa-pre.c (fini_pre): Do not take do_fre argument. Always free loops if available. (execute_pre): Do not pass do_fre to fini_pre. From-SVN: r125114
2007-05-27 19:23:11 +02:00
fini_pre (void)
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
{
basic_block bb;
unsigned int i;
free (postorder);
VEC_free (tree, heap, inserted_exprs);
VEC_free (tree, heap, need_creation);
bitmap.h (struct bitmap_obstack): New obstack type. * bitmap.h (struct bitmap_obstack): New obstack type. (struct bitmap_head_def): Replace using_obstack with obstack pointer. (bitmap_default_obstack): New. (bitmap_initialize): Make inline, does not do allocation. (bitmap_release_memory): Remove. (bitmap_obstack_initialize, bitmap_obstack_release): Declare. (bitmap_obstack_alloc, bitmap_malloc_alloc, bitmap_gc_alloc, bitmap_obstack_free, bitmap_malloc_free): Declare. (BITMAP_OBSTACK_ALLOC, BITMAP_GGC_ALLOC, BITMAP_XMALLOC): Adjust. (BITMAP_FREE): Replace with ... (BITMAP_OBSTACK_FREE): ... this. (BITMAP_XFREE): Adjust. (BITMAP_INIT_ONCE): Remove. * bitmap.c (bitmap_obstack, bitmap_obstack_init, bitmap_free: Remove. (bitmap_default_obstack): New. (bitmap_elem_to_freelist): Adjust. (bitmap_element_allocate): Adjust. Break initialization into ... (bitmap_obstack_initialize): ... here. (bitmap_release_memory): Replace with ... (bitmap_obstack_release): ... this. (bitmap_obstack_alloc, bitmap_malloc_alloc, bitmap_gc_alloc, bitmap_obstack_free, bitmap_malloc_free): New. (bitmap_ior_and_compl, bitmap_ior_and_compl_into): Use bitmap_initialize. (bitmap_initialize): Move to bitmap.h. * gengtype.c (open_base_files): Add obstack.h to ifiles. * Makefile.in (BASIC_BLOCK_H, REGS_H): Add obstack.h. * basic-block.h (INIT_REG_SET): Allocate from reg_obstack. (INITIALIZE_REG_SET): Remove. (FREE_REG_SET): Use BITMAP_OBSTACK_FREE. (INIT_ONCE_REG_SET, MAX_REGNO_REG_SET): Remove. (flow_obstack): Do not declare. (reg_obstack): Declare. * regs.h: Include obstack.h. * tree-optimize.c (tree_rest_of_compilation): Initialize and release bitmap obstack here. * bb-reorder.c: #include regs, not basic-block. (fix_crossing_conditional_branches): Allocate regsets from reg_obstack. * bt-load.c: Do not inlude bitmap.h, sbitmap.h, basic-block.h or obstack.h. * caller-save.c: Include regs.h earlier. * cfg.c: Do not include basic-block.h or obstack.h. (reg_obstack): Define. * cfganal.c: Include obstack.h * cfgcleanyp.c: Do not include basic-block.h. Include regs.h earlier. * cfglayout.c: Do not include obstack.h. (flow_obstack): Remove declaration. (cfg_layout_duplicate_bb): Use reg_obstack. * cfgloop.c, cfgloopanal.c, cfgloopmanip.c: Include obstack.h. * cfgrtl.c (rtl_split_block): Use reg_obstack. (force_nonfallthru_and_redirect, rtl_split_edge): Likewise. (safe_insert_insn_on_edge): Use OBSTACK_ALLOC_REG_SET, adjust. (cfg_layout_split_edge): Use reg_obstack. * cse.c: Include regs.h earlier. * ddg.c: Do not include basic-block.h. * dominance.c: Inlude obstack.h. * flow.c (update_life_info): Use OBSTACK_ALLOC_REG_SET, adjust. (calculate_global_regs_live): Likewise. (allocate_bb_life_data): Use reg_obstack. (init_propagate_block_info): Use OBSTACK_ALLOC_REGSET. * global.c: Do not include basic-block.h. (build_insn_chain): Use OBSTACK_ALLOC_REG_SET, adjust. * graph.c: Include obstack.h. * haifa-sched.c: Do not include basic-block.h. * ifcvt.c: Use OBSTACK_ALLOC_REG_SET, adjust. * local-alloc.c: Do not include basic-block.h. * loop-init.c, loop-invariant.c: Include obstack.h. * loop-iv.c: Likewise. (simplify_using_initial_values): Use OBSTACK_ALLOC_REG_SET, adjust. * loop-unroll.c, loop-unswitch.c: Inlude obstack.h. * modulo-sched.c: Do not include basic-block.h. * passes.c (rest_of_handle_final): Do not call regset_release_memory. * ra-debug.c: Include regs.h earlier. Do not include basic-block.h. * recog.c (peephole2_optimize): Use OBSTACK_ALLOC_REG_SET, adjust. * regclass.c (init_reg_sets): Do not call INIT_ONCE_REG_SET. (allocate_reg_info): Do not call MAX_REGNO_REG_SET. (regset_release_memory): Remove. * resource.c: Do not include basic-block.h. * rtlanal.c: Do not include basic-block.h. * sbitmap.c: Include obstack.h. * sched-deps.c: Do not include basic-block.h. (reg_pending_sets_head, reg_pending_clobbers_head, reg_pending_uses_head): Remove. (init_deps_global): Use OBSTACK_ALLOC_REG_SET. * sched-ebb.c: Do not include basic-block.h. * sched-rgn.c: Likewise. * tree-if-conv.c (get_loop_body_in_if_conv_order): Use BITMAP_XFREE. * tree-outof-ssa.c (perform_edge_inserts): Use BITMAP_XFREE. * tree-sra.c (decide_instantiations): Adjust bitmap initialization. * tree-ssa-dce.c: Include obstack.h. * tree-ssa-pre.c (grand_bitmap_obstack): Make a bitmap_obstack. (value_insert_into_set_bitmap): Remove useless bitmap_clear. (bitmap_set_new): Likewise. (init_pre): Initialize bitmap obstack. (fini_pre): Release bitmap obstack. * tree-ssanames.c (ssa_names_to_rewrite): Make static. (marked_for_rewrite_p): ssa_names_to_rewrite is never NULL. (mark_for_rewrite, unmark_for_rewrite): Likewise. (marked_ssa_names): Likewise. (init_ssanames): Use BITMAP_XMALLOC. (fini_ssanames): Use BITMAP_XFREE. * web.c: Include obstack.h From-SVN: r91009
2004-11-22 13:23:59 +01:00
bitmap_obstack_release (&grand_bitmap_obstack);
free_alloc_pool (bitmap_set_pool);
free_alloc_pool (binary_node_pool);
free_alloc_pool (reference_node_pool);
free_alloc_pool (unary_node_pool);
free_alloc_pool (comparison_node_pool);
free_alloc_pool (modify_expr_node_pool);
htab_delete (phi_translate_table);
remove_fake_exit_edges ();
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
FOR_ALL_BB (bb)
{
free (bb->aux);
bb->aux = NULL;
}
free_dominance_info (CDI_POST_DOMINATORS);
bitmap.h (bitmap_empty_p): New. * bitmap.h (bitmap_empty_p): New. (bitmap_and, bitmap_and_into, bitmap_and_compl, bitmap_and_compl_into, bitmap_ior, bitmap_ior_into, bitmap_ior_compl, bitmap_xor, bitmap_xor_into): New bitmap operation macros. (bitmap_ior_and_compl): Rename to ... (bitmap_ior_and_compl_into): ... here. * bitmap.c (bitmap_equal_p): Use bitmap_xor. (bitmap_ior_and_compl): Rename to ... (bitmap_ior_and_compl_into): ... here. Adjust. Return changed flag. (bitmap_union_of_diff): Use renamed bitmap functions. * basic-block.h (AND_REG_SET, AND_COMPL_REG_SET, IOR_REG_SET, XOR_REG_SET, IOR_AND_COMPL_REG_SET): Likewise. * cfgrtl.c (safe_insert_insn_on_edge): Likewise. * df.c (df_bb_rd_local_compute) * flow.c (calculate_global_regs_live, init_propagate_block_info): Likewise. * ifcvt.c (find_if_case_1, find_if_case_2, dead_or_predicable): Likewise. * ra-build.c (union_web_part_roots, livethrough_conflicts_bb, reset_conflicts, conflicts_between_webs): Likewise. * ra-rewrite.c (reloads_to_loads, rewrite_program2, detect_web_parts_to_rebuild): Likewise. * sched-ebb.c (compute_jump_reg_dependencies): Likewise. * tree-int-ssa.c (insert_phi_nodes_for, rewrite_into_ssa): Likewise. * tree-sra.c (decide_instantiations): Likewise. * tree-ssa-alias.c (create_name_tags, merge_pointed_to_info): Likewise. * tree-ssa-dom.c (tree_ssa_dominator_optimize): Likewise. * tree-ssa-loop-im.c (move_computations): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Likewise. * tree-ssa-pre.c (fini_pre): Likewise. * tree-ssa.c (verify_flow_sensitive_alias_info): Likewise. * tree-ssanames.c (any_marked_for_rewrite_p): Likewise. * tree-vectorizer.c (vectorize_loops): Likewise. From-SVN: r89827
2004-10-29 10:41:10 +02:00
if (!bitmap_empty_p (need_eh_cleanup))
tree-into-ssa.c (set_livein_block): Fix typo in comment. * tree-into-ssa.c (set_livein_block): Fix typo in comment. (rewrite_ssa_into_ssa): Start iterating over SSA names at 1. Release SSA names that have been re-renamed. * tree-phinodes.c (make_phi_node): Set same TREE_TYPE as the variable. * tree-ssa-alias.c (init_alias_info): If aliases have been computed before, clear existing alias information. (create_name_tags): Do no fixup PT_ANYTHING pointers. If the new name tag for a pointer is different than the one it had before, mark the old tag for renaming. (replace_may_alias): New function. (group_aliases): Call it. (setup_pointers_and_addressables): Always call get_tmt_for. (maybe_create_global_var): Don't create .GLOBAL_VAR more than once. (set_pt_anything): New local function. (set_pt_malloc): New local function. (merge_pointed_to_info): Don't merge pointed-to variables from the original pointer if the destination is pointing to an unknown location. (add_pointed_to_expr): Call set_pt_anything and set_pt_malloc. (add_pointed_to_var): Do not add a variable to the points-to set if the pointer is already pointing to anywhere. (collect_points_to_info_r): If the defining statement is a PHI node, only merge pointed-to information if the argument has already been visited. (get_tmt_for): Only create a new tag if the pointer didn't have one already. (dump_alias_info): Emit more information. (dump_points_to_info_for): Likewise. * tree-ssa-dom.c (redirect_edges_and_update_ssa_graph): Don't try to get the annotation of an SSA_NAME. * tree-ssa-operands.c (add_stmt_operand): Only check for empty alias sets when checking is enabled. * tree-ssa-pre.c (need_eh_cleanup): New local variable. (eliminate): Mark basic blocks that will need EH information cleaned up. (init_pre): Split ENTRY_BLOCK->0 if block 0 has more than one predecessor. Initialize need_eh_cleanup. (fini_pre): Call tree_purge_all_dead_eh_edges and cleanup_tree_cfg if needed. Free need_eh_cleanup. * tree-ssa.c (verify_ssa_name): New function. (verify_def): Call it. Re-arrange to avoid printing too many error messages. (verify_use): Likewise. (verify_phi_args): Likewise. (verify_flow_insensitive_alias_info): New function. (verify_flow_sensitive_alias_info): New function. (verify_alias_info): New function. (verify_ssa): Call verify_alias_info. Clear TREE_VISITED on all the SSA_NAMEs before scanning the program. Re-arrange to avoid printing too many error messages. * tree-ssanames.c (make_ssa_name): Clear SSA_NAME_IN_FREE_LIST. (release_ssa_name): Never release a default definition. (release_defs): New function. * tree.h: Declare it. * tree-ssa-dce.c (remove_dead_stmt): Call it. * tree-ssa.c (walk_use_def_chains_1): Add new argument IS_DFS. If true, do a depth-first search. Do a breadht-first search, otherwise. (walk_use_def_chains): Add new argument IS_DFS. Update all users. * tree-flow.h (walk_use_def_chains): Update prototype. From-SVN: r85052
2004-07-22 18:39:49 +02:00
{
tree_purge_all_dead_eh_edges (need_eh_cleanup);
cleanup_tree_cfg ();
}
bitmap.h (BITMAP_XMALLOC, [...]): Remove. * bitmap.h (BITMAP_XMALLOC, BITMAP_XFREE): Remove. * bb-reorder.c (duplicate_computed_gotos): Use BITMAP_ALLOC and BITMAP_FREE. * bt-load.c (btr_def_live_range, combine_btr_defs, migrate_btr_def, migrate_btr_defs): Likewise. * cfgcleanup.c (thread_jump): Likewise. * cfgloop.c (get_loop_body_in_bfs_order): Likewise. * df.c (df_insn_table_realloc, df_bitmaps_alloc, df_bitmaps_free, df_alloc, df_free, df_du_chain_create, df_bb_rd_local_compute, df_rd_local_compute, df_reg_info_compute): Likewise. * dominance.c (init_dom_info, free_dom_info): Likewise. * flow.c (init_propagate_block_info, free_propagate_block_info): Likewise. * gcse.c (alloc_gcse_mem, free_gcse_mem): Likewise. * global.c (allocate_bb_info, free_bb_info, calculate_reg_pav, modify_reg_pav): Likewise. * loop-invariant.c (find_defs, find_invariant_insn, find_invariants, free_inv_motion_data): Likewise. * predict.c (tree_predict_by_opcode, estimate_bb_frequencies): Likewise. * stmt.c (expand_case): Likewise. * tree-cfg.c (tree_duplicate_sese_region): Likewise. * tree-dfa.c (mark_new_vars_to_rename): Likewise. * tree-if-conv.c (get_loop_body_in_if_conv_order): Likewise. * tree-into-ssa.c (insert_phi_nodes_for, def_blocks_free, get_def_blocks_for, mark_def_site_blocks, rewrite_into_ssa, rewrite_ssa_into_ssa): Likewise. * tree-optimize.c (tree_rest_of_compilation): Likewise. * tree-outof-ssa.c (new_temp_expr_table, free_temp_expr_table, analyze_edges_for_bb, perform_edge_inserts): Likewise. * tree-scalar-evolution.c (scev_initialize, scev_finalize): Likewise. * tree-sra.c (tree_sra): Likewise. * tree-ssa-alias.c (init_alias_info, delete_alias_info): Likewise. * tree-ssa-ccp.c (ccp_fold_builtin): Likewise. * tree-ssa-dce.c (tree_dce_init, tree_dce_done): Likewise. * tree-ssa-dom.c (tree_ssa_dominator_optimize): Likewise. * tree-ssa-dse.c (tree_ssa_dse): Likewise. * tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_var): Likewise. * tree-ssa-live.c (new_tree_live_info, delete_tree_live_info, calculate_live_on_entry, calculate_live_on_exit, build_tree_conflict_graph): Likewise. * tree-ssa-loop-ivopts.c (tree_ssa_iv_optimize_init, record_use, record_important_candidates, set_use_iv_cost, find_depends, determine_use_iv_costs, iv_ca_new, iv_ca_free, free_loop_data, tree_ssa_iv_optimize_finalize): Likewise. * tree-ssa-loop-manip.c (add_exit_phis_var, get_loops_exit, find_uses_to_rename_use, rewrite_into_loop_closed_ssa, tree_duplicate_loop_to_header_edge): Likewise. * tree-ssa-pre.c (init_pre, fini_pre): Likewise. * tree-ssa.c (verify_flow_insensitive_alias_info, verify_name_tags, verify_ssa, init_tree_ssa, delete_tree_ssa): Likewise. * tree-ssanames.c (marked_ssa_names, init_ssanames, fini_ssanames): Likewise. * tree-vectorizer.c (slpeel_tree_peel_loop_to_edge): Likewise. From-SVN: r95172
2005-02-17 17:19:49 +01:00
BITMAP_FREE (need_eh_cleanup);
/* Wipe out pointers to VALUE_HANDLEs. In the not terribly distant
future we will want them to be persistent though. */
for (i = 0; i < num_ssa_names; i++)
{
tree name = ssa_name (i);
if (!name)
continue;
if (SSA_NAME_VALUE (name)
&& TREE_CODE (SSA_NAME_VALUE (name)) == VALUE_HANDLE)
SSA_NAME_VALUE (name) = NULL;
}
if (current_loops != NULL)
tree-vrp.c (execute_vrp): Do not update current_loops. * tree-vrp.c (execute_vrp): Do not update current_loops. * loop-unswitch.c (unswitch_loop): Do not use loop_split_edge_with. * doc/loop.texi: Remove documentation for cancelled functions. * tree-ssa-loop-im.c (loop_commit_inserts): Removed. (move_computations, determine_lsm): Use bsi_commit_edge_inserts instead. * cfgloopmanip.c (remove_bbs): Do not update loops explicitly. (remove_path): Ensure that in delete_basic_blocks, the loops are still allocated. (add_loop): Work on valid loop structures. (loopify): Modify call of add_loop. (mfb_update_loops): Removed. (create_preheader): Do not update loops explicitly. (force_single_succ_latches, loop_version): Do not use loop_split_edge_with. (loop_split_edge_with): Removed. * tree-ssa-loop-manip.c (create_iv, determine_exit_conditions): Do not use bsi_insert_on_edge_immediate_loop. (split_loop_exit_edge, tree_unroll_loop): Do not use loop_split_edge_with. (bsi_insert_on_edge_immediate_loop): Removed. * tree-ssa-loop-ch.c (copy_loop_headers): Use current_loops. Do not use loop_split_edge_with. * cfghooks.c: Include cfgloop.h. (verify_flow_info): Verify that loop_father is filled iff current_loops are available. (redirect_edge_and_branch_force, split_block, delete_basic_block, split_edge, merge_blocks, make_forwarder_block, duplicate_block): Update cfg. * cfgloopanal.c (mark_irreducible_loops): Work if the function contains no loops. * modulo-sched.c (generate_prolog_epilog, canon_loop): Do not use loop_split_edge_with. (sms_schedule): Use current_loops. * tree-ssa-dom.c (tree_ssa_dominator_optimize): Use current_loops. * loop-init.c (loop_optimizer_init, loop_optimizer_finalize): Set current_loops. (rtl_loop_init, rtl_loop_done): Do not set current_loops. * tree-ssa-sink.c (execute_sink_code): Use current_loops. * ifcvt.c (if_convert): Ditto. * predict.c (predict_loops): Do not clear current_loops. (tree_estimate_probability): Use current_loops. (propagate_freq): Receive head of the region to propagate instead of loop. (estimate_loops_at_level): Do not use shared to_visit bitmap. (estimate_loops): New function. Handle case current_loops == NULL. (estimate_bb_frequencies): Do not allocate tovisit. Use estimate_loops. * tree-ssa-loop.c (current_loops): Removed. (tree_loop_optimizer_init): Do not return loops. (tree_ssa_loop_init, tree_ssa_loop_done): Do not set current_loops. * tree-vectorizer.c (slpeel_update_phi_nodes_for_guard1, slpeel_update_phi_nodes_for_guard2, slpeel_tree_peel_loop_to_edge): Do not update loops explicitly. * function.h (struct function): Add x_current_loops field. (current_loops): New macro. * tree-if-conv.c (combine_blocks): Do not update loops explicitly. * loop-unroll.c (split_edge_and_insert): New function. (unroll_loop_runtime_iterations, analyze_insns_in_loop): Do not use loop_split_edge_with. * loop-doloop.c (add_test, doloop_modify): Ditto. * tree-ssa-pre.c (init_pre, fini_pre): Do not set current_loops. * cfglayout.c (copy_bbs): Do not update loops explicitly. * lambda-code.c (perfect_nestify): Do not use loop_split_edge_with. * tree-vect-transform.c (vect_transform_loop): Do not update loops explicitly. * cfgloop.c (flow_loops_cfg_dump): Do not dump dfs_order and rc_order. (flow_loops_free): Do not free dfs_order and rc_order. (flow_loops_find): Do not set dfs_order and rc_order in loops structure. Do not call loops and flow info verification. (add_bb_to_loop, remove_bb_from_loops): Check whether the block already belongs to some loop. * cfgloop.h (struct loops): Remove struct cfg. (current_loops, loop_split_edge_with): Declaration removed. (loop_optimizer_init, loop_optimizer_finalize): Declaration changed. * tree-flow.h (loop_commit_inserts, bsi_insert_on_edge_immediate_loop): Declaration removed. * Makefile.in (cfghooks.o): Add CFGLOOP_H dependency. * basic-block.h (split_edge_and_insert): Declare. * tree-cfg.c (remove_bb): Do not update loops explicitly. From-SVN: r118931
2006-11-17 12:29:17 +01:00
loop_optimizer_finalize ();
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
}
/* Main entry point to the SSA-PRE pass. DO_FRE is true if the caller
only wants to do full redundancy elimination. */
static void
execute_pre (bool do_fre)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
do_partial_partial = optimize > 2;
init_pre (do_fre);
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
if (!do_fre)
insert_fake_stores ();
/* Collect and value number expressions computed in each basic block. */
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
run_scc_vn ();
switch_to_PRE_table ();
compute_avail ();
if (dump_file && (dump_flags & TDF_DETAILS))
{
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
basic_block bb;
FOR_ALL_BB (bb)
{
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
print_bitmap_set (dump_file, EXP_GEN (bb), "exp_gen", bb->index);
print_bitmap_set (dump_file, TMP_GEN (bb), "tmp_gen",
bb->index);
tree.h (tree_value_handle): Remove struct value_set declaration. 2006-10-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (tree_value_handle): Remove struct value_set declaration. Change value_set to bitmap_set. * tree-pretty-print.c (dump_generic_node): Use has_stmt_ann. * tree-vn.c (get_value_handle): Made inline and moved to tree-flow-inline.h. * tree-flow-inline.h: (has_stmt_ann): New function. * tree-ssa-pre.c (expressions): New variable. (next_expression_id): Ditto. (alloc_expression_id): New function. (struct value_set): Remove. (get_expression_id): New function. (get_or_alloc_expression_id): Ditto. (expression_for_id): Ditto. (clear_expression_ids): Ditto. (FOR_EACH_EXPR_ID_IN_SET): New macro. (bb_value_sets): Renamed to bb_bitmap_sets. All value sets replaced with bitmap_sets. Add visited member. (BB_VISITED): New macro. (postorder): New variable. (add_to_value): Removed. (value_exists_in_set_bitmap): Ditto. (value_insert_into_set_bitmap): Ditto. (set_new): Ditto. (set_copy): Ditto. (set_remove): Ditto. (set_contains_value): Ditto. (insert_into_set): Ditto. (set_equal): Ditto. (find_leader): Ditto. (bitmap_set_subtract_from_value_set): Ditto. (value_insert_into_set): Ditto. (print_value_set): Ditto. (debug_value_set): Ditto. (constant_expr_p): New function. (bitmap_remove_from_set): Ditto. (bitmap_insert_into_set): Ditto. (bitmap_set_free): Ditto. (vh_compare): Ditto. (sorted_array_from_bitmap_set): Ditto. (bitmap_set_subtract): Ditto. (bitmap_set_equal): Ditto. (debug_bitmap_set): Ditto. (find_leader_in_sets): Ditto. (bitmap_set_replace_value): Modify for bitmapped sets. (phi_translate): Ditto. (phi_translate_set): Ditto. (bitmap_find_leader): Ditto. (valid_in_sets): Ditto. (union_contains_value): Ditto. (clean): Ditto. (compute_antic_aux): Ditto. Mark changed blocks. (compute_antic): Ditto. Iterate in postorder and only over changing blocks. (compute_rvuse_and_antic_safe): Reuse postorder. (create_component_ref_by_pieces): Modify for bitmapped sets. (find_or_generate_expression): Ditto. (create_expression_by_pieces): Ditto. (insert_into_preds_of_block): Ditto. (changed_blocks): New variable. (do_regular_insertion): Broken out from insert_aux. (insert_aux): Modified for bitmapped sets. (find_existing_value_expr): New function. (create_value_expr_from): Use it. (insert_extra_phis): Removed. (print_bitmap_set): Renamed from bitmap_print_value_set. (compute_avail): Handle RETURN_EXPR. (init_pre): Modify for bitmapped sets. * tree-flow.h (has_stmt_ann): New function. From-SVN: r118169
2006-10-30 02:58:42 +01:00
print_bitmap_set (dump_file, AVAIL_OUT (bb), "avail_out",
bb->index);
}
}
/* Insert can get quite slow on an incredibly large number of basic
blocks due to some quadratic behavior. Until this behavior is
fixed, don't run it when he have an incredibly large number of
bb's. If we aren't going to run insert, there is no point in
computing ANTIC, either, even though it's plenty fast. */
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
if (!do_fre && n_basic_blocks < 4000)
{
compute_antic ();
insert ();
}
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
/* Remove all the redundant expressions. */
eliminate ();
if (dump_file && (dump_flags & TDF_STATS))
{
fprintf (dump_file, "Insertions: %d\n", pre_stats.insertions);
fprintf (dump_file, "PA inserted: %d\n", pre_stats.pa_insert);
fprintf (dump_file, "New PHIs: %d\n", pre_stats.phis);
fprintf (dump_file, "Eliminated: %d\n", pre_stats.eliminations);
fprintf (dump_file, "Constified: %d\n", pre_stats.constified);
}
bsi_commit_edge_inserts ();
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 2007-06-30 Daniel Berlin <dberlin@dberlin.org> Fix PR tree-optimization/32540 Fix PR tree-optimization/31651 * tree-ssa-sccvn.c: New file. * tree-ssa-sccvn.h: Ditto. * tree-vn.c: Include tree-ssa-sccvn.h (val_expr_paid_d): Removed. (value_table): Ditto. (vn_compute): Ditto. (val_expr_pair_hash): Ditto. (val_expr_pair_expr_eq): Ditto. (copy_vuses_from_stmt): Ditto. (vn_delete): Ditto. (vn_init): Ditto. (shared_vuses_from_stmt): Ditto. (print_creation_to_file): Moved up. (sort_vuses): Ditto. (sort_vuses_heap): Ditto. (set_value_handle): Make non-static. (make_value_handle): Ditto. (vn_add): Rewritten to use sccvn lookups. (vn_add_with_vuses): Ditto. (vn_lookup): Ditto (and second argument removed). (vn_lookup_with_vuses): Ditto. (vn_lookup_or_add): Ditto (and second argument removed); (vn_lookup_or_add_with_vuses): Ditto. (vn_lookup_with_stmt): New. (vn_lookup_or_add_with_stmt): Ditto. (create_value_handle_for_expr): Ditto. * tree-ssa-pre.c: Include tree-ssa-sccvn.h. (seen_during_translate): New function. (phi_trans_lookup): Use iterative_hash_expr, not vn_compute. (phi_trans_add): Ditto. (constant_expr_p): FIELD_DECL is always constant. (phi_translate_1): Renamed from phi_translate, add seen bitmap. Use constant_expr_p. Avoid infinite recursion on mutually valued expressions. Change callers of vn_lookup_or_add. (phi_translate): New function. (compute_antic_safe): Allow phi nodes. (create_component_ref_by_pieces): Update for FIELD_DECL change. (find_or_generate_expression): Rewrite slightly. (create_expression_by_pieces): Updated for vn_lookup_or_add change. Update VN_INFO for new names. (insert_into_preds_of_block): Update for new names. (add_to_exp_gen): New function. (add_to_sets): Use vn_lookup_or_add_with_stmt. (find_existing_value_expr): Rewrite to changed vn_lookup. (create_value_expr_from): Ditto, and use add_to_exp_gen. (try_look_through_load): Removed. (try_combine_conversion): Ditto. (get_sccvn_value): New function. (make_values_for_phi): Ditto. (make_values_for_stmt): Ditto. (compute_avail): Rewritten for vn_lookup_or_add changes and to use SCCVN. (init_pre): Update for SCCVN changes. (fini_pre): Ditto. (execute_pre): Ditto. * tree-flow.h (make_value_handle): Declare. (set_value_handle): Ditto. (sort_vuses_heap): Ditto. (vn_lookup_or_add_with_stmt): Ditto. (vn_lookup_with_stmt): Ditto. (vn_compute): Remove. (vn_init): Ditto. (vn_delete): Ditto. (vn_lookup): Update arguments. * Makefile.in (tree-ssa-pre.o): Add tree-ssa-sccvn.h (tree-vn.o): Ditto. (tree-ssa-sccvn.o): New. (OBJS-common): Add tree-ssa-sccvn.o From-SVN: r126149
2007-06-30 16:15:26 +02:00
free_scc_vn ();
clear_expression_ids ();
if (!do_fre)
tree.h (VALUE_HANDLE_VUSES): New. 2005-12-29 Daniel Berlin <dberlin@dberlin.org> * tree.h (VALUE_HANDLE_VUSES): New. (struct tree_value_handle): Add vuses. * tree-vn.c (struct val_expr_pair_d): Remove stmt, add vuses. (vn_compute): Remove stmt argument. Don't use vuses in hash value computation. (val_expr_pair_eq): Compare vuse lists. (copy_vuses_from_stmt): New function. (shared_vuses_from_stmt): Ditto. (vn_add): Rewrite in terms of vn_add_with_vuses. (vn_add_with_vuses): New function. (vn_lookup): Rewrite in terms of vn_lookup_with_vuses. (vn_lookup_with_vuses): New function. (vuses_compare): New function. (print_creation_to_file): Ditto. (vn_lookup_or_add): Rewrite to handle vuses. (sort_vuses): New function. (vn_lookup_or_add_with_vuses): Ditto. (vn_init): Initialize shared_lookup_vuses. (vn_delete): Free shared_lookup_vuses. * tree-ssa-pre.c: Update todo list. (bb_value_sets_t): Add rvuse_in, rvuse_out, rvuse_gen, and rvuse_kill. (RVUSE_IN): New macro. (RVUSE_GEN): Ditto. (RVUSE_KILL): Ditto. (RVUSE_OUT): Ditto. (modify_expr_node_pool): New function. (pretemp): New. (storetemp): Ditto. (mergephitemp): Ditto. (prephitemp): Ditto. (struct expr_pred_trans_d): Add vuses member. (expr_pred_trans_eq): Compare vuses. (phi_trans_lookup): Add vuses argument. (phi_trans_add): Ditto. (translate_vuses_through_block): New function. (phi_translate): Use vuses to ask about those expressions that can have vuses. Properly translate virtual uses through phis, and use vn_lookup_or_add_with vuses. Handle tcc_reference. (phi_translate_set): Don't add pointless translations to the cache. (get_representative): New function. (vuses_dies_in_block_x): Ditto. (valid_in_set): Add block argument. Check virtual use validity. (clean): Add block argument. Update call to valid_in_set (compute_antic_aux): Update call to clean. (dump_bitmap_of_names): New function. (compute_vuse_representatives): Ditto. (compute_rvuse): Ditto. (can_value_number_call): Modified to accept calls with vuses. (can_value_number_operation): New function. (can_PRE_operation): Ditto. (need_creation): New vector of stores that may need creation. (find_or_generate_expression): use can_PRE_operation. (create_expression_by_pieces): Handle INDIRECT_REF. Only create one temp until we have to change types. Mark new vars for renaming. (insert_into_preds_of_block): Ignore loopiness of loads. Use can_PRE_operation. Only create one temp until we have to chnge types. (insert_aux): Use can_PRE_operation. Don't pass name to insert_into_preds_of_block. (insert_extra_phis): Only use one temp until we have to change types. (poolify_tree): New function. (modify_expr_template): New var. (poolify_modify_expr): New function. (insert_fake_stores): Ditto. (realify_fake_stores): Ditto. (compute_avail): Use can_value_number_operation. (mark_operand_necessary): Return NULL for non-SSA names. (remove_dead_inserted_code): Update comment. (init_pre): Initialize pretemp, need_creation, storetemp, mergephitemp, prephitemp. Create modify_expr_node_pool. (fini_pre): Free modify_expr_node_pool and need_creation array. (execute_pre): Call insert_fake_stores, compute_rvuse, and realify_fake_stores. * tree-flow.h (vn_compute): Fix prototype. (vn_add): Ditto. (vn_lookup): Ditto. (sort_vuses): New. (vn_lookup_or_add_with_vuses): Ditto. (vn_add_with_vuses): Ditto. (vn_lookup_with_vuses): Ditto. * passes.c (pass_may_alias): Add. From-SVN: r109180
2005-12-30 19:43:00 +01:00
{
remove_dead_inserted_code ();
realify_fake_stores ();
}
tree-vrp.c (execute_vrp): Do not check whether current_loops == NULL. * tree-vrp.c (execute_vrp): Do not check whether current_loops == NULL. * tree-chrec.c (evolution_function_is_invariant_rec_p): Ditto. * ifcvt.c (if_convert): Ditto. * tree-ssa-threadupdate.c (thread_block): Ditto. (thread_through_all_blocks): Ditto. Assert that loops were analysed. * tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa, verify_loop_closed_ssa): Check number_of_loops instead of current_loops. * predict.c (tree_estimate_probability): Ditto. * tree-if-conv.c (main_tree_if_conversion): Ditto. * tree-ssa-loop-ch.c (copy_loop_headers): Ditto. * modulo-sched.c (sms_schedule): Ditto. * tree-scalar-evolution.c (scev_const_prop): Ditto. (scev_finalize): Do not do anything if scev analysis was not initialized. * cfgloopanal.c (mark_irreducible_loops): Do not check whether current_loops == NULL. (mark_loop_exit_edges): Check number_of_loops instead of current_loops. * loop-init.c (loop_optimizer_init): Do not free current_loops when there are no loops. (loop_optimizer_finalize): Assert that loops were analyzed. (rtl_move_loop_invariants, rtl_unswitch, rtl_unroll_and_peel_loops, rtl_doloop): Check number_of_loops instead of current_loops. * tree-ssa-loop.c (tree_loop_optimizer_init): Do not check whether current_loops == NULL. (tree_ssa_loop_init, tree_ssa_loop_im, tree_ssa_loop_unswitch, gate_tree_vectorize tree_linear_transform, check_data_deps, tree_ssa_loop_ivcanon, tree_ssa_empty_loop, tree_ssa_loop_bounds, tree_complete_unroll, tree_ssa_loop_prefetch, tree_ssa_loop_ivopts): Check number_of_loops instead of current_loops. (tree_ssa_loop_done): Do not check whether current_loops == NULL. * tree-ssa-pre.c (fini_pre): Do not take do_fre argument. Always free loops if available. (execute_pre): Do not pass do_fre to fini_pre. From-SVN: r125114
2007-05-27 19:23:11 +02:00
fini_pre ();
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
}
/* Gate and execute functions for PRE. */
tree-vrp.c (execute_vrp): Return value. 2006-03-02 Daniel Berlin <dberlin@dberlin.org> * gcc/tree-vrp.c (execute_vrp): Return value. * gcc/regrename.c (rest_of_handle_regrename): Ditto. * gcc/tree-into-ssa.c (rewrite_into_ssa): Ditto. * gcc/tree-complex.c (tree_lower_complex): Ditto. (tree_lower_complex_O0): Ditto. * gcc/tracer.c (rest_of_handle_tracer): Ditto. * gcc/postreload-gcse.c (rest_of_handle_gcse2): Ditto. * gcc/postreload.c (rest_of_handle_postreload): Ditto. * gcc/tree-tailcall.c (execute_tail_recursion): Ditto. (execute_tail_calls): Ditto. * gcc/tree-ssa-loop-ch.c (copy_loop_headers): Ditto. * gcc/tree.h (init_function_for_compilation): Ditto. * gcc/ipa-cp.c (ipcp_driver): Ditto. * gcc/tree-scalar-evolution.c (scev_const_prop): Ditto. * gcc/tree-scalar-evolution.h (scev_const_prop): Ditto. * gcc/final.c (compute_alignments): Ditto. (rest_of_handle_final): Ditto. (rest_of_handle_shorten_branches): Ditto. (rest_of_clean_state): Ditto. * gcc/omp-low.c (execute_expand_omp): Ditto. (execute_lower_omp): Ditto. * gcc/tree-ssa-dse.c (tree_ssa_dse): Ditto. * gcc/ipa-reference.c (static_execute): Ditto. * gcc/tree-ssa-uncprop.c (tree_ssa_uncprop): Ditto. * gcc/reorg.c (rest_of_handle_delay_slots): Ditto. (rest_of_handle_machine_reorg): Ditto. * gcc/cgraphunit.c (rebuild_cgraph_edges): Ditto. * gcc/flow.c (recompute_reg_usage): Ditto. (rest_of_handle_remove_death_notes): Ditto. (rest_of_handle_life): Ditto. (rest_of_handle_flow2): Ditto. * gcc/tree-ssa-copyrename.c (rename_ssa_copies): Ditto. * gcc/tree-ssa-ccp.c (do_ssa_ccp): Ditto. (do_ssa_store_ccp): Ditto. (execute_fold_all_builtins): Ditto. * gcc/mode-switching.c (rest_of_handle_mode_switching): Ditto. * gcc/modulo-sched.c (rest_of_handle_sms): Ditto. * gcc/ipa-pure-const.c (static_execute): Ditto. * gcc/cse.c (rest_of_handle_cse): Ditto. (rest_of_handle_cse2): Ditto. * gcc/web.c (rest_of_handle_web): Ditto. * gcc/tree-stdarg.c (execute_optimize_stdarg): Ditto. * gcc/tree-ssa-math-opts.c (execute_cse_reciprocals): Ditto. * gcc/tree-ssa-dom.c (tree_ssa_dominator_optimize): Ditto. * gcc/tree-nrv.c (tree_nrv): Ditto. (execute_return_slot_opt): Ditto. * gcc/tree-ssa-alias.c (compute_may_aliases): Ditto. (create_structure_vars): Ditto. * gcc/loop-init.c (rtl_loop_init): Ditto. (rtl_loop_done): Ditto. (rtl_move_loop_invariants): Ditto. (rtl_unswitch): Ditto. (rtl_unroll_and_peel_loops): Ditto. (rtl_doloop): Ditto. * gcc/gimple-low.c (lower_function_body): Ditto. (mark_used_blocks): Ditto. * gcc/tree-ssa-sink.c (execute_sink_code): Ditto. * gcc/ipa-inline.c (cgraph_decide_inlining): Ditto. (cgraph_early_inlining): Ditto. * gcc/global.c (rest_of_handle_global_alloc): Ditto. * gcc/jump.c (cleanup_barriers): Ditto. (purge_line_number_notes): Ditto. * gcc/ifcvt.c (rest_of_handle_if_conversion): Ditto. (rest_of_handle_if_after_reload): Ditto. * gcc/tree-ssa-loop.c (tree_ssa_loop_init): Ditto. (tree_ssa_loop_im): Ditto. (tree_ssa_loop_unswitch): Ditto. (tree_vectorize): Ditto. (tree_linear_transform): Ditto. (tree_ssa_loop_ivcanon): Ditto. (tree_ssa_empty_loop): Ditto. (tree_ssa_loop_bounds): Ditto. (tree_complete_unroll): Ditto. (tree_ssa_loop_prefetch): Ditto. (tree_ssa_loop_ivopts): Ditto. (tree_ssa_loop_done): Ditto. * gcc/predict.c (tree_estimate_probability): Ditto. * gcc/recog.c (split_all_insns_noflow): Ditto. (rest_of_handle_peephole2): Ditto. (rest_of_handle_split_all_insns): Ditto. * gcc/tree-eh.c (lower_eh_constructs): Ditto. * gcc/regmove.c (rest_of_handle_regmove): Ditto. (rest_of_handle_stack_adjustments): Ditto. * gcc/local-alloc.c (rest_of_handle_local_alloc): Ditto. * gcc/function.c (instantiate_virtual_regs): Ditto. (init_function_for_compilation): Ditto. (rest_of_handle_check_leaf_regs): Ditto. * gcc/gcse.c (rest_of_handle_jump_bypass): Ditto. (rest_of_handle_gcse): Ditto. * gcc/ipa-type-escape.c (type_escape_execute): Ditto. * gcc/alias.c (rest_of_handle_cfg): Ditto. * gcc/tree-if-conv.c (main_tree_if_conversion): Ditto. * gcc/profile.c (rest_of_handle_branch_prob): Ditto. * gcc/tree-ssa-phiopt.c (tree_ssa_phiopt): Ditto. * gcc/rtl-factoring.c (rest_of_rtl_seqabstr): Ditto. * gcc/bt-load.c (rest_of_handle_branch_target_load_optimize): Ditto * gcc/tree-dfa.c (find_referenced_vars): Ditto. * gcc/except.c (set_nothrow_function_flags): Ditto. (convert_to_eh_region_ranges): Ditto. (rest_of_handle_eh): Ditto. * gcc/emit-rtl.c (unshare_all_rtl): Ditto. (remove_unnecessary_notes): Ditto. * gcc/except.h (set_nothrow_function_flags): Ditto. (convert_to_eh_region_ranges): Ditto. * gcc/cfgexpand.c (tree_expand_cfg): Ditto. * gcc/tree-cfgcleanup.c (merge_phi_nodes): Ditto. * gcc/tree-ssa-pre.c (do_pre): Ditto. (execute_fre): Ditto. * gcc/cfgcleanup.c (rest_of_handle_jump): Ditto. (rest_of_handle_jump2): Ditto. * gcc/tree-sra.c (tree_sra): Ditto. * gcc/tree-mudflap.c (execute_mudflap_function_ops): Ditto. (execute_mudflap_function_decls): Ditto. * gcc/tree-ssa-copy.c (do_copy_prop): Ditto. (do_store_copy_prop): Ditto. * gcc/ipa-prop.h (ipcp_driver): Ditto. * gcc/cfglayout.c (insn_locators_initialize): Ditto. * gcc/tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_vars): Ditto. * gcc/cfglayout.h (insn_locators_initialize): Ditto. * gcc/tree-ssa-dce.c (tree_ssa_dce): Ditto. * gcc/tree-ssa.c (execute_early_warn_uninitialized): Ditto. (execute_late_warn_uninitialized): Ditto. * gcc/rtl.h (cleanup_barriers): Ditto. (split_all_insns_noflow): Ditto. (purge_line_number_notes): Ditto. (unshare_all_rtl): Ditto. (remove_unnecessary_notes): Ditto. (recompute_reg_usage): Ditto. (variable_tracking_main): Ditto. * gcc/integrate.c (emit_initial_value_sets): Ditto. * gcc/integrate.h (emit_initial_value_sets): Ditto. * gcc/tree-optimize.c (execute_free_datastructures): Ditto (execute_free_cfg_annotations): Ditto. (execute_fixup_cfg): Ditto. (execute_cleanup_cfg_pre_ipa): Ditto. (execute_cleanup_cfg_post_optimizing): Ditto. (execute_init_datastructures): Ditto. * gcc/tree-object-size.c (compute_object_sizes): Ditto. * gcc/combine.c (rest_of_handle_combine): Ditto. * gcc/tree-outof-ssa.c (rewrite_out_of_ssa): Ditto. * gcc/bb-reorder.c (duplicate_computed_gotos): Ditto. (rest_of_handle_reorder_blocks): Ditto. (rest_of_handle_partition_blocks): Ditto. * gcc/var-tracking.c (variable_tracking_main): Ditto. * gcc/tree-profile.c (tree_profiling): Ditto. * gcc/tree-vect-generic.c (expand_vector_operations): Ditto. * gcc/reg-stack.c (rest_of_handle_stack_regs): Ditto. * gcc/sched-rgn.c (rest_of_handle_sched): Ditto. (rest_of_handle_sched2): Ditto. * gcc/basic-block.h (free_bb_insn): Ditto. * gcc/tree-ssa-structalias.c (ipa_pta_execute): Ditto. * gcc/tree-cfg.c (execute_build_cfg): Ditto. (remove_useless_stmts): Ditto. (split_critical_edges): Ditto. (execute_warn_function_return): Ditto. (execute_warn_function_noreturn): Ditto. * gcc/tree-ssa-reassoc.c (execute_reassoc): Ditto. * gcc/cfgrtl.c (free_bb_for_insn): Ditto. * gcc/passes.c (execute_one_pass): Run additional todos returned by execute function. * gcc/tree-pass.h (struct tree_opt_pass): Make execute return a value. From-SVN: r111643
2006-03-02 20:00:11 +01:00
static unsigned int
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
do_pre (void)
{
execute_pre (false);
tree-vrp.c (execute_vrp): Return value. 2006-03-02 Daniel Berlin <dberlin@dberlin.org> * gcc/tree-vrp.c (execute_vrp): Return value. * gcc/regrename.c (rest_of_handle_regrename): Ditto. * gcc/tree-into-ssa.c (rewrite_into_ssa): Ditto. * gcc/tree-complex.c (tree_lower_complex): Ditto. (tree_lower_complex_O0): Ditto. * gcc/tracer.c (rest_of_handle_tracer): Ditto. * gcc/postreload-gcse.c (rest_of_handle_gcse2): Ditto. * gcc/postreload.c (rest_of_handle_postreload): Ditto. * gcc/tree-tailcall.c (execute_tail_recursion): Ditto. (execute_tail_calls): Ditto. * gcc/tree-ssa-loop-ch.c (copy_loop_headers): Ditto. * gcc/tree.h (init_function_for_compilation): Ditto. * gcc/ipa-cp.c (ipcp_driver): Ditto. * gcc/tree-scalar-evolution.c (scev_const_prop): Ditto. * gcc/tree-scalar-evolution.h (scev_const_prop): Ditto. * gcc/final.c (compute_alignments): Ditto. (rest_of_handle_final): Ditto. (rest_of_handle_shorten_branches): Ditto. (rest_of_clean_state): Ditto. * gcc/omp-low.c (execute_expand_omp): Ditto. (execute_lower_omp): Ditto. * gcc/tree-ssa-dse.c (tree_ssa_dse): Ditto. * gcc/ipa-reference.c (static_execute): Ditto. * gcc/tree-ssa-uncprop.c (tree_ssa_uncprop): Ditto. * gcc/reorg.c (rest_of_handle_delay_slots): Ditto. (rest_of_handle_machine_reorg): Ditto. * gcc/cgraphunit.c (rebuild_cgraph_edges): Ditto. * gcc/flow.c (recompute_reg_usage): Ditto. (rest_of_handle_remove_death_notes): Ditto. (rest_of_handle_life): Ditto. (rest_of_handle_flow2): Ditto. * gcc/tree-ssa-copyrename.c (rename_ssa_copies): Ditto. * gcc/tree-ssa-ccp.c (do_ssa_ccp): Ditto. (do_ssa_store_ccp): Ditto. (execute_fold_all_builtins): Ditto. * gcc/mode-switching.c (rest_of_handle_mode_switching): Ditto. * gcc/modulo-sched.c (rest_of_handle_sms): Ditto. * gcc/ipa-pure-const.c (static_execute): Ditto. * gcc/cse.c (rest_of_handle_cse): Ditto. (rest_of_handle_cse2): Ditto. * gcc/web.c (rest_of_handle_web): Ditto. * gcc/tree-stdarg.c (execute_optimize_stdarg): Ditto. * gcc/tree-ssa-math-opts.c (execute_cse_reciprocals): Ditto. * gcc/tree-ssa-dom.c (tree_ssa_dominator_optimize): Ditto. * gcc/tree-nrv.c (tree_nrv): Ditto. (execute_return_slot_opt): Ditto. * gcc/tree-ssa-alias.c (compute_may_aliases): Ditto. (create_structure_vars): Ditto. * gcc/loop-init.c (rtl_loop_init): Ditto. (rtl_loop_done): Ditto. (rtl_move_loop_invariants): Ditto. (rtl_unswitch): Ditto. (rtl_unroll_and_peel_loops): Ditto. (rtl_doloop): Ditto. * gcc/gimple-low.c (lower_function_body): Ditto. (mark_used_blocks): Ditto. * gcc/tree-ssa-sink.c (execute_sink_code): Ditto. * gcc/ipa-inline.c (cgraph_decide_inlining): Ditto. (cgraph_early_inlining): Ditto. * gcc/global.c (rest_of_handle_global_alloc): Ditto. * gcc/jump.c (cleanup_barriers): Ditto. (purge_line_number_notes): Ditto. * gcc/ifcvt.c (rest_of_handle_if_conversion): Ditto. (rest_of_handle_if_after_reload): Ditto. * gcc/tree-ssa-loop.c (tree_ssa_loop_init): Ditto. (tree_ssa_loop_im): Ditto. (tree_ssa_loop_unswitch): Ditto. (tree_vectorize): Ditto. (tree_linear_transform): Ditto. (tree_ssa_loop_ivcanon): Ditto. (tree_ssa_empty_loop): Ditto. (tree_ssa_loop_bounds): Ditto. (tree_complete_unroll): Ditto. (tree_ssa_loop_prefetch): Ditto. (tree_ssa_loop_ivopts): Ditto. (tree_ssa_loop_done): Ditto. * gcc/predict.c (tree_estimate_probability): Ditto. * gcc/recog.c (split_all_insns_noflow): Ditto. (rest_of_handle_peephole2): Ditto. (rest_of_handle_split_all_insns): Ditto. * gcc/tree-eh.c (lower_eh_constructs): Ditto. * gcc/regmove.c (rest_of_handle_regmove): Ditto. (rest_of_handle_stack_adjustments): Ditto. * gcc/local-alloc.c (rest_of_handle_local_alloc): Ditto. * gcc/function.c (instantiate_virtual_regs): Ditto. (init_function_for_compilation): Ditto. (rest_of_handle_check_leaf_regs): Ditto. * gcc/gcse.c (rest_of_handle_jump_bypass): Ditto. (rest_of_handle_gcse): Ditto. * gcc/ipa-type-escape.c (type_escape_execute): Ditto. * gcc/alias.c (rest_of_handle_cfg): Ditto. * gcc/tree-if-conv.c (main_tree_if_conversion): Ditto. * gcc/profile.c (rest_of_handle_branch_prob): Ditto. * gcc/tree-ssa-phiopt.c (tree_ssa_phiopt): Ditto. * gcc/rtl-factoring.c (rest_of_rtl_seqabstr): Ditto. * gcc/bt-load.c (rest_of_handle_branch_target_load_optimize): Ditto * gcc/tree-dfa.c (find_referenced_vars): Ditto. * gcc/except.c (set_nothrow_function_flags): Ditto. (convert_to_eh_region_ranges): Ditto. (rest_of_handle_eh): Ditto. * gcc/emit-rtl.c (unshare_all_rtl): Ditto. (remove_unnecessary_notes): Ditto. * gcc/except.h (set_nothrow_function_flags): Ditto. (convert_to_eh_region_ranges): Ditto. * gcc/cfgexpand.c (tree_expand_cfg): Ditto. * gcc/tree-cfgcleanup.c (merge_phi_nodes): Ditto. * gcc/tree-ssa-pre.c (do_pre): Ditto. (execute_fre): Ditto. * gcc/cfgcleanup.c (rest_of_handle_jump): Ditto. (rest_of_handle_jump2): Ditto. * gcc/tree-sra.c (tree_sra): Ditto. * gcc/tree-mudflap.c (execute_mudflap_function_ops): Ditto. (execute_mudflap_function_decls): Ditto. * gcc/tree-ssa-copy.c (do_copy_prop): Ditto. (do_store_copy_prop): Ditto. * gcc/ipa-prop.h (ipcp_driver): Ditto. * gcc/cfglayout.c (insn_locators_initialize): Ditto. * gcc/tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_vars): Ditto. * gcc/cfglayout.h (insn_locators_initialize): Ditto. * gcc/tree-ssa-dce.c (tree_ssa_dce): Ditto. * gcc/tree-ssa.c (execute_early_warn_uninitialized): Ditto. (execute_late_warn_uninitialized): Ditto. * gcc/rtl.h (cleanup_barriers): Ditto. (split_all_insns_noflow): Ditto. (purge_line_number_notes): Ditto. (unshare_all_rtl): Ditto. (remove_unnecessary_notes): Ditto. (recompute_reg_usage): Ditto. (variable_tracking_main): Ditto. * gcc/integrate.c (emit_initial_value_sets): Ditto. * gcc/integrate.h (emit_initial_value_sets): Ditto. * gcc/tree-optimize.c (execute_free_datastructures): Ditto (execute_free_cfg_annotations): Ditto. (execute_fixup_cfg): Ditto. (execute_cleanup_cfg_pre_ipa): Ditto. (execute_cleanup_cfg_post_optimizing): Ditto. (execute_init_datastructures): Ditto. * gcc/tree-object-size.c (compute_object_sizes): Ditto. * gcc/combine.c (rest_of_handle_combine): Ditto. * gcc/tree-outof-ssa.c (rewrite_out_of_ssa): Ditto. * gcc/bb-reorder.c (duplicate_computed_gotos): Ditto. (rest_of_handle_reorder_blocks): Ditto. (rest_of_handle_partition_blocks): Ditto. * gcc/var-tracking.c (variable_tracking_main): Ditto. * gcc/tree-profile.c (tree_profiling): Ditto. * gcc/tree-vect-generic.c (expand_vector_operations): Ditto. * gcc/reg-stack.c (rest_of_handle_stack_regs): Ditto. * gcc/sched-rgn.c (rest_of_handle_sched): Ditto. (rest_of_handle_sched2): Ditto. * gcc/basic-block.h (free_bb_insn): Ditto. * gcc/tree-ssa-structalias.c (ipa_pta_execute): Ditto. * gcc/tree-cfg.c (execute_build_cfg): Ditto. (remove_useless_stmts): Ditto. (split_critical_edges): Ditto. (execute_warn_function_return): Ditto. (execute_warn_function_noreturn): Ditto. * gcc/tree-ssa-reassoc.c (execute_reassoc): Ditto. * gcc/cfgrtl.c (free_bb_for_insn): Ditto. * gcc/passes.c (execute_one_pass): Run additional todos returned by execute function. * gcc/tree-pass.h (struct tree_opt_pass): Make execute return a value. From-SVN: r111643
2006-03-02 20:00:11 +01:00
return 0;
}
static bool
gate_pre (void)
{
return flag_tree_pre != 0;
}
struct tree_opt_pass pass_pre =
{
"pre", /* name */
gate_pre, /* gate */
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
do_pre, /* execute */
NULL, /* sub */
NULL, /* next */
0, /* static_pass_number */
TV_TREE_PRE, /* tv_id */
PROP_no_crit_edges | PROP_cfg
| PROP_ssa | PROP_alias, /* properties_required */
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
2006-07-04 23:23:03 +02:00
TODO_update_ssa_only_virtuals | TODO_dump_func | TODO_ggc_collect
| TODO_verify_ssa, /* todo_flags_finish */
Unify the management of RTL and tree-level dump files. 2004-09-06 Paolo Bonzini <bonzini@gnu.org> Unify the management of RTL and tree-level dump files. * cfgexpand.c (tree_expand_cfg): Fix incorrect comment. Don't print function name to the dump file, the pass manager would do this for us. Add code from the top of rest_of_compilation, up to the initial RTL dump. * passes.c (rest_of_handle_jump): Call fixup_tail_calls and close the DFI_sibling dump file. (rest_of_compilation): Don't do that here. Remove code up to the initial RTL dump. (init_optimization_passes): Remove. (pass_rest_of_compilation): Change pass name to NULL. * toplev.c (lang_dependent_init): Do not use an empty dump file prefix. Do not call init_optimization_passes. * toplev.h (init_optimization_passes): Remove. * graph.c (print_rtl_graph_with_bb, clean_graph_dump_file, finish_graph_dump_file): Remove SUFFIX parameter. * graph.h (print_rtl_graph_with_bb, clean_graph_dump_file, finish_graph_dump_file): Likewise. * tree-pass.h (struct tree_opt_pass): Add `letter' field. * cfgexpand.c (pass_expand): Adjust. * gimple-low.c (pass_lower_cf, pass_remove_useless_vars): Adjust. * passes.c (pass_rest_of_compilation): Adjust. * predict.c (pass_profile): Adjust. * tree-alias-common.c (pass_build_pta, pass_del_pta): Adjust. * tree-cfg.c (pass_build_cfg, pass_remove_useless_stmts, pass_split_crit_edges, pass_warn_function_return): Adjust. * tree-complex.c (pass_lower_vector_ssa, pass_pre_expand): Adjust. * tree-dfa.c (pass_referenced_vars): Adjust. * tree-eh.c (pass_lower_eh): Adjust. * tree-if-conv.c (pass_build_ssa): Adjust. * tree-into-ssa.c (pass_build_ssa): Adjust. * tree-mudflap.c (pass_mudflap_1, pass_mudflap_2): Adjust. * tree-nomudflap.c (pass_mudflap_1, pass_mudflap_2): Adjust. * tree-nrv.c (pass_nrv): Adjust. * tree-optimize.c (pass_gimple, pass_all_optimizations, pass_cleanup_cfg_post_optimizing, pass_free_datastructures, pass_init_datastructures): Adjust. * tree-outof-ssa.c (pass_del_ssa): Adjust. * tree-profile.c (pass_tree_profile): Adjust. * tree-sra.c (pass_sra): Adjust. * tree-ssa-alias.c (pass_may_alias): Adjust. * tree-ssa-ccp.c (pass_ccp, pass_fold_builtins): Adjust. * tree-ssa-copyrename.c (pass_rename_ssa_copies): Adjust. * tree-ssa-dce.c (pass_dce, pass_cd_dce): Adjust. * tree-ssa-dom.c (pass_dominator): Adjust. * tree-ssa-dse.c (pass_dse): Adjust. * tree-ssa-forwprop.c (pass_forwprop): Adjust. * tree-ssa-if-conv.c (pass_if_conversion): Adjust. * tree-ssa-loop-ch.c (pass_ch): Adjust. * tree-ssa-loop.c (pass_loop, pass_loop_init, pass_lim, pass_loop_done, pass_complete_unroll, pass_iv_canon, pass_iv_optimize, pass_vectorize): Adjust. * tree-ssa-phiopt.c (pass_phiopt): Adjust. * tree-ssa-pre.c (pass_pre, pass_fre): Adjust. * tree-ssa.c (pass_redundant_phi, pass_early_warn_uninitialized, pass_late_warn_uninnitialized): Adjust. * tree-tailcall.c (pass_tail_recursion, pass_tail_calls): Adjust. * Makefile.in (tree-dump.o): Add new dependencies. * cgraph.c (cgraph_remove_node): TDF_all -> TDF_tree_all. * cgraphunit.c (cgraph_preserve_function_body_p, cgraph_optimize): Likewise. * toplev.c (dump_file_name): New. * tree-dump.c (dump_enable_all): Add LETTER parameter. (struct dump_file_info): Add NUM and LETTER fields. (dump_files): Adjust and add RTL dump files. (dump_register): Add NUM and LETTER fields. (get_dump_file_name, dump_initialized_p, enable_rtl_dump_file): New. (dump_begin): Use get_dump_file_name. (dump_switch_p_1): Adjust call to dump_enable_all. * tree-dump.h (dump_register): Adjust prototype. * tree-optimize.c (register_one_dump_file): Take dump file index. Support flags for RTL dumps. (register_dump_files): Fill in NUM field of struct dump_file_info. Track properties both when the gate is executed and when it is not. (execute_todo): Dump RTL. Add PROPERTIES parameter. (execute_one_pass): Pass properties to execute_todo. Handle VCG dumps of RTL. * tree-pass.h (dump_file_name): New. * tree.h (TDF_TREE, TDF_RTL, get_dump_file_name, dump_initialized_p): New. * Makefile.in (passes.o): Add new dependencies. * passes.c (struct dump_file_info, enum dump_file_index, dump_file_tbl, init_optimization_passes): Remove. (open_dump_file, close_dump_file): Use tree-dumping infrastructure. (rest_of_handle_new_regalloc, rest_of_handle_old_regalloc): Use dump_enabled_p. (finish_optimization_passes): Update finish_graph_dump_file loop. (enable_rtl_dump_file): Remove. * tree-dump.c (dump_files): Adjust and add RTL dump files. (enable_rtl_dump_file): Add here. * tree.h (enum tree_dump_index): Add RTL dump file indices. * doc/invoke.texi (Debugging options): Document new RTL debugging options. Update. From-SVN: r87113
2004-09-06 12:08:17 +02:00
0 /* letter */
};
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
/* Gate and execute functions for FRE. */
tree-vrp.c (execute_vrp): Return value. 2006-03-02 Daniel Berlin <dberlin@dberlin.org> * gcc/tree-vrp.c (execute_vrp): Return value. * gcc/regrename.c (rest_of_handle_regrename): Ditto. * gcc/tree-into-ssa.c (rewrite_into_ssa): Ditto. * gcc/tree-complex.c (tree_lower_complex): Ditto. (tree_lower_complex_O0): Ditto. * gcc/tracer.c (rest_of_handle_tracer): Ditto. * gcc/postreload-gcse.c (rest_of_handle_gcse2): Ditto. * gcc/postreload.c (rest_of_handle_postreload): Ditto. * gcc/tree-tailcall.c (execute_tail_recursion): Ditto. (execute_tail_calls): Ditto. * gcc/tree-ssa-loop-ch.c (copy_loop_headers): Ditto. * gcc/tree.h (init_function_for_compilation): Ditto. * gcc/ipa-cp.c (ipcp_driver): Ditto. * gcc/tree-scalar-evolution.c (scev_const_prop): Ditto. * gcc/tree-scalar-evolution.h (scev_const_prop): Ditto. * gcc/final.c (compute_alignments): Ditto. (rest_of_handle_final): Ditto. (rest_of_handle_shorten_branches): Ditto. (rest_of_clean_state): Ditto. * gcc/omp-low.c (execute_expand_omp): Ditto. (execute_lower_omp): Ditto. * gcc/tree-ssa-dse.c (tree_ssa_dse): Ditto. * gcc/ipa-reference.c (static_execute): Ditto. * gcc/tree-ssa-uncprop.c (tree_ssa_uncprop): Ditto. * gcc/reorg.c (rest_of_handle_delay_slots): Ditto. (rest_of_handle_machine_reorg): Ditto. * gcc/cgraphunit.c (rebuild_cgraph_edges): Ditto. * gcc/flow.c (recompute_reg_usage): Ditto. (rest_of_handle_remove_death_notes): Ditto. (rest_of_handle_life): Ditto. (rest_of_handle_flow2): Ditto. * gcc/tree-ssa-copyrename.c (rename_ssa_copies): Ditto. * gcc/tree-ssa-ccp.c (do_ssa_ccp): Ditto. (do_ssa_store_ccp): Ditto. (execute_fold_all_builtins): Ditto. * gcc/mode-switching.c (rest_of_handle_mode_switching): Ditto. * gcc/modulo-sched.c (rest_of_handle_sms): Ditto. * gcc/ipa-pure-const.c (static_execute): Ditto. * gcc/cse.c (rest_of_handle_cse): Ditto. (rest_of_handle_cse2): Ditto. * gcc/web.c (rest_of_handle_web): Ditto. * gcc/tree-stdarg.c (execute_optimize_stdarg): Ditto. * gcc/tree-ssa-math-opts.c (execute_cse_reciprocals): Ditto. * gcc/tree-ssa-dom.c (tree_ssa_dominator_optimize): Ditto. * gcc/tree-nrv.c (tree_nrv): Ditto. (execute_return_slot_opt): Ditto. * gcc/tree-ssa-alias.c (compute_may_aliases): Ditto. (create_structure_vars): Ditto. * gcc/loop-init.c (rtl_loop_init): Ditto. (rtl_loop_done): Ditto. (rtl_move_loop_invariants): Ditto. (rtl_unswitch): Ditto. (rtl_unroll_and_peel_loops): Ditto. (rtl_doloop): Ditto. * gcc/gimple-low.c (lower_function_body): Ditto. (mark_used_blocks): Ditto. * gcc/tree-ssa-sink.c (execute_sink_code): Ditto. * gcc/ipa-inline.c (cgraph_decide_inlining): Ditto. (cgraph_early_inlining): Ditto. * gcc/global.c (rest_of_handle_global_alloc): Ditto. * gcc/jump.c (cleanup_barriers): Ditto. (purge_line_number_notes): Ditto. * gcc/ifcvt.c (rest_of_handle_if_conversion): Ditto. (rest_of_handle_if_after_reload): Ditto. * gcc/tree-ssa-loop.c (tree_ssa_loop_init): Ditto. (tree_ssa_loop_im): Ditto. (tree_ssa_loop_unswitch): Ditto. (tree_vectorize): Ditto. (tree_linear_transform): Ditto. (tree_ssa_loop_ivcanon): Ditto. (tree_ssa_empty_loop): Ditto. (tree_ssa_loop_bounds): Ditto. (tree_complete_unroll): Ditto. (tree_ssa_loop_prefetch): Ditto. (tree_ssa_loop_ivopts): Ditto. (tree_ssa_loop_done): Ditto. * gcc/predict.c (tree_estimate_probability): Ditto. * gcc/recog.c (split_all_insns_noflow): Ditto. (rest_of_handle_peephole2): Ditto. (rest_of_handle_split_all_insns): Ditto. * gcc/tree-eh.c (lower_eh_constructs): Ditto. * gcc/regmove.c (rest_of_handle_regmove): Ditto. (rest_of_handle_stack_adjustments): Ditto. * gcc/local-alloc.c (rest_of_handle_local_alloc): Ditto. * gcc/function.c (instantiate_virtual_regs): Ditto. (init_function_for_compilation): Ditto. (rest_of_handle_check_leaf_regs): Ditto. * gcc/gcse.c (rest_of_handle_jump_bypass): Ditto. (rest_of_handle_gcse): Ditto. * gcc/ipa-type-escape.c (type_escape_execute): Ditto. * gcc/alias.c (rest_of_handle_cfg): Ditto. * gcc/tree-if-conv.c (main_tree_if_conversion): Ditto. * gcc/profile.c (rest_of_handle_branch_prob): Ditto. * gcc/tree-ssa-phiopt.c (tree_ssa_phiopt): Ditto. * gcc/rtl-factoring.c (rest_of_rtl_seqabstr): Ditto. * gcc/bt-load.c (rest_of_handle_branch_target_load_optimize): Ditto * gcc/tree-dfa.c (find_referenced_vars): Ditto. * gcc/except.c (set_nothrow_function_flags): Ditto. (convert_to_eh_region_ranges): Ditto. (rest_of_handle_eh): Ditto. * gcc/emit-rtl.c (unshare_all_rtl): Ditto. (remove_unnecessary_notes): Ditto. * gcc/except.h (set_nothrow_function_flags): Ditto. (convert_to_eh_region_ranges): Ditto. * gcc/cfgexpand.c (tree_expand_cfg): Ditto. * gcc/tree-cfgcleanup.c (merge_phi_nodes): Ditto. * gcc/tree-ssa-pre.c (do_pre): Ditto. (execute_fre): Ditto. * gcc/cfgcleanup.c (rest_of_handle_jump): Ditto. (rest_of_handle_jump2): Ditto. * gcc/tree-sra.c (tree_sra): Ditto. * gcc/tree-mudflap.c (execute_mudflap_function_ops): Ditto. (execute_mudflap_function_decls): Ditto. * gcc/tree-ssa-copy.c (do_copy_prop): Ditto. (do_store_copy_prop): Ditto. * gcc/ipa-prop.h (ipcp_driver): Ditto. * gcc/cfglayout.c (insn_locators_initialize): Ditto. * gcc/tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_vars): Ditto. * gcc/cfglayout.h (insn_locators_initialize): Ditto. * gcc/tree-ssa-dce.c (tree_ssa_dce): Ditto. * gcc/tree-ssa.c (execute_early_warn_uninitialized): Ditto. (execute_late_warn_uninitialized): Ditto. * gcc/rtl.h (cleanup_barriers): Ditto. (split_all_insns_noflow): Ditto. (purge_line_number_notes): Ditto. (unshare_all_rtl): Ditto. (remove_unnecessary_notes): Ditto. (recompute_reg_usage): Ditto. (variable_tracking_main): Ditto. * gcc/integrate.c (emit_initial_value_sets): Ditto. * gcc/integrate.h (emit_initial_value_sets): Ditto. * gcc/tree-optimize.c (execute_free_datastructures): Ditto (execute_free_cfg_annotations): Ditto. (execute_fixup_cfg): Ditto. (execute_cleanup_cfg_pre_ipa): Ditto. (execute_cleanup_cfg_post_optimizing): Ditto. (execute_init_datastructures): Ditto. * gcc/tree-object-size.c (compute_object_sizes): Ditto. * gcc/combine.c (rest_of_handle_combine): Ditto. * gcc/tree-outof-ssa.c (rewrite_out_of_ssa): Ditto. * gcc/bb-reorder.c (duplicate_computed_gotos): Ditto. (rest_of_handle_reorder_blocks): Ditto. (rest_of_handle_partition_blocks): Ditto. * gcc/var-tracking.c (variable_tracking_main): Ditto. * gcc/tree-profile.c (tree_profiling): Ditto. * gcc/tree-vect-generic.c (expand_vector_operations): Ditto. * gcc/reg-stack.c (rest_of_handle_stack_regs): Ditto. * gcc/sched-rgn.c (rest_of_handle_sched): Ditto. (rest_of_handle_sched2): Ditto. * gcc/basic-block.h (free_bb_insn): Ditto. * gcc/tree-ssa-structalias.c (ipa_pta_execute): Ditto. * gcc/tree-cfg.c (execute_build_cfg): Ditto. (remove_useless_stmts): Ditto. (split_critical_edges): Ditto. (execute_warn_function_return): Ditto. (execute_warn_function_noreturn): Ditto. * gcc/tree-ssa-reassoc.c (execute_reassoc): Ditto. * gcc/cfgrtl.c (free_bb_for_insn): Ditto. * gcc/passes.c (execute_one_pass): Run additional todos returned by execute function. * gcc/tree-pass.h (struct tree_opt_pass): Make execute return a value. From-SVN: r111643
2006-03-02 20:00:11 +01:00
static unsigned int
execute_fre (void)
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
{
execute_pre (true);
tree-vrp.c (execute_vrp): Return value. 2006-03-02 Daniel Berlin <dberlin@dberlin.org> * gcc/tree-vrp.c (execute_vrp): Return value. * gcc/regrename.c (rest_of_handle_regrename): Ditto. * gcc/tree-into-ssa.c (rewrite_into_ssa): Ditto. * gcc/tree-complex.c (tree_lower_complex): Ditto. (tree_lower_complex_O0): Ditto. * gcc/tracer.c (rest_of_handle_tracer): Ditto. * gcc/postreload-gcse.c (rest_of_handle_gcse2): Ditto. * gcc/postreload.c (rest_of_handle_postreload): Ditto. * gcc/tree-tailcall.c (execute_tail_recursion): Ditto. (execute_tail_calls): Ditto. * gcc/tree-ssa-loop-ch.c (copy_loop_headers): Ditto. * gcc/tree.h (init_function_for_compilation): Ditto. * gcc/ipa-cp.c (ipcp_driver): Ditto. * gcc/tree-scalar-evolution.c (scev_const_prop): Ditto. * gcc/tree-scalar-evolution.h (scev_const_prop): Ditto. * gcc/final.c (compute_alignments): Ditto. (rest_of_handle_final): Ditto. (rest_of_handle_shorten_branches): Ditto. (rest_of_clean_state): Ditto. * gcc/omp-low.c (execute_expand_omp): Ditto. (execute_lower_omp): Ditto. * gcc/tree-ssa-dse.c (tree_ssa_dse): Ditto. * gcc/ipa-reference.c (static_execute): Ditto. * gcc/tree-ssa-uncprop.c (tree_ssa_uncprop): Ditto. * gcc/reorg.c (rest_of_handle_delay_slots): Ditto. (rest_of_handle_machine_reorg): Ditto. * gcc/cgraphunit.c (rebuild_cgraph_edges): Ditto. * gcc/flow.c (recompute_reg_usage): Ditto. (rest_of_handle_remove_death_notes): Ditto. (rest_of_handle_life): Ditto. (rest_of_handle_flow2): Ditto. * gcc/tree-ssa-copyrename.c (rename_ssa_copies): Ditto. * gcc/tree-ssa-ccp.c (do_ssa_ccp): Ditto. (do_ssa_store_ccp): Ditto. (execute_fold_all_builtins): Ditto. * gcc/mode-switching.c (rest_of_handle_mode_switching): Ditto. * gcc/modulo-sched.c (rest_of_handle_sms): Ditto. * gcc/ipa-pure-const.c (static_execute): Ditto. * gcc/cse.c (rest_of_handle_cse): Ditto. (rest_of_handle_cse2): Ditto. * gcc/web.c (rest_of_handle_web): Ditto. * gcc/tree-stdarg.c (execute_optimize_stdarg): Ditto. * gcc/tree-ssa-math-opts.c (execute_cse_reciprocals): Ditto. * gcc/tree-ssa-dom.c (tree_ssa_dominator_optimize): Ditto. * gcc/tree-nrv.c (tree_nrv): Ditto. (execute_return_slot_opt): Ditto. * gcc/tree-ssa-alias.c (compute_may_aliases): Ditto. (create_structure_vars): Ditto. * gcc/loop-init.c (rtl_loop_init): Ditto. (rtl_loop_done): Ditto. (rtl_move_loop_invariants): Ditto. (rtl_unswitch): Ditto. (rtl_unroll_and_peel_loops): Ditto. (rtl_doloop): Ditto. * gcc/gimple-low.c (lower_function_body): Ditto. (mark_used_blocks): Ditto. * gcc/tree-ssa-sink.c (execute_sink_code): Ditto. * gcc/ipa-inline.c (cgraph_decide_inlining): Ditto. (cgraph_early_inlining): Ditto. * gcc/global.c (rest_of_handle_global_alloc): Ditto. * gcc/jump.c (cleanup_barriers): Ditto. (purge_line_number_notes): Ditto. * gcc/ifcvt.c (rest_of_handle_if_conversion): Ditto. (rest_of_handle_if_after_reload): Ditto. * gcc/tree-ssa-loop.c (tree_ssa_loop_init): Ditto. (tree_ssa_loop_im): Ditto. (tree_ssa_loop_unswitch): Ditto. (tree_vectorize): Ditto. (tree_linear_transform): Ditto. (tree_ssa_loop_ivcanon): Ditto. (tree_ssa_empty_loop): Ditto. (tree_ssa_loop_bounds): Ditto. (tree_complete_unroll): Ditto. (tree_ssa_loop_prefetch): Ditto. (tree_ssa_loop_ivopts): Ditto. (tree_ssa_loop_done): Ditto. * gcc/predict.c (tree_estimate_probability): Ditto. * gcc/recog.c (split_all_insns_noflow): Ditto. (rest_of_handle_peephole2): Ditto. (rest_of_handle_split_all_insns): Ditto. * gcc/tree-eh.c (lower_eh_constructs): Ditto. * gcc/regmove.c (rest_of_handle_regmove): Ditto. (rest_of_handle_stack_adjustments): Ditto. * gcc/local-alloc.c (rest_of_handle_local_alloc): Ditto. * gcc/function.c (instantiate_virtual_regs): Ditto. (init_function_for_compilation): Ditto. (rest_of_handle_check_leaf_regs): Ditto. * gcc/gcse.c (rest_of_handle_jump_bypass): Ditto. (rest_of_handle_gcse): Ditto. * gcc/ipa-type-escape.c (type_escape_execute): Ditto. * gcc/alias.c (rest_of_handle_cfg): Ditto. * gcc/tree-if-conv.c (main_tree_if_conversion): Ditto. * gcc/profile.c (rest_of_handle_branch_prob): Ditto. * gcc/tree-ssa-phiopt.c (tree_ssa_phiopt): Ditto. * gcc/rtl-factoring.c (rest_of_rtl_seqabstr): Ditto. * gcc/bt-load.c (rest_of_handle_branch_target_load_optimize): Ditto * gcc/tree-dfa.c (find_referenced_vars): Ditto. * gcc/except.c (set_nothrow_function_flags): Ditto. (convert_to_eh_region_ranges): Ditto. (rest_of_handle_eh): Ditto. * gcc/emit-rtl.c (unshare_all_rtl): Ditto. (remove_unnecessary_notes): Ditto. * gcc/except.h (set_nothrow_function_flags): Ditto. (convert_to_eh_region_ranges): Ditto. * gcc/cfgexpand.c (tree_expand_cfg): Ditto. * gcc/tree-cfgcleanup.c (merge_phi_nodes): Ditto. * gcc/tree-ssa-pre.c (do_pre): Ditto. (execute_fre): Ditto. * gcc/cfgcleanup.c (rest_of_handle_jump): Ditto. (rest_of_handle_jump2): Ditto. * gcc/tree-sra.c (tree_sra): Ditto. * gcc/tree-mudflap.c (execute_mudflap_function_ops): Ditto. (execute_mudflap_function_decls): Ditto. * gcc/tree-ssa-copy.c (do_copy_prop): Ditto. (do_store_copy_prop): Ditto. * gcc/ipa-prop.h (ipcp_driver): Ditto. * gcc/cfglayout.c (insn_locators_initialize): Ditto. * gcc/tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_vars): Ditto. * gcc/cfglayout.h (insn_locators_initialize): Ditto. * gcc/tree-ssa-dce.c (tree_ssa_dce): Ditto. * gcc/tree-ssa.c (execute_early_warn_uninitialized): Ditto. (execute_late_warn_uninitialized): Ditto. * gcc/rtl.h (cleanup_barriers): Ditto. (split_all_insns_noflow): Ditto. (purge_line_number_notes): Ditto. (unshare_all_rtl): Ditto. (remove_unnecessary_notes): Ditto. (recompute_reg_usage): Ditto. (variable_tracking_main): Ditto. * gcc/integrate.c (emit_initial_value_sets): Ditto. * gcc/integrate.h (emit_initial_value_sets): Ditto. * gcc/tree-optimize.c (execute_free_datastructures): Ditto (execute_free_cfg_annotations): Ditto. (execute_fixup_cfg): Ditto. (execute_cleanup_cfg_pre_ipa): Ditto. (execute_cleanup_cfg_post_optimizing): Ditto. (execute_init_datastructures): Ditto. * gcc/tree-object-size.c (compute_object_sizes): Ditto. * gcc/combine.c (rest_of_handle_combine): Ditto. * gcc/tree-outof-ssa.c (rewrite_out_of_ssa): Ditto. * gcc/bb-reorder.c (duplicate_computed_gotos): Ditto. (rest_of_handle_reorder_blocks): Ditto. (rest_of_handle_partition_blocks): Ditto. * gcc/var-tracking.c (variable_tracking_main): Ditto. * gcc/tree-profile.c (tree_profiling): Ditto. * gcc/tree-vect-generic.c (expand_vector_operations): Ditto. * gcc/reg-stack.c (rest_of_handle_stack_regs): Ditto. * gcc/sched-rgn.c (rest_of_handle_sched): Ditto. (rest_of_handle_sched2): Ditto. * gcc/basic-block.h (free_bb_insn): Ditto. * gcc/tree-ssa-structalias.c (ipa_pta_execute): Ditto. * gcc/tree-cfg.c (execute_build_cfg): Ditto. (remove_useless_stmts): Ditto. (split_critical_edges): Ditto. (execute_warn_function_return): Ditto. (execute_warn_function_noreturn): Ditto. * gcc/tree-ssa-reassoc.c (execute_reassoc): Ditto. * gcc/cfgrtl.c (free_bb_for_insn): Ditto. * gcc/passes.c (execute_one_pass): Run additional todos returned by execute function. * gcc/tree-pass.h (struct tree_opt_pass): Make execute return a value. From-SVN: r111643
2006-03-02 20:00:11 +01:00
return 0;
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
}
static bool
gate_fre (void)
{
return flag_tree_fre != 0;
}
struct tree_opt_pass pass_fre =
{
"fre", /* name */
gate_fre, /* gate */
execute_fre, /* execute */
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
NULL, /* sub */
NULL, /* next */
0, /* static_pass_number */
TV_TREE_FRE, /* tv_id */
PROP_cfg | PROP_ssa | PROP_alias, /* properties_required */
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
Unify the management of RTL and tree-level dump files. 2004-09-06 Paolo Bonzini <bonzini@gnu.org> Unify the management of RTL and tree-level dump files. * cfgexpand.c (tree_expand_cfg): Fix incorrect comment. Don't print function name to the dump file, the pass manager would do this for us. Add code from the top of rest_of_compilation, up to the initial RTL dump. * passes.c (rest_of_handle_jump): Call fixup_tail_calls and close the DFI_sibling dump file. (rest_of_compilation): Don't do that here. Remove code up to the initial RTL dump. (init_optimization_passes): Remove. (pass_rest_of_compilation): Change pass name to NULL. * toplev.c (lang_dependent_init): Do not use an empty dump file prefix. Do not call init_optimization_passes. * toplev.h (init_optimization_passes): Remove. * graph.c (print_rtl_graph_with_bb, clean_graph_dump_file, finish_graph_dump_file): Remove SUFFIX parameter. * graph.h (print_rtl_graph_with_bb, clean_graph_dump_file, finish_graph_dump_file): Likewise. * tree-pass.h (struct tree_opt_pass): Add `letter' field. * cfgexpand.c (pass_expand): Adjust. * gimple-low.c (pass_lower_cf, pass_remove_useless_vars): Adjust. * passes.c (pass_rest_of_compilation): Adjust. * predict.c (pass_profile): Adjust. * tree-alias-common.c (pass_build_pta, pass_del_pta): Adjust. * tree-cfg.c (pass_build_cfg, pass_remove_useless_stmts, pass_split_crit_edges, pass_warn_function_return): Adjust. * tree-complex.c (pass_lower_vector_ssa, pass_pre_expand): Adjust. * tree-dfa.c (pass_referenced_vars): Adjust. * tree-eh.c (pass_lower_eh): Adjust. * tree-if-conv.c (pass_build_ssa): Adjust. * tree-into-ssa.c (pass_build_ssa): Adjust. * tree-mudflap.c (pass_mudflap_1, pass_mudflap_2): Adjust. * tree-nomudflap.c (pass_mudflap_1, pass_mudflap_2): Adjust. * tree-nrv.c (pass_nrv): Adjust. * tree-optimize.c (pass_gimple, pass_all_optimizations, pass_cleanup_cfg_post_optimizing, pass_free_datastructures, pass_init_datastructures): Adjust. * tree-outof-ssa.c (pass_del_ssa): Adjust. * tree-profile.c (pass_tree_profile): Adjust. * tree-sra.c (pass_sra): Adjust. * tree-ssa-alias.c (pass_may_alias): Adjust. * tree-ssa-ccp.c (pass_ccp, pass_fold_builtins): Adjust. * tree-ssa-copyrename.c (pass_rename_ssa_copies): Adjust. * tree-ssa-dce.c (pass_dce, pass_cd_dce): Adjust. * tree-ssa-dom.c (pass_dominator): Adjust. * tree-ssa-dse.c (pass_dse): Adjust. * tree-ssa-forwprop.c (pass_forwprop): Adjust. * tree-ssa-if-conv.c (pass_if_conversion): Adjust. * tree-ssa-loop-ch.c (pass_ch): Adjust. * tree-ssa-loop.c (pass_loop, pass_loop_init, pass_lim, pass_loop_done, pass_complete_unroll, pass_iv_canon, pass_iv_optimize, pass_vectorize): Adjust. * tree-ssa-phiopt.c (pass_phiopt): Adjust. * tree-ssa-pre.c (pass_pre, pass_fre): Adjust. * tree-ssa.c (pass_redundant_phi, pass_early_warn_uninitialized, pass_late_warn_uninnitialized): Adjust. * tree-tailcall.c (pass_tail_recursion, pass_tail_calls): Adjust. * Makefile.in (tree-dump.o): Add new dependencies. * cgraph.c (cgraph_remove_node): TDF_all -> TDF_tree_all. * cgraphunit.c (cgraph_preserve_function_body_p, cgraph_optimize): Likewise. * toplev.c (dump_file_name): New. * tree-dump.c (dump_enable_all): Add LETTER parameter. (struct dump_file_info): Add NUM and LETTER fields. (dump_files): Adjust and add RTL dump files. (dump_register): Add NUM and LETTER fields. (get_dump_file_name, dump_initialized_p, enable_rtl_dump_file): New. (dump_begin): Use get_dump_file_name. (dump_switch_p_1): Adjust call to dump_enable_all. * tree-dump.h (dump_register): Adjust prototype. * tree-optimize.c (register_one_dump_file): Take dump file index. Support flags for RTL dumps. (register_dump_files): Fill in NUM field of struct dump_file_info. Track properties both when the gate is executed and when it is not. (execute_todo): Dump RTL. Add PROPERTIES parameter. (execute_one_pass): Pass properties to execute_todo. Handle VCG dumps of RTL. * tree-pass.h (dump_file_name): New. * tree.h (TDF_TREE, TDF_RTL, get_dump_file_name, dump_initialized_p): New. * Makefile.in (passes.o): Add new dependencies. * passes.c (struct dump_file_info, enum dump_file_index, dump_file_tbl, init_optimization_passes): Remove. (open_dump_file, close_dump_file): Use tree-dumping infrastructure. (rest_of_handle_new_regalloc, rest_of_handle_old_regalloc): Use dump_enabled_p. (finish_optimization_passes): Update finish_graph_dump_file loop. (enable_rtl_dump_file): Remove. * tree-dump.c (dump_files): Adjust and add RTL dump files. (enable_rtl_dump_file): Add here. * tree.h (enum tree_dump_index): Add RTL dump file indices. * doc/invoke.texi (Debugging options): Document new RTL debugging options. Update. From-SVN: r87113
2004-09-06 12:08:17 +02:00
TODO_dump_func | TODO_ggc_collect | TODO_verify_ssa, /* todo_flags_finish */
0 /* letter */
common.opt (ftree-fre): New flag. * common.opt (ftree-fre): New flag. * flags.h (flag_tree_fre): Declare. * opts.c (decode_options): Set. * timevar.def (TV_TREE_FRE): Define. * tree-flow-inline.h (may_propagate_copy): Re-arrange for readability. Handle destinations that are not SSA_NAMEs. * tree-flow.h (struct ptr_info_def): Move from tree.h (cprop_into_stmt, cprop_into_successor_phis): Remove. (vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Add vuse_optype parameter. * tree-pass.h (pass_fre): Declare. * tree-ssa-copy.c (cprop_operand): Move to tree-ssa-dom.c (cprop_into_stmt): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-dom.c (eliminate_redundant_computations): Fix argument ordering in call to may_propagate_copy. * tree-ssa-pre.c (is_undefined_value): Assume hard registers to be always defined. (add_to_sets): New local function. (create_value_expr_from): New local function. (compute_avail): Call them. (eliminate): Don't ignore statements with virtual operands. (init_pre): New local function. (fini_pre): New local function. (execute_pre): Call them. Add argument DO_FRE. Don't do insertion if DO_FRE is true. (do_pre): New function. (do_fre): New function. (gate_fre): New function. (pass_fre): Declare. * tree-ssa.c (init_tree_ssa): Don't call vn_init. (delete_tree_ssa): Don't call vn_delete. * tree-vn.c (val_expr_pair_d): Add documentation. (vn_compute): Add VUSES argument to incorporate in computing hash values. Update all callers. (expressions_equal_p): Call operand_equal_p with OEP_PURE_SAME. (vn_add): Add VUSES argument. Update all callers. (vn_lookup): Likewise. (vn_lookup_or_add): Likewise. * doc/invoke.texi: Document -ftree-fre and -fdump-tree-fre. From-SVN: r83837
2004-06-29 03:53:04 +02:00
};