mirror of git://gcc.gnu.org/git/gcc.git
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
This commit is contained in:
parent
dc90f45b24
commit
5039610b96
636
gcc/ChangeLog
636
gcc/ChangeLog
|
|
@ -1,3 +1,639 @@
|
|||
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 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
|
||||
|
||||
PR c/26494
|
||||
|
|
|
|||
4793
gcc/builtins.c
4793
gcc/builtins.c
File diff suppressed because it is too large
Load Diff
|
|
@ -1576,16 +1576,23 @@ verify_tree (tree x, struct tlist **pbefore_sp, struct tlist **pno_sp,
|
|||
/* We need to warn about conflicts among arguments and conflicts between
|
||||
args and the function address. Side effects of the function address,
|
||||
however, are not ordered by the sequence point of the call. */
|
||||
tmp_before = tmp_nosp = tmp_list2 = tmp_list3 = 0;
|
||||
verify_tree (TREE_OPERAND (x, 0), &tmp_before, &tmp_nosp, NULL_TREE);
|
||||
if (TREE_OPERAND (x, 1))
|
||||
verify_tree (TREE_OPERAND (x, 1), &tmp_list2, &tmp_list3, NULL_TREE);
|
||||
merge_tlist (&tmp_list3, tmp_list2, 0);
|
||||
add_tlist (&tmp_before, tmp_list3, NULL_TREE, 0);
|
||||
add_tlist (&tmp_before, tmp_nosp, NULL_TREE, 0);
|
||||
warn_for_collisions (tmp_before);
|
||||
add_tlist (pbefore_sp, tmp_before, NULL_TREE, 0);
|
||||
return;
|
||||
{
|
||||
call_expr_arg_iterator iter;
|
||||
tree arg;
|
||||
tmp_before = tmp_nosp = 0;
|
||||
verify_tree (CALL_EXPR_FN (x), &tmp_before, &tmp_nosp, NULL_TREE);
|
||||
FOR_EACH_CALL_EXPR_ARG (arg, iter, x)
|
||||
{
|
||||
tmp_list2 = tmp_list3 = 0;
|
||||
verify_tree (arg, &tmp_list2, &tmp_list3, NULL_TREE);
|
||||
merge_tlist (&tmp_list3, tmp_list2, 0);
|
||||
add_tlist (&tmp_before, tmp_list3, NULL_TREE, 0);
|
||||
}
|
||||
add_tlist (&tmp_before, tmp_nosp, NULL_TREE, 0);
|
||||
warn_for_collisions (tmp_before);
|
||||
add_tlist (pbefore_sp, tmp_before, NULL_TREE, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
case TREE_LIST:
|
||||
/* Scan all the list, e.g. indices of multi dimensional array. */
|
||||
|
|
@ -1645,7 +1652,7 @@ verify_tree (tree x, struct tlist **pbefore_sp, struct tlist **pno_sp,
|
|||
else if (IS_EXPR_CODE_CLASS (cl))
|
||||
{
|
||||
int lp;
|
||||
int max = TREE_CODE_LENGTH (TREE_CODE (x));
|
||||
int max = TREE_OPERAND_LENGTH (x);
|
||||
for (lp = 0; lp < max; lp++)
|
||||
{
|
||||
tmp_before = tmp_nosp = 0;
|
||||
|
|
@ -5940,7 +5947,7 @@ check_function_arguments_recurse (void (*callback)
|
|||
|
||||
if (TREE_CODE (param) == CALL_EXPR)
|
||||
{
|
||||
tree type = TREE_TYPE (TREE_TYPE (TREE_OPERAND (param, 0)));
|
||||
tree type = TREE_TYPE (TREE_TYPE (CALL_EXPR_FN (param)));
|
||||
tree attrs;
|
||||
bool found_format_arg = false;
|
||||
|
||||
|
|
@ -5953,10 +5960,11 @@ check_function_arguments_recurse (void (*callback)
|
|||
attrs = TREE_CHAIN (attrs))
|
||||
if (is_attribute_p ("format_arg", TREE_PURPOSE (attrs)))
|
||||
{
|
||||
tree inner_args;
|
||||
tree inner_arg;
|
||||
tree format_num_expr;
|
||||
int format_num;
|
||||
int i;
|
||||
call_expr_arg_iterator iter;
|
||||
|
||||
/* Extract the argument number, which was previously checked
|
||||
to be valid. */
|
||||
|
|
@ -5967,14 +5975,13 @@ check_function_arguments_recurse (void (*callback)
|
|||
|
||||
format_num = TREE_INT_CST_LOW (format_num_expr);
|
||||
|
||||
for (inner_args = TREE_OPERAND (param, 1), i = 1;
|
||||
inner_args != 0;
|
||||
inner_args = TREE_CHAIN (inner_args), i++)
|
||||
for (inner_arg = first_call_expr_arg (param, &iter), i = 1;
|
||||
inner_arg != 0;
|
||||
inner_arg = next_call_expr_arg (&iter), i++)
|
||||
if (i == format_num)
|
||||
{
|
||||
check_function_arguments_recurse (callback, ctx,
|
||||
TREE_VALUE (inner_args),
|
||||
param_num);
|
||||
inner_arg, param_num);
|
||||
found_format_arg = true;
|
||||
break;
|
||||
}
|
||||
|
|
@ -6191,7 +6198,7 @@ c_warn_unused_result (tree *top_p)
|
|||
ftype = TREE_TYPE (fdecl);
|
||||
else
|
||||
{
|
||||
ftype = TREE_TYPE (TREE_OPERAND (t, 0));
|
||||
ftype = TREE_TYPE (CALL_EXPR_FN (t));
|
||||
/* Look past pointer-to-function to the function type itself. */
|
||||
ftype = TREE_TYPE (ftype);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ c_finish_omp_barrier (void)
|
|||
tree x;
|
||||
|
||||
x = built_in_decls[BUILT_IN_GOMP_BARRIER];
|
||||
x = build_function_call_expr (x, NULL);
|
||||
x = build_call_expr (x, 0);
|
||||
add_stmt (x);
|
||||
}
|
||||
|
||||
|
|
@ -150,7 +150,7 @@ c_finish_omp_flush (void)
|
|||
tree x;
|
||||
|
||||
x = built_in_decls[BUILT_IN_SYNCHRONIZE];
|
||||
x = build_function_call_expr (x, NULL);
|
||||
x = build_call_expr (x, 0);
|
||||
add_stmt (x);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1270,9 +1270,20 @@ pp_c_postfix_expression (c_pretty_printer *pp, tree e)
|
|||
break;
|
||||
|
||||
case CALL_EXPR:
|
||||
pp_postfix_expression (pp, TREE_OPERAND (e, 0));
|
||||
pp_c_call_argument_list (pp, TREE_OPERAND (e, 1));
|
||||
break;
|
||||
{
|
||||
call_expr_arg_iterator iter;
|
||||
tree arg;
|
||||
pp_postfix_expression (pp, CALL_EXPR_FN (e));
|
||||
pp_c_left_paren (pp);
|
||||
FOR_EACH_CALL_EXPR_ARG (arg, iter, e)
|
||||
{
|
||||
pp_expression (pp, arg);
|
||||
if (more_call_expr_args_p (&iter))
|
||||
pp_separate_with (pp, ',');
|
||||
}
|
||||
pp_c_right_paren (pp);
|
||||
break;
|
||||
}
|
||||
|
||||
case UNORDERED_EXPR:
|
||||
pp_c_identifier (pp, flag_isoc99
|
||||
|
|
@ -1419,7 +1430,8 @@ pp_c_constructor_elts (c_pretty_printer *pp, VEC(constructor_elt,gc) *v)
|
|||
}
|
||||
}
|
||||
|
||||
/* Print out an expression-list in parens, as in a function call. */
|
||||
/* Print out an expression-list in parens, as if it were the argument
|
||||
list to a function. */
|
||||
|
||||
void
|
||||
pp_c_call_argument_list (c_pretty_printer *pp, tree t)
|
||||
|
|
|
|||
|
|
@ -115,6 +115,9 @@ build_stmt (enum tree_code code, ...)
|
|||
va_list p;
|
||||
bool side_effects;
|
||||
|
||||
/* This function cannot be used to construct variably-sized nodes. */
|
||||
gcc_assert (TREE_CODE_CLASS (code) != tcc_vl_exp);
|
||||
|
||||
va_start (p, code);
|
||||
|
||||
ret = make_node (code);
|
||||
|
|
|
|||
|
|
@ -2330,17 +2330,17 @@ build_function_call (tree function, tree params)
|
|||
|
||||
if (require_constant_value)
|
||||
{
|
||||
result = fold_build3_initializer (CALL_EXPR, TREE_TYPE (fntype),
|
||||
function, coerced_params, NULL_TREE);
|
||||
|
||||
result = fold_build_call_list_initializer (TREE_TYPE (fntype),
|
||||
function,
|
||||
coerced_params);
|
||||
if (TREE_CONSTANT (result)
|
||||
&& (name == NULL_TREE
|
||||
|| strncmp (IDENTIFIER_POINTER (name), "__builtin_", 10) != 0))
|
||||
pedwarn_init ("initializer element is not constant");
|
||||
}
|
||||
else
|
||||
result = fold_build3 (CALL_EXPR, TREE_TYPE (fntype),
|
||||
function, coerced_params, NULL_TREE);
|
||||
result = fold_build_call_list (TREE_TYPE (fntype),
|
||||
function, coerced_params);
|
||||
|
||||
if (VOID_TYPE_P (TREE_TYPE (result)))
|
||||
return result;
|
||||
|
|
|
|||
27
gcc/calls.c
27
gcc/calls.c
|
|
@ -553,11 +553,10 @@ bool
|
|||
alloca_call_p (tree exp)
|
||||
{
|
||||
if (TREE_CODE (exp) == CALL_EXPR
|
||||
&& TREE_CODE (TREE_OPERAND (exp, 0)) == ADDR_EXPR
|
||||
&& (TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))
|
||||
== FUNCTION_DECL)
|
||||
&& (special_function_p (TREE_OPERAND (TREE_OPERAND (exp, 0), 0),
|
||||
0) & ECF_MAY_BE_ALLOCA))
|
||||
&& TREE_CODE (CALL_EXPR_FN (exp)) == ADDR_EXPR
|
||||
&& (TREE_CODE (TREE_OPERAND (CALL_EXPR_FN (exp), 0)) == FUNCTION_DECL)
|
||||
&& (special_function_p (TREE_OPERAND (CALL_EXPR_FN (exp), 0), 0)
|
||||
& ECF_MAY_BE_ALLOCA))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
|
@ -626,7 +625,7 @@ call_expr_flags (tree t)
|
|||
flags = flags_from_decl_or_type (decl);
|
||||
else
|
||||
{
|
||||
t = TREE_TYPE (TREE_OPERAND (t, 0));
|
||||
t = TREE_TYPE (CALL_EXPR_FN (t));
|
||||
if (t && TREE_CODE (t) == POINTER_TYPE)
|
||||
flags = flags_from_decl_or_type (TREE_TYPE (t));
|
||||
else
|
||||
|
|
@ -1280,7 +1279,8 @@ precompute_arguments (int flags, int num_actuals, struct arg_data *args)
|
|||
compute and return the final value for MUST_PREALLOCATE. */
|
||||
|
||||
static int
|
||||
finalize_must_preallocate (int must_preallocate, int num_actuals, struct arg_data *args, struct args_size *args_size)
|
||||
finalize_must_preallocate (int must_preallocate, int num_actuals,
|
||||
struct arg_data *args, struct args_size *args_size)
|
||||
{
|
||||
/* See if we have or want to preallocate stack space.
|
||||
|
||||
|
|
@ -1809,7 +1809,7 @@ shift_return_value (enum machine_mode mode, bool left_p, rtx value)
|
|||
return true;
|
||||
}
|
||||
|
||||
/* Generate all the code for a function call
|
||||
/* Generate all the code for a CALL_EXPR exp
|
||||
and return an rtx for its value.
|
||||
Store the value in TARGET (specified as an rtx) if convenient.
|
||||
If the value is stored in TARGET then TARGET is returned.
|
||||
|
|
@ -1822,7 +1822,8 @@ expand_call (tree exp, rtx target, int ignore)
|
|||
static int currently_expanding_call = 0;
|
||||
|
||||
/* List of actual parameters. */
|
||||
tree actparms = TREE_OPERAND (exp, 1);
|
||||
/* FIXME: rewrite this so that it doesn't cons up a TREE_LIST. */
|
||||
tree actparms = CALL_EXPR_ARGS (exp);
|
||||
/* RTX for the function to be called. */
|
||||
rtx funexp;
|
||||
/* Sequence of insns to perform a normal "call". */
|
||||
|
|
@ -1923,8 +1924,8 @@ expand_call (tree exp, rtx target, int ignore)
|
|||
int old_stack_pointer_delta = 0;
|
||||
|
||||
rtx call_fusage;
|
||||
tree p = TREE_OPERAND (exp, 0);
|
||||
tree addr = TREE_OPERAND (exp, 0);
|
||||
tree p = CALL_EXPR_FN (exp);
|
||||
tree addr = CALL_EXPR_FN (exp);
|
||||
int i;
|
||||
/* The alignment of the stack, in bits. */
|
||||
unsigned HOST_WIDE_INT preferred_stack_boundary;
|
||||
|
|
@ -2585,8 +2586,8 @@ expand_call (tree exp, rtx target, int ignore)
|
|||
once we have started filling any specific hard regs. */
|
||||
precompute_register_parameters (num_actuals, args, ®_parm_seen);
|
||||
|
||||
if (TREE_OPERAND (exp, 2))
|
||||
static_chain_value = expand_normal (TREE_OPERAND (exp, 2));
|
||||
if (CALL_EXPR_STATIC_CHAIN (exp))
|
||||
static_chain_value = expand_normal (CALL_EXPR_STATIC_CHAIN (exp));
|
||||
else
|
||||
static_chain_value = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -131,6 +131,8 @@ build_cgraph_edges (void)
|
|||
|
||||
if (call && (decl = get_callee_fndecl (call)))
|
||||
{
|
||||
int i;
|
||||
int n = call_expr_nargs (call);
|
||||
int freq = (!bb->frequency && !entry_freq ? CGRAPH_FREQ_BASE
|
||||
: bb->frequency * CGRAPH_FREQ_BASE / entry_freq);
|
||||
if (freq > CGRAPH_FREQ_MAX)
|
||||
|
|
@ -138,8 +140,9 @@ build_cgraph_edges (void)
|
|||
cgraph_create_edge (node, cgraph_node (decl), stmt,
|
||||
bb->count, freq,
|
||||
bb->loop_depth);
|
||||
walk_tree (&TREE_OPERAND (call, 1),
|
||||
record_reference, node, visited_nodes);
|
||||
for (i = 0; i < n; i++)
|
||||
walk_tree (&CALL_EXPR_ARG (call, i),
|
||||
record_reference, node, visited_nodes);
|
||||
if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
|
||||
walk_tree (&GIMPLE_STMT_OPERAND (stmt, 0),
|
||||
record_reference, node, visited_nodes);
|
||||
|
|
|
|||
|
|
@ -1402,7 +1402,7 @@ update_call_expr (struct cgraph_node *new_version)
|
|||
for (e = new_version->callers; e; e = e->next_caller)
|
||||
/* Update the call expr on the edges
|
||||
to call the new version. */
|
||||
TREE_OPERAND (TREE_OPERAND (get_call_expr_in (e->call_stmt), 0), 0) = new_version->decl;
|
||||
TREE_OPERAND (CALL_EXPR_FN (get_call_expr_in (e->call_stmt)), 0) = new_version->decl;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6500,9 +6500,10 @@ alpha_expand_builtin (tree exp, rtx target,
|
|||
{
|
||||
#define MAX_ARGS 2
|
||||
|
||||
tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
|
||||
tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
|
||||
unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
|
||||
tree arglist = TREE_OPERAND (exp, 1);
|
||||
tree arg;
|
||||
call_expr_arg_iterator iter;
|
||||
enum insn_code icode;
|
||||
rtx op[MAX_ARGS], pat;
|
||||
int arity;
|
||||
|
|
@ -6516,13 +6517,11 @@ alpha_expand_builtin (tree exp, rtx target,
|
|||
|
||||
nonvoid = TREE_TYPE (TREE_TYPE (fndecl)) != void_type_node;
|
||||
|
||||
for (arglist = TREE_OPERAND (exp, 1), arity = 0;
|
||||
arglist;
|
||||
arglist = TREE_CHAIN (arglist), arity++)
|
||||
arity = 0;
|
||||
FOR_EACH_CALL_EXPR_ARG (arg, iter, exp)
|
||||
{
|
||||
const struct insn_operand_data *insn_op;
|
||||
|
||||
tree arg = TREE_VALUE (arglist);
|
||||
if (arg == error_mark_node)
|
||||
return NULL_RTX;
|
||||
if (arity > MAX_ARGS)
|
||||
|
|
@ -6534,6 +6533,7 @@ alpha_expand_builtin (tree exp, rtx target,
|
|||
|
||||
if (!(*insn_op->predicate) (op[arity], insn_op->mode))
|
||||
op[arity] = copy_to_mode_reg (insn_op->mode, op[arity]);
|
||||
arity++;
|
||||
}
|
||||
|
||||
if (nonvoid)
|
||||
|
|
|
|||
|
|
@ -13341,11 +13341,11 @@ safe_vector_operand (rtx x, enum machine_mode mode)
|
|||
|
||||
static rtx
|
||||
arm_expand_binop_builtin (enum insn_code icode,
|
||||
tree arglist, rtx target)
|
||||
tree exp, rtx target)
|
||||
{
|
||||
rtx pat;
|
||||
tree arg0 = TREE_VALUE (arglist);
|
||||
tree arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
tree arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
tree arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
rtx op0 = expand_normal (arg0);
|
||||
rtx op1 = expand_normal (arg1);
|
||||
enum machine_mode tmode = insn_data[icode].operand[0].mode;
|
||||
|
|
@ -13380,10 +13380,10 @@ arm_expand_binop_builtin (enum insn_code icode,
|
|||
|
||||
static rtx
|
||||
arm_expand_unop_builtin (enum insn_code icode,
|
||||
tree arglist, rtx target, int do_load)
|
||||
tree exp, rtx target, int do_load)
|
||||
{
|
||||
rtx pat;
|
||||
tree arg0 = TREE_VALUE (arglist);
|
||||
tree arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
rtx op0 = expand_normal (arg0);
|
||||
enum machine_mode tmode = insn_data[icode].operand[0].mode;
|
||||
enum machine_mode mode0 = insn_data[icode].operand[1].mode;
|
||||
|
|
@ -13425,8 +13425,7 @@ arm_expand_builtin (tree exp,
|
|||
{
|
||||
const struct builtin_description * d;
|
||||
enum insn_code icode;
|
||||
tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
|
||||
tree arglist = TREE_OPERAND (exp, 1);
|
||||
tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
|
||||
tree arg0;
|
||||
tree arg1;
|
||||
tree arg2;
|
||||
|
|
@ -13455,8 +13454,8 @@ arm_expand_builtin (tree exp,
|
|||
: fcode == ARM_BUILTIN_TEXTRMUH ? CODE_FOR_iwmmxt_textrmuh
|
||||
: CODE_FOR_iwmmxt_textrmw);
|
||||
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
op0 = expand_normal (arg0);
|
||||
op1 = expand_normal (arg1);
|
||||
tmode = insn_data[icode].operand[0].mode;
|
||||
|
|
@ -13487,9 +13486,9 @@ arm_expand_builtin (tree exp,
|
|||
icode = (fcode == ARM_BUILTIN_TINSRB ? CODE_FOR_iwmmxt_tinsrb
|
||||
: fcode == ARM_BUILTIN_TINSRH ? CODE_FOR_iwmmxt_tinsrh
|
||||
: CODE_FOR_iwmmxt_tinsrw);
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
arg2 = CALL_EXPR_ARG (exp, 2);
|
||||
op0 = expand_normal (arg0);
|
||||
op1 = expand_normal (arg1);
|
||||
op2 = expand_normal (arg2);
|
||||
|
|
@ -13519,15 +13518,15 @@ arm_expand_builtin (tree exp,
|
|||
return target;
|
||||
|
||||
case ARM_BUILTIN_SETWCX:
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
op0 = force_reg (SImode, expand_normal (arg0));
|
||||
op1 = expand_normal (arg1);
|
||||
emit_insn (gen_iwmmxt_tmcr (op1, op0));
|
||||
return 0;
|
||||
|
||||
case ARM_BUILTIN_GETWCX:
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
op0 = expand_normal (arg0);
|
||||
target = gen_reg_rtx (SImode);
|
||||
emit_insn (gen_iwmmxt_tmrc (target, op0));
|
||||
|
|
@ -13535,8 +13534,8 @@ arm_expand_builtin (tree exp,
|
|||
|
||||
case ARM_BUILTIN_WSHUFH:
|
||||
icode = CODE_FOR_iwmmxt_wshufh;
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
op0 = expand_normal (arg0);
|
||||
op1 = expand_normal (arg1);
|
||||
tmode = insn_data[icode].operand[0].mode;
|
||||
|
|
@ -13562,13 +13561,13 @@ arm_expand_builtin (tree exp,
|
|||
return target;
|
||||
|
||||
case ARM_BUILTIN_WSADB:
|
||||
return arm_expand_binop_builtin (CODE_FOR_iwmmxt_wsadb, arglist, target);
|
||||
return arm_expand_binop_builtin (CODE_FOR_iwmmxt_wsadb, exp, target);
|
||||
case ARM_BUILTIN_WSADH:
|
||||
return arm_expand_binop_builtin (CODE_FOR_iwmmxt_wsadh, arglist, target);
|
||||
return arm_expand_binop_builtin (CODE_FOR_iwmmxt_wsadh, exp, target);
|
||||
case ARM_BUILTIN_WSADBZ:
|
||||
return arm_expand_binop_builtin (CODE_FOR_iwmmxt_wsadbz, arglist, target);
|
||||
return arm_expand_binop_builtin (CODE_FOR_iwmmxt_wsadbz, exp, target);
|
||||
case ARM_BUILTIN_WSADHZ:
|
||||
return arm_expand_binop_builtin (CODE_FOR_iwmmxt_wsadhz, arglist, target);
|
||||
return arm_expand_binop_builtin (CODE_FOR_iwmmxt_wsadhz, exp, target);
|
||||
|
||||
/* Several three-argument builtins. */
|
||||
case ARM_BUILTIN_WMACS:
|
||||
|
|
@ -13589,9 +13588,9 @@ arm_expand_builtin (tree exp,
|
|||
: fcode == ARM_BUILTIN_TMIATB ? CODE_FOR_iwmmxt_tmiatb
|
||||
: fcode == ARM_BUILTIN_TMIATT ? CODE_FOR_iwmmxt_tmiatt
|
||||
: CODE_FOR_iwmmxt_walign);
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
arg2 = CALL_EXPR_ARG (exp, 2);
|
||||
op0 = expand_normal (arg0);
|
||||
op1 = expand_normal (arg1);
|
||||
op2 = expand_normal (arg2);
|
||||
|
|
@ -13630,11 +13629,11 @@ arm_expand_builtin (tree exp,
|
|||
|
||||
for (i = 0, d = bdesc_2arg; i < ARRAY_SIZE (bdesc_2arg); i++, d++)
|
||||
if (d->code == (const enum arm_builtins) fcode)
|
||||
return arm_expand_binop_builtin (d->icode, arglist, target);
|
||||
return arm_expand_binop_builtin (d->icode, exp, target);
|
||||
|
||||
for (i = 0, d = bdesc_1arg; i < ARRAY_SIZE (bdesc_1arg); i++, d++)
|
||||
if (d->code == (const enum arm_builtins) fcode)
|
||||
return arm_expand_unop_builtin (d->icode, arglist, target, 0);
|
||||
return arm_expand_unop_builtin (d->icode, exp, target, 0);
|
||||
|
||||
/* @@@ Should really do something sensible here. */
|
||||
return NULL_RTX;
|
||||
|
|
|
|||
|
|
@ -4617,12 +4617,12 @@ safe_vector_operand (rtx x, enum machine_mode mode)
|
|||
if this is a normal binary op, or one of the MACFLAG_xxx constants. */
|
||||
|
||||
static rtx
|
||||
bfin_expand_binop_builtin (enum insn_code icode, tree arglist, rtx target,
|
||||
bfin_expand_binop_builtin (enum insn_code icode, tree exp, rtx target,
|
||||
int macflag)
|
||||
{
|
||||
rtx pat;
|
||||
tree arg0 = TREE_VALUE (arglist);
|
||||
tree arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
tree arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
tree arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
rtx op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
|
||||
rtx op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
|
||||
enum machine_mode op0mode = GET_MODE (op0);
|
||||
|
|
@ -4675,11 +4675,11 @@ bfin_expand_binop_builtin (enum insn_code icode, tree arglist, rtx target,
|
|||
/* Subroutine of bfin_expand_builtin to take care of unop insns. */
|
||||
|
||||
static rtx
|
||||
bfin_expand_unop_builtin (enum insn_code icode, tree arglist,
|
||||
bfin_expand_unop_builtin (enum insn_code icode, tree exp,
|
||||
rtx target)
|
||||
{
|
||||
rtx pat;
|
||||
tree arg0 = TREE_VALUE (arglist);
|
||||
tree arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
rtx op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
|
||||
enum machine_mode op0mode = GET_MODE (op0);
|
||||
enum machine_mode tmode = insn_data[icode].operand[0].mode;
|
||||
|
|
@ -4725,8 +4725,7 @@ bfin_expand_builtin (tree exp, rtx target ATTRIBUTE_UNUSED,
|
|||
size_t i;
|
||||
enum insn_code icode;
|
||||
const struct builtin_description *d;
|
||||
tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
|
||||
tree arglist = TREE_OPERAND (exp, 1);
|
||||
tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
|
||||
unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
|
||||
tree arg0, arg1, arg2;
|
||||
rtx op0, op1, op2, accvec, pat, tmp1, tmp2;
|
||||
|
|
@ -4743,7 +4742,7 @@ bfin_expand_builtin (tree exp, rtx target ATTRIBUTE_UNUSED,
|
|||
|
||||
case BFIN_BUILTIN_DIFFHL_2X16:
|
||||
case BFIN_BUILTIN_DIFFLH_2X16:
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
|
||||
icode = (fcode == BFIN_BUILTIN_DIFFHL_2X16
|
||||
? CODE_FOR_subhilov2hi3 : CODE_FOR_sublohiv2hi3);
|
||||
|
|
@ -4768,8 +4767,8 @@ bfin_expand_builtin (tree exp, rtx target ATTRIBUTE_UNUSED,
|
|||
return target;
|
||||
|
||||
case BFIN_BUILTIN_CPLX_MUL_16:
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
|
||||
op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
|
||||
accvec = gen_reg_rtx (V2PDImode);
|
||||
|
|
@ -4795,9 +4794,9 @@ bfin_expand_builtin (tree exp, rtx target ATTRIBUTE_UNUSED,
|
|||
|
||||
case BFIN_BUILTIN_CPLX_MAC_16:
|
||||
case BFIN_BUILTIN_CPLX_MSU_16:
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
arg2 = CALL_EXPR_ARG (exp, 2);
|
||||
op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
|
||||
op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
|
||||
op2 = expand_expr (arg2, NULL_RTX, VOIDmode, 0);
|
||||
|
|
@ -4838,12 +4837,12 @@ bfin_expand_builtin (tree exp, rtx target ATTRIBUTE_UNUSED,
|
|||
|
||||
for (i = 0, d = bdesc_2arg; i < ARRAY_SIZE (bdesc_2arg); i++, d++)
|
||||
if (d->code == fcode)
|
||||
return bfin_expand_binop_builtin (d->icode, arglist, target,
|
||||
return bfin_expand_binop_builtin (d->icode, exp, target,
|
||||
d->macflag);
|
||||
|
||||
for (i = 0, d = bdesc_1arg; i < ARRAY_SIZE (bdesc_1arg); i++, d++)
|
||||
if (d->code == fcode)
|
||||
return bfin_expand_unop_builtin (d->icode, arglist, target);
|
||||
return bfin_expand_unop_builtin (d->icode, exp, target);
|
||||
|
||||
gcc_unreachable ();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4395,16 +4395,15 @@ c4x_expand_builtin (tree exp, rtx target,
|
|||
enum machine_mode mode ATTRIBUTE_UNUSED,
|
||||
int ignore ATTRIBUTE_UNUSED)
|
||||
{
|
||||
tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
|
||||
tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
|
||||
unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
|
||||
tree arglist = TREE_OPERAND (exp, 1);
|
||||
tree arg0, arg1;
|
||||
rtx r0, r1;
|
||||
|
||||
switch (fcode)
|
||||
{
|
||||
case C4X_BUILTIN_FIX:
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
r0 = expand_expr (arg0, NULL_RTX, QFmode, 0);
|
||||
if (! target || ! register_operand (target, QImode))
|
||||
target = gen_reg_rtx (QImode);
|
||||
|
|
@ -4412,7 +4411,7 @@ c4x_expand_builtin (tree exp, rtx target,
|
|||
return target;
|
||||
|
||||
case C4X_BUILTIN_FIX_ANSI:
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
r0 = expand_expr (arg0, NULL_RTX, QFmode, 0);
|
||||
if (! target || ! register_operand (target, QImode))
|
||||
target = gen_reg_rtx (QImode);
|
||||
|
|
@ -4422,8 +4421,8 @@ c4x_expand_builtin (tree exp, rtx target,
|
|||
case C4X_BUILTIN_MPYI:
|
||||
if (! TARGET_C3X)
|
||||
break;
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
r0 = expand_expr (arg0, NULL_RTX, QImode, 0);
|
||||
r1 = expand_expr (arg1, NULL_RTX, QImode, 0);
|
||||
if (! target || ! register_operand (target, QImode))
|
||||
|
|
@ -4434,7 +4433,7 @@ c4x_expand_builtin (tree exp, rtx target,
|
|||
case C4X_BUILTIN_TOIEEE:
|
||||
if (TARGET_C3X)
|
||||
break;
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
r0 = expand_expr (arg0, NULL_RTX, QFmode, 0);
|
||||
if (! target || ! register_operand (target, QFmode))
|
||||
target = gen_reg_rtx (QFmode);
|
||||
|
|
@ -4444,7 +4443,7 @@ c4x_expand_builtin (tree exp, rtx target,
|
|||
case C4X_BUILTIN_FRIEEE:
|
||||
if (TARGET_C3X)
|
||||
break;
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
r0 = expand_expr (arg0, NULL_RTX, QFmode, 0);
|
||||
if (register_operand (r0, QFmode))
|
||||
{
|
||||
|
|
@ -4460,7 +4459,7 @@ c4x_expand_builtin (tree exp, rtx target,
|
|||
case C4X_BUILTIN_RCPF:
|
||||
if (TARGET_C3X)
|
||||
break;
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
r0 = expand_expr (arg0, NULL_RTX, QFmode, 0);
|
||||
if (! target || ! register_operand (target, QFmode))
|
||||
target = gen_reg_rtx (QFmode);
|
||||
|
|
|
|||
|
|
@ -9216,8 +9216,9 @@ frv_expand_builtin (tree exp,
|
|||
enum machine_mode mode ATTRIBUTE_UNUSED,
|
||||
int ignore ATTRIBUTE_UNUSED)
|
||||
{
|
||||
tree arglist = TREE_OPERAND (exp, 1);
|
||||
tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
|
||||
/* FIXME: Pass the CALL_EXPR directly instead of consing up an arglist. */
|
||||
tree arglist = CALL_EXPR_ARGS (exp);
|
||||
tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
|
||||
unsigned fcode = (unsigned)DECL_FUNCTION_CODE (fndecl);
|
||||
unsigned i;
|
||||
struct builtin_description *d;
|
||||
|
|
|
|||
|
|
@ -2695,7 +2695,7 @@ ix86_function_ok_for_sibcall (tree decl, tree exp)
|
|||
func = decl;
|
||||
else
|
||||
{
|
||||
func = TREE_TYPE (TREE_OPERAND (exp, 0));
|
||||
func = TREE_TYPE (CALL_EXPR_FN (exp));
|
||||
if (POINTER_TYPE_P (func))
|
||||
func = TREE_TYPE (func);
|
||||
}
|
||||
|
|
@ -2730,7 +2730,7 @@ ix86_function_ok_for_sibcall (tree decl, tree exp)
|
|||
tree type;
|
||||
|
||||
/* We're looking at the CALL_EXPR, we need the type of the function. */
|
||||
type = TREE_OPERAND (exp, 0); /* pointer expression */
|
||||
type = CALL_EXPR_FN (exp); /* pointer expression */
|
||||
type = TREE_TYPE (type); /* pointer type */
|
||||
type = TREE_TYPE (type); /* function type */
|
||||
|
||||
|
|
@ -17254,11 +17254,11 @@ safe_vector_operand (rtx x, enum machine_mode mode)
|
|||
/* Subroutine of ix86_expand_builtin to take care of binop insns. */
|
||||
|
||||
static rtx
|
||||
ix86_expand_binop_builtin (enum insn_code icode, tree arglist, rtx target)
|
||||
ix86_expand_binop_builtin (enum insn_code icode, tree exp, rtx target)
|
||||
{
|
||||
rtx pat, xops[3];
|
||||
tree arg0 = TREE_VALUE (arglist);
|
||||
tree arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
tree arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
tree arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
rtx op0 = expand_normal (arg0);
|
||||
rtx op1 = expand_normal (arg1);
|
||||
enum machine_mode tmode = insn_data[icode].operand[0].mode;
|
||||
|
|
@ -17322,11 +17322,11 @@ ix86_expand_binop_builtin (enum insn_code icode, tree arglist, rtx target)
|
|||
/* Subroutine of ix86_expand_builtin to take care of stores. */
|
||||
|
||||
static rtx
|
||||
ix86_expand_store_builtin (enum insn_code icode, tree arglist)
|
||||
ix86_expand_store_builtin (enum insn_code icode, tree exp)
|
||||
{
|
||||
rtx pat;
|
||||
tree arg0 = TREE_VALUE (arglist);
|
||||
tree arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
tree arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
tree arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
rtx op0 = expand_normal (arg0);
|
||||
rtx op1 = expand_normal (arg1);
|
||||
enum machine_mode mode0 = insn_data[icode].operand[0].mode;
|
||||
|
|
@ -17347,11 +17347,11 @@ ix86_expand_store_builtin (enum insn_code icode, tree arglist)
|
|||
/* Subroutine of ix86_expand_builtin to take care of unop insns. */
|
||||
|
||||
static rtx
|
||||
ix86_expand_unop_builtin (enum insn_code icode, tree arglist,
|
||||
ix86_expand_unop_builtin (enum insn_code icode, tree exp,
|
||||
rtx target, int do_load)
|
||||
{
|
||||
rtx pat;
|
||||
tree arg0 = TREE_VALUE (arglist);
|
||||
tree arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
rtx op0 = expand_normal (arg0);
|
||||
enum machine_mode tmode = insn_data[icode].operand[0].mode;
|
||||
enum machine_mode mode0 = insn_data[icode].operand[1].mode;
|
||||
|
|
@ -17383,10 +17383,10 @@ ix86_expand_unop_builtin (enum insn_code icode, tree arglist,
|
|||
sqrtss, rsqrtss, rcpss. */
|
||||
|
||||
static rtx
|
||||
ix86_expand_unop1_builtin (enum insn_code icode, tree arglist, rtx target)
|
||||
ix86_expand_unop1_builtin (enum insn_code icode, tree exp, rtx target)
|
||||
{
|
||||
rtx pat;
|
||||
tree arg0 = TREE_VALUE (arglist);
|
||||
tree arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
rtx op1, op0 = expand_normal (arg0);
|
||||
enum machine_mode tmode = insn_data[icode].operand[0].mode;
|
||||
enum machine_mode mode0 = insn_data[icode].operand[1].mode;
|
||||
|
|
@ -17417,12 +17417,12 @@ ix86_expand_unop1_builtin (enum insn_code icode, tree arglist, rtx target)
|
|||
/* Subroutine of ix86_expand_builtin to take care of comparison insns. */
|
||||
|
||||
static rtx
|
||||
ix86_expand_sse_compare (const struct builtin_description *d, tree arglist,
|
||||
ix86_expand_sse_compare (const struct builtin_description *d, tree exp,
|
||||
rtx target)
|
||||
{
|
||||
rtx pat;
|
||||
tree arg0 = TREE_VALUE (arglist);
|
||||
tree arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
tree arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
tree arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
rtx op0 = expand_normal (arg0);
|
||||
rtx op1 = expand_normal (arg1);
|
||||
rtx op2;
|
||||
|
|
@ -17469,12 +17469,12 @@ ix86_expand_sse_compare (const struct builtin_description *d, tree arglist,
|
|||
/* Subroutine of ix86_expand_builtin to take care of comi insns. */
|
||||
|
||||
static rtx
|
||||
ix86_expand_sse_comi (const struct builtin_description *d, tree arglist,
|
||||
ix86_expand_sse_comi (const struct builtin_description *d, tree exp,
|
||||
rtx target)
|
||||
{
|
||||
rtx pat;
|
||||
tree arg0 = TREE_VALUE (arglist);
|
||||
tree arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
tree arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
tree arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
rtx op0 = expand_normal (arg0);
|
||||
rtx op1 = expand_normal (arg1);
|
||||
rtx op2;
|
||||
|
|
@ -17549,7 +17549,7 @@ get_element_number (tree vec_type, tree arg)
|
|||
these sorts of instructions. */
|
||||
|
||||
static rtx
|
||||
ix86_expand_vec_init_builtin (tree type, tree arglist, rtx target)
|
||||
ix86_expand_vec_init_builtin (tree type, tree exp, rtx target)
|
||||
{
|
||||
enum machine_mode tmode = TYPE_MODE (type);
|
||||
enum machine_mode inner_mode = GET_MODE_INNER (tmode);
|
||||
|
|
@ -17557,15 +17557,14 @@ ix86_expand_vec_init_builtin (tree type, tree arglist, rtx target)
|
|||
rtvec v = rtvec_alloc (n_elt);
|
||||
|
||||
gcc_assert (VECTOR_MODE_P (tmode));
|
||||
gcc_assert (call_expr_nargs (exp) == n_elt);
|
||||
|
||||
for (i = 0; i < n_elt; ++i, arglist = TREE_CHAIN (arglist))
|
||||
for (i = 0; i < n_elt; ++i)
|
||||
{
|
||||
rtx x = expand_normal (TREE_VALUE (arglist));
|
||||
rtx x = expand_normal (CALL_EXPR_ARG (exp, i));
|
||||
RTVEC_ELT (v, i) = gen_lowpart (inner_mode, x);
|
||||
}
|
||||
|
||||
gcc_assert (arglist == NULL);
|
||||
|
||||
if (!target || !register_operand (target, tmode))
|
||||
target = gen_reg_rtx (tmode);
|
||||
|
||||
|
|
@ -17578,15 +17577,15 @@ ix86_expand_vec_init_builtin (tree type, tree arglist, rtx target)
|
|||
had a language-level syntax for referencing vector elements. */
|
||||
|
||||
static rtx
|
||||
ix86_expand_vec_ext_builtin (tree arglist, rtx target)
|
||||
ix86_expand_vec_ext_builtin (tree exp, rtx target)
|
||||
{
|
||||
enum machine_mode tmode, mode0;
|
||||
tree arg0, arg1;
|
||||
int elt;
|
||||
rtx op0;
|
||||
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
|
||||
op0 = expand_normal (arg0);
|
||||
elt = get_element_number (TREE_TYPE (arg0), arg1);
|
||||
|
|
@ -17610,16 +17609,16 @@ ix86_expand_vec_ext_builtin (tree arglist, rtx target)
|
|||
a language-level syntax for referencing vector elements. */
|
||||
|
||||
static rtx
|
||||
ix86_expand_vec_set_builtin (tree arglist)
|
||||
ix86_expand_vec_set_builtin (tree exp)
|
||||
{
|
||||
enum machine_mode tmode, mode1;
|
||||
tree arg0, arg1, arg2;
|
||||
int elt;
|
||||
rtx op0, op1;
|
||||
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
arg2 = CALL_EXPR_ARG (exp, 2);
|
||||
|
||||
tmode = TYPE_MODE (TREE_TYPE (arg0));
|
||||
mode1 = TYPE_MODE (TREE_TYPE (TREE_TYPE (arg0)));
|
||||
|
|
@ -17654,8 +17653,7 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
|||
const struct builtin_description *d;
|
||||
size_t i;
|
||||
enum insn_code icode;
|
||||
tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
|
||||
tree arglist = TREE_OPERAND (exp, 1);
|
||||
tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
|
||||
tree arg0, arg1, arg2, arg3;
|
||||
rtx op0, op1, op2, op3, pat;
|
||||
enum machine_mode tmode, mode0, mode1, mode2, mode3, mode4;
|
||||
|
|
@ -17677,9 +17675,9 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
|||
? CODE_FOR_mmx_maskmovq
|
||||
: CODE_FOR_sse2_maskmovdqu);
|
||||
/* Note the arg order is different from the operand order. */
|
||||
arg1 = TREE_VALUE (arglist);
|
||||
arg2 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
arg0 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
|
||||
arg1 = CALL_EXPR_ARG (exp, 0);
|
||||
arg2 = CALL_EXPR_ARG (exp, 1);
|
||||
arg0 = CALL_EXPR_ARG (exp, 2);
|
||||
op0 = expand_normal (arg0);
|
||||
op1 = expand_normal (arg1);
|
||||
op2 = expand_normal (arg2);
|
||||
|
|
@ -17703,17 +17701,17 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
|||
return 0;
|
||||
|
||||
case IX86_BUILTIN_SQRTSS:
|
||||
return ix86_expand_unop1_builtin (CODE_FOR_sse_vmsqrtv4sf2, arglist, target);
|
||||
return ix86_expand_unop1_builtin (CODE_FOR_sse_vmsqrtv4sf2, exp, target);
|
||||
case IX86_BUILTIN_RSQRTSS:
|
||||
return ix86_expand_unop1_builtin (CODE_FOR_sse_vmrsqrtv4sf2, arglist, target);
|
||||
return ix86_expand_unop1_builtin (CODE_FOR_sse_vmrsqrtv4sf2, exp, target);
|
||||
case IX86_BUILTIN_RCPSS:
|
||||
return ix86_expand_unop1_builtin (CODE_FOR_sse_vmrcpv4sf2, arglist, target);
|
||||
return ix86_expand_unop1_builtin (CODE_FOR_sse_vmrcpv4sf2, exp, target);
|
||||
|
||||
case IX86_BUILTIN_LOADUPS:
|
||||
return ix86_expand_unop_builtin (CODE_FOR_sse_movups, arglist, target, 1);
|
||||
return ix86_expand_unop_builtin (CODE_FOR_sse_movups, exp, target, 1);
|
||||
|
||||
case IX86_BUILTIN_STOREUPS:
|
||||
return ix86_expand_store_builtin (CODE_FOR_sse_movups, arglist);
|
||||
return ix86_expand_store_builtin (CODE_FOR_sse_movups, exp);
|
||||
|
||||
case IX86_BUILTIN_LOADHPS:
|
||||
case IX86_BUILTIN_LOADLPS:
|
||||
|
|
@ -17723,8 +17721,8 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
|||
: fcode == IX86_BUILTIN_LOADLPS ? CODE_FOR_sse_loadlps
|
||||
: fcode == IX86_BUILTIN_LOADHPD ? CODE_FOR_sse2_loadhpd
|
||||
: CODE_FOR_sse2_loadlpd);
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
op0 = expand_normal (arg0);
|
||||
op1 = expand_normal (arg1);
|
||||
tmode = insn_data[icode].operand[0].mode;
|
||||
|
|
@ -17747,8 +17745,8 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
|||
case IX86_BUILTIN_STORELPS:
|
||||
icode = (fcode == IX86_BUILTIN_STOREHPS ? CODE_FOR_sse_storehps
|
||||
: CODE_FOR_sse_storelps);
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
op0 = expand_normal (arg0);
|
||||
op1 = expand_normal (arg1);
|
||||
mode0 = insn_data[icode].operand[0].mode;
|
||||
|
|
@ -17764,12 +17762,12 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
|||
return const0_rtx;
|
||||
|
||||
case IX86_BUILTIN_MOVNTPS:
|
||||
return ix86_expand_store_builtin (CODE_FOR_sse_movntv4sf, arglist);
|
||||
return ix86_expand_store_builtin (CODE_FOR_sse_movntv4sf, exp);
|
||||
case IX86_BUILTIN_MOVNTQ:
|
||||
return ix86_expand_store_builtin (CODE_FOR_sse_movntdi, arglist);
|
||||
return ix86_expand_store_builtin (CODE_FOR_sse_movntdi, exp);
|
||||
|
||||
case IX86_BUILTIN_LDMXCSR:
|
||||
op0 = expand_normal (TREE_VALUE (arglist));
|
||||
op0 = expand_normal (CALL_EXPR_ARG (exp, 0));
|
||||
target = assign_386_stack_local (SImode, SLOT_TEMP);
|
||||
emit_move_insn (target, op0);
|
||||
emit_insn (gen_sse_ldmxcsr (target));
|
||||
|
|
@ -17785,9 +17783,9 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
|||
icode = (fcode == IX86_BUILTIN_SHUFPS
|
||||
? CODE_FOR_sse_shufps
|
||||
: CODE_FOR_sse2_shufpd);
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
arg2 = CALL_EXPR_ARG (exp, 2);
|
||||
op0 = expand_normal (arg0);
|
||||
op1 = expand_normal (arg1);
|
||||
op2 = expand_normal (arg2);
|
||||
|
|
@ -17825,8 +17823,8 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
|||
: fcode == IX86_BUILTIN_PSHUFLW ? CODE_FOR_sse2_pshuflw
|
||||
: fcode == IX86_BUILTIN_PSHUFD ? CODE_FOR_sse2_pshufd
|
||||
: CODE_FOR_mmx_pshufw);
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
op0 = expand_normal (arg0);
|
||||
op1 = expand_normal (arg1);
|
||||
tmode = insn_data[icode].operand[0].mode;
|
||||
|
|
@ -17855,8 +17853,8 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
|||
case IX86_BUILTIN_PSRLDQI128:
|
||||
icode = ( fcode == IX86_BUILTIN_PSLLDQI128 ? CODE_FOR_sse2_ashlti3
|
||||
: CODE_FOR_sse2_lshrti3);
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
op0 = expand_normal (arg0);
|
||||
op1 = expand_normal (arg1);
|
||||
tmode = insn_data[icode].operand[0].mode;
|
||||
|
|
@ -17885,86 +17883,86 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
|||
return NULL_RTX;
|
||||
|
||||
case IX86_BUILTIN_PAVGUSB:
|
||||
return ix86_expand_binop_builtin (CODE_FOR_mmx_uavgv8qi3, arglist, target);
|
||||
return ix86_expand_binop_builtin (CODE_FOR_mmx_uavgv8qi3, exp, target);
|
||||
|
||||
case IX86_BUILTIN_PF2ID:
|
||||
return ix86_expand_unop_builtin (CODE_FOR_mmx_pf2id, arglist, target, 0);
|
||||
return ix86_expand_unop_builtin (CODE_FOR_mmx_pf2id, exp, target, 0);
|
||||
|
||||
case IX86_BUILTIN_PFACC:
|
||||
return ix86_expand_binop_builtin (CODE_FOR_mmx_haddv2sf3, arglist, target);
|
||||
return ix86_expand_binop_builtin (CODE_FOR_mmx_haddv2sf3, exp, target);
|
||||
|
||||
case IX86_BUILTIN_PFADD:
|
||||
return ix86_expand_binop_builtin (CODE_FOR_mmx_addv2sf3, arglist, target);
|
||||
return ix86_expand_binop_builtin (CODE_FOR_mmx_addv2sf3, exp, target);
|
||||
|
||||
case IX86_BUILTIN_PFCMPEQ:
|
||||
return ix86_expand_binop_builtin (CODE_FOR_mmx_eqv2sf3, arglist, target);
|
||||
return ix86_expand_binop_builtin (CODE_FOR_mmx_eqv2sf3, exp, target);
|
||||
|
||||
case IX86_BUILTIN_PFCMPGE:
|
||||
return ix86_expand_binop_builtin (CODE_FOR_mmx_gev2sf3, arglist, target);
|
||||
return ix86_expand_binop_builtin (CODE_FOR_mmx_gev2sf3, exp, target);
|
||||
|
||||
case IX86_BUILTIN_PFCMPGT:
|
||||
return ix86_expand_binop_builtin (CODE_FOR_mmx_gtv2sf3, arglist, target);
|
||||
return ix86_expand_binop_builtin (CODE_FOR_mmx_gtv2sf3, exp, target);
|
||||
|
||||
case IX86_BUILTIN_PFMAX:
|
||||
return ix86_expand_binop_builtin (CODE_FOR_mmx_smaxv2sf3, arglist, target);
|
||||
return ix86_expand_binop_builtin (CODE_FOR_mmx_smaxv2sf3, exp, target);
|
||||
|
||||
case IX86_BUILTIN_PFMIN:
|
||||
return ix86_expand_binop_builtin (CODE_FOR_mmx_sminv2sf3, arglist, target);
|
||||
return ix86_expand_binop_builtin (CODE_FOR_mmx_sminv2sf3, exp, target);
|
||||
|
||||
case IX86_BUILTIN_PFMUL:
|
||||
return ix86_expand_binop_builtin (CODE_FOR_mmx_mulv2sf3, arglist, target);
|
||||
return ix86_expand_binop_builtin (CODE_FOR_mmx_mulv2sf3, exp, target);
|
||||
|
||||
case IX86_BUILTIN_PFRCP:
|
||||
return ix86_expand_unop_builtin (CODE_FOR_mmx_rcpv2sf2, arglist, target, 0);
|
||||
return ix86_expand_unop_builtin (CODE_FOR_mmx_rcpv2sf2, exp, target, 0);
|
||||
|
||||
case IX86_BUILTIN_PFRCPIT1:
|
||||
return ix86_expand_binop_builtin (CODE_FOR_mmx_rcpit1v2sf3, arglist, target);
|
||||
return ix86_expand_binop_builtin (CODE_FOR_mmx_rcpit1v2sf3, exp, target);
|
||||
|
||||
case IX86_BUILTIN_PFRCPIT2:
|
||||
return ix86_expand_binop_builtin (CODE_FOR_mmx_rcpit2v2sf3, arglist, target);
|
||||
return ix86_expand_binop_builtin (CODE_FOR_mmx_rcpit2v2sf3, exp, target);
|
||||
|
||||
case IX86_BUILTIN_PFRSQIT1:
|
||||
return ix86_expand_binop_builtin (CODE_FOR_mmx_rsqit1v2sf3, arglist, target);
|
||||
return ix86_expand_binop_builtin (CODE_FOR_mmx_rsqit1v2sf3, exp, target);
|
||||
|
||||
case IX86_BUILTIN_PFRSQRT:
|
||||
return ix86_expand_unop_builtin (CODE_FOR_mmx_rsqrtv2sf2, arglist, target, 0);
|
||||
return ix86_expand_unop_builtin (CODE_FOR_mmx_rsqrtv2sf2, exp, target, 0);
|
||||
|
||||
case IX86_BUILTIN_PFSUB:
|
||||
return ix86_expand_binop_builtin (CODE_FOR_mmx_subv2sf3, arglist, target);
|
||||
return ix86_expand_binop_builtin (CODE_FOR_mmx_subv2sf3, exp, target);
|
||||
|
||||
case IX86_BUILTIN_PFSUBR:
|
||||
return ix86_expand_binop_builtin (CODE_FOR_mmx_subrv2sf3, arglist, target);
|
||||
return ix86_expand_binop_builtin (CODE_FOR_mmx_subrv2sf3, exp, target);
|
||||
|
||||
case IX86_BUILTIN_PI2FD:
|
||||
return ix86_expand_unop_builtin (CODE_FOR_mmx_floatv2si2, arglist, target, 0);
|
||||
return ix86_expand_unop_builtin (CODE_FOR_mmx_floatv2si2, exp, target, 0);
|
||||
|
||||
case IX86_BUILTIN_PMULHRW:
|
||||
return ix86_expand_binop_builtin (CODE_FOR_mmx_pmulhrwv4hi3, arglist, target);
|
||||
return ix86_expand_binop_builtin (CODE_FOR_mmx_pmulhrwv4hi3, exp, target);
|
||||
|
||||
case IX86_BUILTIN_PF2IW:
|
||||
return ix86_expand_unop_builtin (CODE_FOR_mmx_pf2iw, arglist, target, 0);
|
||||
return ix86_expand_unop_builtin (CODE_FOR_mmx_pf2iw, exp, target, 0);
|
||||
|
||||
case IX86_BUILTIN_PFNACC:
|
||||
return ix86_expand_binop_builtin (CODE_FOR_mmx_hsubv2sf3, arglist, target);
|
||||
return ix86_expand_binop_builtin (CODE_FOR_mmx_hsubv2sf3, exp, target);
|
||||
|
||||
case IX86_BUILTIN_PFPNACC:
|
||||
return ix86_expand_binop_builtin (CODE_FOR_mmx_addsubv2sf3, arglist, target);
|
||||
return ix86_expand_binop_builtin (CODE_FOR_mmx_addsubv2sf3, exp, target);
|
||||
|
||||
case IX86_BUILTIN_PI2FW:
|
||||
return ix86_expand_unop_builtin (CODE_FOR_mmx_pi2fw, arglist, target, 0);
|
||||
return ix86_expand_unop_builtin (CODE_FOR_mmx_pi2fw, exp, target, 0);
|
||||
|
||||
case IX86_BUILTIN_PSWAPDSI:
|
||||
return ix86_expand_unop_builtin (CODE_FOR_mmx_pswapdv2si2, arglist, target, 0);
|
||||
return ix86_expand_unop_builtin (CODE_FOR_mmx_pswapdv2si2, exp, target, 0);
|
||||
|
||||
case IX86_BUILTIN_PSWAPDSF:
|
||||
return ix86_expand_unop_builtin (CODE_FOR_mmx_pswapdv2sf2, arglist, target, 0);
|
||||
return ix86_expand_unop_builtin (CODE_FOR_mmx_pswapdv2sf2, exp, target, 0);
|
||||
|
||||
case IX86_BUILTIN_SQRTSD:
|
||||
return ix86_expand_unop1_builtin (CODE_FOR_sse2_vmsqrtv2df2, arglist, target);
|
||||
return ix86_expand_unop1_builtin (CODE_FOR_sse2_vmsqrtv2df2, exp, target);
|
||||
case IX86_BUILTIN_LOADUPD:
|
||||
return ix86_expand_unop_builtin (CODE_FOR_sse2_movupd, arglist, target, 1);
|
||||
return ix86_expand_unop_builtin (CODE_FOR_sse2_movupd, exp, target, 1);
|
||||
case IX86_BUILTIN_STOREUPD:
|
||||
return ix86_expand_store_builtin (CODE_FOR_sse2_movupd, arglist);
|
||||
return ix86_expand_store_builtin (CODE_FOR_sse2_movupd, exp);
|
||||
|
||||
case IX86_BUILTIN_MFENCE:
|
||||
emit_insn (gen_sse2_mfence ());
|
||||
|
|
@ -17974,7 +17972,7 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
|||
return 0;
|
||||
|
||||
case IX86_BUILTIN_CLFLUSH:
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
op0 = expand_normal (arg0);
|
||||
icode = CODE_FOR_sse2_clflush;
|
||||
if (! (*insn_data[icode].operand[0].predicate) (op0, Pmode))
|
||||
|
|
@ -17984,21 +17982,21 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
|||
return 0;
|
||||
|
||||
case IX86_BUILTIN_MOVNTPD:
|
||||
return ix86_expand_store_builtin (CODE_FOR_sse2_movntv2df, arglist);
|
||||
return ix86_expand_store_builtin (CODE_FOR_sse2_movntv2df, exp);
|
||||
case IX86_BUILTIN_MOVNTDQ:
|
||||
return ix86_expand_store_builtin (CODE_FOR_sse2_movntv2di, arglist);
|
||||
return ix86_expand_store_builtin (CODE_FOR_sse2_movntv2di, exp);
|
||||
case IX86_BUILTIN_MOVNTI:
|
||||
return ix86_expand_store_builtin (CODE_FOR_sse2_movntsi, arglist);
|
||||
return ix86_expand_store_builtin (CODE_FOR_sse2_movntsi, exp);
|
||||
|
||||
case IX86_BUILTIN_LOADDQU:
|
||||
return ix86_expand_unop_builtin (CODE_FOR_sse2_movdqu, arglist, target, 1);
|
||||
return ix86_expand_unop_builtin (CODE_FOR_sse2_movdqu, exp, target, 1);
|
||||
case IX86_BUILTIN_STOREDQU:
|
||||
return ix86_expand_store_builtin (CODE_FOR_sse2_movdqu, arglist);
|
||||
return ix86_expand_store_builtin (CODE_FOR_sse2_movdqu, exp);
|
||||
|
||||
case IX86_BUILTIN_MONITOR:
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
arg2 = CALL_EXPR_ARG (exp, 2);
|
||||
op0 = expand_normal (arg0);
|
||||
op1 = expand_normal (arg1);
|
||||
op2 = expand_normal (arg2);
|
||||
|
|
@ -18015,8 +18013,8 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
|||
return 0;
|
||||
|
||||
case IX86_BUILTIN_MWAIT:
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
op0 = expand_normal (arg0);
|
||||
op1 = expand_normal (arg1);
|
||||
if (!REG_P (op0))
|
||||
|
|
@ -18027,7 +18025,7 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
|||
return 0;
|
||||
|
||||
case IX86_BUILTIN_LDDQU:
|
||||
return ix86_expand_unop_builtin (CODE_FOR_sse3_lddqu, arglist,
|
||||
return ix86_expand_unop_builtin (CODE_FOR_sse3_lddqu, exp,
|
||||
target, 1);
|
||||
|
||||
case IX86_BUILTIN_PALIGNR:
|
||||
|
|
@ -18042,9 +18040,9 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
|||
icode = CODE_FOR_ssse3_palignrti;
|
||||
mode = V2DImode;
|
||||
}
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
arg2 = CALL_EXPR_ARG (exp, 2);
|
||||
op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
|
||||
op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
|
||||
op2 = expand_expr (arg2, NULL_RTX, VOIDmode, 0);
|
||||
|
|
@ -18077,18 +18075,18 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
|||
return target;
|
||||
|
||||
case IX86_BUILTIN_MOVNTSD:
|
||||
return ix86_expand_store_builtin (CODE_FOR_sse4a_vmmovntv2df, arglist);
|
||||
return ix86_expand_store_builtin (CODE_FOR_sse4a_vmmovntv2df, exp);
|
||||
|
||||
case IX86_BUILTIN_MOVNTSS:
|
||||
return ix86_expand_store_builtin (CODE_FOR_sse4a_vmmovntv4sf, arglist);
|
||||
return ix86_expand_store_builtin (CODE_FOR_sse4a_vmmovntv4sf, exp);
|
||||
|
||||
case IX86_BUILTIN_INSERTQ:
|
||||
case IX86_BUILTIN_EXTRQ:
|
||||
icode = (fcode == IX86_BUILTIN_EXTRQ
|
||||
? CODE_FOR_sse4a_extrq
|
||||
: CODE_FOR_sse4a_insertq);
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
op0 = expand_normal (arg0);
|
||||
op1 = expand_normal (arg1);
|
||||
tmode = insn_data[icode].operand[0].mode;
|
||||
|
|
@ -18110,9 +18108,9 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
|||
|
||||
case IX86_BUILTIN_EXTRQI:
|
||||
icode = CODE_FOR_sse4a_extrqi;
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
arg2 = CALL_EXPR_ARG (exp, 2);
|
||||
op0 = expand_normal (arg0);
|
||||
op1 = expand_normal (arg1);
|
||||
op2 = expand_normal (arg2);
|
||||
|
|
@ -18144,10 +18142,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
|||
|
||||
case IX86_BUILTIN_INSERTQI:
|
||||
icode = CODE_FOR_sse4a_insertqi;
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
|
||||
arg3 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (arglist))));
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
arg2 = CALL_EXPR_ARG (exp, 2);
|
||||
arg3 = CALL_EXPR_ARG (exp, 3);
|
||||
op0 = expand_normal (arg0);
|
||||
op1 = expand_normal (arg1);
|
||||
op2 = expand_normal (arg2);
|
||||
|
|
@ -18187,7 +18185,7 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
|||
case IX86_BUILTIN_VEC_INIT_V2SI:
|
||||
case IX86_BUILTIN_VEC_INIT_V4HI:
|
||||
case IX86_BUILTIN_VEC_INIT_V8QI:
|
||||
return ix86_expand_vec_init_builtin (TREE_TYPE (exp), arglist, target);
|
||||
return ix86_expand_vec_init_builtin (TREE_TYPE (exp), exp, target);
|
||||
|
||||
case IX86_BUILTIN_VEC_EXT_V2DF:
|
||||
case IX86_BUILTIN_VEC_EXT_V2DI:
|
||||
|
|
@ -18196,11 +18194,11 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
|||
case IX86_BUILTIN_VEC_EXT_V8HI:
|
||||
case IX86_BUILTIN_VEC_EXT_V2SI:
|
||||
case IX86_BUILTIN_VEC_EXT_V4HI:
|
||||
return ix86_expand_vec_ext_builtin (arglist, target);
|
||||
return ix86_expand_vec_ext_builtin (exp, target);
|
||||
|
||||
case IX86_BUILTIN_VEC_SET_V8HI:
|
||||
case IX86_BUILTIN_VEC_SET_V4HI:
|
||||
return ix86_expand_vec_set_builtin (arglist);
|
||||
return ix86_expand_vec_set_builtin (exp);
|
||||
|
||||
default:
|
||||
break;
|
||||
|
|
@ -18214,18 +18212,18 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
|||
|| d->icode == CODE_FOR_sse_vmmaskcmpv4sf3
|
||||
|| d->icode == CODE_FOR_sse2_maskcmpv2df3
|
||||
|| d->icode == CODE_FOR_sse2_vmmaskcmpv2df3)
|
||||
return ix86_expand_sse_compare (d, arglist, target);
|
||||
return ix86_expand_sse_compare (d, exp, target);
|
||||
|
||||
return ix86_expand_binop_builtin (d->icode, arglist, target);
|
||||
return ix86_expand_binop_builtin (d->icode, exp, target);
|
||||
}
|
||||
|
||||
for (i = 0, d = bdesc_1arg; i < ARRAY_SIZE (bdesc_1arg); i++, d++)
|
||||
if (d->code == fcode)
|
||||
return ix86_expand_unop_builtin (d->icode, arglist, target, 0);
|
||||
return ix86_expand_unop_builtin (d->icode, exp, target, 0);
|
||||
|
||||
for (i = 0, d = bdesc_comi; i < ARRAY_SIZE (bdesc_comi); i++, d++)
|
||||
if (d->code == fcode)
|
||||
return ix86_expand_sse_comi (d, arglist, target);
|
||||
return ix86_expand_sse_comi (d, exp, target);
|
||||
|
||||
gcc_unreachable ();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2569,11 +2569,11 @@ void_ftype_int_int_int
|
|||
def_builtin ("__builtin_syscall", void_ftype, IQ2000_BUILTIN_SYSCALL);
|
||||
}
|
||||
|
||||
/* Builtin for ICODE having ARGCOUNT args in ARGLIST where each arg
|
||||
/* Builtin for ICODE having ARGCOUNT args in EXP where each arg
|
||||
has an rtx CODE. */
|
||||
|
||||
static rtx
|
||||
expand_one_builtin (enum insn_code icode, rtx target, tree arglist,
|
||||
expand_one_builtin (enum insn_code icode, rtx target, tree exp,
|
||||
enum rtx_code *code, int argcount)
|
||||
{
|
||||
rtx pat;
|
||||
|
|
@ -2585,8 +2585,7 @@ expand_one_builtin (enum insn_code icode, rtx target, tree arglist,
|
|||
mode[0] = insn_data[icode].operand[0].mode;
|
||||
for (i = 0; i < argcount; i++)
|
||||
{
|
||||
arg[i] = TREE_VALUE (arglist);
|
||||
arglist = TREE_CHAIN (arglist);
|
||||
arg[i] = CALL_EXPR_ARG (exp, i);
|
||||
op[i] = expand_expr (arg[i], NULL_RTX, VOIDmode, 0);
|
||||
mode[i] = insn_data[icode].operand[i].mode;
|
||||
if (code[i] == CONST_INT && GET_CODE (op[i]) != CONST_INT)
|
||||
|
|
@ -2655,8 +2654,7 @@ iq2000_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
|||
enum machine_mode mode ATTRIBUTE_UNUSED,
|
||||
int ignore ATTRIBUTE_UNUSED)
|
||||
{
|
||||
tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
|
||||
tree arglist = TREE_OPERAND (exp, 1);
|
||||
tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
|
||||
int fcode = DECL_FUNCTION_CODE (fndecl);
|
||||
enum rtx_code code [5];
|
||||
|
||||
|
|
@ -2671,162 +2669,162 @@ iq2000_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
|||
break;
|
||||
|
||||
case IQ2000_BUILTIN_ADO16:
|
||||
return expand_one_builtin (CODE_FOR_ado16, target, arglist, code, 2);
|
||||
return expand_one_builtin (CODE_FOR_ado16, target, exp, code, 2);
|
||||
|
||||
case IQ2000_BUILTIN_RAM:
|
||||
code[1] = CONST_INT;
|
||||
code[2] = CONST_INT;
|
||||
code[3] = CONST_INT;
|
||||
return expand_one_builtin (CODE_FOR_ram, target, arglist, code, 4);
|
||||
return expand_one_builtin (CODE_FOR_ram, target, exp, code, 4);
|
||||
|
||||
case IQ2000_BUILTIN_CHKHDR:
|
||||
return expand_one_builtin (CODE_FOR_chkhdr, target, arglist, code, 2);
|
||||
return expand_one_builtin (CODE_FOR_chkhdr, target, exp, code, 2);
|
||||
|
||||
case IQ2000_BUILTIN_PKRL:
|
||||
return expand_one_builtin (CODE_FOR_pkrl, target, arglist, code, 2);
|
||||
return expand_one_builtin (CODE_FOR_pkrl, target, exp, code, 2);
|
||||
|
||||
case IQ2000_BUILTIN_CFC0:
|
||||
code[0] = CONST_INT;
|
||||
return expand_one_builtin (CODE_FOR_cfc0, target, arglist, code, 1);
|
||||
return expand_one_builtin (CODE_FOR_cfc0, target, exp, code, 1);
|
||||
|
||||
case IQ2000_BUILTIN_CFC1:
|
||||
code[0] = CONST_INT;
|
||||
return expand_one_builtin (CODE_FOR_cfc1, target, arglist, code, 1);
|
||||
return expand_one_builtin (CODE_FOR_cfc1, target, exp, code, 1);
|
||||
|
||||
case IQ2000_BUILTIN_CFC2:
|
||||
code[0] = CONST_INT;
|
||||
return expand_one_builtin (CODE_FOR_cfc2, target, arglist, code, 1);
|
||||
return expand_one_builtin (CODE_FOR_cfc2, target, exp, code, 1);
|
||||
|
||||
case IQ2000_BUILTIN_CFC3:
|
||||
code[0] = CONST_INT;
|
||||
return expand_one_builtin (CODE_FOR_cfc3, target, arglist, code, 1);
|
||||
return expand_one_builtin (CODE_FOR_cfc3, target, exp, code, 1);
|
||||
|
||||
case IQ2000_BUILTIN_CTC0:
|
||||
code[1] = CONST_INT;
|
||||
return expand_one_builtin (CODE_FOR_ctc0, target, arglist, code, 2);
|
||||
return expand_one_builtin (CODE_FOR_ctc0, target, exp, code, 2);
|
||||
|
||||
case IQ2000_BUILTIN_CTC1:
|
||||
code[1] = CONST_INT;
|
||||
return expand_one_builtin (CODE_FOR_ctc1, target, arglist, code, 2);
|
||||
return expand_one_builtin (CODE_FOR_ctc1, target, exp, code, 2);
|
||||
|
||||
case IQ2000_BUILTIN_CTC2:
|
||||
code[1] = CONST_INT;
|
||||
return expand_one_builtin (CODE_FOR_ctc2, target, arglist, code, 2);
|
||||
return expand_one_builtin (CODE_FOR_ctc2, target, exp, code, 2);
|
||||
|
||||
case IQ2000_BUILTIN_CTC3:
|
||||
code[1] = CONST_INT;
|
||||
return expand_one_builtin (CODE_FOR_ctc3, target, arglist, code, 2);
|
||||
return expand_one_builtin (CODE_FOR_ctc3, target, exp, code, 2);
|
||||
|
||||
case IQ2000_BUILTIN_MFC0:
|
||||
code[0] = CONST_INT;
|
||||
return expand_one_builtin (CODE_FOR_mfc0, target, arglist, code, 1);
|
||||
return expand_one_builtin (CODE_FOR_mfc0, target, exp, code, 1);
|
||||
|
||||
case IQ2000_BUILTIN_MFC1:
|
||||
code[0] = CONST_INT;
|
||||
return expand_one_builtin (CODE_FOR_mfc1, target, arglist, code, 1);
|
||||
return expand_one_builtin (CODE_FOR_mfc1, target, exp, code, 1);
|
||||
|
||||
case IQ2000_BUILTIN_MFC2:
|
||||
code[0] = CONST_INT;
|
||||
return expand_one_builtin (CODE_FOR_mfc2, target, arglist, code, 1);
|
||||
return expand_one_builtin (CODE_FOR_mfc2, target, exp, code, 1);
|
||||
|
||||
case IQ2000_BUILTIN_MFC3:
|
||||
code[0] = CONST_INT;
|
||||
return expand_one_builtin (CODE_FOR_mfc3, target, arglist, code, 1);
|
||||
return expand_one_builtin (CODE_FOR_mfc3, target, exp, code, 1);
|
||||
|
||||
case IQ2000_BUILTIN_MTC0:
|
||||
code[1] = CONST_INT;
|
||||
return expand_one_builtin (CODE_FOR_mtc0, target, arglist, code, 2);
|
||||
return expand_one_builtin (CODE_FOR_mtc0, target, exp, code, 2);
|
||||
|
||||
case IQ2000_BUILTIN_MTC1:
|
||||
code[1] = CONST_INT;
|
||||
return expand_one_builtin (CODE_FOR_mtc1, target, arglist, code, 2);
|
||||
return expand_one_builtin (CODE_FOR_mtc1, target, exp, code, 2);
|
||||
|
||||
case IQ2000_BUILTIN_MTC2:
|
||||
code[1] = CONST_INT;
|
||||
return expand_one_builtin (CODE_FOR_mtc2, target, arglist, code, 2);
|
||||
return expand_one_builtin (CODE_FOR_mtc2, target, exp, code, 2);
|
||||
|
||||
case IQ2000_BUILTIN_MTC3:
|
||||
code[1] = CONST_INT;
|
||||
return expand_one_builtin (CODE_FOR_mtc3, target, arglist, code, 2);
|
||||
return expand_one_builtin (CODE_FOR_mtc3, target, exp, code, 2);
|
||||
|
||||
case IQ2000_BUILTIN_LUR:
|
||||
return expand_one_builtin (CODE_FOR_lur, target, arglist, code, 2);
|
||||
return expand_one_builtin (CODE_FOR_lur, target, exp, code, 2);
|
||||
|
||||
case IQ2000_BUILTIN_RB:
|
||||
return expand_one_builtin (CODE_FOR_rb, target, arglist, code, 2);
|
||||
return expand_one_builtin (CODE_FOR_rb, target, exp, code, 2);
|
||||
|
||||
case IQ2000_BUILTIN_RX:
|
||||
return expand_one_builtin (CODE_FOR_rx, target, arglist, code, 2);
|
||||
return expand_one_builtin (CODE_FOR_rx, target, exp, code, 2);
|
||||
|
||||
case IQ2000_BUILTIN_SRRD:
|
||||
return expand_one_builtin (CODE_FOR_srrd, target, arglist, code, 1);
|
||||
return expand_one_builtin (CODE_FOR_srrd, target, exp, code, 1);
|
||||
|
||||
case IQ2000_BUILTIN_SRWR:
|
||||
return expand_one_builtin (CODE_FOR_srwr, target, arglist, code, 2);
|
||||
return expand_one_builtin (CODE_FOR_srwr, target, exp, code, 2);
|
||||
|
||||
case IQ2000_BUILTIN_WB:
|
||||
return expand_one_builtin (CODE_FOR_wb, target, arglist, code, 2);
|
||||
return expand_one_builtin (CODE_FOR_wb, target, exp, code, 2);
|
||||
|
||||
case IQ2000_BUILTIN_WX:
|
||||
return expand_one_builtin (CODE_FOR_wx, target, arglist, code, 2);
|
||||
return expand_one_builtin (CODE_FOR_wx, target, exp, code, 2);
|
||||
|
||||
case IQ2000_BUILTIN_LUC32L:
|
||||
return expand_one_builtin (CODE_FOR_luc32l, target, arglist, code, 2);
|
||||
return expand_one_builtin (CODE_FOR_luc32l, target, exp, code, 2);
|
||||
|
||||
case IQ2000_BUILTIN_LUC64:
|
||||
return expand_one_builtin (CODE_FOR_luc64, target, arglist, code, 2);
|
||||
return expand_one_builtin (CODE_FOR_luc64, target, exp, code, 2);
|
||||
|
||||
case IQ2000_BUILTIN_LUC64L:
|
||||
return expand_one_builtin (CODE_FOR_luc64l, target, arglist, code, 2);
|
||||
return expand_one_builtin (CODE_FOR_luc64l, target, exp, code, 2);
|
||||
|
||||
case IQ2000_BUILTIN_LUK:
|
||||
return expand_one_builtin (CODE_FOR_luk, target, arglist, code, 2);
|
||||
return expand_one_builtin (CODE_FOR_luk, target, exp, code, 2);
|
||||
|
||||
case IQ2000_BUILTIN_LULCK:
|
||||
return expand_one_builtin (CODE_FOR_lulck, target, arglist, code, 1);
|
||||
return expand_one_builtin (CODE_FOR_lulck, target, exp, code, 1);
|
||||
|
||||
case IQ2000_BUILTIN_LUM32:
|
||||
return expand_one_builtin (CODE_FOR_lum32, target, arglist, code, 2);
|
||||
return expand_one_builtin (CODE_FOR_lum32, target, exp, code, 2);
|
||||
|
||||
case IQ2000_BUILTIN_LUM32L:
|
||||
return expand_one_builtin (CODE_FOR_lum32l, target, arglist, code, 2);
|
||||
return expand_one_builtin (CODE_FOR_lum32l, target, exp, code, 2);
|
||||
|
||||
case IQ2000_BUILTIN_LUM64:
|
||||
return expand_one_builtin (CODE_FOR_lum64, target, arglist, code, 2);
|
||||
return expand_one_builtin (CODE_FOR_lum64, target, exp, code, 2);
|
||||
|
||||
case IQ2000_BUILTIN_LUM64L:
|
||||
return expand_one_builtin (CODE_FOR_lum64l, target, arglist, code, 2);
|
||||
return expand_one_builtin (CODE_FOR_lum64l, target, exp, code, 2);
|
||||
|
||||
case IQ2000_BUILTIN_LURL:
|
||||
return expand_one_builtin (CODE_FOR_lurl, target, arglist, code, 2);
|
||||
return expand_one_builtin (CODE_FOR_lurl, target, exp, code, 2);
|
||||
|
||||
case IQ2000_BUILTIN_MRGB:
|
||||
code[2] = CONST_INT;
|
||||
return expand_one_builtin (CODE_FOR_mrgb, target, arglist, code, 3);
|
||||
return expand_one_builtin (CODE_FOR_mrgb, target, exp, code, 3);
|
||||
|
||||
case IQ2000_BUILTIN_SRRDL:
|
||||
return expand_one_builtin (CODE_FOR_srrdl, target, arglist, code, 1);
|
||||
return expand_one_builtin (CODE_FOR_srrdl, target, exp, code, 1);
|
||||
|
||||
case IQ2000_BUILTIN_SRULCK:
|
||||
return expand_one_builtin (CODE_FOR_srulck, target, arglist, code, 1);
|
||||
return expand_one_builtin (CODE_FOR_srulck, target, exp, code, 1);
|
||||
|
||||
case IQ2000_BUILTIN_SRWRU:
|
||||
return expand_one_builtin (CODE_FOR_srwru, target, arglist, code, 2);
|
||||
return expand_one_builtin (CODE_FOR_srwru, target, exp, code, 2);
|
||||
|
||||
case IQ2000_BUILTIN_TRAPQFL:
|
||||
return expand_one_builtin (CODE_FOR_trapqfl, target, arglist, code, 0);
|
||||
return expand_one_builtin (CODE_FOR_trapqfl, target, exp, code, 0);
|
||||
|
||||
case IQ2000_BUILTIN_TRAPQNE:
|
||||
return expand_one_builtin (CODE_FOR_trapqne, target, arglist, code, 0);
|
||||
return expand_one_builtin (CODE_FOR_trapqne, target, exp, code, 0);
|
||||
|
||||
case IQ2000_BUILTIN_TRAPREL:
|
||||
return expand_one_builtin (CODE_FOR_traprel, target, arglist, code, 1);
|
||||
return expand_one_builtin (CODE_FOR_traprel, target, exp, code, 1);
|
||||
|
||||
case IQ2000_BUILTIN_WBU:
|
||||
return expand_one_builtin (CODE_FOR_wbu, target, arglist, code, 3);
|
||||
return expand_one_builtin (CODE_FOR_wbu, target, exp, code, 3);
|
||||
|
||||
case IQ2000_BUILTIN_SYSCALL:
|
||||
return expand_one_builtin (CODE_FOR_syscall, target, arglist, code, 0);
|
||||
return expand_one_builtin (CODE_FOR_syscall, target, exp, code, 0);
|
||||
}
|
||||
|
||||
return NULL_RTX;
|
||||
|
|
|
|||
|
|
@ -10336,8 +10336,10 @@ mips_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
|||
const struct builtin_description *bdesc;
|
||||
const struct bdesc_map *m;
|
||||
|
||||
fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
|
||||
arglist = TREE_OPERAND (exp, 1);
|
||||
fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
|
||||
/* FIXME: Rewrite this to use the CALL_EXPR directly instead of consing
|
||||
up an arglist. */
|
||||
arglist = CALL_EXPR_ARGS (exp);
|
||||
fcode = DECL_FUNCTION_CODE (fndecl);
|
||||
|
||||
bdesc = NULL;
|
||||
|
|
|
|||
|
|
@ -2436,7 +2436,8 @@ altivec_build_resolved_builtin (tree *args, int n,
|
|||
tree impl_fndecl = rs6000_builtin_decls[desc->overloaded_code];
|
||||
tree ret_type = rs6000_builtin_type (desc->ret_type);
|
||||
tree argtypes = TYPE_ARG_TYPES (TREE_TYPE (impl_fndecl));
|
||||
tree arglist = NULL_TREE, arg_type[3];
|
||||
tree arg_type[3];
|
||||
tree call;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < n; i++)
|
||||
|
|
@ -2463,13 +2464,30 @@ altivec_build_resolved_builtin (tree *args, int n,
|
|||
build_int_cst (NULL_TREE, 2));
|
||||
}
|
||||
|
||||
while (--n >= 0)
|
||||
arglist = tree_cons (NULL_TREE,
|
||||
fold_convert (arg_type[n], args[n]),
|
||||
arglist);
|
||||
|
||||
return fold_convert (ret_type,
|
||||
build_function_call_expr (impl_fndecl, arglist));
|
||||
switch (n)
|
||||
{
|
||||
case 0:
|
||||
call = build_call_expr (impl_fndecl, 0);
|
||||
break;
|
||||
case 1:
|
||||
call = build_call_expr (impl_fndecl, 1,
|
||||
fold_convert (arg_type[0], args[0]));
|
||||
break;
|
||||
case 2:
|
||||
call = build_call_expr (impl_fndecl, 2,
|
||||
fold_convert (arg_type[0], args[0]),
|
||||
fold_convert (arg_type[1], args[1]));
|
||||
break;
|
||||
case 3:
|
||||
call = build_call_expr (impl_fndecl, 3,
|
||||
fold_convert (arg_type[0], args[0]),
|
||||
fold_convert (arg_type[1], args[1]),
|
||||
fold_convert (arg_type[2], args[2]));
|
||||
break;
|
||||
default:
|
||||
gcc_unreachable ();
|
||||
}
|
||||
return fold_convert (ret_type, call);
|
||||
}
|
||||
|
||||
/* Implementation of the resolve_overloaded_builtin target hook, to
|
||||
|
|
|
|||
|
|
@ -6294,12 +6294,8 @@ rs6000_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p)
|
|||
tree tmp = create_tmp_var (type, "va_arg_tmp");
|
||||
tree dest_addr = build_fold_addr_expr (tmp);
|
||||
|
||||
tree copy = build_function_call_expr
|
||||
(implicit_built_in_decls[BUILT_IN_MEMCPY],
|
||||
tree_cons (NULL_TREE, dest_addr,
|
||||
tree_cons (NULL_TREE, addr,
|
||||
tree_cons (NULL_TREE, size_int (rsize * 4),
|
||||
NULL_TREE))));
|
||||
tree copy = build_call_expr (implicit_built_in_decls[BUILT_IN_MEMCPY],
|
||||
3, dest_addr, addr, size_int (rsize * 4));
|
||||
|
||||
gimplify_and_add (copy, pre_p);
|
||||
addr = dest_addr;
|
||||
|
|
@ -6934,10 +6930,10 @@ static struct builtin_description bdesc_1arg[] =
|
|||
};
|
||||
|
||||
static rtx
|
||||
rs6000_expand_unop_builtin (enum insn_code icode, tree arglist, rtx target)
|
||||
rs6000_expand_unop_builtin (enum insn_code icode, tree exp, rtx target)
|
||||
{
|
||||
rtx pat;
|
||||
tree arg0 = TREE_VALUE (arglist);
|
||||
tree arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
rtx op0 = expand_normal (arg0);
|
||||
enum machine_mode tmode = insn_data[icode].operand[0].mode;
|
||||
enum machine_mode mode0 = insn_data[icode].operand[1].mode;
|
||||
|
|
@ -6983,10 +6979,10 @@ rs6000_expand_unop_builtin (enum insn_code icode, tree arglist, rtx target)
|
|||
}
|
||||
|
||||
static rtx
|
||||
altivec_expand_abs_builtin (enum insn_code icode, tree arglist, rtx target)
|
||||
altivec_expand_abs_builtin (enum insn_code icode, tree exp, rtx target)
|
||||
{
|
||||
rtx pat, scratch1, scratch2;
|
||||
tree arg0 = TREE_VALUE (arglist);
|
||||
tree arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
rtx op0 = expand_normal (arg0);
|
||||
enum machine_mode tmode = insn_data[icode].operand[0].mode;
|
||||
enum machine_mode mode0 = insn_data[icode].operand[1].mode;
|
||||
|
|
@ -7015,11 +7011,11 @@ altivec_expand_abs_builtin (enum insn_code icode, tree arglist, rtx target)
|
|||
}
|
||||
|
||||
static rtx
|
||||
rs6000_expand_binop_builtin (enum insn_code icode, tree arglist, rtx target)
|
||||
rs6000_expand_binop_builtin (enum insn_code icode, tree exp, rtx target)
|
||||
{
|
||||
rtx pat;
|
||||
tree arg0 = TREE_VALUE (arglist);
|
||||
tree arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
tree arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
tree arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
rtx op0 = expand_normal (arg0);
|
||||
rtx op1 = expand_normal (arg1);
|
||||
enum machine_mode tmode = insn_data[icode].operand[0].mode;
|
||||
|
|
@ -7089,12 +7085,12 @@ rs6000_expand_binop_builtin (enum insn_code icode, tree arglist, rtx target)
|
|||
|
||||
static rtx
|
||||
altivec_expand_predicate_builtin (enum insn_code icode, const char *opcode,
|
||||
tree arglist, rtx target)
|
||||
tree exp, rtx target)
|
||||
{
|
||||
rtx pat, scratch;
|
||||
tree cr6_form = TREE_VALUE (arglist);
|
||||
tree arg0 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
tree arg1 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
|
||||
tree cr6_form = CALL_EXPR_ARG (exp, 0);
|
||||
tree arg0 = CALL_EXPR_ARG (exp, 1);
|
||||
tree arg1 = CALL_EXPR_ARG (exp, 2);
|
||||
rtx op0 = expand_normal (arg0);
|
||||
rtx op1 = expand_normal (arg1);
|
||||
enum machine_mode tmode = SImode;
|
||||
|
|
@ -7165,11 +7161,11 @@ altivec_expand_predicate_builtin (enum insn_code icode, const char *opcode,
|
|||
}
|
||||
|
||||
static rtx
|
||||
altivec_expand_lv_builtin (enum insn_code icode, tree arglist, rtx target)
|
||||
altivec_expand_lv_builtin (enum insn_code icode, tree exp, rtx target)
|
||||
{
|
||||
rtx pat, addr;
|
||||
tree arg0 = TREE_VALUE (arglist);
|
||||
tree arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
tree arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
tree arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
enum machine_mode tmode = insn_data[icode].operand[0].mode;
|
||||
enum machine_mode mode0 = Pmode;
|
||||
enum machine_mode mode1 = Pmode;
|
||||
|
|
@ -7211,11 +7207,11 @@ altivec_expand_lv_builtin (enum insn_code icode, tree arglist, rtx target)
|
|||
}
|
||||
|
||||
static rtx
|
||||
spe_expand_stv_builtin (enum insn_code icode, tree arglist)
|
||||
spe_expand_stv_builtin (enum insn_code icode, tree exp)
|
||||
{
|
||||
tree arg0 = TREE_VALUE (arglist);
|
||||
tree arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
tree arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
|
||||
tree arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
tree arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
tree arg2 = CALL_EXPR_ARG (exp, 2);
|
||||
rtx op0 = expand_normal (arg0);
|
||||
rtx op1 = expand_normal (arg1);
|
||||
rtx op2 = expand_normal (arg2);
|
||||
|
|
@ -7244,11 +7240,11 @@ spe_expand_stv_builtin (enum insn_code icode, tree arglist)
|
|||
}
|
||||
|
||||
static rtx
|
||||
altivec_expand_stv_builtin (enum insn_code icode, tree arglist)
|
||||
altivec_expand_stv_builtin (enum insn_code icode, tree exp)
|
||||
{
|
||||
tree arg0 = TREE_VALUE (arglist);
|
||||
tree arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
tree arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
|
||||
tree arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
tree arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
tree arg2 = CALL_EXPR_ARG (exp, 2);
|
||||
rtx op0 = expand_normal (arg0);
|
||||
rtx op1 = expand_normal (arg1);
|
||||
rtx op2 = expand_normal (arg2);
|
||||
|
|
@ -7285,12 +7281,12 @@ altivec_expand_stv_builtin (enum insn_code icode, tree arglist)
|
|||
}
|
||||
|
||||
static rtx
|
||||
rs6000_expand_ternop_builtin (enum insn_code icode, tree arglist, rtx target)
|
||||
rs6000_expand_ternop_builtin (enum insn_code icode, tree exp, rtx target)
|
||||
{
|
||||
rtx pat;
|
||||
tree arg0 = TREE_VALUE (arglist);
|
||||
tree arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
tree arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
|
||||
tree arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
tree arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
tree arg2 = CALL_EXPR_ARG (exp, 2);
|
||||
rtx op0 = expand_normal (arg0);
|
||||
rtx op1 = expand_normal (arg1);
|
||||
rtx op2 = expand_normal (arg2);
|
||||
|
|
@ -7348,8 +7344,7 @@ rs6000_expand_ternop_builtin (enum insn_code icode, tree arglist, rtx target)
|
|||
static rtx
|
||||
altivec_expand_ld_builtin (tree exp, rtx target, bool *expandedp)
|
||||
{
|
||||
tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
|
||||
tree arglist = TREE_OPERAND (exp, 1);
|
||||
tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
|
||||
unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
|
||||
tree arg0;
|
||||
enum machine_mode tmode, mode0;
|
||||
|
|
@ -7377,7 +7372,7 @@ altivec_expand_ld_builtin (tree exp, rtx target, bool *expandedp)
|
|||
|
||||
*expandedp = true;
|
||||
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
op0 = expand_normal (arg0);
|
||||
tmode = insn_data[icode].operand[0].mode;
|
||||
mode0 = insn_data[icode].operand[1].mode;
|
||||
|
|
@ -7402,8 +7397,7 @@ static rtx
|
|||
altivec_expand_st_builtin (tree exp, rtx target ATTRIBUTE_UNUSED,
|
||||
bool *expandedp)
|
||||
{
|
||||
tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
|
||||
tree arglist = TREE_OPERAND (exp, 1);
|
||||
tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
|
||||
unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
|
||||
tree arg0, arg1;
|
||||
enum machine_mode mode0, mode1;
|
||||
|
|
@ -7429,8 +7423,8 @@ altivec_expand_st_builtin (tree exp, rtx target ATTRIBUTE_UNUSED,
|
|||
return NULL_RTX;
|
||||
}
|
||||
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
op0 = expand_normal (arg0);
|
||||
op1 = expand_normal (arg1);
|
||||
mode0 = insn_data[icode].operand[0].mode;
|
||||
|
|
@ -7454,8 +7448,7 @@ static rtx
|
|||
altivec_expand_dst_builtin (tree exp, rtx target ATTRIBUTE_UNUSED,
|
||||
bool *expandedp)
|
||||
{
|
||||
tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
|
||||
tree arglist = TREE_OPERAND (exp, 1);
|
||||
tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
|
||||
unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
|
||||
tree arg0, arg1, arg2;
|
||||
enum machine_mode mode0, mode1, mode2;
|
||||
|
|
@ -7470,9 +7463,9 @@ altivec_expand_dst_builtin (tree exp, rtx target ATTRIBUTE_UNUSED,
|
|||
for (i = 0; i < ARRAY_SIZE (bdesc_dst); i++, d++)
|
||||
if (d->code == fcode)
|
||||
{
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
arg2 = CALL_EXPR_ARG (exp, 2);
|
||||
op0 = expand_normal (arg0);
|
||||
op1 = expand_normal (arg1);
|
||||
op2 = expand_normal (arg2);
|
||||
|
|
@ -7512,7 +7505,7 @@ altivec_expand_dst_builtin (tree exp, rtx target ATTRIBUTE_UNUSED,
|
|||
|
||||
/* Expand vec_init builtin. */
|
||||
static rtx
|
||||
altivec_expand_vec_init_builtin (tree type, tree arglist, rtx target)
|
||||
altivec_expand_vec_init_builtin (tree type, tree exp, rtx target)
|
||||
{
|
||||
enum machine_mode tmode = TYPE_MODE (type);
|
||||
enum machine_mode inner_mode = GET_MODE_INNER (tmode);
|
||||
|
|
@ -7520,15 +7513,14 @@ altivec_expand_vec_init_builtin (tree type, tree arglist, rtx target)
|
|||
rtvec v = rtvec_alloc (n_elt);
|
||||
|
||||
gcc_assert (VECTOR_MODE_P (tmode));
|
||||
|
||||
for (i = 0; i < n_elt; ++i, arglist = TREE_CHAIN (arglist))
|
||||
gcc_assert (n_elt == call_expr_nargs (exp));
|
||||
|
||||
for (i = 0; i < n_elt; ++i)
|
||||
{
|
||||
rtx x = expand_normal (TREE_VALUE (arglist));
|
||||
rtx x = expand_normal (CALL_EXPR_ARG (exp, i));
|
||||
RTVEC_ELT (v, i) = gen_lowpart (inner_mode, x);
|
||||
}
|
||||
|
||||
gcc_assert (arglist == NULL);
|
||||
|
||||
if (!target || !register_operand (target, tmode))
|
||||
target = gen_reg_rtx (tmode);
|
||||
|
||||
|
|
@ -7556,16 +7548,16 @@ get_element_number (tree vec_type, tree arg)
|
|||
|
||||
/* Expand vec_set builtin. */
|
||||
static rtx
|
||||
altivec_expand_vec_set_builtin (tree arglist)
|
||||
altivec_expand_vec_set_builtin (tree exp)
|
||||
{
|
||||
enum machine_mode tmode, mode1;
|
||||
tree arg0, arg1, arg2;
|
||||
int elt;
|
||||
rtx op0, op1;
|
||||
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
arg2 = CALL_EXPR_ARG (exp, 2);
|
||||
|
||||
tmode = TYPE_MODE (TREE_TYPE (arg0));
|
||||
mode1 = TYPE_MODE (TREE_TYPE (TREE_TYPE (arg0)));
|
||||
|
|
@ -7588,15 +7580,15 @@ altivec_expand_vec_set_builtin (tree arglist)
|
|||
|
||||
/* Expand vec_ext builtin. */
|
||||
static rtx
|
||||
altivec_expand_vec_ext_builtin (tree arglist, rtx target)
|
||||
altivec_expand_vec_ext_builtin (tree exp, rtx target)
|
||||
{
|
||||
enum machine_mode tmode, mode0;
|
||||
tree arg0, arg1;
|
||||
int elt;
|
||||
rtx op0;
|
||||
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
|
||||
op0 = expand_normal (arg0);
|
||||
elt = get_element_number (TREE_TYPE (arg0), arg1);
|
||||
|
|
@ -7624,8 +7616,7 @@ altivec_expand_builtin (tree exp, rtx target, bool *expandedp)
|
|||
struct builtin_description_predicates *dp;
|
||||
size_t i;
|
||||
enum insn_code icode;
|
||||
tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
|
||||
tree arglist = TREE_OPERAND (exp, 1);
|
||||
tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
|
||||
tree arg0;
|
||||
rtx op0, pat;
|
||||
enum machine_mode tmode, mode0;
|
||||
|
|
@ -7656,15 +7647,15 @@ altivec_expand_builtin (tree exp, rtx target, bool *expandedp)
|
|||
switch (fcode)
|
||||
{
|
||||
case ALTIVEC_BUILTIN_STVX:
|
||||
return altivec_expand_stv_builtin (CODE_FOR_altivec_stvx, arglist);
|
||||
return altivec_expand_stv_builtin (CODE_FOR_altivec_stvx, exp);
|
||||
case ALTIVEC_BUILTIN_STVEBX:
|
||||
return altivec_expand_stv_builtin (CODE_FOR_altivec_stvebx, arglist);
|
||||
return altivec_expand_stv_builtin (CODE_FOR_altivec_stvebx, exp);
|
||||
case ALTIVEC_BUILTIN_STVEHX:
|
||||
return altivec_expand_stv_builtin (CODE_FOR_altivec_stvehx, arglist);
|
||||
return altivec_expand_stv_builtin (CODE_FOR_altivec_stvehx, exp);
|
||||
case ALTIVEC_BUILTIN_STVEWX:
|
||||
return altivec_expand_stv_builtin (CODE_FOR_altivec_stvewx, arglist);
|
||||
return altivec_expand_stv_builtin (CODE_FOR_altivec_stvewx, exp);
|
||||
case ALTIVEC_BUILTIN_STVXL:
|
||||
return altivec_expand_stv_builtin (CODE_FOR_altivec_stvxl, arglist);
|
||||
return altivec_expand_stv_builtin (CODE_FOR_altivec_stvxl, exp);
|
||||
|
||||
case ALTIVEC_BUILTIN_MFVSCR:
|
||||
icode = CODE_FOR_altivec_mfvscr;
|
||||
|
|
@ -7683,7 +7674,7 @@ altivec_expand_builtin (tree exp, rtx target, bool *expandedp)
|
|||
|
||||
case ALTIVEC_BUILTIN_MTVSCR:
|
||||
icode = CODE_FOR_altivec_mtvscr;
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
op0 = expand_normal (arg0);
|
||||
mode0 = insn_data[icode].operand[0].mode;
|
||||
|
||||
|
|
@ -7705,7 +7696,7 @@ altivec_expand_builtin (tree exp, rtx target, bool *expandedp)
|
|||
|
||||
case ALTIVEC_BUILTIN_DSS:
|
||||
icode = CODE_FOR_altivec_dss;
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
STRIP_NOPS (arg0);
|
||||
op0 = expand_normal (arg0);
|
||||
mode0 = insn_data[icode].operand[0].mode;
|
||||
|
|
@ -7731,19 +7722,19 @@ altivec_expand_builtin (tree exp, rtx target, bool *expandedp)
|
|||
case ALTIVEC_BUILTIN_VEC_INIT_V8HI:
|
||||
case ALTIVEC_BUILTIN_VEC_INIT_V16QI:
|
||||
case ALTIVEC_BUILTIN_VEC_INIT_V4SF:
|
||||
return altivec_expand_vec_init_builtin (TREE_TYPE (exp), arglist, target);
|
||||
return altivec_expand_vec_init_builtin (TREE_TYPE (exp), exp, target);
|
||||
|
||||
case ALTIVEC_BUILTIN_VEC_SET_V4SI:
|
||||
case ALTIVEC_BUILTIN_VEC_SET_V8HI:
|
||||
case ALTIVEC_BUILTIN_VEC_SET_V16QI:
|
||||
case ALTIVEC_BUILTIN_VEC_SET_V4SF:
|
||||
return altivec_expand_vec_set_builtin (arglist);
|
||||
return altivec_expand_vec_set_builtin (exp);
|
||||
|
||||
case ALTIVEC_BUILTIN_VEC_EXT_V4SI:
|
||||
case ALTIVEC_BUILTIN_VEC_EXT_V8HI:
|
||||
case ALTIVEC_BUILTIN_VEC_EXT_V16QI:
|
||||
case ALTIVEC_BUILTIN_VEC_EXT_V4SF:
|
||||
return altivec_expand_vec_ext_builtin (arglist, target);
|
||||
return altivec_expand_vec_ext_builtin (exp, target);
|
||||
|
||||
default:
|
||||
break;
|
||||
|
|
@ -7754,39 +7745,39 @@ altivec_expand_builtin (tree exp, rtx target, bool *expandedp)
|
|||
d = (struct builtin_description *) bdesc_abs;
|
||||
for (i = 0; i < ARRAY_SIZE (bdesc_abs); i++, d++)
|
||||
if (d->code == fcode)
|
||||
return altivec_expand_abs_builtin (d->icode, arglist, target);
|
||||
return altivec_expand_abs_builtin (d->icode, exp, target);
|
||||
|
||||
/* Expand the AltiVec predicates. */
|
||||
dp = (struct builtin_description_predicates *) bdesc_altivec_preds;
|
||||
for (i = 0; i < ARRAY_SIZE (bdesc_altivec_preds); i++, dp++)
|
||||
if (dp->code == fcode)
|
||||
return altivec_expand_predicate_builtin (dp->icode, dp->opcode,
|
||||
arglist, target);
|
||||
exp, target);
|
||||
|
||||
/* LV* are funky. We initialized them differently. */
|
||||
switch (fcode)
|
||||
{
|
||||
case ALTIVEC_BUILTIN_LVSL:
|
||||
return altivec_expand_lv_builtin (CODE_FOR_altivec_lvsl,
|
||||
arglist, target);
|
||||
exp, target);
|
||||
case ALTIVEC_BUILTIN_LVSR:
|
||||
return altivec_expand_lv_builtin (CODE_FOR_altivec_lvsr,
|
||||
arglist, target);
|
||||
exp, target);
|
||||
case ALTIVEC_BUILTIN_LVEBX:
|
||||
return altivec_expand_lv_builtin (CODE_FOR_altivec_lvebx,
|
||||
arglist, target);
|
||||
exp, target);
|
||||
case ALTIVEC_BUILTIN_LVEHX:
|
||||
return altivec_expand_lv_builtin (CODE_FOR_altivec_lvehx,
|
||||
arglist, target);
|
||||
exp, target);
|
||||
case ALTIVEC_BUILTIN_LVEWX:
|
||||
return altivec_expand_lv_builtin (CODE_FOR_altivec_lvewx,
|
||||
arglist, target);
|
||||
exp, target);
|
||||
case ALTIVEC_BUILTIN_LVXL:
|
||||
return altivec_expand_lv_builtin (CODE_FOR_altivec_lvxl,
|
||||
arglist, target);
|
||||
exp, target);
|
||||
case ALTIVEC_BUILTIN_LVX:
|
||||
return altivec_expand_lv_builtin (CODE_FOR_altivec_lvx,
|
||||
arglist, target);
|
||||
exp, target);
|
||||
default:
|
||||
break;
|
||||
/* Fall through. */
|
||||
|
|
@ -7832,8 +7823,7 @@ static struct builtin_description bdesc_2arg_spe[] =
|
|||
static rtx
|
||||
spe_expand_builtin (tree exp, rtx target, bool *expandedp)
|
||||
{
|
||||
tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
|
||||
tree arglist = TREE_OPERAND (exp, 1);
|
||||
tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
|
||||
tree arg1, arg0;
|
||||
unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
|
||||
enum insn_code icode;
|
||||
|
|
@ -7854,7 +7844,7 @@ spe_expand_builtin (tree exp, rtx target, bool *expandedp)
|
|||
case SPE_BUILTIN_EVSTWHO:
|
||||
case SPE_BUILTIN_EVSTWWE:
|
||||
case SPE_BUILTIN_EVSTWWO:
|
||||
arg1 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
|
||||
arg1 = CALL_EXPR_ARG (exp, 2);
|
||||
if (TREE_CODE (arg1) != INTEGER_CST
|
||||
|| TREE_INT_CST_LOW (arg1) & ~0x1f)
|
||||
{
|
||||
|
|
@ -7871,10 +7861,10 @@ spe_expand_builtin (tree exp, rtx target, bool *expandedp)
|
|||
{
|
||||
case SPE_BUILTIN_EVSPLATFI:
|
||||
return rs6000_expand_unop_builtin (CODE_FOR_spe_evsplatfi,
|
||||
arglist, target);
|
||||
exp, target);
|
||||
case SPE_BUILTIN_EVSPLATI:
|
||||
return rs6000_expand_unop_builtin (CODE_FOR_spe_evsplati,
|
||||
arglist, target);
|
||||
exp, target);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -7882,48 +7872,48 @@ spe_expand_builtin (tree exp, rtx target, bool *expandedp)
|
|||
d = (struct builtin_description *) bdesc_2arg_spe;
|
||||
for (i = 0; i < ARRAY_SIZE (bdesc_2arg_spe); ++i, ++d)
|
||||
if (d->code == fcode)
|
||||
return rs6000_expand_binop_builtin (d->icode, arglist, target);
|
||||
return rs6000_expand_binop_builtin (d->icode, exp, target);
|
||||
|
||||
d = (struct builtin_description *) bdesc_spe_predicates;
|
||||
for (i = 0; i < ARRAY_SIZE (bdesc_spe_predicates); ++i, ++d)
|
||||
if (d->code == fcode)
|
||||
return spe_expand_predicate_builtin (d->icode, arglist, target);
|
||||
return spe_expand_predicate_builtin (d->icode, exp, target);
|
||||
|
||||
d = (struct builtin_description *) bdesc_spe_evsel;
|
||||
for (i = 0; i < ARRAY_SIZE (bdesc_spe_evsel); ++i, ++d)
|
||||
if (d->code == fcode)
|
||||
return spe_expand_evsel_builtin (d->icode, arglist, target);
|
||||
return spe_expand_evsel_builtin (d->icode, exp, target);
|
||||
|
||||
switch (fcode)
|
||||
{
|
||||
case SPE_BUILTIN_EVSTDDX:
|
||||
return spe_expand_stv_builtin (CODE_FOR_spe_evstddx, arglist);
|
||||
return spe_expand_stv_builtin (CODE_FOR_spe_evstddx, exp);
|
||||
case SPE_BUILTIN_EVSTDHX:
|
||||
return spe_expand_stv_builtin (CODE_FOR_spe_evstdhx, arglist);
|
||||
return spe_expand_stv_builtin (CODE_FOR_spe_evstdhx, exp);
|
||||
case SPE_BUILTIN_EVSTDWX:
|
||||
return spe_expand_stv_builtin (CODE_FOR_spe_evstdwx, arglist);
|
||||
return spe_expand_stv_builtin (CODE_FOR_spe_evstdwx, exp);
|
||||
case SPE_BUILTIN_EVSTWHEX:
|
||||
return spe_expand_stv_builtin (CODE_FOR_spe_evstwhex, arglist);
|
||||
return spe_expand_stv_builtin (CODE_FOR_spe_evstwhex, exp);
|
||||
case SPE_BUILTIN_EVSTWHOX:
|
||||
return spe_expand_stv_builtin (CODE_FOR_spe_evstwhox, arglist);
|
||||
return spe_expand_stv_builtin (CODE_FOR_spe_evstwhox, exp);
|
||||
case SPE_BUILTIN_EVSTWWEX:
|
||||
return spe_expand_stv_builtin (CODE_FOR_spe_evstwwex, arglist);
|
||||
return spe_expand_stv_builtin (CODE_FOR_spe_evstwwex, exp);
|
||||
case SPE_BUILTIN_EVSTWWOX:
|
||||
return spe_expand_stv_builtin (CODE_FOR_spe_evstwwox, arglist);
|
||||
return spe_expand_stv_builtin (CODE_FOR_spe_evstwwox, exp);
|
||||
case SPE_BUILTIN_EVSTDD:
|
||||
return spe_expand_stv_builtin (CODE_FOR_spe_evstdd, arglist);
|
||||
return spe_expand_stv_builtin (CODE_FOR_spe_evstdd, exp);
|
||||
case SPE_BUILTIN_EVSTDH:
|
||||
return spe_expand_stv_builtin (CODE_FOR_spe_evstdh, arglist);
|
||||
return spe_expand_stv_builtin (CODE_FOR_spe_evstdh, exp);
|
||||
case SPE_BUILTIN_EVSTDW:
|
||||
return spe_expand_stv_builtin (CODE_FOR_spe_evstdw, arglist);
|
||||
return spe_expand_stv_builtin (CODE_FOR_spe_evstdw, exp);
|
||||
case SPE_BUILTIN_EVSTWHE:
|
||||
return spe_expand_stv_builtin (CODE_FOR_spe_evstwhe, arglist);
|
||||
return spe_expand_stv_builtin (CODE_FOR_spe_evstwhe, exp);
|
||||
case SPE_BUILTIN_EVSTWHO:
|
||||
return spe_expand_stv_builtin (CODE_FOR_spe_evstwho, arglist);
|
||||
return spe_expand_stv_builtin (CODE_FOR_spe_evstwho, exp);
|
||||
case SPE_BUILTIN_EVSTWWE:
|
||||
return spe_expand_stv_builtin (CODE_FOR_spe_evstwwe, arglist);
|
||||
return spe_expand_stv_builtin (CODE_FOR_spe_evstwwe, exp);
|
||||
case SPE_BUILTIN_EVSTWWO:
|
||||
return spe_expand_stv_builtin (CODE_FOR_spe_evstwwo, arglist);
|
||||
return spe_expand_stv_builtin (CODE_FOR_spe_evstwwo, exp);
|
||||
case SPE_BUILTIN_MFSPEFSCR:
|
||||
icode = CODE_FOR_spe_mfspefscr;
|
||||
tmode = insn_data[icode].operand[0].mode;
|
||||
|
|
@ -7940,7 +7930,7 @@ spe_expand_builtin (tree exp, rtx target, bool *expandedp)
|
|||
return target;
|
||||
case SPE_BUILTIN_MTSPEFSCR:
|
||||
icode = CODE_FOR_spe_mtspefscr;
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
op0 = expand_normal (arg0);
|
||||
mode0 = insn_data[icode].operand[0].mode;
|
||||
|
||||
|
|
@ -7963,12 +7953,12 @@ spe_expand_builtin (tree exp, rtx target, bool *expandedp)
|
|||
}
|
||||
|
||||
static rtx
|
||||
spe_expand_predicate_builtin (enum insn_code icode, tree arglist, rtx target)
|
||||
spe_expand_predicate_builtin (enum insn_code icode, tree exp, rtx target)
|
||||
{
|
||||
rtx pat, scratch, tmp;
|
||||
tree form = TREE_VALUE (arglist);
|
||||
tree arg0 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
tree arg1 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
|
||||
tree form = CALL_EXPR_ARG (exp, 0);
|
||||
tree arg0 = CALL_EXPR_ARG (exp, 1);
|
||||
tree arg1 = CALL_EXPR_ARG (exp, 2);
|
||||
rtx op0 = expand_normal (arg0);
|
||||
rtx op1 = expand_normal (arg1);
|
||||
enum machine_mode mode0 = insn_data[icode].operand[1].mode;
|
||||
|
|
@ -8071,13 +8061,13 @@ spe_expand_predicate_builtin (enum insn_code icode, tree arglist, rtx target)
|
|||
*/
|
||||
|
||||
static rtx
|
||||
spe_expand_evsel_builtin (enum insn_code icode, tree arglist, rtx target)
|
||||
spe_expand_evsel_builtin (enum insn_code icode, tree exp, rtx target)
|
||||
{
|
||||
rtx pat, scratch;
|
||||
tree arg0 = TREE_VALUE (arglist);
|
||||
tree arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
tree arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
|
||||
tree arg3 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (arglist))));
|
||||
tree arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
tree arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
tree arg2 = CALL_EXPR_ARG (exp, 2);
|
||||
tree arg3 = CALL_EXPR_ARG (exp, 3);
|
||||
rtx op0 = expand_normal (arg0);
|
||||
rtx op1 = expand_normal (arg1);
|
||||
rtx op2 = expand_normal (arg2);
|
||||
|
|
@ -8131,8 +8121,7 @@ rs6000_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
|||
enum machine_mode mode ATTRIBUTE_UNUSED,
|
||||
int ignore ATTRIBUTE_UNUSED)
|
||||
{
|
||||
tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
|
||||
tree arglist = TREE_OPERAND (exp, 1);
|
||||
tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
|
||||
unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
|
||||
struct builtin_description *d;
|
||||
size_t i;
|
||||
|
|
@ -8150,7 +8139,7 @@ rs6000_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
|||
|
||||
gcc_assert (TARGET_ALTIVEC);
|
||||
|
||||
arg = TREE_VALUE (arglist);
|
||||
arg = CALL_EXPR_ARG (exp, 0);
|
||||
gcc_assert (TREE_CODE (TREE_TYPE (arg)) == POINTER_TYPE);
|
||||
op = expand_expr (arg, NULL_RTX, Pmode, EXPAND_NORMAL);
|
||||
addr = memory_address (mode, op);
|
||||
|
|
@ -8178,20 +8167,15 @@ rs6000_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
|||
|
||||
return target;
|
||||
}
|
||||
|
||||
|
||||
/* FIXME: There's got to be a nicer way to handle this case than
|
||||
constructing a new CALL_EXPR. */
|
||||
if (fcode == ALTIVEC_BUILTIN_VCFUX
|
||||
|| fcode == ALTIVEC_BUILTIN_VCFSX)
|
||||
{
|
||||
if (!TREE_CHAIN (arglist))
|
||||
{
|
||||
tree t, arg0;
|
||||
t = NULL_TREE;
|
||||
t = tree_cons (NULL_TREE, integer_zero_node, t);
|
||||
arg0 = TREE_VALUE (arglist);
|
||||
t = tree_cons (NULL_TREE, arg0, t);
|
||||
arglist = t;
|
||||
TREE_OPERAND (exp, 1) = t;
|
||||
}
|
||||
if (call_expr_nargs (exp) == 1)
|
||||
exp = build_call_nary (TREE_TYPE (exp), CALL_EXPR_FN (exp),
|
||||
2, CALL_EXPR_ARG (exp, 0), integer_zero_node);
|
||||
}
|
||||
|
||||
if (TARGET_ALTIVEC)
|
||||
|
|
@ -8215,19 +8199,19 @@ rs6000_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
|||
d = (struct builtin_description *) bdesc_1arg;
|
||||
for (i = 0; i < ARRAY_SIZE (bdesc_1arg); i++, d++)
|
||||
if (d->code == fcode)
|
||||
return rs6000_expand_unop_builtin (d->icode, arglist, target);
|
||||
return rs6000_expand_unop_builtin (d->icode, exp, target);
|
||||
|
||||
/* Handle simple binary operations. */
|
||||
d = (struct builtin_description *) bdesc_2arg;
|
||||
for (i = 0; i < ARRAY_SIZE (bdesc_2arg); i++, d++)
|
||||
if (d->code == fcode)
|
||||
return rs6000_expand_binop_builtin (d->icode, arglist, target);
|
||||
return rs6000_expand_binop_builtin (d->icode, exp, target);
|
||||
|
||||
/* Handle simple ternary operations. */
|
||||
d = (struct builtin_description *) bdesc_3arg;
|
||||
for (i = 0; i < ARRAY_SIZE (bdesc_3arg); i++, d++)
|
||||
if (d->code == fcode)
|
||||
return rs6000_expand_ternop_builtin (d->icode, arglist, target);
|
||||
return rs6000_expand_ternop_builtin (d->icode, exp, target);
|
||||
|
||||
gcc_unreachable ();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8210,13 +8210,14 @@ s390_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
|||
unsigned int const *code_for_builtin =
|
||||
TARGET_64BIT ? code_for_builtin_64 : code_for_builtin_31;
|
||||
|
||||
tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
|
||||
tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
|
||||
unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
|
||||
tree arglist = TREE_OPERAND (exp, 1);
|
||||
enum insn_code icode;
|
||||
rtx op[MAX_ARGS], pat;
|
||||
int arity;
|
||||
bool nonvoid;
|
||||
tree arg;
|
||||
call_expr_arg_iterator iter;
|
||||
|
||||
if (fcode >= S390_BUILTIN_max)
|
||||
internal_error ("bad builtin fcode");
|
||||
|
|
@ -8226,13 +8227,11 @@ s390_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
|||
|
||||
nonvoid = TREE_TYPE (TREE_TYPE (fndecl)) != void_type_node;
|
||||
|
||||
for (arglist = TREE_OPERAND (exp, 1), arity = 0;
|
||||
arglist;
|
||||
arglist = TREE_CHAIN (arglist), arity++)
|
||||
arity = 0;
|
||||
FOR_EACH_CALL_EXPR_ARG (arg, iter, exp)
|
||||
{
|
||||
const struct insn_operand_data *insn_op;
|
||||
|
||||
tree arg = TREE_VALUE (arglist);
|
||||
if (arg == error_mark_node)
|
||||
return NULL_RTX;
|
||||
if (arity > MAX_ARGS)
|
||||
|
|
@ -8244,6 +8243,7 @@ s390_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
|||
|
||||
if (!(*insn_op->predicate) (op[arity], insn_op->mode))
|
||||
op[arity] = copy_to_mode_reg (insn_op->mode, op[arity]);
|
||||
arity++;
|
||||
}
|
||||
|
||||
if (nonvoid)
|
||||
|
|
|
|||
|
|
@ -9904,8 +9904,7 @@ static rtx
|
|||
sh_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
||||
enum machine_mode mode ATTRIBUTE_UNUSED, int ignore)
|
||||
{
|
||||
tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
|
||||
tree arglist = TREE_OPERAND (exp, 1);
|
||||
tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
|
||||
unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
|
||||
const struct builtin_description *d = &bdesc[fcode];
|
||||
enum insn_code icode = d->icode;
|
||||
|
|
@ -9938,10 +9937,9 @@ sh_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
|||
|
||||
if (! signature_args[signature][i])
|
||||
break;
|
||||
arg = TREE_VALUE (arglist);
|
||||
arg = CALL_EXPR_ARG (exp, i - 1);
|
||||
if (arg == error_mark_node)
|
||||
return const0_rtx;
|
||||
arglist = TREE_CHAIN (arglist);
|
||||
if (signature_args[signature][i] & 8)
|
||||
{
|
||||
opmode = ptr_mode;
|
||||
|
|
|
|||
|
|
@ -5701,12 +5701,10 @@ sparc_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p)
|
|||
tree tmp = create_tmp_var (type, "va_arg_tmp");
|
||||
tree dest_addr = build_fold_addr_expr (tmp);
|
||||
|
||||
tree copy = build_function_call_expr
|
||||
(implicit_built_in_decls[BUILT_IN_MEMCPY],
|
||||
tree_cons (NULL_TREE, dest_addr,
|
||||
tree_cons (NULL_TREE, addr,
|
||||
tree_cons (NULL_TREE, size_int (rsize),
|
||||
NULL_TREE))));
|
||||
tree copy = build_call_expr (implicit_built_in_decls[BUILT_IN_MEMCPY], 3,
|
||||
dest_addr,
|
||||
addr,
|
||||
size_int (rsize));
|
||||
|
||||
gimplify_and_add (copy, pre_p);
|
||||
addr = dest_addr;
|
||||
|
|
@ -7985,8 +7983,9 @@ static rtx
|
|||
sparc_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
||||
enum machine_mode tmode, int ignore ATTRIBUTE_UNUSED)
|
||||
{
|
||||
tree arglist;
|
||||
tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
|
||||
tree arg;
|
||||
call_expr_arg_iterator iter;
|
||||
tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
|
||||
unsigned int icode = DECL_FUNCTION_CODE (fndecl);
|
||||
rtx pat, op[4];
|
||||
enum machine_mode mode[4];
|
||||
|
|
@ -8001,11 +8000,8 @@ sparc_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
|
|||
else
|
||||
op[arg_count] = target;
|
||||
|
||||
for (arglist = TREE_OPERAND (exp, 1); arglist;
|
||||
arglist = TREE_CHAIN (arglist))
|
||||
FOR_EACH_CALL_EXPR_ARG (arg, iter, exp)
|
||||
{
|
||||
tree arg = TREE_VALUE (arglist);
|
||||
|
||||
arg_count++;
|
||||
mode[arg_count] = insn_data[icode].operand[arg_count].mode;
|
||||
op[arg_count] = expand_normal (arg);
|
||||
|
|
|
|||
|
|
@ -16014,70 +16014,70 @@ echo "${ECHO_T}$gcc_cv_ld_pie" >&6
|
|||
echo "$as_me:$LINENO: checking linker EH-compatible garbage collection of sections" >&5
|
||||
echo $ECHO_N "checking linker EH-compatible garbage collection of sections... $ECHO_C" >&6
|
||||
gcc_cv_ld_eh_gc_sections=no
|
||||
if test $in_tree_ld = yes ; then
|
||||
if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 17 -o "$gcc_cv_gld_major_version" -gt 2 \
|
||||
&& test $in_tree_ld_is_elf = yes; then
|
||||
gcc_cv_ld_eh_gc_sections=yes
|
||||
fi
|
||||
elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then
|
||||
cat > conftest.s <<EOF
|
||||
.section .text
|
||||
.globl _start
|
||||
.type _start, @function
|
||||
_start:
|
||||
.long foo
|
||||
.size _start, .-_start
|
||||
.section .text.foo,"ax",@progbits
|
||||
.type foo, @function
|
||||
foo:
|
||||
.long 0
|
||||
.size foo, .-foo
|
||||
.section .gcc_except_table.foo,"a",@progbits
|
||||
.L0:
|
||||
.long 0
|
||||
.section .eh_frame,"a",@progbits
|
||||
.long .L0
|
||||
EOF
|
||||
if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
|
||||
if $gcc_cv_ld -o conftest conftest.o --entry=_start --gc-sections 2>&1 \
|
||||
| grep "gc-sections option ignored" > /dev/null; then
|
||||
gcc_cv_ld_eh_gc_sections=no
|
||||
elif $gcc_cv_objdump -h conftest | grep gcc_except_table > /dev/null; then
|
||||
gcc_cv_ld_eh_gc_sections=yes
|
||||
# If no COMDAT groups, the compiler will emit .gnu.linkonce.t. sections.
|
||||
if test x$gcc_cv_as_comdat_group != xyes; then
|
||||
gcc_cv_ld_eh_gc_sections=no
|
||||
cat > conftest.s <<EOF
|
||||
.section .text
|
||||
.globl _start
|
||||
.type _start, @function
|
||||
_start:
|
||||
.long foo
|
||||
.size _start, .-_start
|
||||
.section .gnu.linkonce.t.foo,"ax",@progbits
|
||||
.type foo, @function
|
||||
foo:
|
||||
.long 0
|
||||
.size foo, .-foo
|
||||
.section .gcc_except_table.foo,"a",@progbits
|
||||
.L0:
|
||||
.long 0
|
||||
.section .eh_frame,"a",@progbits
|
||||
.long .L0
|
||||
EOF
|
||||
if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
|
||||
if $gcc_cv_ld -o conftest conftest.o --entry=_start --gc-sections 2>&1 \
|
||||
| grep "gc-sections option ignored" > /dev/null; then
|
||||
gcc_cv_ld_eh_gc_sections=no
|
||||
elif $gcc_cv_objdump -h conftest | grep gcc_except_table > /dev/null; then
|
||||
gcc_cv_ld_eh_gc_sections=yes
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
rm -f conftest.s conftest.o conftest
|
||||
fi
|
||||
#if test $in_tree_ld = yes ; then
|
||||
# if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 17 -o "$gcc_cv_gld_major_version" -gt 2 \
|
||||
# && test $in_tree_ld_is_elf = yes; then
|
||||
# gcc_cv_ld_eh_gc_sections=yes
|
||||
# fi
|
||||
#elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then
|
||||
# cat > conftest.s <<EOF
|
||||
# .section .text
|
||||
#.globl _start
|
||||
# .type _start, @function
|
||||
#_start:
|
||||
# .long foo
|
||||
# .size _start, .-_start
|
||||
# .section .text.foo,"ax",@progbits
|
||||
# .type foo, @function
|
||||
#foo:
|
||||
# .long 0
|
||||
# .size foo, .-foo
|
||||
# .section .gcc_except_table.foo,"a",@progbits
|
||||
#.L0:
|
||||
# .long 0
|
||||
# .section .eh_frame,"a",@progbits
|
||||
# .long .L0
|
||||
#EOF
|
||||
# if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
|
||||
# if $gcc_cv_ld -o conftest conftest.o --entry=_start --gc-sections 2>&1 \
|
||||
# | grep "gc-sections option ignored" > /dev/null; then
|
||||
# gcc_cv_ld_eh_gc_sections=no
|
||||
# elif $gcc_cv_objdump -h conftest | grep gcc_except_table > /dev/null; then
|
||||
# gcc_cv_ld_eh_gc_sections=yes
|
||||
# # If no COMDAT groups, the compiler will emit .gnu.linkonce.t. sections.
|
||||
# if test x$gcc_cv_as_comdat_group != xyes; then
|
||||
# gcc_cv_ld_eh_gc_sections=no
|
||||
# cat > conftest.s <<EOF
|
||||
# .section .text
|
||||
#.globl _start
|
||||
# .type _start, @function
|
||||
#_start:
|
||||
# .long foo
|
||||
# .size _start, .-_start
|
||||
# .section .gnu.linkonce.t.foo,"ax",@progbits
|
||||
# .type foo, @function
|
||||
#foo:
|
||||
# .long 0
|
||||
# .size foo, .-foo
|
||||
# .section .gcc_except_table.foo,"a",@progbits
|
||||
#.L0:
|
||||
# .long 0
|
||||
# .section .eh_frame,"a",@progbits
|
||||
# .long .L0
|
||||
#EOF
|
||||
# if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
|
||||
# if $gcc_cv_ld -o conftest conftest.o --entry=_start --gc-sections 2>&1 \
|
||||
# | grep "gc-sections option ignored" > /dev/null; then
|
||||
# gcc_cv_ld_eh_gc_sections=no
|
||||
# elif $gcc_cv_objdump -h conftest | grep gcc_except_table > /dev/null; then
|
||||
# gcc_cv_ld_eh_gc_sections=yes
|
||||
# fi
|
||||
# fi
|
||||
# fi
|
||||
# fi
|
||||
# fi
|
||||
# rm -f conftest.s conftest.o conftest
|
||||
#fi
|
||||
case "$target" in
|
||||
hppa*-*-linux*)
|
||||
# ??? This apparently exposes a binutils bug with PC-relative relocations.
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ convert_to_real (tree type, tree expr)
|
|||
CASE_MATHFN (Y1)
|
||||
#undef CASE_MATHFN
|
||||
{
|
||||
tree arg0 = strip_float_extensions (TREE_VALUE (TREE_OPERAND (expr, 1)));
|
||||
tree arg0 = strip_float_extensions (CALL_EXPR_ARG (expr, 0));
|
||||
tree newtype = type;
|
||||
|
||||
/* We have (outertype)sqrt((innertype)x). Choose the wider mode from
|
||||
|
|
@ -188,13 +188,12 @@ convert_to_real (tree type, tree expr)
|
|||
&& (TYPE_MODE (newtype) == TYPE_MODE (double_type_node)
|
||||
|| TYPE_MODE (newtype) == TYPE_MODE (float_type_node)))
|
||||
{
|
||||
tree arglist;
|
||||
tree fn = mathfn_built_in (newtype, fcode);
|
||||
|
||||
if (fn)
|
||||
{
|
||||
arglist = build_tree_list (NULL_TREE, fold (convert_to_real (newtype, arg0)));
|
||||
expr = build_function_call_expr (fn, arglist);
|
||||
tree arg = fold (convert_to_real (newtype, arg0));
|
||||
expr = build_call_expr (fn, 1, arg);
|
||||
if (newtype == type)
|
||||
return expr;
|
||||
}
|
||||
|
|
@ -225,18 +224,14 @@ convert_to_real (tree type, tree expr)
|
|||
|
||||
if (fn)
|
||||
{
|
||||
tree arg
|
||||
= strip_float_extensions (TREE_VALUE (TREE_OPERAND (expr, 1)));
|
||||
tree arg = strip_float_extensions (CALL_EXPR_ARG (expr, 0));
|
||||
|
||||
/* Make sure (type)arg0 is an extension, otherwise we could end up
|
||||
changing (float)floor(double d) into floorf((float)d), which is
|
||||
incorrect because (float)d uses round-to-nearest and can round
|
||||
up to the next integer. */
|
||||
if (TYPE_PRECISION (type) >= TYPE_PRECISION (TREE_TYPE (arg)))
|
||||
return
|
||||
build_function_call_expr (fn,
|
||||
build_tree_list (NULL_TREE,
|
||||
fold (convert_to_real (type, arg))));
|
||||
return build_call_expr (fn, 1, fold (convert_to_real (type, arg)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -434,10 +429,7 @@ convert_to_integer (tree type, tree expr)
|
|||
break;
|
||||
|
||||
CASE_FLT_FN (BUILT_IN_TRUNC):
|
||||
{
|
||||
tree arglist = TREE_OPERAND (s_expr, 1);
|
||||
return convert_to_integer (type, TREE_VALUE (arglist));
|
||||
}
|
||||
return convert_to_integer (type, CALL_EXPR_ARG (s_expr, 0));
|
||||
|
||||
default:
|
||||
break;
|
||||
|
|
@ -445,8 +437,7 @@ convert_to_integer (tree type, tree expr)
|
|||
|
||||
if (fn)
|
||||
{
|
||||
tree arglist = TREE_OPERAND (s_expr, 1);
|
||||
tree newexpr = build_function_call_expr (fn, arglist);
|
||||
tree newexpr = build_call_expr (fn, 1, CALL_EXPR_ARG (s_expr, 0));
|
||||
return convert_to_integer (type, newexpr);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -949,8 +949,7 @@ create_coverage (void)
|
|||
/* Generate a call to __gcov_init(&gcov_info). */
|
||||
body = NULL;
|
||||
t = build_fold_addr_expr (gcov_info);
|
||||
t = tree_cons (NULL, t, NULL);
|
||||
t = build_function_call_expr (gcov_init, t);
|
||||
t = build_call_expr (gcov_init, 1, t);
|
||||
append_to_statement_list (t, &body);
|
||||
|
||||
/* Generate a constructor to run it. */
|
||||
|
|
|
|||
|
|
@ -1,3 +1,90 @@
|
|||
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 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
|
||||
|
||||
PR c++/28943
|
||||
|
|
|
|||
|
|
@ -336,7 +336,7 @@ build_call (tree function, tree parms)
|
|||
TREE_VALUE (tmp), t);
|
||||
}
|
||||
|
||||
function = build3 (CALL_EXPR, result_type, function, parms, NULL_TREE);
|
||||
function = build_call_list (result_type, function, parms);
|
||||
TREE_HAS_CONSTRUCTOR (function) = is_constructor;
|
||||
TREE_NOTHROW (function) = nothrow;
|
||||
|
||||
|
|
@ -4740,7 +4740,7 @@ build_over_call (struct z_candidate *cand, int flags)
|
|||
tree expr;
|
||||
tree return_type;
|
||||
return_type = TREE_TYPE (TREE_TYPE (fn));
|
||||
expr = build3 (CALL_EXPR, return_type, fn, args, NULL_TREE);
|
||||
expr = build_call_list (return_type, fn, args);
|
||||
if (TREE_THIS_VOLATILE (fn) && cfun)
|
||||
current_function_returns_abnormally = 1;
|
||||
if (!VOID_TYPE_P (return_type))
|
||||
|
|
@ -5122,7 +5122,7 @@ build_java_interface_fn_ref (tree fn, tree instance)
|
|||
lookup_fn = build1 (ADDR_EXPR,
|
||||
build_pointer_type (TREE_TYPE (java_iface_lookup_fn)),
|
||||
java_iface_lookup_fn);
|
||||
return build3 (CALL_EXPR, ptr_type_node, lookup_fn, lookup_args, NULL_TREE);
|
||||
return build_call_list (ptr_type_node, lookup_fn, lookup_args);
|
||||
}
|
||||
|
||||
/* Returns the value to use for the in-charge parameter when making a
|
||||
|
|
@ -5533,10 +5533,10 @@ build_new_method_call (tree instance, tree fns, tree args,
|
|||
}
|
||||
|
||||
if (processing_template_decl && call != error_mark_node)
|
||||
call = (build_min_non_dep
|
||||
(CALL_EXPR, call,
|
||||
call = (build_min_non_dep_call_list
|
||||
(call,
|
||||
build_min_nt (COMPONENT_REF, orig_instance, orig_fns, NULL_TREE),
|
||||
orig_args, NULL_TREE));
|
||||
orig_args));
|
||||
|
||||
/* Free all the conversions we allocated. */
|
||||
obstack_free (&conversion_obstack, p);
|
||||
|
|
|
|||
|
|
@ -410,7 +410,7 @@ cp_gimplify_init_expr (tree *expr_p, tree *pre_p, tree *post_p)
|
|||
if (TREE_CODE (sub) == AGGR_INIT_EXPR)
|
||||
{
|
||||
gimplify_expr (&to, pre_p, post_p, is_gimple_lvalue, fb_lvalue);
|
||||
TREE_OPERAND (sub, 2) = to;
|
||||
AGGR_INIT_EXPR_SLOT (sub) = to;
|
||||
*expr_p = from;
|
||||
|
||||
/* The initialization is now a side-effect, so the container can
|
||||
|
|
|
|||
|
|
@ -74,10 +74,12 @@ DEFTREECODE (MEMBER_REF, "member_ref", tcc_reference, 2)
|
|||
operator converts to. Operand is expression to be converted. */
|
||||
DEFTREECODE (TYPE_EXPR, "type_expr", tcc_expression, 1)
|
||||
|
||||
/* For AGGR_INIT_EXPR, operand 0 is function which performs initialization,
|
||||
operand 1 is argument list to initialization function,
|
||||
and operand 2 is the slot which was allocated for this expression. */
|
||||
DEFTREECODE (AGGR_INIT_EXPR, "aggr_init_expr", tcc_expression, 3)
|
||||
/* AGGR_INIT_EXPRs have a variably-sized representation similar to
|
||||
that of CALL_EXPRs. Operand 0 is an INTEGER_CST node containing the
|
||||
operand count, operand 1 is the function which performs initialization,
|
||||
operand 2 is the slot which was allocated for this expression, and
|
||||
the remaining operands are the arguments to the initialization function. */
|
||||
DEFTREECODE (AGGR_INIT_EXPR, "aggr_init_expr", tcc_vl_exp, 3)
|
||||
|
||||
/* A throw expression. operand 0 is the expression, if there was one,
|
||||
else it is NULL_TREE. */
|
||||
|
|
|
|||
|
|
@ -2331,6 +2331,85 @@ extern void decl_shadowed_for_var_insert (tree, tree);
|
|||
#define AGGR_INIT_VIA_CTOR_P(NODE) \
|
||||
TREE_LANG_FLAG_0 (AGGR_INIT_EXPR_CHECK (NODE))
|
||||
|
||||
/* AGGR_INIT_EXPR accessors. These are equivalent to the CALL_EXPR
|
||||
accessors, except for AGGR_INIT_EXPR_SLOT (which takes the place of
|
||||
CALL_EXPR_STATIC_CHAIN). */
|
||||
|
||||
#define AGGR_INIT_EXPR_FN(NODE) TREE_OPERAND (AGGR_INIT_EXPR_CHECK (NODE), 1)
|
||||
#define AGGR_INIT_EXPR_SLOT(NODE) \
|
||||
TREE_OPERAND (AGGR_INIT_EXPR_CHECK (NODE), 2)
|
||||
#define AGGR_INIT_EXPR_ARG(NODE, I) \
|
||||
TREE_OPERAND (AGGR_INIT_EXPR_CHECK (NODE), (I) + 3)
|
||||
#define aggr_init_expr_nargs(NODE) (VL_EXP_OPERAND_LENGTH(NODE) - 3)
|
||||
|
||||
/* AGGR_INIT_EXPR_ARGP returns a pointer to the argument vector for NODE.
|
||||
We can't use &AGGR_INIT_EXPR_ARG (NODE, 0) because that will complain if
|
||||
the argument count is zero when checking is enabled. Instead, do
|
||||
the pointer arithmetic to advance past the 3 fixed operands in a
|
||||
AGGR_INIT_EXPR. That produces a valid pointer to just past the end of
|
||||
the operand array, even if it's not valid to dereference it. */
|
||||
#define AGGR_INIT_EXPR_ARGP(NODE) \
|
||||
(&(TREE_OPERAND (AGGR_INIT_EXPR_CHECK (NODE), 0)) + 3)
|
||||
|
||||
/* Abstract iterators for AGGR_INIT_EXPRs. */
|
||||
|
||||
/* Structure containing iterator state. */
|
||||
typedef struct aggr_init_expr_arg_iterator_d GTY (())
|
||||
{
|
||||
tree t; /* the aggr_init_expr */
|
||||
int n; /* argument count */
|
||||
int i; /* next argument index */
|
||||
} aggr_init_expr_arg_iterator;
|
||||
|
||||
/* Initialize the abstract argument list iterator object ITER with the
|
||||
arguments from AGGR_INIT_EXPR node EXP. */
|
||||
static inline void
|
||||
init_aggr_init_expr_arg_iterator (tree exp,
|
||||
aggr_init_expr_arg_iterator *iter)
|
||||
{
|
||||
iter->t = exp;
|
||||
iter->n = aggr_init_expr_nargs (exp);
|
||||
iter->i = 0;
|
||||
}
|
||||
|
||||
/* Return the next argument from abstract argument list iterator object ITER,
|
||||
and advance its state. Return NULL_TREE if there are no more arguments. */
|
||||
static inline tree
|
||||
next_aggr_init_expr_arg (aggr_init_expr_arg_iterator *iter)
|
||||
{
|
||||
tree result;
|
||||
if (iter->i >= iter->n)
|
||||
return NULL_TREE;
|
||||
result = AGGR_INIT_EXPR_ARG (iter->t, iter->i);
|
||||
iter->i++;
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Initialize the abstract argument list iterator object ITER, then advance
|
||||
past and return the first argument. Useful in for expressions, e.g.
|
||||
for (arg = first_aggr_init_expr_arg (exp, &iter); arg;
|
||||
arg = next_aggr_init_expr_arg (&iter)) */
|
||||
static inline tree
|
||||
first_aggr_init_expr_arg (tree exp, aggr_init_expr_arg_iterator *iter)
|
||||
{
|
||||
init_aggr_init_expr_arg_iterator (exp, iter);
|
||||
return next_aggr_init_expr_arg (iter);
|
||||
}
|
||||
|
||||
/* Test whether there are more arguments in abstract argument list iterator
|
||||
ITER, without changing its state. */
|
||||
static inline bool
|
||||
more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
|
||||
{
|
||||
return (iter->i < iter->n);
|
||||
}
|
||||
|
||||
/* Iterate through each argument ARG of AGGR_INIT_EXPR CALL, using variable
|
||||
ITER (of type aggr_init_expr_arg_iterator) to hold the iteration state. */
|
||||
#define FOR_EACH_AGGR_INIT_EXPR_ARG(arg, iter, call) \
|
||||
for ((arg) = first_aggr_init_expr_arg ((call), &(iter)); (arg); \
|
||||
(arg) = next_aggr_init_expr_arg (&(iter)))
|
||||
|
||||
/* The TYPE_MAIN_DECL for a class template type is a TYPE_DECL, not a
|
||||
TEMPLATE_DECL. This macro determines whether or not a given class
|
||||
type is really a template type, as opposed to an instantiation or
|
||||
|
|
@ -4375,6 +4454,7 @@ extern void lang_check_failed (const char *, int,
|
|||
const char *) ATTRIBUTE_NORETURN;
|
||||
extern tree stabilize_expr (tree, tree *);
|
||||
extern void stabilize_call (tree, tree *);
|
||||
extern void stabilize_aggr_init (tree, tree *);
|
||||
extern bool stabilize_init (tree, tree *);
|
||||
extern tree add_stmt_to_compound (tree, tree);
|
||||
extern tree cxx_maybe_build_cleanup (tree);
|
||||
|
|
@ -4390,6 +4470,7 @@ extern bool builtin_valid_in_constant_expr_p (tree);
|
|||
extern tree build_min (enum tree_code, tree, ...);
|
||||
extern tree build_min_nt (enum tree_code, ...);
|
||||
extern tree build_min_non_dep (enum tree_code, tree, ...);
|
||||
extern tree build_min_non_dep_call_list (tree, tree, tree);
|
||||
extern tree build_cplus_new (tree, tree);
|
||||
extern tree get_target_expr (tree);
|
||||
extern tree build_cplus_array_type (tree, tree);
|
||||
|
|
|
|||
|
|
@ -902,9 +902,11 @@ convert_to_void (tree expr, const char *implicit)
|
|||
if (TREE_CODE (init) == AGGR_INIT_EXPR
|
||||
&& !AGGR_INIT_VIA_CTOR_P (init))
|
||||
{
|
||||
tree fn = TREE_OPERAND (init, 0);
|
||||
expr = build3 (CALL_EXPR, TREE_TYPE (TREE_TYPE (TREE_TYPE (fn))),
|
||||
fn, TREE_OPERAND (init, 1), NULL_TREE);
|
||||
tree fn = AGGR_INIT_EXPR_FN (init);
|
||||
expr = build_call_array (TREE_TYPE (TREE_TYPE (TREE_TYPE (fn))),
|
||||
fn,
|
||||
aggr_init_expr_nargs (init),
|
||||
AGGR_INIT_EXPR_ARGP (init));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -412,9 +412,11 @@ pp_cxx_postfix_expression (cxx_pretty_printer *pp, tree t)
|
|||
case AGGR_INIT_EXPR:
|
||||
case CALL_EXPR:
|
||||
{
|
||||
tree fun = TREE_OPERAND (t, 0);
|
||||
tree args = TREE_OPERAND (t, 1);
|
||||
tree fun = (code == AGGR_INIT_EXPR ? AGGR_INIT_EXPR_FN (t)
|
||||
: CALL_EXPR_FN (t));
|
||||
tree saved_scope = pp->enclosing_scope;
|
||||
bool skipfirst = false;
|
||||
tree arg;
|
||||
|
||||
if (TREE_CODE (fun) == ADDR_EXPR)
|
||||
fun = TREE_OPERAND (fun, 0);
|
||||
|
|
@ -427,9 +429,11 @@ pp_cxx_postfix_expression (cxx_pretty_printer *pp, tree t)
|
|||
;
|
||||
else if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fun))
|
||||
{
|
||||
tree object = code == AGGR_INIT_EXPR && AGGR_INIT_VIA_CTOR_P (t)
|
||||
? TREE_OPERAND (t, 2)
|
||||
: TREE_VALUE (args);
|
||||
tree object = (code == AGGR_INIT_EXPR
|
||||
? (AGGR_INIT_VIA_CTOR_P (t)
|
||||
? AGGR_INIT_EXPR_SLOT (t)
|
||||
: AGGR_INIT_EXPR_ARG (t, 0))
|
||||
: CALL_EXPR_ARG (t, 0));
|
||||
|
||||
while (TREE_CODE (object) == NOP_EXPR)
|
||||
object = TREE_OPERAND (object, 0);
|
||||
|
|
@ -447,18 +451,49 @@ pp_cxx_postfix_expression (cxx_pretty_printer *pp, tree t)
|
|||
pp_cxx_postfix_expression (pp, object);
|
||||
pp_cxx_arrow (pp);
|
||||
}
|
||||
args = TREE_CHAIN (args);
|
||||
skipfirst = true;
|
||||
pp->enclosing_scope = strip_pointer_operator (TREE_TYPE (object));
|
||||
}
|
||||
|
||||
pp_cxx_postfix_expression (pp, fun);
|
||||
pp->enclosing_scope = saved_scope;
|
||||
pp_cxx_call_argument_list (pp, args);
|
||||
pp_cxx_left_paren (pp);
|
||||
if (code == AGGR_INIT_EXPR)
|
||||
{
|
||||
aggr_init_expr_arg_iterator iter;
|
||||
FOR_EACH_AGGR_INIT_EXPR_ARG (arg, iter, t)
|
||||
{
|
||||
if (skipfirst)
|
||||
skipfirst = false;
|
||||
else
|
||||
{
|
||||
pp_cxx_expression (pp, arg);
|
||||
if (more_aggr_init_expr_args_p (&iter))
|
||||
pp_cxx_separate_with (pp, ',');
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
call_expr_arg_iterator iter;
|
||||
FOR_EACH_CALL_EXPR_ARG (arg, iter, t)
|
||||
{
|
||||
if (skipfirst)
|
||||
skipfirst = false;
|
||||
else
|
||||
{
|
||||
pp_cxx_expression (pp, arg);
|
||||
if (more_call_expr_args_p (&iter))
|
||||
pp_cxx_separate_with (pp, ',');
|
||||
}
|
||||
}
|
||||
}
|
||||
pp_cxx_right_paren (pp);
|
||||
}
|
||||
if (code == AGGR_INIT_EXPR && AGGR_INIT_VIA_CTOR_P (t))
|
||||
{
|
||||
pp_cxx_separate_with (pp, ',');
|
||||
pp_cxx_postfix_expression (pp, TREE_OPERAND (t, 2));
|
||||
pp_cxx_postfix_expression (pp, AGGR_INIT_EXPR_SLOT (t));
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -3401,7 +3401,7 @@ build_offset_ref_call_from_tree (tree fn, tree args)
|
|||
|| TREE_CODE (fn) == MEMBER_REF);
|
||||
if (type_dependent_expression_p (fn)
|
||||
|| any_type_dependent_arguments_p (args))
|
||||
return build_min_nt (CALL_EXPR, fn, args, NULL_TREE);
|
||||
return build_nt_call_list (fn, args);
|
||||
|
||||
/* Transform the arguments and add the implicit "this"
|
||||
parameter. That must be done before the FN is transformed
|
||||
|
|
@ -3431,7 +3431,7 @@ build_offset_ref_call_from_tree (tree fn, tree args)
|
|||
|
||||
expr = build_function_call (fn, args);
|
||||
if (processing_template_decl && expr != error_mark_node)
|
||||
return build_min_non_dep (CALL_EXPR, expr, orig_fn, orig_args, NULL_TREE);
|
||||
return build_min_non_dep_call_list (expr, orig_fn, orig_args);
|
||||
return expr;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -388,10 +388,21 @@ cp_dump_tree (void* dump_info, tree t)
|
|||
break;
|
||||
|
||||
case AGGR_INIT_EXPR:
|
||||
dump_int (di, "ctor", AGGR_INIT_VIA_CTOR_P (t));
|
||||
dump_child ("fn", TREE_OPERAND (t, 0));
|
||||
dump_child ("args", TREE_OPERAND (t, 1));
|
||||
dump_child ("decl", TREE_OPERAND (t, 2));
|
||||
{
|
||||
int i = 0;
|
||||
tree arg;
|
||||
aggr_init_expr_arg_iterator iter;
|
||||
dump_int (di, "ctor", AGGR_INIT_VIA_CTOR_P (t));
|
||||
dump_child ("fn", AGGR_INIT_EXPR_FN (t));
|
||||
FOR_EACH_AGGR_INIT_EXPR_ARG (arg, iter, t)
|
||||
{
|
||||
char buffer[32];
|
||||
sprintf (buffer, "%u", i);
|
||||
dump_child (buffer, arg);
|
||||
i++;
|
||||
}
|
||||
dump_child ("decl", AGGR_INIT_EXPR_SLOT (t));
|
||||
}
|
||||
break;
|
||||
|
||||
case HANDLER:
|
||||
|
|
|
|||
|
|
@ -66,6 +66,8 @@ static void dump_aggr_type (tree, int);
|
|||
static void dump_type_prefix (tree, int);
|
||||
static void dump_type_suffix (tree, int);
|
||||
static void dump_function_name (tree, int);
|
||||
static void dump_call_expr_args (tree, int, bool);
|
||||
static void dump_aggr_init_expr_args (tree, int, bool);
|
||||
static void dump_expr_list (tree, int);
|
||||
static void dump_global_iord (tree);
|
||||
static void dump_parameters (tree, int);
|
||||
|
|
@ -1265,6 +1267,55 @@ dump_template_parms (tree info, int primary, int flags)
|
|||
pp_cxx_end_template_argument_list (cxx_pp);
|
||||
}
|
||||
|
||||
/* Print out the arguments of CALL_EXPR T as a parenthesized list using
|
||||
flags FLAGS. Skip over the first argument if SKIPFIRST is true. */
|
||||
|
||||
static void
|
||||
dump_call_expr_args (tree t, int flags, bool skipfirst)
|
||||
{
|
||||
tree arg;
|
||||
call_expr_arg_iterator iter;
|
||||
|
||||
pp_cxx_left_paren (cxx_pp);
|
||||
FOR_EACH_CALL_EXPR_ARG (arg, iter, t)
|
||||
{
|
||||
if (skipfirst)
|
||||
skipfirst = false;
|
||||
else
|
||||
{
|
||||
dump_expr (arg, flags | TFF_EXPR_IN_PARENS);
|
||||
if (more_call_expr_args_p (&iter))
|
||||
pp_separate_with_comma (cxx_pp);
|
||||
}
|
||||
}
|
||||
pp_cxx_right_paren (cxx_pp);
|
||||
}
|
||||
|
||||
/* Print out the arguments of AGGR_INIT_EXPR T as a parenthesized list
|
||||
using flags FLAGS. Skip over the first argument if SKIPFIRST is
|
||||
true. */
|
||||
|
||||
static void
|
||||
dump_aggr_init_expr_args (tree t, int flags, bool skipfirst)
|
||||
{
|
||||
tree arg;
|
||||
aggr_init_expr_arg_iterator iter;
|
||||
|
||||
pp_cxx_left_paren (cxx_pp);
|
||||
FOR_EACH_AGGR_INIT_EXPR_ARG (arg, iter, t)
|
||||
{
|
||||
if (skipfirst)
|
||||
skipfirst = false;
|
||||
else
|
||||
{
|
||||
dump_expr (arg, flags | TFF_EXPR_IN_PARENS);
|
||||
if (more_aggr_init_expr_args_p (&iter))
|
||||
pp_separate_with_comma (cxx_pp);
|
||||
}
|
||||
}
|
||||
pp_cxx_right_paren (cxx_pp);
|
||||
}
|
||||
|
||||
/* Print out a list of initializers (subr of dump_expr). */
|
||||
|
||||
static void
|
||||
|
|
@ -1387,8 +1438,8 @@ dump_expr (tree t, int flags)
|
|||
{
|
||||
tree fn = NULL_TREE;
|
||||
|
||||
if (TREE_CODE (TREE_OPERAND (t, 0)) == ADDR_EXPR)
|
||||
fn = TREE_OPERAND (TREE_OPERAND (t, 0), 0);
|
||||
if (TREE_CODE (AGGR_INIT_EXPR_FN (t)) == ADDR_EXPR)
|
||||
fn = TREE_OPERAND (AGGR_INIT_EXPR_FN (t), 0);
|
||||
|
||||
if (fn && TREE_CODE (fn) == FUNCTION_DECL)
|
||||
{
|
||||
|
|
@ -1398,18 +1449,15 @@ dump_expr (tree t, int flags)
|
|||
dump_decl (fn, 0);
|
||||
}
|
||||
else
|
||||
dump_expr (TREE_OPERAND (t, 0), 0);
|
||||
dump_expr (AGGR_INIT_EXPR_FN (t), 0);
|
||||
}
|
||||
pp_cxx_left_paren (cxx_pp);
|
||||
if (TREE_OPERAND (t, 1))
|
||||
dump_expr_list (TREE_CHAIN (TREE_OPERAND (t, 1)), flags);
|
||||
pp_cxx_right_paren (cxx_pp);
|
||||
dump_aggr_init_expr_args (t, flags, false);
|
||||
break;
|
||||
|
||||
case CALL_EXPR:
|
||||
{
|
||||
tree fn = TREE_OPERAND (t, 0);
|
||||
tree args = TREE_OPERAND (t, 1);
|
||||
tree fn = CALL_EXPR_FN (t);
|
||||
bool skipfirst = false;
|
||||
|
||||
if (TREE_CODE (fn) == ADDR_EXPR)
|
||||
fn = TREE_OPERAND (fn, 0);
|
||||
|
|
@ -1420,7 +1468,7 @@ dump_expr (tree t, int flags)
|
|||
|
||||
if (TREE_TYPE (fn) != NULL_TREE && NEXT_CODE (fn) == METHOD_TYPE)
|
||||
{
|
||||
tree ob = TREE_VALUE (args);
|
||||
tree ob = CALL_EXPR_ARG (t, 0);
|
||||
if (TREE_CODE (ob) == ADDR_EXPR)
|
||||
{
|
||||
dump_expr (TREE_OPERAND (ob, 0), flags | TFF_EXPR_IN_PARENS);
|
||||
|
|
@ -1432,12 +1480,10 @@ dump_expr (tree t, int flags)
|
|||
dump_expr (ob, flags | TFF_EXPR_IN_PARENS);
|
||||
pp_arrow (cxx_pp);
|
||||
}
|
||||
args = TREE_CHAIN (args);
|
||||
skipfirst = true;
|
||||
}
|
||||
dump_expr (fn, flags | TFF_EXPR_IN_PARENS);
|
||||
pp_cxx_left_paren (cxx_pp);
|
||||
dump_expr_list (args, flags);
|
||||
pp_cxx_right_paren (cxx_pp);
|
||||
dump_call_expr_args (t, flags, skipfirst);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -1581,10 +1627,8 @@ dump_expr (tree t, int flags)
|
|||
{
|
||||
t = TREE_OPERAND (t, 0);
|
||||
gcc_assert (TREE_CODE (t) == CALL_EXPR);
|
||||
dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
|
||||
pp_cxx_left_paren (cxx_pp);
|
||||
dump_expr_list (TREE_CHAIN (TREE_OPERAND (t, 1)), flags);
|
||||
pp_cxx_right_paren (cxx_pp);
|
||||
dump_expr (CALL_EXPR_FN (t), flags | TFF_EXPR_IN_PARENS);
|
||||
dump_call_expr_args (t, flags, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2206,7 +2206,7 @@ write_expression (tree expr)
|
|||
break;
|
||||
|
||||
default:
|
||||
for (i = 0; i < TREE_CODE_LENGTH (code); ++i)
|
||||
for (i = 0; i < TREE_OPERAND_LENGTH (expr); ++i)
|
||||
{
|
||||
tree operand = TREE_OPERAND (expr, i);
|
||||
/* As a GNU extension, the middle operand of a
|
||||
|
|
|
|||
|
|
@ -4443,8 +4443,7 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p)
|
|||
|| any_type_dependent_arguments_p (args)))
|
||||
{
|
||||
postfix_expression
|
||||
= build_min_nt (CALL_EXPR, postfix_expression,
|
||||
args, NULL_TREE);
|
||||
= build_nt_call_list (postfix_expression, args);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
23
gcc/cp/pt.c
23
gcc/cp/pt.c
|
|
@ -8350,12 +8350,15 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
|
|||
NULL_TREE, NULL_TREE);
|
||||
|
||||
case CALL_EXPR:
|
||||
return build_nt (code,
|
||||
tsubst_copy (TREE_OPERAND (t, 0), args,
|
||||
complain, in_decl),
|
||||
tsubst_copy (TREE_OPERAND (t, 1), args, complain,
|
||||
in_decl),
|
||||
NULL_TREE);
|
||||
{
|
||||
int n = VL_EXP_OPERAND_LENGTH (t);
|
||||
tree result = build_vl_exp (CALL_EXPR, n);
|
||||
int i;
|
||||
for (i = 0; i < n; i++)
|
||||
TREE_OPERAND (t, i) = tsubst_copy (TREE_OPERAND (t, i), args,
|
||||
complain, in_decl);
|
||||
return result;
|
||||
}
|
||||
|
||||
case COND_EXPR:
|
||||
case MODOP_EXPR:
|
||||
|
|
@ -9271,7 +9274,7 @@ tsubst_copy_and_build (tree t,
|
|||
bool qualified_p;
|
||||
bool koenig_p;
|
||||
|
||||
function = TREE_OPERAND (t, 0);
|
||||
function = CALL_EXPR_FN (t);
|
||||
/* When we parsed the expression, we determined whether or
|
||||
not Koenig lookup should be performed. */
|
||||
koenig_p = KOENIG_LOOKUP_P (t);
|
||||
|
|
@ -9304,7 +9307,8 @@ tsubst_copy_and_build (tree t,
|
|||
qualified_p = true;
|
||||
}
|
||||
|
||||
call_args = RECUR (TREE_OPERAND (t, 1));
|
||||
/* FIXME: Rewrite this so as not to construct an arglist. */
|
||||
call_args = RECUR (CALL_EXPR_ARGS (t));
|
||||
|
||||
/* We do not perform argument-dependent lookup if normal
|
||||
lookup finds a non-function, in accordance with the
|
||||
|
|
@ -13064,9 +13068,10 @@ value_dependent_expression_p (tree expression)
|
|||
(TREE_OPERAND (expression, 1))));
|
||||
|
||||
case tcc_expression:
|
||||
case tcc_vl_exp:
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < TREE_CODE_LENGTH (TREE_CODE (expression)); ++i)
|
||||
for (i = 0; i < TREE_OPERAND_LENGTH (expression); ++i)
|
||||
/* In some cases, some of the operands may be missing.
|
||||
(For example, in the case of PREDECREMENT_EXPR, the
|
||||
amount to increment by may be missing.) That doesn't
|
||||
|
|
|
|||
|
|
@ -1789,7 +1789,7 @@ finish_call_expr (tree fn, tree args, bool disallow_virtual, bool koenig_p)
|
|||
if (type_dependent_expression_p (fn)
|
||||
|| any_type_dependent_arguments_p (args))
|
||||
{
|
||||
result = build_nt (CALL_EXPR, fn, args, NULL_TREE);
|
||||
result = build_nt_call_list (fn, args);
|
||||
KOENIG_LOOKUP_P (result) = koenig_p;
|
||||
return result;
|
||||
}
|
||||
|
|
@ -1846,7 +1846,7 @@ finish_call_expr (tree fn, tree args, bool disallow_virtual, bool koenig_p)
|
|||
if (processing_template_decl)
|
||||
{
|
||||
if (type_dependent_expression_p (object))
|
||||
return build_nt (CALL_EXPR, orig_fn, orig_args, NULL_TREE);
|
||||
return build_nt_call_list (orig_fn, orig_args);
|
||||
object = build_non_dependent_expr (object);
|
||||
}
|
||||
|
||||
|
|
@ -1890,8 +1890,7 @@ finish_call_expr (tree fn, tree args, bool disallow_virtual, bool koenig_p)
|
|||
|
||||
if (processing_template_decl)
|
||||
{
|
||||
result = build3 (CALL_EXPR, TREE_TYPE (result), orig_fn,
|
||||
orig_args, NULL_TREE);
|
||||
result = build_call_list (TREE_TYPE (result), orig_fn, orig_args);
|
||||
KOENIG_LOOKUP_P (result) = koenig_p;
|
||||
}
|
||||
return result;
|
||||
|
|
@ -2975,9 +2974,8 @@ simplify_aggr_init_expr (tree *tp)
|
|||
tree aggr_init_expr = *tp;
|
||||
|
||||
/* Form an appropriate CALL_EXPR. */
|
||||
tree fn = TREE_OPERAND (aggr_init_expr, 0);
|
||||
tree args = TREE_OPERAND (aggr_init_expr, 1);
|
||||
tree slot = TREE_OPERAND (aggr_init_expr, 2);
|
||||
tree fn = AGGR_INIT_EXPR_FN (aggr_init_expr);
|
||||
tree slot = AGGR_INIT_EXPR_SLOT (aggr_init_expr);
|
||||
tree type = TREE_TYPE (slot);
|
||||
|
||||
tree call_expr;
|
||||
|
|
@ -2995,23 +2993,20 @@ simplify_aggr_init_expr (tree *tp)
|
|||
style = arg;
|
||||
}
|
||||
|
||||
call_expr = build_call_array (TREE_TYPE (TREE_TYPE (TREE_TYPE (fn))),
|
||||
fn,
|
||||
aggr_init_expr_nargs (aggr_init_expr),
|
||||
AGGR_INIT_EXPR_ARGP (aggr_init_expr));
|
||||
|
||||
if (style == ctor)
|
||||
{
|
||||
/* Replace the first argument to the ctor with the address of the
|
||||
slot. */
|
||||
tree addr;
|
||||
|
||||
args = TREE_CHAIN (args);
|
||||
cxx_mark_addressable (slot);
|
||||
addr = build1 (ADDR_EXPR, build_pointer_type (type), slot);
|
||||
args = tree_cons (NULL_TREE, addr, args);
|
||||
CALL_EXPR_ARG (call_expr, 0) =
|
||||
build1 (ADDR_EXPR, build_pointer_type (type), slot);
|
||||
}
|
||||
|
||||
call_expr = build3 (CALL_EXPR,
|
||||
TREE_TYPE (TREE_TYPE (TREE_TYPE (fn))),
|
||||
fn, args, NULL_TREE);
|
||||
|
||||
if (style == arg)
|
||||
else if (style == arg)
|
||||
{
|
||||
/* Just mark it addressable here, and leave the rest to
|
||||
expand_call{,_inline}. */
|
||||
|
|
|
|||
172
gcc/cp/tree.c
172
gcc/cp/tree.c
|
|
@ -261,8 +261,55 @@ build_local_temp (tree type)
|
|||
return slot;
|
||||
}
|
||||
|
||||
/* INIT is a CALL_EXPR which needs info about its target.
|
||||
TYPE is the type that this initialization should appear to have.
|
||||
/* Set various status flags when building an AGGR_INIT_EXPR object T. */
|
||||
|
||||
static void
|
||||
process_aggr_init_operands (tree t)
|
||||
{
|
||||
bool side_effects;
|
||||
|
||||
side_effects = TREE_SIDE_EFFECTS (t);
|
||||
if (!side_effects)
|
||||
{
|
||||
int i, n;
|
||||
n = TREE_OPERAND_LENGTH (t);
|
||||
for (i = 1; i < n; i++)
|
||||
{
|
||||
tree op = TREE_OPERAND (t, i);
|
||||
if (op && TREE_SIDE_EFFECTS (op))
|
||||
{
|
||||
side_effects = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
TREE_SIDE_EFFECTS (t) = side_effects;
|
||||
}
|
||||
|
||||
/* Build an AGGR_INIT_EXPR of class tcc_vl_exp with the indicated RETURN_TYPE,
|
||||
FN, and SLOT. NARGS is the number of call arguments which are specified
|
||||
as a tree array ARGS. */
|
||||
|
||||
static tree
|
||||
build_aggr_init_array (tree return_type, tree fn, tree slot, int nargs,
|
||||
tree *args)
|
||||
{
|
||||
tree t;
|
||||
int i;
|
||||
|
||||
t = build_vl_exp (AGGR_INIT_EXPR, nargs + 3);
|
||||
TREE_TYPE (t) = return_type;
|
||||
AGGR_INIT_EXPR_FN (t) = fn;
|
||||
AGGR_INIT_EXPR_SLOT (t) = slot;
|
||||
for (i = 0; i < nargs; i++)
|
||||
AGGR_INIT_EXPR_ARG (t, i) = args[i];
|
||||
process_aggr_init_operands (t);
|
||||
return t;
|
||||
}
|
||||
|
||||
/* INIT is a CALL_EXPR or AGGR_INIT_EXPR which needs info about its
|
||||
target. TYPE is the type that this initialization should appear to
|
||||
have.
|
||||
|
||||
Build an encapsulation of the initialization to perform
|
||||
and return it so that it can be processed by language-independent
|
||||
|
|
@ -280,10 +327,13 @@ build_cplus_new (tree type, tree init)
|
|||
abstract class. */
|
||||
abstract_virtuals_error (NULL_TREE, type);
|
||||
|
||||
if (TREE_CODE (init) != CALL_EXPR && TREE_CODE (init) != AGGR_INIT_EXPR)
|
||||
if (TREE_CODE (init) == CALL_EXPR)
|
||||
fn = CALL_EXPR_FN (init);
|
||||
else if (TREE_CODE (init) == AGGR_INIT_EXPR)
|
||||
fn = AGGR_INIT_EXPR_FN (init);
|
||||
else
|
||||
return convert (type, init);
|
||||
|
||||
fn = TREE_OPERAND (init, 0);
|
||||
is_ctor = (TREE_CODE (fn) == ADDR_EXPR
|
||||
&& TREE_CODE (TREE_OPERAND (fn, 0)) == FUNCTION_DECL
|
||||
&& DECL_CONSTRUCTOR_P (TREE_OPERAND (fn, 0)));
|
||||
|
|
@ -303,8 +353,14 @@ build_cplus_new (tree type, tree init)
|
|||
type, don't mess with AGGR_INIT_EXPR. */
|
||||
if (is_ctor || TREE_ADDRESSABLE (type))
|
||||
{
|
||||
rval = build3 (AGGR_INIT_EXPR, void_type_node, fn,
|
||||
TREE_OPERAND (init, 1), slot);
|
||||
if (TREE_CODE(init) == CALL_EXPR)
|
||||
rval = build_aggr_init_array (void_type_node, fn, slot,
|
||||
call_expr_nargs (init),
|
||||
CALL_EXPR_ARGP (init));
|
||||
else
|
||||
rval = build_aggr_init_array (void_type_node, fn, slot,
|
||||
aggr_init_expr_nargs (init),
|
||||
AGGR_INIT_EXPR_ARGP (init));
|
||||
TREE_SIDE_EFFECTS (rval) = 1;
|
||||
AGGR_INIT_VIA_CTOR_P (rval) = is_ctor;
|
||||
}
|
||||
|
|
@ -1420,6 +1476,8 @@ build_min_nt (enum tree_code code, ...)
|
|||
int i;
|
||||
va_list p;
|
||||
|
||||
gcc_assert (TREE_CODE_CLASS (code) != tcc_vl_exp);
|
||||
|
||||
va_start (p, code);
|
||||
|
||||
t = make_node (code);
|
||||
|
|
@ -1435,6 +1493,7 @@ build_min_nt (enum tree_code code, ...)
|
|||
return t;
|
||||
}
|
||||
|
||||
|
||||
/* Similar to `build', but for template definitions. */
|
||||
|
||||
tree
|
||||
|
|
@ -1445,6 +1504,8 @@ build_min (enum tree_code code, tree tt, ...)
|
|||
int i;
|
||||
va_list p;
|
||||
|
||||
gcc_assert (TREE_CODE_CLASS (code) != tcc_vl_exp);
|
||||
|
||||
va_start (p, tt);
|
||||
|
||||
t = make_node (code);
|
||||
|
|
@ -1475,6 +1536,8 @@ build_min_non_dep (enum tree_code code, tree non_dep, ...)
|
|||
int i;
|
||||
va_list p;
|
||||
|
||||
gcc_assert (TREE_CODE_CLASS (code) != tcc_vl_exp);
|
||||
|
||||
va_start (p, non_dep);
|
||||
|
||||
t = make_node (code);
|
||||
|
|
@ -1497,6 +1560,19 @@ build_min_non_dep (enum tree_code code, tree non_dep, ...)
|
|||
return t;
|
||||
}
|
||||
|
||||
/* Similar to `build_call_list', but for template definitions of non-dependent
|
||||
expressions. NON_DEP is the non-dependent expression that has been
|
||||
built. */
|
||||
|
||||
tree
|
||||
build_min_non_dep_call_list (tree non_dep, tree fn, tree arglist)
|
||||
{
|
||||
tree t = build_nt_call_list (fn, arglist);
|
||||
TREE_TYPE (t) = TREE_TYPE (non_dep);
|
||||
TREE_SIDE_EFFECTS (t) = TREE_SIDE_EFFECTS (non_dep);
|
||||
return t;
|
||||
}
|
||||
|
||||
tree
|
||||
get_type_decl (tree t)
|
||||
{
|
||||
|
|
@ -1615,9 +1691,20 @@ cp_tree_equal (tree t1, tree t2)
|
|||
return cp_tree_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
|
||||
|
||||
case CALL_EXPR:
|
||||
if (!cp_tree_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0)))
|
||||
return false;
|
||||
return cp_tree_equal (TREE_OPERAND (t1, 1), TREE_OPERAND (t2, 1));
|
||||
{
|
||||
tree arg1, arg2;
|
||||
call_expr_arg_iterator iter1, iter2;
|
||||
if (!cp_tree_equal (CALL_EXPR_FN (t1), CALL_EXPR_FN (t2)))
|
||||
return false;
|
||||
for (arg1 = first_call_expr_arg (t1, &iter1),
|
||||
arg2 = first_call_expr_arg (t2, &iter2);
|
||||
arg1 && arg2;
|
||||
arg1 = next_call_expr_arg (&iter1),
|
||||
arg2 = next_call_expr_arg (&iter2))
|
||||
if (!cp_tree_equal (arg1, arg2))
|
||||
return false;
|
||||
return (arg1 || arg2);
|
||||
}
|
||||
|
||||
case TARGET_EXPR:
|
||||
{
|
||||
|
|
@ -1747,12 +1834,18 @@ cp_tree_equal (tree t1, tree t2)
|
|||
case tcc_binary:
|
||||
case tcc_comparison:
|
||||
case tcc_expression:
|
||||
case tcc_vl_exp:
|
||||
case tcc_reference:
|
||||
case tcc_statement:
|
||||
{
|
||||
int i;
|
||||
int i, n;
|
||||
|
||||
for (i = 0; i < TREE_CODE_LENGTH (code1); ++i)
|
||||
n = TREE_OPERAND_LENGTH (t1);
|
||||
if (TREE_CODE_CLASS (code1) == tcc_vl_exp
|
||||
&& n != TREE_OPERAND_LENGTH (t2))
|
||||
return false;
|
||||
|
||||
for (i = 0; i < n; ++i)
|
||||
if (!cp_tree_equal (TREE_OPERAND (t1, i), TREE_OPERAND (t2, i)))
|
||||
return false;
|
||||
|
||||
|
|
@ -2438,21 +2531,49 @@ void
|
|||
stabilize_call (tree call, tree *initp)
|
||||
{
|
||||
tree inits = NULL_TREE;
|
||||
tree t;
|
||||
int i;
|
||||
int nargs = call_expr_nargs (call);
|
||||
|
||||
if (call == error_mark_node)
|
||||
return;
|
||||
|
||||
gcc_assert (TREE_CODE (call) == CALL_EXPR
|
||||
|| TREE_CODE (call) == AGGR_INIT_EXPR);
|
||||
gcc_assert (TREE_CODE (call) == CALL_EXPR);
|
||||
|
||||
for (t = TREE_OPERAND (call, 1); t; t = TREE_CHAIN (t))
|
||||
if (TREE_SIDE_EFFECTS (TREE_VALUE (t)))
|
||||
{
|
||||
tree init;
|
||||
TREE_VALUE (t) = stabilize_expr (TREE_VALUE (t), &init);
|
||||
inits = add_stmt_to_compound (inits, init);
|
||||
}
|
||||
for (i = 0; i < nargs; i++)
|
||||
{
|
||||
tree init;
|
||||
CALL_EXPR_ARG (call, i) =
|
||||
stabilize_expr (CALL_EXPR_ARG (call, i), &init);
|
||||
inits = add_stmt_to_compound (inits, init);
|
||||
}
|
||||
|
||||
*initp = inits;
|
||||
}
|
||||
|
||||
/* Like stabilize_expr, but for an AGGR_INIT_EXPR whose arguments we want
|
||||
to pre-evaluate. CALL is modified in place to use the pre-evaluated
|
||||
arguments, while, upon return, *INITP contains an expression to
|
||||
compute the arguments. */
|
||||
|
||||
void
|
||||
stabilize_aggr_init (tree call, tree *initp)
|
||||
{
|
||||
tree inits = NULL_TREE;
|
||||
int i;
|
||||
int nargs = aggr_init_expr_nargs (call);
|
||||
|
||||
if (call == error_mark_node)
|
||||
return;
|
||||
|
||||
gcc_assert (TREE_CODE (call) == AGGR_INIT_EXPR);
|
||||
|
||||
for (i = 0; i < nargs; i++)
|
||||
{
|
||||
tree init;
|
||||
AGGR_INIT_EXPR_ARG (call, i) =
|
||||
stabilize_expr (AGGR_INIT_EXPR_ARG (call, i), &init);
|
||||
inits = add_stmt_to_compound (inits, init);
|
||||
}
|
||||
|
||||
*initp = inits;
|
||||
}
|
||||
|
|
@ -2499,13 +2620,18 @@ stabilize_init (tree init, tree *initp)
|
|||
if (TREE_CODE (t) == COND_EXPR)
|
||||
return false;
|
||||
|
||||
if (TREE_CODE (t) == CALL_EXPR
|
||||
|| TREE_CODE (t) == AGGR_INIT_EXPR)
|
||||
if (TREE_CODE (t) == CALL_EXPR)
|
||||
{
|
||||
stabilize_call (t, initp);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (TREE_CODE (t) == AGGR_INIT_EXPR)
|
||||
{
|
||||
stabilize_aggr_init (t, initp);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* The initialization is being performed via a bitwise copy -- and
|
||||
the item copied may have side effects. */
|
||||
return TREE_SIDE_EFFECTS (init);
|
||||
|
|
|
|||
|
|
@ -2474,19 +2474,39 @@ argument does cause side-effects.
|
|||
|
||||
@item CALL_EXPR
|
||||
These nodes are used to represent calls to functions, including
|
||||
non-static member functions. The first operand is a pointer to the
|
||||
non-static member functions. @code{CALL_EXPR}s are implemented as
|
||||
expression nodes with a variable number of operands. Rather than using
|
||||
@code{TREE_OPERAND} to extract them, it is preferable to use the
|
||||
specialized accessor macros and functions that operate specifically on
|
||||
@code{CALL_EXPR} nodes.
|
||||
|
||||
@code{CALL_EXPR_FN} returns a pointer to the
|
||||
function to call; it is always an expression whose type is a
|
||||
@code{POINTER_TYPE}. The second argument is a @code{TREE_LIST}. The
|
||||
arguments to the call appear left-to-right in the list. The
|
||||
@code{TREE_VALUE} of each list node contains the expression
|
||||
corresponding to that argument. (The value of @code{TREE_PURPOSE} for
|
||||
these nodes is unspecified, and should be ignored.) For non-static
|
||||
@code{POINTER_TYPE}.
|
||||
|
||||
The number of arguments to the call is returned by @code{call_expr_nargs},
|
||||
while the arguments themselves can be accessed with the @code{CALL_EXPR_ARG}
|
||||
macro. The arguments are zero-indexed and numbered left-to-right.
|
||||
You can iterate over the arguments using @code{FOR_EACH_CALL_EXPR_ARG}, as in:
|
||||
|
||||
@smallexample
|
||||
tree call, arg;
|
||||
call_expr_arg_iterator iter;
|
||||
FOR_EACH_CALL_EXPR_ARG (arg, iter, call)
|
||||
/* arg is bound to successive arguments of call. */
|
||||
...;
|
||||
@end smallexample
|
||||
|
||||
For non-static
|
||||
member functions, there will be an operand corresponding to the
|
||||
@code{this} pointer. There will always be expressions corresponding to
|
||||
all of the arguments, even if the function is declared with default
|
||||
arguments and some arguments are not explicitly provided at the call
|
||||
sites.
|
||||
|
||||
@code{CALL_EXPR}s also have a @code{CALL_EXPR_STATIC_CHAIN} operand that
|
||||
is used to implement nested functions. This operand is otherwise null.
|
||||
|
||||
@item STMT_EXPR
|
||||
These nodes are used to represent GCC's statement-expression extension.
|
||||
The statement-expression extension allows code like this:
|
||||
|
|
@ -2613,15 +2633,14 @@ cleanups.
|
|||
An @code{AGGR_INIT_EXPR} represents the initialization as the return
|
||||
value of a function call, or as the result of a constructor. An
|
||||
@code{AGGR_INIT_EXPR} will only appear as a full-expression, or as the
|
||||
second operand of a @code{TARGET_EXPR}. The first operand to the
|
||||
@code{AGGR_INIT_EXPR} is the address of a function to call, just as in
|
||||
a @code{CALL_EXPR}. The second operand are the arguments to pass that
|
||||
function, as a @code{TREE_LIST}, again in a manner similar to that of
|
||||
a @code{CALL_EXPR}.
|
||||
second operand of a @code{TARGET_EXPR}. @code{AGGR_INIT_EXPR}s have
|
||||
a representation similar to that of @code{CALL_EXPR}s. You can use
|
||||
the @code{AGGR_INIT_EXPR_FN} and @code{AGGR_INIT_EXPR_ARG} macros to access
|
||||
the function to call and the arguments to pass.
|
||||
|
||||
If @code{AGGR_INIT_VIA_CTOR_P} holds of the @code{AGGR_INIT_EXPR}, then
|
||||
the initialization is via a constructor call. The address of the third
|
||||
operand of the @code{AGGR_INIT_EXPR}, which is always a @code{VAR_DECL},
|
||||
the initialization is via a constructor call. The address of the
|
||||
@code{AGGR_INIT_EXPR_SLOT} operand, which is always a @code{VAR_DECL},
|
||||
is taken, and this value replaces the first argument in the argument
|
||||
list.
|
||||
|
||||
|
|
|
|||
|
|
@ -2867,9 +2867,9 @@ expand_builtin_unwind_init (void)
|
|||
}
|
||||
|
||||
rtx
|
||||
expand_builtin_eh_return_data_regno (tree arglist)
|
||||
expand_builtin_eh_return_data_regno (tree exp)
|
||||
{
|
||||
tree which = TREE_VALUE (arglist);
|
||||
tree which = CALL_EXPR_ARG (exp, 0);
|
||||
unsigned HOST_WIDE_INT iwhich;
|
||||
|
||||
if (TREE_CODE (which) != INTEGER_CST)
|
||||
|
|
|
|||
34
gcc/expr.c
34
gcc/expr.c
|
|
@ -1355,7 +1355,7 @@ rtx
|
|||
emit_block_move_via_libcall (rtx dst, rtx src, rtx size, bool tailcall)
|
||||
{
|
||||
rtx dst_addr, src_addr;
|
||||
tree call_expr, arg_list, fn, src_tree, dst_tree, size_tree;
|
||||
tree call_expr, fn, src_tree, dst_tree, size_tree;
|
||||
enum machine_mode size_mode;
|
||||
rtx retval;
|
||||
|
||||
|
|
@ -1386,14 +1386,7 @@ emit_block_move_via_libcall (rtx dst, rtx src, rtx size, bool tailcall)
|
|||
size_tree = make_tree (sizetype, size);
|
||||
|
||||
fn = emit_block_move_libcall_fn (true);
|
||||
arg_list = tree_cons (NULL_TREE, size_tree, NULL_TREE);
|
||||
arg_list = tree_cons (NULL_TREE, src_tree, arg_list);
|
||||
arg_list = tree_cons (NULL_TREE, dst_tree, arg_list);
|
||||
|
||||
/* Now we have to build up the CALL_EXPR itself. */
|
||||
call_expr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (fn)), fn);
|
||||
call_expr = build3 (CALL_EXPR, TREE_TYPE (TREE_TYPE (fn)),
|
||||
call_expr, arg_list, NULL_TREE);
|
||||
call_expr = build_call_expr (fn, 3, dst_tree, src_tree, size_tree);
|
||||
CALL_EXPR_TAILCALL (call_expr) = tailcall;
|
||||
|
||||
retval = expand_normal (call_expr);
|
||||
|
|
@ -2576,7 +2569,7 @@ clear_storage (rtx object, rtx size, enum block_op_methods method)
|
|||
rtx
|
||||
set_storage_via_libcall (rtx object, rtx size, rtx val, bool tailcall)
|
||||
{
|
||||
tree call_expr, arg_list, fn, object_tree, size_tree, val_tree;
|
||||
tree call_expr, fn, object_tree, size_tree, val_tree;
|
||||
enum machine_mode size_mode;
|
||||
rtx retval;
|
||||
|
||||
|
|
@ -2602,14 +2595,8 @@ set_storage_via_libcall (rtx object, rtx size, rtx val, bool tailcall)
|
|||
val_tree = make_tree (integer_type_node, val);
|
||||
|
||||
fn = clear_storage_libcall_fn (true);
|
||||
arg_list = tree_cons (NULL_TREE, size_tree, NULL_TREE);
|
||||
arg_list = tree_cons (NULL_TREE, val_tree, arg_list);
|
||||
arg_list = tree_cons (NULL_TREE, object_tree, arg_list);
|
||||
|
||||
/* Now we have to build up the CALL_EXPR itself. */
|
||||
call_expr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (fn)), fn);
|
||||
call_expr = build3 (CALL_EXPR, TREE_TYPE (TREE_TYPE (fn)),
|
||||
call_expr, arg_list, NULL_TREE);
|
||||
call_expr = build_call_expr (fn, 3,
|
||||
object_tree, integer_zero_node, size_tree);
|
||||
CALL_EXPR_TAILCALL (call_expr) = tailcall;
|
||||
|
||||
retval = expand_normal (call_expr);
|
||||
|
|
@ -6225,6 +6212,7 @@ safe_from_p (rtx x, tree exp, int top_p)
|
|||
|
||||
case tcc_expression:
|
||||
case tcc_reference:
|
||||
case tcc_vl_exp:
|
||||
/* Now do code-specific tests. EXP_RTL is set to any rtx we find in
|
||||
the expression. If it is set, we conflict iff we are that rtx or
|
||||
both are in memory. Otherwise, we check all operands of the
|
||||
|
|
@ -6287,7 +6275,7 @@ safe_from_p (rtx x, tree exp, int top_p)
|
|||
if (exp_rtl)
|
||||
break;
|
||||
|
||||
nops = TREE_CODE_LENGTH (TREE_CODE (exp));
|
||||
nops = TREE_OPERAND_LENGTH (exp);
|
||||
for (i = 0; i < nops; i++)
|
||||
if (TREE_OPERAND (exp, i) != 0
|
||||
&& ! safe_from_p (x, TREE_OPERAND (exp, i), 0))
|
||||
|
|
@ -7769,12 +7757,12 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
|
|||
|
||||
case CALL_EXPR:
|
||||
/* Check for a built-in function. */
|
||||
if (TREE_CODE (TREE_OPERAND (exp, 0)) == ADDR_EXPR
|
||||
&& (TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))
|
||||
if (TREE_CODE (CALL_EXPR_FN (exp)) == ADDR_EXPR
|
||||
&& (TREE_CODE (TREE_OPERAND (CALL_EXPR_FN (exp), 0))
|
||||
== FUNCTION_DECL)
|
||||
&& DECL_BUILT_IN (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))
|
||||
&& DECL_BUILT_IN (TREE_OPERAND (CALL_EXPR_FN (exp), 0)))
|
||||
{
|
||||
if (DECL_BUILT_IN_CLASS (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))
|
||||
if (DECL_BUILT_IN_CLASS (TREE_OPERAND (CALL_EXPR_FN (exp), 0))
|
||||
== BUILT_IN_FRONTEND)
|
||||
return lang_hooks.expand_expr (exp, original_target,
|
||||
tmode, modifier,
|
||||
|
|
|
|||
348
gcc/fold-const.c
348
gcc/fold-const.c
|
|
@ -1195,7 +1195,7 @@ negate_expr_p (tree t)
|
|||
case CALL_EXPR:
|
||||
/* Negate -f(x) as f(-x). */
|
||||
if (negate_mathfn_p (builtin_mathfn_code (t)))
|
||||
return negate_expr_p (TREE_VALUE (TREE_OPERAND (t, 1)));
|
||||
return negate_expr_p (CALL_EXPR_ARG (t, 0));
|
||||
break;
|
||||
|
||||
case RSHIFT_EXPR:
|
||||
|
|
@ -1382,14 +1382,13 @@ fold_negate_expr (tree t)
|
|||
case CALL_EXPR:
|
||||
/* Negate -f(x) as f(-x). */
|
||||
if (negate_mathfn_p (builtin_mathfn_code (t))
|
||||
&& negate_expr_p (TREE_VALUE (TREE_OPERAND (t, 1))))
|
||||
&& negate_expr_p (CALL_EXPR_ARG (t, 0)))
|
||||
{
|
||||
tree fndecl, arg, arglist;
|
||||
tree fndecl, arg;
|
||||
|
||||
fndecl = get_callee_fndecl (t);
|
||||
arg = negate_expr (TREE_VALUE (TREE_OPERAND (t, 1)));
|
||||
arglist = build_tree_list (NULL_TREE, arg);
|
||||
return build_function_call_expr (fndecl, arglist);
|
||||
arg = negate_expr (CALL_EXPR_ARG (t, 0));
|
||||
return build_call_expr (fndecl, 1, arg);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -2929,10 +2928,18 @@ operand_equal_p (tree arg0, tree arg1, unsigned int flags)
|
|||
&& operand_equal_p (TREE_OPERAND (arg0, 1),
|
||||
TREE_OPERAND (arg1, 0), flags));
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
case tcc_vl_exp:
|
||||
switch (TREE_CODE (arg0))
|
||||
{
|
||||
case CALL_EXPR:
|
||||
/* If the CALL_EXPRs call different functions, then they
|
||||
clearly can not be equal. */
|
||||
if (!OP_SAME (0))
|
||||
if (! operand_equal_p (CALL_EXPR_FN (arg0), CALL_EXPR_FN (arg1),
|
||||
flags))
|
||||
return 0;
|
||||
|
||||
{
|
||||
|
|
@ -2945,25 +2952,22 @@ operand_equal_p (tree arg0, tree arg1, unsigned int flags)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Now see if all the arguments are the same. operand_equal_p
|
||||
does not handle TREE_LIST, so we walk the operands here
|
||||
feeding them to operand_equal_p. */
|
||||
arg0 = TREE_OPERAND (arg0, 1);
|
||||
arg1 = TREE_OPERAND (arg1, 1);
|
||||
while (arg0 && arg1)
|
||||
{
|
||||
if (! operand_equal_p (TREE_VALUE (arg0), TREE_VALUE (arg1),
|
||||
flags))
|
||||
/* Now see if all the arguments are the same. */
|
||||
{
|
||||
call_expr_arg_iterator iter0, iter1;
|
||||
tree a0, a1;
|
||||
for (a0 = first_call_expr_arg (arg0, &iter0),
|
||||
a1 = first_call_expr_arg (arg1, &iter1);
|
||||
a0 && a1;
|
||||
a0 = next_call_expr_arg (&iter0),
|
||||
a1 = next_call_expr_arg (&iter1))
|
||||
if (! operand_equal_p (a0, a1, flags))
|
||||
return 0;
|
||||
|
||||
arg0 = TREE_CHAIN (arg0);
|
||||
arg1 = TREE_CHAIN (arg1);
|
||||
}
|
||||
|
||||
/* If we get here and both argument lists are exhausted
|
||||
then the CALL_EXPRs are equal. */
|
||||
return ! (arg0 || arg1);
|
||||
|
||||
/* If we get here and both argument lists are exhausted
|
||||
then the CALL_EXPRs are equal. */
|
||||
return ! (a0 || a1);
|
||||
}
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -4035,7 +4039,7 @@ make_range (tree exp, int *pin_p, tree *plow, tree *phigh,
|
|||
|
||||
if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code)))
|
||||
{
|
||||
if (TREE_CODE_LENGTH (code) > 0)
|
||||
if (TREE_OPERAND_LENGTH (exp) > 0)
|
||||
arg0 = TREE_OPERAND (exp, 0);
|
||||
if (TREE_CODE_CLASS (code) == tcc_comparison
|
||||
|| TREE_CODE_CLASS (code) == tcc_unary
|
||||
|
|
@ -4044,7 +4048,7 @@ make_range (tree exp, int *pin_p, tree *plow, tree *phigh,
|
|||
if (TREE_CODE_CLASS (code) == tcc_binary
|
||||
|| TREE_CODE_CLASS (code) == tcc_comparison
|
||||
|| (TREE_CODE_CLASS (code) == tcc_expression
|
||||
&& TREE_CODE_LENGTH (code) > 1))
|
||||
&& TREE_OPERAND_LENGTH (exp) > 1))
|
||||
arg1 = TREE_OPERAND (exp, 1);
|
||||
}
|
||||
|
||||
|
|
@ -5677,6 +5681,7 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type,
|
|||
if ((COMPARISON_CLASS_P (op0)
|
||||
|| UNARY_CLASS_P (op0)
|
||||
|| BINARY_CLASS_P (op0)
|
||||
|| VL_EXP_CLASS_P (op0)
|
||||
|| EXPRESSION_CLASS_P (op0))
|
||||
/* ... and is unsigned, and its type is smaller than ctype,
|
||||
then we cannot pass through as widening. */
|
||||
|
|
@ -6151,7 +6156,7 @@ fold_mathfn_compare (enum built_in_function fcode, enum tree_code code,
|
|||
|
||||
if (BUILTIN_SQRT_P (fcode))
|
||||
{
|
||||
tree arg = TREE_VALUE (TREE_OPERAND (arg0, 1));
|
||||
tree arg = CALL_EXPR_ARG (arg0, 0);
|
||||
enum machine_mode mode = TYPE_MODE (TREE_TYPE (arg0));
|
||||
|
||||
c = TREE_REAL_CST (arg1);
|
||||
|
|
@ -7970,8 +7975,7 @@ fold_unary (enum tree_code code, tree type, tree op0)
|
|||
CASE_FLT_FN (BUILT_IN_CEXPI):
|
||||
fn = mathfn_built_in (type, BUILT_IN_COS);
|
||||
if (fn)
|
||||
return build_function_call_expr (fn,
|
||||
TREE_OPERAND (arg0, 1));
|
||||
return build_call_expr (fn, 1, CALL_EXPR_ARG (arg0, 0));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -8013,8 +8017,7 @@ fold_unary (enum tree_code code, tree type, tree op0)
|
|||
CASE_FLT_FN (BUILT_IN_CEXPI):
|
||||
fn = mathfn_built_in (type, BUILT_IN_SIN);
|
||||
if (fn)
|
||||
return build_function_call_expr (fn,
|
||||
TREE_OPERAND (arg0, 1));
|
||||
return build_call_expr (fn, 1, CALL_EXPR_ARG (arg0, 0));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -9807,9 +9810,9 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
|
|||
/* Optimizations of root(...)*root(...). */
|
||||
if (fcode0 == fcode1 && BUILTIN_ROOT_P (fcode0))
|
||||
{
|
||||
tree rootfn, arg, arglist;
|
||||
tree arg00 = TREE_VALUE (TREE_OPERAND (arg0, 1));
|
||||
tree arg10 = TREE_VALUE (TREE_OPERAND (arg1, 1));
|
||||
tree rootfn, arg;
|
||||
tree arg00 = CALL_EXPR_ARG (arg0, 0);
|
||||
tree arg10 = CALL_EXPR_ARG (arg1, 0);
|
||||
|
||||
/* Optimize sqrt(x)*sqrt(x) as x. */
|
||||
if (BUILTIN_SQRT_P (fcode0)
|
||||
|
|
@ -9818,21 +9821,19 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
|
|||
return arg00;
|
||||
|
||||
/* Optimize root(x)*root(y) as root(x*y). */
|
||||
rootfn = TREE_OPERAND (TREE_OPERAND (arg0, 0), 0);
|
||||
rootfn = TREE_OPERAND (CALL_EXPR_FN (arg0), 0);
|
||||
arg = fold_build2 (MULT_EXPR, type, arg00, arg10);
|
||||
arglist = build_tree_list (NULL_TREE, arg);
|
||||
return build_function_call_expr (rootfn, arglist);
|
||||
return build_call_expr (rootfn, 1, arg);
|
||||
}
|
||||
|
||||
/* Optimize expN(x)*expN(y) as expN(x+y). */
|
||||
if (fcode0 == fcode1 && BUILTIN_EXPONENT_P (fcode0))
|
||||
{
|
||||
tree expfn = TREE_OPERAND (TREE_OPERAND (arg0, 0), 0);
|
||||
tree expfn = TREE_OPERAND (CALL_EXPR_FN (arg0), 0);
|
||||
tree arg = fold_build2 (PLUS_EXPR, type,
|
||||
TREE_VALUE (TREE_OPERAND (arg0, 1)),
|
||||
TREE_VALUE (TREE_OPERAND (arg1, 1)));
|
||||
tree arglist = build_tree_list (NULL_TREE, arg);
|
||||
return build_function_call_expr (expfn, arglist);
|
||||
CALL_EXPR_ARG (arg0, 0),
|
||||
CALL_EXPR_ARG (arg1, 0));
|
||||
return build_call_expr (expfn, 1, arg);
|
||||
}
|
||||
|
||||
/* Optimizations of pow(...)*pow(...). */
|
||||
|
|
@ -9840,33 +9841,25 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
|
|||
|| (fcode0 == BUILT_IN_POWF && fcode1 == BUILT_IN_POWF)
|
||||
|| (fcode0 == BUILT_IN_POWL && fcode1 == BUILT_IN_POWL))
|
||||
{
|
||||
tree arg00 = TREE_VALUE (TREE_OPERAND (arg0, 1));
|
||||
tree arg01 = TREE_VALUE (TREE_CHAIN (TREE_OPERAND (arg0,
|
||||
1)));
|
||||
tree arg10 = TREE_VALUE (TREE_OPERAND (arg1, 1));
|
||||
tree arg11 = TREE_VALUE (TREE_CHAIN (TREE_OPERAND (arg1,
|
||||
1)));
|
||||
tree arg00 = CALL_EXPR_ARG (arg0, 0);
|
||||
tree arg01 = CALL_EXPR_ARG (arg0, 1);
|
||||
tree arg10 = CALL_EXPR_ARG (arg1, 0);
|
||||
tree arg11 = CALL_EXPR_ARG (arg1, 1);
|
||||
|
||||
/* Optimize pow(x,y)*pow(z,y) as pow(x*z,y). */
|
||||
if (operand_equal_p (arg01, arg11, 0))
|
||||
{
|
||||
tree powfn = TREE_OPERAND (TREE_OPERAND (arg0, 0), 0);
|
||||
tree powfn = TREE_OPERAND (CALL_EXPR_FN (arg0), 0);
|
||||
tree arg = fold_build2 (MULT_EXPR, type, arg00, arg10);
|
||||
tree arglist = tree_cons (NULL_TREE, arg,
|
||||
build_tree_list (NULL_TREE,
|
||||
arg01));
|
||||
return build_function_call_expr (powfn, arglist);
|
||||
return build_call_expr (powfn, 2, arg, arg01);
|
||||
}
|
||||
|
||||
/* Optimize pow(x,y)*pow(x,z) as pow(x,y+z). */
|
||||
if (operand_equal_p (arg00, arg10, 0))
|
||||
{
|
||||
tree powfn = TREE_OPERAND (TREE_OPERAND (arg0, 0), 0);
|
||||
tree powfn = TREE_OPERAND (CALL_EXPR_FN (arg0), 0);
|
||||
tree arg = fold_build2 (PLUS_EXPR, type, arg01, arg11);
|
||||
tree arglist = tree_cons (NULL_TREE, arg00,
|
||||
build_tree_list (NULL_TREE,
|
||||
arg));
|
||||
return build_function_call_expr (powfn, arglist);
|
||||
return build_call_expr (powfn, 2, arg00, arg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -9877,14 +9870,13 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
|
|||
|| (fcode0 == BUILT_IN_COS && fcode1 == BUILT_IN_TAN)
|
||||
|| (fcode0 == BUILT_IN_COSF && fcode1 == BUILT_IN_TANF)
|
||||
|| (fcode0 == BUILT_IN_COSL && fcode1 == BUILT_IN_TANL))
|
||||
&& operand_equal_p (TREE_VALUE (TREE_OPERAND (arg0, 1)),
|
||||
TREE_VALUE (TREE_OPERAND (arg1, 1)), 0))
|
||||
&& operand_equal_p (CALL_EXPR_ARG (arg0, 0),
|
||||
CALL_EXPR_ARG (arg1, 0), 0))
|
||||
{
|
||||
tree sinfn = mathfn_built_in (type, BUILT_IN_SIN);
|
||||
|
||||
if (sinfn != NULL_TREE)
|
||||
return build_function_call_expr (sinfn,
|
||||
TREE_OPERAND (arg0, 1));
|
||||
return build_call_expr (sinfn, 1, CALL_EXPR_ARG (arg0, 0));
|
||||
}
|
||||
|
||||
/* Optimize x*pow(x,c) as pow(x,c+1). */
|
||||
|
|
@ -9892,23 +9884,20 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
|
|||
|| fcode1 == BUILT_IN_POWF
|
||||
|| fcode1 == BUILT_IN_POWL)
|
||||
{
|
||||
tree arg10 = TREE_VALUE (TREE_OPERAND (arg1, 1));
|
||||
tree arg11 = TREE_VALUE (TREE_CHAIN (TREE_OPERAND (arg1,
|
||||
1)));
|
||||
tree arg10 = CALL_EXPR_ARG (arg1, 0);
|
||||
tree arg11 = CALL_EXPR_ARG (arg1, 1);
|
||||
if (TREE_CODE (arg11) == REAL_CST
|
||||
&& !TREE_OVERFLOW (arg11)
|
||||
&& operand_equal_p (arg0, arg10, 0))
|
||||
{
|
||||
tree powfn = TREE_OPERAND (TREE_OPERAND (arg1, 0), 0);
|
||||
tree powfn = TREE_OPERAND (CALL_EXPR_FN (arg1), 0);
|
||||
REAL_VALUE_TYPE c;
|
||||
tree arg, arglist;
|
||||
tree arg;
|
||||
|
||||
c = TREE_REAL_CST (arg11);
|
||||
real_arithmetic (&c, PLUS_EXPR, &c, &dconst1);
|
||||
arg = build_real (type, c);
|
||||
arglist = build_tree_list (NULL_TREE, arg);
|
||||
arglist = tree_cons (NULL_TREE, arg0, arglist);
|
||||
return build_function_call_expr (powfn, arglist);
|
||||
return build_call_expr (powfn, 2, arg0, arg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -9917,23 +9906,20 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
|
|||
|| fcode0 == BUILT_IN_POWF
|
||||
|| fcode0 == BUILT_IN_POWL)
|
||||
{
|
||||
tree arg00 = TREE_VALUE (TREE_OPERAND (arg0, 1));
|
||||
tree arg01 = TREE_VALUE (TREE_CHAIN (TREE_OPERAND (arg0,
|
||||
1)));
|
||||
tree arg00 = CALL_EXPR_ARG (arg0, 0);
|
||||
tree arg01 = CALL_EXPR_ARG (arg0, 1);
|
||||
if (TREE_CODE (arg01) == REAL_CST
|
||||
&& !TREE_OVERFLOW (arg01)
|
||||
&& operand_equal_p (arg1, arg00, 0))
|
||||
{
|
||||
tree powfn = TREE_OPERAND (TREE_OPERAND (arg0, 0), 0);
|
||||
tree powfn = TREE_OPERAND (CALL_EXPR_FN (arg0), 0);
|
||||
REAL_VALUE_TYPE c;
|
||||
tree arg, arglist;
|
||||
tree arg;
|
||||
|
||||
c = TREE_REAL_CST (arg01);
|
||||
real_arithmetic (&c, PLUS_EXPR, &c, &dconst1);
|
||||
arg = build_real (type, c);
|
||||
arglist = build_tree_list (NULL_TREE, arg);
|
||||
arglist = tree_cons (NULL_TREE, arg1, arglist);
|
||||
return build_function_call_expr (powfn, arglist);
|
||||
return build_call_expr (powfn, 2, arg1, arg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -9946,9 +9932,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
|
|||
if (powfn)
|
||||
{
|
||||
tree arg = build_real (type, dconst2);
|
||||
tree arglist = build_tree_list (NULL_TREE, arg);
|
||||
arglist = tree_cons (NULL_TREE, arg0, arglist);
|
||||
return build_function_call_expr (powfn, arglist);
|
||||
return build_call_expr (powfn, 2, arg0, arg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -10480,29 +10464,27 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
|
|||
if (((fcode0 == BUILT_IN_SIN && fcode1 == BUILT_IN_COS)
|
||||
|| (fcode0 == BUILT_IN_SINF && fcode1 == BUILT_IN_COSF)
|
||||
|| (fcode0 == BUILT_IN_SINL && fcode1 == BUILT_IN_COSL))
|
||||
&& operand_equal_p (TREE_VALUE (TREE_OPERAND (arg0, 1)),
|
||||
TREE_VALUE (TREE_OPERAND (arg1, 1)), 0))
|
||||
&& operand_equal_p (CALL_EXPR_ARG (arg0, 0),
|
||||
CALL_EXPR_ARG (arg1, 0), 0))
|
||||
{
|
||||
tree tanfn = mathfn_built_in (type, BUILT_IN_TAN);
|
||||
|
||||
if (tanfn != NULL_TREE)
|
||||
return build_function_call_expr (tanfn,
|
||||
TREE_OPERAND (arg0, 1));
|
||||
return build_call_expr (tanfn, 1, CALL_EXPR_ARG (arg0, 0));
|
||||
}
|
||||
|
||||
/* Optimize cos(x)/sin(x) as 1.0/tan(x). */
|
||||
if (((fcode0 == BUILT_IN_COS && fcode1 == BUILT_IN_SIN)
|
||||
|| (fcode0 == BUILT_IN_COSF && fcode1 == BUILT_IN_SINF)
|
||||
|| (fcode0 == BUILT_IN_COSL && fcode1 == BUILT_IN_SINL))
|
||||
&& operand_equal_p (TREE_VALUE (TREE_OPERAND (arg0, 1)),
|
||||
TREE_VALUE (TREE_OPERAND (arg1, 1)), 0))
|
||||
&& operand_equal_p (CALL_EXPR_ARG (arg0, 0),
|
||||
CALL_EXPR_ARG (arg1, 0), 0))
|
||||
{
|
||||
tree tanfn = mathfn_built_in (type, BUILT_IN_TAN);
|
||||
|
||||
if (tanfn != NULL_TREE)
|
||||
{
|
||||
tree tmp = TREE_OPERAND (arg0, 1);
|
||||
tmp = build_function_call_expr (tanfn, tmp);
|
||||
tree tmp = build_call_expr (tanfn, 1, CALL_EXPR_ARG (arg0, 0));
|
||||
return fold_build2 (RDIV_EXPR, type,
|
||||
build_real (type, dconst1), tmp);
|
||||
}
|
||||
|
|
@ -10514,8 +10496,8 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
|
|||
|| (fcode0 == BUILT_IN_SINF && fcode1 == BUILT_IN_TANF)
|
||||
|| (fcode0 == BUILT_IN_SINL && fcode1 == BUILT_IN_TANL)))
|
||||
{
|
||||
tree arg00 = TREE_VALUE (TREE_OPERAND (arg0, 1));
|
||||
tree arg01 = TREE_VALUE (TREE_OPERAND (arg1, 1));
|
||||
tree arg00 = CALL_EXPR_ARG (arg0, 0);
|
||||
tree arg01 = CALL_EXPR_ARG (arg1, 0);
|
||||
|
||||
if (! HONOR_NANS (TYPE_MODE (TREE_TYPE (arg00)))
|
||||
&& ! HONOR_INFINITIES (TYPE_MODE (TREE_TYPE (arg00)))
|
||||
|
|
@ -10524,8 +10506,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
|
|||
tree cosfn = mathfn_built_in (type, BUILT_IN_COS);
|
||||
|
||||
if (cosfn != NULL_TREE)
|
||||
return build_function_call_expr (cosfn,
|
||||
TREE_OPERAND (arg0, 1));
|
||||
return build_call_expr (cosfn, 1, arg00);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -10535,8 +10516,8 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
|
|||
|| (fcode0 == BUILT_IN_TANF && fcode1 == BUILT_IN_SINF)
|
||||
|| (fcode0 == BUILT_IN_TANL && fcode1 == BUILT_IN_SINL)))
|
||||
{
|
||||
tree arg00 = TREE_VALUE (TREE_OPERAND (arg0, 1));
|
||||
tree arg01 = TREE_VALUE (TREE_OPERAND (arg1, 1));
|
||||
tree arg00 = CALL_EXPR_ARG (arg0, 0);
|
||||
tree arg01 = CALL_EXPR_ARG (arg1, 0);
|
||||
|
||||
if (! HONOR_NANS (TYPE_MODE (TREE_TYPE (arg00)))
|
||||
&& ! HONOR_INFINITIES (TYPE_MODE (TREE_TYPE (arg00)))
|
||||
|
|
@ -10546,8 +10527,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
|
|||
|
||||
if (cosfn != NULL_TREE)
|
||||
{
|
||||
tree tmp = TREE_OPERAND (arg0, 1);
|
||||
tmp = build_function_call_expr (cosfn, tmp);
|
||||
tree tmp = build_call_expr (cosfn, 1, arg00);
|
||||
return fold_build2 (RDIV_EXPR, type,
|
||||
build_real (type, dconst1),
|
||||
tmp);
|
||||
|
|
@ -10560,33 +10540,29 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
|
|||
|| fcode0 == BUILT_IN_POWF
|
||||
|| fcode0 == BUILT_IN_POWL)
|
||||
{
|
||||
tree arg00 = TREE_VALUE (TREE_OPERAND (arg0, 1));
|
||||
tree arg01 = TREE_VALUE (TREE_CHAIN (TREE_OPERAND (arg0, 1)));
|
||||
tree arg00 = CALL_EXPR_ARG (arg0, 0);
|
||||
tree arg01 = CALL_EXPR_ARG (arg0, 1);
|
||||
if (TREE_CODE (arg01) == REAL_CST
|
||||
&& !TREE_OVERFLOW (arg01)
|
||||
&& operand_equal_p (arg1, arg00, 0))
|
||||
{
|
||||
tree powfn = TREE_OPERAND (TREE_OPERAND (arg0, 0), 0);
|
||||
tree powfn = TREE_OPERAND (CALL_EXPR_FN (arg0), 0);
|
||||
REAL_VALUE_TYPE c;
|
||||
tree arg, arglist;
|
||||
tree arg;
|
||||
|
||||
c = TREE_REAL_CST (arg01);
|
||||
real_arithmetic (&c, MINUS_EXPR, &c, &dconst1);
|
||||
arg = build_real (type, c);
|
||||
arglist = build_tree_list (NULL_TREE, arg);
|
||||
arglist = tree_cons (NULL_TREE, arg1, arglist);
|
||||
return build_function_call_expr (powfn, arglist);
|
||||
return build_call_expr (powfn, 2, arg1, arg);
|
||||
}
|
||||
}
|
||||
|
||||
/* Optimize x/expN(y) into x*expN(-y). */
|
||||
if (BUILTIN_EXPONENT_P (fcode1))
|
||||
{
|
||||
tree expfn = TREE_OPERAND (TREE_OPERAND (arg1, 0), 0);
|
||||
tree arg = negate_expr (TREE_VALUE (TREE_OPERAND (arg1, 1)));
|
||||
tree arglist = build_tree_list (NULL_TREE,
|
||||
fold_convert (type, arg));
|
||||
arg1 = build_function_call_expr (expfn, arglist);
|
||||
tree expfn = TREE_OPERAND (CALL_EXPR_FN (arg1), 0);
|
||||
tree arg = negate_expr (CALL_EXPR_ARG (arg1, 0));
|
||||
arg1 = build_call_expr (expfn, 1, fold_convert (type, arg));
|
||||
return fold_build2 (MULT_EXPR, type, arg0, arg1);
|
||||
}
|
||||
|
||||
|
|
@ -10595,13 +10571,11 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
|
|||
|| fcode1 == BUILT_IN_POWF
|
||||
|| fcode1 == BUILT_IN_POWL)
|
||||
{
|
||||
tree powfn = TREE_OPERAND (TREE_OPERAND (arg1, 0), 0);
|
||||
tree arg10 = TREE_VALUE (TREE_OPERAND (arg1, 1));
|
||||
tree arg11 = TREE_VALUE (TREE_CHAIN (TREE_OPERAND (arg1, 1)));
|
||||
tree powfn = TREE_OPERAND (CALL_EXPR_FN (arg1), 0);
|
||||
tree arg10 = CALL_EXPR_ARG (arg1, 0);
|
||||
tree arg11 = CALL_EXPR_ARG (arg1, 1);
|
||||
tree neg11 = fold_convert (type, negate_expr (arg11));
|
||||
tree arglist = tree_cons (NULL_TREE, arg10,
|
||||
build_tree_list (NULL_TREE, neg11));
|
||||
arg1 = build_function_call_expr (powfn, arglist);
|
||||
arg1 = build_call_expr (powfn, 2, arg10, neg11);
|
||||
return fold_build2 (MULT_EXPR, type, arg0, arg1);
|
||||
}
|
||||
}
|
||||
|
|
@ -11386,16 +11360,14 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
|
|||
&& integer_zerop (arg1))
|
||||
{
|
||||
tree fndecl = get_callee_fndecl (arg0);
|
||||
tree arglist;
|
||||
|
||||
if (fndecl
|
||||
&& DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
|
||||
&& DECL_FUNCTION_CODE (fndecl) == BUILT_IN_STRLEN
|
||||
&& (arglist = TREE_OPERAND (arg0, 1))
|
||||
&& TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) == POINTER_TYPE
|
||||
&& ! TREE_CHAIN (arglist))
|
||||
&& call_expr_nargs (arg0) == 1
|
||||
&& TREE_CODE (TREE_TYPE (CALL_EXPR_ARG (arg0, 0))) == POINTER_TYPE)
|
||||
{
|
||||
tree iref = build_fold_indirect_ref (TREE_VALUE (arglist));
|
||||
tree iref = build_fold_indirect_ref (CALL_EXPR_ARG (arg0, 0));
|
||||
return fold_build2 (code, type, iref,
|
||||
build_int_cst (TREE_TYPE (iref), 0));
|
||||
}
|
||||
|
|
@ -12376,12 +12348,9 @@ fold_ternary (enum tree_code code, tree type, tree op0, tree op1, tree op2)
|
|||
return NULL_TREE;
|
||||
|
||||
case CALL_EXPR:
|
||||
/* Check for a built-in function. */
|
||||
if (TREE_CODE (op0) == ADDR_EXPR
|
||||
&& TREE_CODE (TREE_OPERAND (op0, 0)) == FUNCTION_DECL
|
||||
&& DECL_BUILT_IN (TREE_OPERAND (op0, 0)))
|
||||
return fold_builtin (TREE_OPERAND (op0, 0), op1, false);
|
||||
return NULL_TREE;
|
||||
/* CALL_EXPRs used to be ternary exprs. Catch any mistaken uses
|
||||
of fold_ternary on them. */
|
||||
gcc_unreachable ();
|
||||
|
||||
case BIT_FIELD_REF:
|
||||
if (TREE_CODE (arg0) == VECTOR_CST
|
||||
|
|
@ -12439,6 +12408,18 @@ fold (tree expr)
|
|||
if (kind == tcc_constant)
|
||||
return t;
|
||||
|
||||
/* CALL_EXPR-like objects with variable numbers of operands are
|
||||
treated specially. */
|
||||
if (kind == tcc_vl_exp)
|
||||
{
|
||||
if (code == CALL_EXPR)
|
||||
{
|
||||
tem = fold_call_expr (expr, false);
|
||||
return tem ? tem : expr;
|
||||
}
|
||||
return expr;
|
||||
}
|
||||
|
||||
if (IS_EXPR_CODE_CLASS (kind)
|
||||
|| IS_GIMPLE_STMT_CODE_CLASS (kind))
|
||||
{
|
||||
|
|
@ -12632,7 +12613,8 @@ recursive_label:
|
|||
case tcc_unary:
|
||||
case tcc_binary:
|
||||
case tcc_statement:
|
||||
len = TREE_CODE_LENGTH (code);
|
||||
case tcc_vl_exp:
|
||||
len = TREE_OPERAND_LENGTH (expr);
|
||||
for (i = 0; i < len; ++i)
|
||||
fold_checksum_tree (TREE_OPERAND (expr, i), ctx, ht);
|
||||
break;
|
||||
|
|
@ -12811,7 +12793,8 @@ fold_build3_stat (enum tree_code code, tree type, tree op0, tree op1, tree op2
|
|||
md5_finish_ctx (&ctx, checksum_before_op2);
|
||||
htab_empty (ht);
|
||||
#endif
|
||||
|
||||
|
||||
gcc_assert (TREE_CODE_CLASS (code) != tcc_vl_exp);
|
||||
tem = fold_ternary (code, type, op0, op1, op2);
|
||||
if (!tem)
|
||||
tem = build3_stat (code, type, op0, op1, op2 PASS_MEM_STAT);
|
||||
|
|
@ -12844,6 +12827,57 @@ fold_build3_stat (enum tree_code code, tree type, tree op0, tree op1, tree op2
|
|||
return tem;
|
||||
}
|
||||
|
||||
/* Fold a CALL_EXPR expression of type TYPE with operands FN and ARGLIST
|
||||
and a null static chain.
|
||||
Return a folded expression if successful. Otherwise, return a CALL_EXPR
|
||||
of type TYPE from the given operands as constructed by build_call_list. */
|
||||
|
||||
tree
|
||||
fold_build_call_list (tree type, tree fn, tree arglist)
|
||||
{
|
||||
tree tem;
|
||||
#ifdef ENABLE_FOLD_CHECKING
|
||||
unsigned char checksum_before_fn[16],
|
||||
checksum_before_arglist[16],
|
||||
checksum_after_fn[16],
|
||||
checksum_after_arglist[16];
|
||||
struct md5_ctx ctx;
|
||||
htab_t ht;
|
||||
|
||||
ht = htab_create (32, htab_hash_pointer, htab_eq_pointer, NULL);
|
||||
md5_init_ctx (&ctx);
|
||||
fold_checksum_tree (fn, &ctx, ht);
|
||||
md5_finish_ctx (&ctx, checksum_before_fn);
|
||||
htab_empty (ht);
|
||||
|
||||
md5_init_ctx (&ctx);
|
||||
fold_checksum_tree (arglist, &ctx, ht);
|
||||
md5_finish_ctx (&ctx, checksum_before_arglist);
|
||||
htab_empty (ht);
|
||||
#endif
|
||||
|
||||
tem = fold_builtin_call_list (type, fn, arglist);
|
||||
|
||||
#ifdef ENABLE_FOLD_CHECKING
|
||||
md5_init_ctx (&ctx);
|
||||
fold_checksum_tree (fn, &ctx, ht);
|
||||
md5_finish_ctx (&ctx, checksum_after_fn);
|
||||
htab_empty (ht);
|
||||
|
||||
if (memcmp (checksum_before_fn, checksum_after_fn, 16))
|
||||
fold_check_failed (fn, tem);
|
||||
|
||||
md5_init_ctx (&ctx);
|
||||
fold_checksum_tree (arglist, &ctx, ht);
|
||||
md5_finish_ctx (&ctx, checksum_after_arglist);
|
||||
htab_delete (ht);
|
||||
|
||||
if (memcmp (checksum_before_arglist, checksum_after_arglist, 16))
|
||||
fold_check_failed (arglist, tem);
|
||||
#endif
|
||||
return tem;
|
||||
}
|
||||
|
||||
/* Perform constant folding and related simplification of initializer
|
||||
expression EXPR. These behave identically to "fold_buildN" but ignore
|
||||
potential run-time traps and exceptions that fold must preserve. */
|
||||
|
|
@ -12904,6 +12938,18 @@ fold_build3_initializer (enum tree_code code, tree type, tree op0, tree op1,
|
|||
return result;
|
||||
}
|
||||
|
||||
tree
|
||||
fold_build_call_list_initializer (tree type, tree fn, tree arglist)
|
||||
{
|
||||
tree result;
|
||||
START_FOLD_INIT;
|
||||
|
||||
result = fold_build_call_list (type, fn, arglist);
|
||||
|
||||
END_FOLD_INIT;
|
||||
return result;
|
||||
}
|
||||
|
||||
#undef START_FOLD_INIT
|
||||
#undef END_FOLD_INIT
|
||||
|
||||
|
|
@ -13223,7 +13269,6 @@ tree_expr_nonnegative_warnv_p (tree t, bool *strict_overflow_p)
|
|||
case CALL_EXPR:
|
||||
{
|
||||
tree fndecl = get_callee_fndecl (t);
|
||||
tree arglist = TREE_OPERAND (t, 1);
|
||||
if (fndecl && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
|
||||
switch (DECL_FUNCTION_CODE (fndecl))
|
||||
{
|
||||
|
|
@ -13251,7 +13296,7 @@ tree_expr_nonnegative_warnv_p (tree t, bool *strict_overflow_p)
|
|||
/* sqrt(-0.0) is -0.0. */
|
||||
if (!HONOR_SIGNED_ZEROS (TYPE_MODE (TREE_TYPE (t))))
|
||||
return true;
|
||||
return tree_expr_nonnegative_warnv_p (TREE_VALUE (arglist),
|
||||
return tree_expr_nonnegative_warnv_p (CALL_EXPR_ARG (t, 0),
|
||||
strict_overflow_p);
|
||||
|
||||
CASE_FLT_FN (BUILT_IN_ASINH):
|
||||
|
|
@ -13282,52 +13327,49 @@ tree_expr_nonnegative_warnv_p (tree t, bool *strict_overflow_p)
|
|||
CASE_FLT_FN (BUILT_IN_TANH):
|
||||
CASE_FLT_FN (BUILT_IN_TRUNC):
|
||||
/* True if the 1st argument is nonnegative. */
|
||||
return tree_expr_nonnegative_warnv_p (TREE_VALUE (arglist),
|
||||
return tree_expr_nonnegative_warnv_p (CALL_EXPR_ARG (t, 0),
|
||||
strict_overflow_p);
|
||||
|
||||
CASE_FLT_FN (BUILT_IN_FMAX):
|
||||
/* True if the 1st OR 2nd arguments are nonnegative. */
|
||||
return (tree_expr_nonnegative_warnv_p (TREE_VALUE (arglist),
|
||||
return (tree_expr_nonnegative_warnv_p (CALL_EXPR_ARG (t, 0),
|
||||
strict_overflow_p)
|
||||
|| (tree_expr_nonnegative_warnv_p
|
||||
(TREE_VALUE (TREE_CHAIN (arglist)),
|
||||
strict_overflow_p)));
|
||||
|| (tree_expr_nonnegative_warnv_p (CALL_EXPR_ARG (t, 1),
|
||||
strict_overflow_p)));
|
||||
|
||||
CASE_FLT_FN (BUILT_IN_FMIN):
|
||||
/* True if the 1st AND 2nd arguments are nonnegative. */
|
||||
return (tree_expr_nonnegative_warnv_p (TREE_VALUE (arglist),
|
||||
return (tree_expr_nonnegative_warnv_p (CALL_EXPR_ARG (t, 0),
|
||||
strict_overflow_p)
|
||||
&& (tree_expr_nonnegative_warnv_p
|
||||
(TREE_VALUE (TREE_CHAIN (arglist)),
|
||||
strict_overflow_p)));
|
||||
&& (tree_expr_nonnegative_warnv_p (CALL_EXPR_ARG (t, 1),
|
||||
strict_overflow_p)));
|
||||
|
||||
CASE_FLT_FN (BUILT_IN_COPYSIGN):
|
||||
/* True if the 2nd argument is nonnegative. */
|
||||
return (tree_expr_nonnegative_warnv_p
|
||||
(TREE_VALUE (TREE_CHAIN (arglist)),
|
||||
strict_overflow_p));
|
||||
return tree_expr_nonnegative_warnv_p (CALL_EXPR_ARG (t, 1),
|
||||
strict_overflow_p);
|
||||
|
||||
CASE_FLT_FN (BUILT_IN_POWI):
|
||||
/* True if the 1st argument is nonnegative or the second
|
||||
argument is an even integer. */
|
||||
if (TREE_CODE (TREE_VALUE (TREE_CHAIN (arglist))) == INTEGER_CST)
|
||||
if (TREE_CODE (CALL_EXPR_ARG (t, 1)) == INTEGER_CST)
|
||||
{
|
||||
tree arg1 = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
tree arg1 = CALL_EXPR_ARG (t, 1);
|
||||
if ((TREE_INT_CST_LOW (arg1) & 1) == 0)
|
||||
return true;
|
||||
}
|
||||
return tree_expr_nonnegative_warnv_p (TREE_VALUE (arglist),
|
||||
return tree_expr_nonnegative_warnv_p (CALL_EXPR_ARG (t, 0),
|
||||
strict_overflow_p);
|
||||
|
||||
CASE_FLT_FN (BUILT_IN_POW):
|
||||
/* True if the 1st argument is nonnegative or the second
|
||||
argument is an even integer valued real. */
|
||||
if (TREE_CODE (TREE_VALUE (TREE_CHAIN (arglist))) == REAL_CST)
|
||||
if (TREE_CODE (CALL_EXPR_ARG (t, 1)) == REAL_CST)
|
||||
{
|
||||
REAL_VALUE_TYPE c;
|
||||
HOST_WIDE_INT n;
|
||||
|
||||
c = TREE_REAL_CST (TREE_VALUE (TREE_CHAIN (arglist)));
|
||||
c = TREE_REAL_CST (CALL_EXPR_ARG (t, 1));
|
||||
n = real_to_integer (&c);
|
||||
if ((n & 1) == 0)
|
||||
{
|
||||
|
|
@ -13338,7 +13380,7 @@ tree_expr_nonnegative_warnv_p (tree t, bool *strict_overflow_p)
|
|||
return true;
|
||||
}
|
||||
}
|
||||
return tree_expr_nonnegative_warnv_p (TREE_VALUE (arglist),
|
||||
return tree_expr_nonnegative_warnv_p (CALL_EXPR_ARG (t, 0),
|
||||
strict_overflow_p);
|
||||
|
||||
default:
|
||||
|
|
@ -14336,19 +14378,17 @@ fold_strip_sign_ops (tree exp)
|
|||
{
|
||||
CASE_FLT_FN (BUILT_IN_COPYSIGN):
|
||||
/* Strip copysign function call, return the 1st argument. */
|
||||
arg0 = TREE_VALUE (TREE_OPERAND (exp, 1));
|
||||
arg1 = TREE_VALUE (TREE_CHAIN (TREE_OPERAND (exp, 1)));
|
||||
arg0 = CALL_EXPR_ARG (exp, 0);
|
||||
arg1 = CALL_EXPR_ARG (exp, 1);
|
||||
return omit_one_operand (TREE_TYPE (exp), arg0, arg1);
|
||||
|
||||
default:
|
||||
/* Strip sign ops from the argument of "odd" math functions. */
|
||||
if (negate_mathfn_p (fcode))
|
||||
{
|
||||
arg0 = fold_strip_sign_ops (TREE_VALUE (TREE_OPERAND (exp, 1)));
|
||||
arg0 = fold_strip_sign_ops (CALL_EXPR_ARG (exp, 0));
|
||||
if (arg0)
|
||||
return build_function_call_expr (get_callee_fndecl (exp),
|
||||
build_tree_list (NULL_TREE,
|
||||
arg0));
|
||||
return build_call_expr (get_callee_fndecl (exp), 1, arg0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,68 @@
|
|||
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.
|
||||
|
||||
2007-02-14 Jerry DeLisle <jvdelisle@gcc.gnu.org>
|
||||
|
||||
PR fortran/30779
|
||||
|
|
|
|||
|
|
@ -501,7 +501,6 @@ gfc_trans_allocate_array_storage (stmtblock_t * pre, stmtblock_t * post,
|
|||
bool dynamic, bool dealloc)
|
||||
{
|
||||
tree tmp;
|
||||
tree args;
|
||||
tree desc;
|
||||
bool onstack;
|
||||
|
||||
|
|
@ -534,15 +533,13 @@ gfc_trans_allocate_array_storage (stmtblock_t * pre, stmtblock_t * post,
|
|||
else
|
||||
{
|
||||
/* Allocate memory to hold the data. */
|
||||
args = gfc_chainon_list (NULL_TREE, size);
|
||||
|
||||
if (gfc_index_integer_kind == 4)
|
||||
tmp = gfor_fndecl_internal_malloc;
|
||||
else if (gfc_index_integer_kind == 8)
|
||||
tmp = gfor_fndecl_internal_malloc64;
|
||||
else
|
||||
gcc_unreachable ();
|
||||
tmp = build_function_call_expr (tmp, args);
|
||||
tmp = build_call_expr (tmp, 1, size);
|
||||
tmp = gfc_evaluate_now (tmp, pre);
|
||||
gfc_conv_descriptor_data_set (pre, desc, tmp);
|
||||
}
|
||||
|
|
@ -559,8 +556,7 @@ gfc_trans_allocate_array_storage (stmtblock_t * pre, stmtblock_t * post,
|
|||
/* Free the temporary. */
|
||||
tmp = gfc_conv_descriptor_data_get (desc);
|
||||
tmp = fold_convert (pvoid_type_node, tmp);
|
||||
tmp = gfc_chainon_list (NULL_TREE, tmp);
|
||||
tmp = build_function_call_expr (gfor_fndecl_internal_free, tmp);
|
||||
tmp = build_call_expr (gfor_fndecl_internal_free, 1, tmp);
|
||||
gfc_add_expr_to_block (post, tmp);
|
||||
}
|
||||
}
|
||||
|
|
@ -829,7 +825,7 @@ gfc_get_iteration_count (tree start, tree end, tree step)
|
|||
static void
|
||||
gfc_grow_array (stmtblock_t * pblock, tree desc, tree extra)
|
||||
{
|
||||
tree args;
|
||||
tree arg0, arg1;
|
||||
tree tmp;
|
||||
tree size;
|
||||
tree ubound;
|
||||
|
|
@ -844,14 +840,12 @@ gfc_grow_array (stmtblock_t * pblock, tree desc, tree extra)
|
|||
gfc_add_modify_expr (pblock, ubound, tmp);
|
||||
|
||||
/* Get the value of the current data pointer. */
|
||||
tmp = gfc_conv_descriptor_data_get (desc);
|
||||
args = gfc_chainon_list (NULL_TREE, tmp);
|
||||
arg0 = gfc_conv_descriptor_data_get (desc);
|
||||
|
||||
/* Calculate the new array size. */
|
||||
size = TYPE_SIZE_UNIT (gfc_get_element_type (TREE_TYPE (desc)));
|
||||
tmp = build2 (PLUS_EXPR, gfc_array_index_type, ubound, gfc_index_one_node);
|
||||
tmp = build2 (MULT_EXPR, gfc_array_index_type, tmp, size);
|
||||
args = gfc_chainon_list (args, tmp);
|
||||
arg1 = build2 (MULT_EXPR, gfc_array_index_type, tmp, size);
|
||||
|
||||
/* Pick the appropriate realloc function. */
|
||||
if (gfc_index_integer_kind == 4)
|
||||
|
|
@ -862,7 +856,7 @@ gfc_grow_array (stmtblock_t * pblock, tree desc, tree extra)
|
|||
gcc_unreachable ();
|
||||
|
||||
/* Set the new data pointer. */
|
||||
tmp = build_function_call_expr (tmp, args);
|
||||
tmp = build_call_expr (tmp, 2, arg0, arg1);
|
||||
gfc_conv_descriptor_data_set (pblock, desc, tmp);
|
||||
}
|
||||
|
||||
|
|
@ -971,7 +965,6 @@ gfc_trans_array_ctor_element (stmtblock_t * pblock, tree desc,
|
|||
tree offset, gfc_se * se, gfc_expr * expr)
|
||||
{
|
||||
tree tmp;
|
||||
tree args;
|
||||
|
||||
gfc_conv_expr (se, expr);
|
||||
|
||||
|
|
@ -993,11 +986,8 @@ gfc_trans_array_ctor_element (stmtblock_t * pblock, tree desc,
|
|||
tmp = gfc_build_addr_expr (pchar_type_node, tmp);
|
||||
/* We know the temporary and the value will be the same length,
|
||||
so can use memcpy. */
|
||||
args = gfc_chainon_list (NULL_TREE, tmp);
|
||||
args = gfc_chainon_list (args, se->expr);
|
||||
args = gfc_chainon_list (args, se->string_length);
|
||||
tmp = built_in_decls[BUILT_IN_MEMCPY];
|
||||
tmp = build_function_call_expr (tmp, args);
|
||||
tmp = build_call_expr (built_in_decls[BUILT_IN_MEMCPY], 3,
|
||||
tmp, se->expr, se->string_length);
|
||||
gfc_add_expr_to_block (&se->pre, tmp);
|
||||
}
|
||||
}
|
||||
|
|
@ -1206,11 +1196,8 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type,
|
|||
|
||||
size = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (type));
|
||||
bound = build_int_cst (NULL_TREE, n * size);
|
||||
tmp = gfc_chainon_list (NULL_TREE, tmp);
|
||||
tmp = gfc_chainon_list (tmp, init);
|
||||
tmp = gfc_chainon_list (tmp, bound);
|
||||
tmp = build_function_call_expr (built_in_decls[BUILT_IN_MEMCPY],
|
||||
tmp);
|
||||
tmp = build_call_expr (built_in_decls[BUILT_IN_MEMCPY], 3,
|
||||
tmp, init, bound);
|
||||
gfc_add_expr_to_block (&body, tmp);
|
||||
|
||||
*poffset = fold_build2 (PLUS_EXPR, gfc_array_index_type,
|
||||
|
|
@ -3491,13 +3478,11 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree pstat)
|
|||
else
|
||||
gcc_unreachable ();
|
||||
|
||||
tmp = NULL_TREE;
|
||||
/* The allocate_array variants take the old pointer as first argument. */
|
||||
if (allocatable_array)
|
||||
tmp = gfc_chainon_list (tmp, pointer);
|
||||
tmp = gfc_chainon_list (tmp, size);
|
||||
tmp = gfc_chainon_list (tmp, pstat);
|
||||
tmp = build_function_call_expr (allocate, tmp);
|
||||
tmp = build_call_expr (allocate, 3, pointer, size, pstat);
|
||||
else
|
||||
tmp = build_call_expr (allocate, 2, size, pstat);
|
||||
tmp = build2 (MODIFY_EXPR, void_type_node, pointer, tmp);
|
||||
gfc_add_expr_to_block (&se->pre, tmp);
|
||||
|
||||
|
|
@ -3533,9 +3518,7 @@ gfc_array_deallocate (tree descriptor, tree pstat)
|
|||
STRIP_NOPS (var);
|
||||
|
||||
/* Parameter is the address of the data component. */
|
||||
tmp = gfc_chainon_list (NULL_TREE, var);
|
||||
tmp = gfc_chainon_list (tmp, pstat);
|
||||
tmp = build_function_call_expr (gfor_fndecl_deallocate, tmp);
|
||||
tmp = build_call_expr (gfor_fndecl_deallocate, 2, var, pstat);
|
||||
gfc_add_expr_to_block (&block, tmp);
|
||||
|
||||
/* Zero the data pointer. */
|
||||
|
|
@ -3826,15 +3809,13 @@ gfc_trans_auto_array_allocation (tree decl, gfc_symbol * sym, tree fnbody)
|
|||
size = fold_build2 (MULT_EXPR, gfc_array_index_type, size, tmp);
|
||||
|
||||
/* Allocate memory to hold the data. */
|
||||
tmp = gfc_chainon_list (NULL_TREE, size);
|
||||
|
||||
if (gfc_index_integer_kind == 4)
|
||||
fndecl = gfor_fndecl_internal_malloc;
|
||||
else if (gfc_index_integer_kind == 8)
|
||||
fndecl = gfor_fndecl_internal_malloc64;
|
||||
else
|
||||
gcc_unreachable ();
|
||||
tmp = build_function_call_expr (fndecl, tmp);
|
||||
tmp = build_call_expr (fndecl, 1, size);
|
||||
tmp = fold (convert (TREE_TYPE (decl), tmp));
|
||||
gfc_add_modify_expr (&block, decl, tmp);
|
||||
|
||||
|
|
@ -3850,8 +3831,7 @@ gfc_trans_auto_array_allocation (tree decl, gfc_symbol * sym, tree fnbody)
|
|||
|
||||
/* Free the temporary. */
|
||||
tmp = convert (pvoid_type_node, decl);
|
||||
tmp = gfc_chainon_list (NULL_TREE, tmp);
|
||||
tmp = build_function_call_expr (gfor_fndecl_internal_free, tmp);
|
||||
tmp = build_call_expr (gfor_fndecl_internal_free, 1, tmp);
|
||||
gfc_add_expr_to_block (&block, tmp);
|
||||
|
||||
return gfc_finish_block (&block);
|
||||
|
|
@ -4020,8 +4000,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body)
|
|||
gcc_assert (integer_onep (GFC_TYPE_ARRAY_STRIDE (type, 0)));
|
||||
/* A library call to repack the array if necessary. */
|
||||
tmp = GFC_DECL_SAVED_DESCRIPTOR (tmpdesc);
|
||||
tmp = gfc_chainon_list (NULL_TREE, tmp);
|
||||
stmt_unpacked = build_function_call_expr (gfor_fndecl_in_pack, tmp);
|
||||
stmt_unpacked = build_call_expr (gfor_fndecl_in_pack, 1, tmp);
|
||||
|
||||
stride = gfc_index_one_node;
|
||||
}
|
||||
|
|
@ -4203,15 +4182,12 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body)
|
|||
if (sym->attr.intent != INTENT_IN)
|
||||
{
|
||||
/* Copy the data back. */
|
||||
tmp = gfc_chainon_list (NULL_TREE, dumdesc);
|
||||
tmp = gfc_chainon_list (tmp, tmpdesc);
|
||||
tmp = build_function_call_expr (gfor_fndecl_in_unpack, tmp);
|
||||
tmp = build_call_expr (gfor_fndecl_in_unpack, 2, dumdesc, tmpdesc);
|
||||
gfc_add_expr_to_block (&cleanup, tmp);
|
||||
}
|
||||
|
||||
/* Free the temporary. */
|
||||
tmp = gfc_chainon_list (NULL_TREE, tmpdesc);
|
||||
tmp = build_function_call_expr (gfor_fndecl_internal_free, tmp);
|
||||
tmp = build_call_expr (gfor_fndecl_internal_free, 1, tmpdesc);
|
||||
gfc_add_expr_to_block (&cleanup, tmp);
|
||||
|
||||
stmt = gfc_finish_block (&cleanup);
|
||||
|
|
@ -4778,23 +4754,19 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, gfc_ss * ss, int g77)
|
|||
{
|
||||
desc = se->expr;
|
||||
/* Repack the array. */
|
||||
tmp = gfc_chainon_list (NULL_TREE, desc);
|
||||
ptr = build_function_call_expr (gfor_fndecl_in_pack, tmp);
|
||||
ptr = build_call_expr (gfor_fndecl_in_pack, 1, desc);
|
||||
ptr = gfc_evaluate_now (ptr, &se->pre);
|
||||
se->expr = ptr;
|
||||
|
||||
gfc_start_block (&block);
|
||||
|
||||
/* Copy the data back. */
|
||||
tmp = gfc_chainon_list (NULL_TREE, desc);
|
||||
tmp = gfc_chainon_list (tmp, ptr);
|
||||
tmp = build_function_call_expr (gfor_fndecl_in_unpack, tmp);
|
||||
tmp = build_call_expr (gfor_fndecl_in_unpack, 2, desc, ptr);
|
||||
gfc_add_expr_to_block (&block, tmp);
|
||||
|
||||
/* Free the temporary. */
|
||||
tmp = convert (pvoid_type_node, ptr);
|
||||
tmp = gfc_chainon_list (NULL_TREE, tmp);
|
||||
tmp = build_function_call_expr (gfor_fndecl_internal_free, tmp);
|
||||
tmp = build_call_expr (gfor_fndecl_internal_free, 1, tmp);
|
||||
gfc_add_expr_to_block (&block, tmp);
|
||||
|
||||
stmt = gfc_finish_block (&block);
|
||||
|
|
@ -4836,9 +4808,7 @@ gfc_trans_dealloc_allocated (tree descriptor)
|
|||
/* Call array_deallocate with an int* present in the second argument.
|
||||
Although it is ignored here, it's presence ensures that arrays that
|
||||
are already deallocated are ignored. */
|
||||
tmp = gfc_chainon_list (NULL_TREE, var);
|
||||
tmp = gfc_chainon_list (tmp, ptr);
|
||||
tmp = build_function_call_expr (gfor_fndecl_deallocate, tmp);
|
||||
tmp = build_call_expr (gfor_fndecl_deallocate, 2, var, ptr);
|
||||
gfc_add_expr_to_block (&block, tmp);
|
||||
|
||||
/* Zero the data pointer. */
|
||||
|
|
@ -4880,7 +4850,6 @@ gfc_duplicate_allocatable(tree dest, tree src, tree type, int rank)
|
|||
tree tmp;
|
||||
tree size;
|
||||
tree nelems;
|
||||
tree args;
|
||||
tree null_cond;
|
||||
tree null_data;
|
||||
stmtblock_t block;
|
||||
|
|
@ -4897,11 +4866,10 @@ gfc_duplicate_allocatable(tree dest, tree src, tree type, int rank)
|
|||
TYPE_SIZE_UNIT (gfc_get_element_type (type)));
|
||||
|
||||
/* Allocate memory to the destination. */
|
||||
tmp = gfc_chainon_list (NULL_TREE, size);
|
||||
if (gfc_index_integer_kind == 4)
|
||||
tmp = build_function_call_expr (gfor_fndecl_internal_malloc, tmp);
|
||||
tmp = build_call_expr (gfor_fndecl_internal_malloc, 1, size);
|
||||
else if (gfc_index_integer_kind == 8)
|
||||
tmp = build_function_call_expr (gfor_fndecl_internal_malloc64, tmp);
|
||||
tmp = build_call_expr (gfor_fndecl_internal_malloc64, 1, size);
|
||||
else
|
||||
gcc_unreachable ();
|
||||
tmp = fold (convert (TREE_TYPE (gfc_conv_descriptor_data_get (src)),
|
||||
|
|
@ -4910,13 +4878,9 @@ gfc_duplicate_allocatable(tree dest, tree src, tree type, int rank)
|
|||
|
||||
/* We know the temporary and the value will be the same length,
|
||||
so can use memcpy. */
|
||||
tmp = gfc_conv_descriptor_data_get (dest);
|
||||
args = gfc_chainon_list (NULL_TREE, tmp);
|
||||
tmp = gfc_conv_descriptor_data_get (src);
|
||||
args = gfc_chainon_list (args, tmp);
|
||||
args = gfc_chainon_list (args, size);
|
||||
tmp = built_in_decls[BUILT_IN_MEMCPY];
|
||||
tmp = build_function_call_expr (tmp, args);
|
||||
tmp = build_call_expr (tmp, 3, gfc_conv_descriptor_data_get (dest),
|
||||
gfc_conv_descriptor_data_get (src), size);
|
||||
gfc_add_expr_to_block (&block, tmp);
|
||||
tmp = gfc_finish_block (&block);
|
||||
|
||||
|
|
|
|||
|
|
@ -3135,23 +3135,16 @@ gfc_generate_function_code (gfc_namespace * ns)
|
|||
|
||||
if (sym->attr.is_main_program)
|
||||
{
|
||||
tree arglist, gfc_int4_type_node;
|
||||
|
||||
gfc_int4_type_node = gfc_get_int_type (4);
|
||||
arglist = gfc_chainon_list (NULL_TREE,
|
||||
build_int_cst (gfc_int4_type_node,
|
||||
gfc_option.warn_std));
|
||||
arglist = gfc_chainon_list (arglist,
|
||||
build_int_cst (gfc_int4_type_node,
|
||||
gfc_option.allow_std));
|
||||
arglist = gfc_chainon_list (arglist,
|
||||
build_int_cst (gfc_int4_type_node,
|
||||
pedantic));
|
||||
arglist = gfc_chainon_list (arglist,
|
||||
build_int_cst (gfc_int4_type_node,
|
||||
gfc_option.flag_dump_core));
|
||||
|
||||
tmp = build_function_call_expr (gfor_fndecl_set_std, arglist);
|
||||
tree gfc_int4_type_node = gfc_get_int_type (4);
|
||||
tmp = build_call_expr (gfor_fndecl_set_std, 3,
|
||||
build_int_cst (gfc_int4_type_node,
|
||||
gfc_option.warn_std),
|
||||
build_int_cst (gfc_int4_type_node,
|
||||
gfc_option.allow_std),
|
||||
build_int_cst (gfc_int4_type_node,
|
||||
pedantic),
|
||||
build_int_cst (gfc_int4_type_node,
|
||||
gfc_option.flag_dump_core));
|
||||
gfc_add_expr_to_block (&body, tmp);
|
||||
}
|
||||
|
||||
|
|
@ -3160,13 +3153,10 @@ gfc_generate_function_code (gfc_namespace * ns)
|
|||
needed. */
|
||||
if (sym->attr.is_main_program && gfc_option.fpe != 0)
|
||||
{
|
||||
tree arglist, gfc_c_int_type_node;
|
||||
|
||||
gfc_c_int_type_node = gfc_get_int_type (gfc_c_int_kind);
|
||||
arglist = gfc_chainon_list (NULL_TREE,
|
||||
build_int_cst (gfc_c_int_type_node,
|
||||
gfc_option.fpe));
|
||||
tmp = build_function_call_expr (gfor_fndecl_set_fpe, arglist);
|
||||
tree gfc_c_int_type_node = gfc_get_int_type (gfc_c_int_kind);
|
||||
tmp = build_call_expr (gfor_fndecl_set_fpe, 1,
|
||||
build_int_cst (gfc_c_int_type_node,
|
||||
gfc_option.fpe));
|
||||
gfc_add_expr_to_block (&body, tmp);
|
||||
}
|
||||
|
||||
|
|
@ -3175,13 +3165,10 @@ gfc_generate_function_code (gfc_namespace * ns)
|
|||
|
||||
if (sym->attr.is_main_program && gfc_option.convert != CONVERT_NATIVE)
|
||||
{
|
||||
tree arglist, gfc_c_int_type_node;
|
||||
|
||||
gfc_c_int_type_node = gfc_get_int_type (gfc_c_int_kind);
|
||||
arglist = gfc_chainon_list (NULL_TREE,
|
||||
build_int_cst (gfc_c_int_type_node,
|
||||
gfc_option.convert));
|
||||
tmp = build_function_call_expr (gfor_fndecl_set_convert, arglist);
|
||||
tree gfc_c_int_type_node = gfc_get_int_type (gfc_c_int_kind);
|
||||
tmp = build_call_expr (gfor_fndecl_set_convert, 1,
|
||||
build_int_cst (gfc_c_int_type_node,
|
||||
gfc_option.convert));
|
||||
gfc_add_expr_to_block (&body, tmp);
|
||||
}
|
||||
|
||||
|
|
@ -3190,26 +3177,22 @@ gfc_generate_function_code (gfc_namespace * ns)
|
|||
|
||||
if (sym->attr.is_main_program && gfc_option.record_marker != 0)
|
||||
{
|
||||
tree arglist, gfc_c_int_type_node;
|
||||
|
||||
gfc_c_int_type_node = gfc_get_int_type (gfc_c_int_kind);
|
||||
arglist = gfc_chainon_list (NULL_TREE,
|
||||
build_int_cst (gfc_c_int_type_node,
|
||||
gfc_option.record_marker));
|
||||
tmp = build_function_call_expr (gfor_fndecl_set_record_marker, arglist);
|
||||
tree gfc_c_int_type_node = gfc_get_int_type (gfc_c_int_kind);
|
||||
tmp = build_call_expr (gfor_fndecl_set_record_marker, 1,
|
||||
build_int_cst (gfc_c_int_type_node,
|
||||
gfc_option.record_marker));
|
||||
gfc_add_expr_to_block (&body, tmp);
|
||||
|
||||
}
|
||||
|
||||
if (sym->attr.is_main_program && gfc_option.max_subrecord_length != 0)
|
||||
{
|
||||
tree arglist, gfc_c_int_type_node;
|
||||
tree gfc_c_int_type_node;
|
||||
|
||||
gfc_c_int_type_node = gfc_get_int_type (gfc_c_int_kind);
|
||||
arglist = gfc_chainon_list (NULL_TREE,
|
||||
build_int_cst (gfc_c_int_type_node,
|
||||
gfc_option.max_subrecord_length));
|
||||
tmp = build_function_call_expr (gfor_fndecl_set_max_subrecord_length, arglist);
|
||||
tmp = build_call_expr (gfor_fndecl_set_max_subrecord_length,
|
||||
1,
|
||||
build_int_cst (gfc_c_int_type_node,
|
||||
gfc_option.max_subrecord_length));
|
||||
gfc_add_expr_to_block (&body, tmp);
|
||||
}
|
||||
|
||||
|
|
@ -3374,8 +3357,7 @@ gfc_generate_constructors (void)
|
|||
|
||||
for (; gfc_static_ctors; gfc_static_ctors = TREE_CHAIN (gfc_static_ctors))
|
||||
{
|
||||
tmp =
|
||||
build_function_call_expr (TREE_VALUE (gfc_static_ctors), NULL_TREE);
|
||||
tmp = build_call_expr (TREE_VALUE (gfc_static_ctors), 0);
|
||||
DECL_SAVED_TREE (fndecl) = build_stmt (EXPR_STMT, tmp);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -748,7 +748,6 @@ gfc_conv_power_op (gfc_se * se, gfc_expr * expr)
|
|||
gfc_se lse;
|
||||
gfc_se rse;
|
||||
tree fndecl;
|
||||
tree tmp;
|
||||
|
||||
gfc_init_se (&lse, se);
|
||||
gfc_conv_expr_val (&lse, expr->value.op.op1);
|
||||
|
|
@ -887,9 +886,7 @@ gfc_conv_power_op (gfc_se * se, gfc_expr * expr)
|
|||
break;
|
||||
}
|
||||
|
||||
tmp = gfc_chainon_list (NULL_TREE, lse.expr);
|
||||
tmp = gfc_chainon_list (tmp, rse.expr);
|
||||
se->expr = build_function_call_expr (fndecl, tmp);
|
||||
se->expr = build_call_expr (fndecl, 2, lse.expr, rse.expr);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -900,7 +897,6 @@ gfc_conv_string_tmp (gfc_se * se, tree type, tree len)
|
|||
{
|
||||
tree var;
|
||||
tree tmp;
|
||||
tree args;
|
||||
|
||||
gcc_assert (TREE_TYPE (len) == gfc_charlen_type_node);
|
||||
|
||||
|
|
@ -918,15 +914,13 @@ gfc_conv_string_tmp (gfc_se * se, tree type, tree len)
|
|||
{
|
||||
/* Allocate a temporary to hold the result. */
|
||||
var = gfc_create_var (type, "pstr");
|
||||
args = gfc_chainon_list (NULL_TREE, len);
|
||||
tmp = build_function_call_expr (gfor_fndecl_internal_malloc, args);
|
||||
tmp = build_call_expr (gfor_fndecl_internal_malloc, 1, len);
|
||||
tmp = convert (type, tmp);
|
||||
gfc_add_modify_expr (&se->pre, var, tmp);
|
||||
|
||||
/* Free the temporary afterwards. */
|
||||
tmp = convert (pvoid_type_node, var);
|
||||
args = gfc_chainon_list (NULL_TREE, tmp);
|
||||
tmp = build_function_call_expr (gfor_fndecl_internal_free, args);
|
||||
tmp = build_call_expr (gfor_fndecl_internal_free, 1, tmp);
|
||||
gfc_add_expr_to_block (&se->post, tmp);
|
||||
}
|
||||
|
||||
|
|
@ -945,7 +939,6 @@ gfc_conv_concat_op (gfc_se * se, gfc_expr * expr)
|
|||
tree len;
|
||||
tree type;
|
||||
tree var;
|
||||
tree args;
|
||||
tree tmp;
|
||||
|
||||
gcc_assert (expr->value.op.op1->ts.type == BT_CHARACTER
|
||||
|
|
@ -974,14 +967,10 @@ gfc_conv_concat_op (gfc_se * se, gfc_expr * expr)
|
|||
var = gfc_conv_string_tmp (se, type, len);
|
||||
|
||||
/* Do the actual concatenation. */
|
||||
args = NULL_TREE;
|
||||
args = gfc_chainon_list (args, len);
|
||||
args = gfc_chainon_list (args, var);
|
||||
args = gfc_chainon_list (args, lse.string_length);
|
||||
args = gfc_chainon_list (args, lse.expr);
|
||||
args = gfc_chainon_list (args, rse.string_length);
|
||||
args = gfc_chainon_list (args, rse.expr);
|
||||
tmp = build_function_call_expr (gfor_fndecl_concat_string, args);
|
||||
tmp = build_call_expr (gfor_fndecl_concat_string, 6,
|
||||
len, var,
|
||||
lse.string_length, lse.expr,
|
||||
rse.string_length, rse.expr);
|
||||
gfc_add_expr_to_block (&se->pre, tmp);
|
||||
|
||||
/* Add the cleanup for the operands. */
|
||||
|
|
@ -1205,17 +1194,9 @@ gfc_build_compare_string (tree len1, tree str1, tree len2, tree str2)
|
|||
tmp = fold_build2 (MINUS_EXPR, type, sc1, sc2);
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = NULL_TREE;
|
||||
tmp = gfc_chainon_list (tmp, len1);
|
||||
tmp = gfc_chainon_list (tmp, str1);
|
||||
tmp = gfc_chainon_list (tmp, len2);
|
||||
tmp = gfc_chainon_list (tmp, str2);
|
||||
|
||||
/* Build a call for the comparison. */
|
||||
tmp = build_function_call_expr (gfor_fndecl_compare_string, tmp);
|
||||
}
|
||||
|
||||
/* Build a call for the comparison. */
|
||||
tmp = build_call_expr (gfor_fndecl_compare_string, 4,
|
||||
len1, str1, len2, str2);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
|
@ -1281,7 +1262,7 @@ gfc_conv_operator_assign (gfc_se *lse, gfc_se *rse, gfc_symbol *sym)
|
|||
gfc_init_se (&se, NULL);
|
||||
gfc_conv_function_val (&se, sym);
|
||||
tmp = TREE_TYPE (TREE_TYPE (TREE_TYPE (se.expr)));
|
||||
tmp = build3 (CALL_EXPR, tmp, se.expr, args, NULL_TREE);
|
||||
tmp = build_call_list (tmp, se.expr, args);
|
||||
gfc_add_expr_to_block (&block, tmp);
|
||||
|
||||
gfc_add_block_to_block (&block, &lse->post);
|
||||
|
|
@ -2407,8 +2388,7 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym,
|
|||
}
|
||||
|
||||
fntype = TREE_TYPE (TREE_TYPE (se->expr));
|
||||
se->expr = build3 (CALL_EXPR, TREE_TYPE (fntype), se->expr,
|
||||
arglist, NULL_TREE);
|
||||
se->expr = build_call_list (TREE_TYPE (fntype), se->expr, arglist);
|
||||
|
||||
/* If we have a pointer function, but we don't want a pointer, e.g.
|
||||
something like
|
||||
|
|
@ -2542,26 +2522,21 @@ gfc_trans_string_copy (stmtblock_t * block, tree dlength, tree dest,
|
|||
|
||||
/* Truncate string if source is too long. */
|
||||
cond2 = fold_build2 (GE_EXPR, boolean_type_node, slen, dlen);
|
||||
tmp2 = gfc_chainon_list (NULL_TREE, dest);
|
||||
tmp2 = gfc_chainon_list (tmp2, src);
|
||||
tmp2 = gfc_chainon_list (tmp2, dlen);
|
||||
tmp2 = build_function_call_expr (built_in_decls[BUILT_IN_MEMMOVE], tmp2);
|
||||
tmp2 = build_call_expr (built_in_decls[BUILT_IN_MEMMOVE],
|
||||
3, dest, src, dlen);
|
||||
|
||||
/* Else copy and pad with spaces. */
|
||||
tmp3 = gfc_chainon_list (NULL_TREE, dest);
|
||||
tmp3 = gfc_chainon_list (tmp3, src);
|
||||
tmp3 = gfc_chainon_list (tmp3, slen);
|
||||
tmp3 = build_function_call_expr (built_in_decls[BUILT_IN_MEMMOVE], tmp3);
|
||||
tmp3 = build_call_expr (built_in_decls[BUILT_IN_MEMMOVE],
|
||||
3, dest, src, slen);
|
||||
|
||||
tmp4 = fold_build2 (PLUS_EXPR, pchar_type_node, dest,
|
||||
fold_convert (pchar_type_node, slen));
|
||||
tmp4 = gfc_chainon_list (NULL_TREE, tmp4);
|
||||
tmp4 = gfc_chainon_list (tmp4, build_int_cst
|
||||
(gfc_get_int_type (gfc_c_int_kind),
|
||||
lang_hooks.to_target_charset (' ')));
|
||||
tmp4 = gfc_chainon_list (tmp4, fold_build2 (MINUS_EXPR, TREE_TYPE(dlen),
|
||||
dlen, slen));
|
||||
tmp4 = build_function_call_expr (built_in_decls[BUILT_IN_MEMSET], tmp4);
|
||||
tmp4 = build_call_expr (built_in_decls[BUILT_IN_MEMSET], 3,
|
||||
tmp4,
|
||||
build_int_cst (gfc_get_int_type (gfc_c_int_kind),
|
||||
lang_hooks.to_target_charset (' ')),
|
||||
fold_build2 (MINUS_EXPR, TREE_TYPE(dlen),
|
||||
dlen, slen));
|
||||
|
||||
gfc_init_block (&tempblock);
|
||||
gfc_add_expr_to_block (&tempblock, tmp3);
|
||||
|
|
@ -3585,7 +3560,7 @@ static tree
|
|||
gfc_trans_zero_assign (gfc_expr * expr)
|
||||
{
|
||||
tree dest, len, type;
|
||||
tree tmp, args;
|
||||
tree tmp;
|
||||
gfc_symbol *sym;
|
||||
|
||||
sym = expr->symtree->n.sym;
|
||||
|
|
@ -3613,10 +3588,8 @@ gfc_trans_zero_assign (gfc_expr * expr)
|
|||
len = fold_convert (size_type_node, len);
|
||||
|
||||
/* Construct call to __builtin_memset. */
|
||||
args = build_tree_list (NULL_TREE, len);
|
||||
args = tree_cons (NULL_TREE, integer_zero_node, args);
|
||||
args = tree_cons (NULL_TREE, dest, args);
|
||||
tmp = build_function_call_expr (built_in_decls[BUILT_IN_MEMSET], args);
|
||||
tmp = build_call_expr (built_in_decls[BUILT_IN_MEMSET],
|
||||
3, dest, integer_zero_node, len);
|
||||
return fold_convert (void_type_node, tmp);
|
||||
}
|
||||
|
||||
|
|
@ -3627,7 +3600,7 @@ gfc_trans_zero_assign (gfc_expr * expr)
|
|||
static tree
|
||||
gfc_build_memcpy_call (tree dst, tree src, tree len)
|
||||
{
|
||||
tree tmp, args;
|
||||
tree tmp;
|
||||
|
||||
/* Convert arguments to the correct types. */
|
||||
if (!POINTER_TYPE_P (TREE_TYPE (dst)))
|
||||
|
|
@ -3643,10 +3616,7 @@ gfc_build_memcpy_call (tree dst, tree src, tree len)
|
|||
len = fold_convert (size_type_node, len);
|
||||
|
||||
/* Construct call to __builtin_memcpy. */
|
||||
args = build_tree_list (NULL_TREE, len);
|
||||
args = tree_cons (NULL_TREE, src, args);
|
||||
args = tree_cons (NULL_TREE, dst, args);
|
||||
tmp = build_function_call_expr (built_in_decls[BUILT_IN_MEMCPY], args);
|
||||
tmp = build_call_expr (built_in_decls[BUILT_IN_MEMCPY], 3, dst, src, len);
|
||||
return fold_convert (void_type_node, tmp);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -164,6 +164,8 @@ real_compnt_info;
|
|||
enum rounding_mode { RND_ROUND, RND_TRUNC, RND_CEIL, RND_FLOOR };
|
||||
|
||||
/* Evaluate the arguments to an intrinsic function. */
|
||||
/* FIXME: This function and its callers should be rewritten so that it's
|
||||
not necessary to cons up a list to hold the arguments. */
|
||||
|
||||
static tree
|
||||
gfc_conv_intrinsic_function_args (gfc_se * se, gfc_expr * expr)
|
||||
|
|
@ -1273,8 +1275,7 @@ gfc_conv_intrinsic_ctime (gfc_se * se, gfc_expr * expr)
|
|||
/* Free the temporary afterwards, if necessary. */
|
||||
cond = build2 (GT_EXPR, boolean_type_node, len,
|
||||
build_int_cst (TREE_TYPE (len), 0));
|
||||
arglist = gfc_chainon_list (NULL_TREE, var);
|
||||
tmp = build_function_call_expr (gfor_fndecl_internal_free, arglist);
|
||||
tmp = build_call_expr (gfor_fndecl_internal_free, 1, var);
|
||||
tmp = build3_v (COND_EXPR, cond, tmp, build_empty_stmt ());
|
||||
gfc_add_expr_to_block (&se->post, tmp);
|
||||
|
||||
|
|
@ -1309,8 +1310,7 @@ gfc_conv_intrinsic_fdate (gfc_se * se, gfc_expr * expr)
|
|||
/* Free the temporary afterwards, if necessary. */
|
||||
cond = build2 (GT_EXPR, boolean_type_node, len,
|
||||
build_int_cst (TREE_TYPE (len), 0));
|
||||
arglist = gfc_chainon_list (NULL_TREE, var);
|
||||
tmp = build_function_call_expr (gfor_fndecl_internal_free, arglist);
|
||||
tmp = build_call_expr (gfor_fndecl_internal_free, 1, var);
|
||||
tmp = build3_v (COND_EXPR, cond, tmp, build_empty_stmt ());
|
||||
gfc_add_expr_to_block (&se->post, tmp);
|
||||
|
||||
|
|
@ -1347,8 +1347,7 @@ gfc_conv_intrinsic_ttynam (gfc_se * se, gfc_expr * expr)
|
|||
/* Free the temporary afterwards, if necessary. */
|
||||
cond = build2 (GT_EXPR, boolean_type_node, len,
|
||||
build_int_cst (TREE_TYPE (len), 0));
|
||||
arglist = gfc_chainon_list (NULL_TREE, var);
|
||||
tmp = build_function_call_expr (gfor_fndecl_internal_free, arglist);
|
||||
tmp = build_call_expr (gfor_fndecl_internal_free, 1, var);
|
||||
tmp = build3_v (COND_EXPR, cond, tmp, build_empty_stmt ());
|
||||
gfc_add_expr_to_block (&se->post, tmp);
|
||||
|
||||
|
|
@ -2809,7 +2808,6 @@ gfc_conv_intrinsic_array_transfer (gfc_se * se, gfc_expr * expr)
|
|||
tree lower;
|
||||
tree stride;
|
||||
tree stmt;
|
||||
tree args;
|
||||
gfc_actual_arglist *arg;
|
||||
gfc_se argse;
|
||||
gfc_ss *ss;
|
||||
|
|
@ -2850,15 +2848,13 @@ gfc_conv_intrinsic_array_transfer (gfc_se * se, gfc_expr * expr)
|
|||
&& arg->expr->ref->u.ar.type == AR_FULL))
|
||||
{
|
||||
tmp = build_fold_addr_expr (argse.expr);
|
||||
tmp = gfc_chainon_list (NULL_TREE, tmp);
|
||||
source = build_function_call_expr (gfor_fndecl_in_pack, tmp);
|
||||
source = build_call_expr (gfor_fndecl_in_pack, 1, tmp);
|
||||
source = gfc_evaluate_now (source, &argse.pre);
|
||||
|
||||
/* Free the temporary. */
|
||||
gfc_start_block (&block);
|
||||
tmp = convert (pvoid_type_node, source);
|
||||
tmp = gfc_chainon_list (NULL_TREE, tmp);
|
||||
tmp = build_function_call_expr (gfor_fndecl_internal_free, tmp);
|
||||
tmp = build_call_expr (gfor_fndecl_internal_free, 1, tmp);
|
||||
gfc_add_expr_to_block (&block, tmp);
|
||||
stmt = gfc_finish_block (&block);
|
||||
|
||||
|
|
@ -2998,13 +2994,11 @@ gfc_conv_intrinsic_array_transfer (gfc_se * se, gfc_expr * expr)
|
|||
info, tmp, false, true, false);
|
||||
|
||||
/* Use memcpy to do the transfer. */
|
||||
tmp = gfc_conv_descriptor_data_get (info->descriptor);
|
||||
args = gfc_chainon_list (NULL_TREE, tmp);
|
||||
tmp = fold_convert (pvoid_type_node, source);
|
||||
args = gfc_chainon_list (args, source);
|
||||
args = gfc_chainon_list (args, size_bytes);
|
||||
tmp = built_in_decls[BUILT_IN_MEMCPY];
|
||||
tmp = build_function_call_expr (tmp, args);
|
||||
tmp = build_call_expr (built_in_decls[BUILT_IN_MEMCPY],
|
||||
3,
|
||||
gfc_conv_descriptor_data_get (info->descriptor),
|
||||
fold_convert (pvoid_type_node, source),
|
||||
size_bytes);
|
||||
gfc_add_expr_to_block (&se->pre, tmp);
|
||||
|
||||
se->expr = info->descriptor;
|
||||
|
|
@ -3024,7 +3018,7 @@ gfc_conv_intrinsic_transfer (gfc_se * se, gfc_expr * expr)
|
|||
tree type;
|
||||
tree ptr;
|
||||
gfc_ss *ss;
|
||||
tree tmpdecl, tmp, args;
|
||||
tree tmpdecl, tmp;
|
||||
|
||||
/* Get a pointer to the source. */
|
||||
arg = expr->value.function.actual;
|
||||
|
|
@ -3059,13 +3053,10 @@ gfc_conv_intrinsic_transfer (gfc_se * se, gfc_expr * expr)
|
|||
|
||||
/* Use memcpy to do the transfer. */
|
||||
tmp = build1 (ADDR_EXPR, build_pointer_type (type), tmpdecl);
|
||||
tmp = fold_convert (pvoid_type_node, tmp);
|
||||
args = gfc_chainon_list (NULL_TREE, tmp);
|
||||
tmp = fold_convert (pvoid_type_node, ptr);
|
||||
args = gfc_chainon_list (args, tmp);
|
||||
args = gfc_chainon_list (args, moldsize);
|
||||
tmp = built_in_decls[BUILT_IN_MEMCPY];
|
||||
tmp = build_function_call_expr (tmp, args);
|
||||
tmp = build_call_expr (built_in_decls[BUILT_IN_MEMCPY], 3,
|
||||
fold_convert (pvoid_type_node, tmp),
|
||||
fold_convert (pvoid_type_node, ptr),
|
||||
moldsize);
|
||||
gfc_add_expr_to_block (&se->pre, tmp);
|
||||
|
||||
se->expr = tmpdecl;
|
||||
|
|
@ -3112,7 +3103,7 @@ gfc_conv_associated (gfc_se *se, gfc_expr *expr)
|
|||
gfc_se arg2se;
|
||||
tree tmp2;
|
||||
tree tmp;
|
||||
tree args, fndecl;
|
||||
tree fndecl;
|
||||
tree nonzero_charlen;
|
||||
tree nonzero_arraylen;
|
||||
gfc_ss *ss1, *ss2;
|
||||
|
|
@ -3185,18 +3176,15 @@ gfc_conv_associated (gfc_se *se, gfc_expr *expr)
|
|||
|
||||
/* A pointer to an array, call library function _gfor_associated. */
|
||||
gcc_assert (ss2 != gfc_ss_terminator);
|
||||
args = NULL_TREE;
|
||||
arg1se.want_pointer = 1;
|
||||
gfc_conv_expr_descriptor (&arg1se, arg1->expr, ss1);
|
||||
args = gfc_chainon_list (args, arg1se.expr);
|
||||
|
||||
arg2se.want_pointer = 1;
|
||||
gfc_conv_expr_descriptor (&arg2se, arg2->expr, ss2);
|
||||
gfc_add_block_to_block (&se->pre, &arg2se.pre);
|
||||
gfc_add_block_to_block (&se->post, &arg2se.post);
|
||||
args = gfc_chainon_list (args, arg2se.expr);
|
||||
fndecl = gfor_fndecl_associated;
|
||||
se->expr = build_function_call_expr (fndecl, args);
|
||||
se->expr = build_call_expr (fndecl, 2, arg1se.expr, arg2se.expr);
|
||||
se->expr = build2 (TRUTH_AND_EXPR, boolean_type_node,
|
||||
se->expr, nonzero_arraylen);
|
||||
|
||||
|
|
@ -3287,8 +3275,7 @@ gfc_conv_intrinsic_si_kind (gfc_se * se, gfc_expr * expr)
|
|||
args = gfc_conv_intrinsic_function_args (se, expr);
|
||||
args = TREE_VALUE (args);
|
||||
args = build_fold_addr_expr (args);
|
||||
args = tree_cons (NULL_TREE, args, NULL_TREE);
|
||||
se->expr = build_function_call_expr (gfor_fndecl_si_kind, args);
|
||||
se->expr = build_call_expr (gfor_fndecl_si_kind, 1, args);
|
||||
}
|
||||
|
||||
/* Generate code for SELECTED_REAL_KIND (P, R) intrinsic function. */
|
||||
|
|
@ -3351,8 +3338,7 @@ gfc_conv_intrinsic_trim (gfc_se * se, gfc_expr * expr)
|
|||
/* Free the temporary afterwards, if necessary. */
|
||||
cond = build2 (GT_EXPR, boolean_type_node, len,
|
||||
build_int_cst (TREE_TYPE (len), 0));
|
||||
arglist = gfc_chainon_list (NULL_TREE, var);
|
||||
tmp = build_function_call_expr (gfor_fndecl_internal_free, arglist);
|
||||
tmp = build_call_expr (gfor_fndecl_internal_free, 1, var);
|
||||
tmp = build3_v (COND_EXPR, cond, tmp, build_empty_stmt ());
|
||||
gfc_add_expr_to_block (&se->post, tmp);
|
||||
|
||||
|
|
@ -3370,7 +3356,6 @@ gfc_conv_intrinsic_repeat (gfc_se * se, gfc_expr * expr)
|
|||
tree tmp;
|
||||
tree len;
|
||||
tree args;
|
||||
tree arglist;
|
||||
tree ncopies;
|
||||
tree var;
|
||||
tree type;
|
||||
|
|
@ -3395,12 +3380,9 @@ gfc_conv_intrinsic_repeat (gfc_se * se, gfc_expr * expr)
|
|||
var = gfc_conv_string_tmp (se, build_pointer_type (type), len);
|
||||
|
||||
/* Create the argument list and generate the function call. */
|
||||
arglist = NULL_TREE;
|
||||
arglist = gfc_chainon_list (arglist, var);
|
||||
arglist = gfc_chainon_list (arglist, TREE_VALUE (args));
|
||||
arglist = gfc_chainon_list (arglist, TREE_VALUE (TREE_CHAIN (args)));
|
||||
arglist = gfc_chainon_list (arglist, ncopies);
|
||||
tmp = build_function_call_expr (gfor_fndecl_string_repeat, arglist);
|
||||
tmp = build_call_expr (gfor_fndecl_string_repeat, 4, var,
|
||||
TREE_VALUE (args),
|
||||
TREE_VALUE (TREE_CHAIN (args)), ncopies);
|
||||
gfc_add_expr_to_block (&se->pre, tmp);
|
||||
|
||||
se->expr = var;
|
||||
|
|
@ -3419,7 +3401,7 @@ gfc_conv_intrinsic_iargc (gfc_se * se, gfc_expr * expr)
|
|||
|
||||
/* Call the library function. This always returns an INTEGER(4). */
|
||||
fndecl = gfor_fndecl_iargc;
|
||||
tmp = build_function_call_expr (fndecl, NULL_TREE);
|
||||
tmp = build_call_expr (fndecl, 0);
|
||||
|
||||
/* Convert it to the required type. */
|
||||
type = gfc_typenode_for_spec (&expr->ts);
|
||||
|
|
|
|||
|
|
@ -835,8 +835,7 @@ gfc_trans_open (gfc_code * code)
|
|||
set_parameter_const (&block, var, IOPARM_common_flags, mask);
|
||||
|
||||
tmp = build_fold_addr_expr (var);
|
||||
tmp = gfc_chainon_list (NULL_TREE, tmp);
|
||||
tmp = build_function_call_expr (iocall[IOCALL_OPEN], tmp);
|
||||
tmp = build_call_expr (iocall[IOCALL_OPEN], 1, tmp);
|
||||
gfc_add_expr_to_block (&block, tmp);
|
||||
|
||||
gfc_add_block_to_block (&block, &post_block);
|
||||
|
|
@ -888,8 +887,7 @@ gfc_trans_close (gfc_code * code)
|
|||
set_parameter_const (&block, var, IOPARM_common_flags, mask);
|
||||
|
||||
tmp = build_fold_addr_expr (var);
|
||||
tmp = gfc_chainon_list (NULL_TREE, tmp);
|
||||
tmp = build_function_call_expr (iocall[IOCALL_CLOSE], tmp);
|
||||
tmp = build_call_expr (iocall[IOCALL_CLOSE], 1, tmp);
|
||||
gfc_add_expr_to_block (&block, tmp);
|
||||
|
||||
gfc_add_block_to_block (&block, &post_block);
|
||||
|
|
@ -939,8 +937,7 @@ build_filepos (tree function, gfc_code * code)
|
|||
set_parameter_const (&block, var, IOPARM_common_flags, mask);
|
||||
|
||||
tmp = build_fold_addr_expr (var);
|
||||
tmp = gfc_chainon_list (NULL_TREE, tmp);
|
||||
tmp = build_function_call_expr (function, tmp);
|
||||
tmp = build_call_expr (function, 1, tmp);
|
||||
gfc_add_expr_to_block (&block, tmp);
|
||||
|
||||
gfc_add_block_to_block (&block, &post_block);
|
||||
|
|
@ -1125,8 +1122,7 @@ gfc_trans_inquire (gfc_code * code)
|
|||
set_parameter_const (&block, var, IOPARM_common_flags, mask);
|
||||
|
||||
tmp = build_fold_addr_expr (var);
|
||||
tmp = gfc_chainon_list (NULL_TREE, tmp);
|
||||
tmp = build_function_call_expr (iocall[IOCALL_INQUIRE], tmp);
|
||||
tmp = build_call_expr (iocall[IOCALL_INQUIRE], 1, tmp);
|
||||
gfc_add_expr_to_block (&block, tmp);
|
||||
|
||||
gfc_add_block_to_block (&block, &post_block);
|
||||
|
|
@ -1248,8 +1244,6 @@ nml_get_addr_expr (gfc_symbol * sym, gfc_component * c,
|
|||
call to iocall[IOCALL_SET_NML_VAL]. For derived type variable, recursively
|
||||
generate calls to iocall[IOCALL_SET_NML_VAL] for each component. */
|
||||
|
||||
#define NML_FIRST_ARG(a) args = gfc_chainon_list (NULL_TREE, a)
|
||||
#define NML_ADD_ARG(a) args = gfc_chainon_list (args, a)
|
||||
#define IARG(i) build_int_cst (gfc_array_index_type, i)
|
||||
|
||||
static void
|
||||
|
|
@ -1263,7 +1257,6 @@ transfer_namelist_element (stmtblock_t * block, const char * var_name,
|
|||
tree dt = NULL;
|
||||
tree string;
|
||||
tree tmp;
|
||||
tree args;
|
||||
tree dtype;
|
||||
tree dt_parm_addr;
|
||||
int n_dim;
|
||||
|
|
@ -1329,18 +1322,14 @@ transfer_namelist_element (stmtblock_t * block, const char * var_name,
|
|||
(address, name, type, kind or string_length, dtype) */
|
||||
|
||||
dt_parm_addr = build_fold_addr_expr (dt_parm);
|
||||
NML_FIRST_ARG (dt_parm_addr);
|
||||
NML_ADD_ARG (addr_expr);
|
||||
NML_ADD_ARG (string);
|
||||
NML_ADD_ARG (IARG (ts->kind));
|
||||
|
||||
if (ts->type == BT_CHARACTER)
|
||||
NML_ADD_ARG (ts->cl->backend_decl);
|
||||
tmp = ts->cl->backend_decl;
|
||||
else
|
||||
NML_ADD_ARG (build_int_cst (gfc_charlen_type_node, 0));
|
||||
|
||||
NML_ADD_ARG (dtype);
|
||||
tmp = build_function_call_expr (iocall[IOCALL_SET_NML_VAL], args);
|
||||
tmp = build_int_cst (gfc_charlen_type_node, 0);
|
||||
tmp = build_call_expr (iocall[IOCALL_SET_NML_VAL], 6,
|
||||
dt_parm_addr, addr_expr, string,
|
||||
IARG (ts->kind), tmp, dtype);
|
||||
gfc_add_expr_to_block (block, tmp);
|
||||
|
||||
/* If the object is an array, transfer rank times:
|
||||
|
|
@ -1348,12 +1337,12 @@ transfer_namelist_element (stmtblock_t * block, const char * var_name,
|
|||
|
||||
for ( n_dim = 0 ; n_dim < rank ; n_dim++ )
|
||||
{
|
||||
NML_FIRST_ARG (dt_parm_addr);
|
||||
NML_ADD_ARG (IARG (n_dim));
|
||||
NML_ADD_ARG (GFC_TYPE_ARRAY_STRIDE (dt, n_dim));
|
||||
NML_ADD_ARG (GFC_TYPE_ARRAY_LBOUND (dt, n_dim));
|
||||
NML_ADD_ARG (GFC_TYPE_ARRAY_UBOUND (dt, n_dim));
|
||||
tmp = build_function_call_expr (iocall[IOCALL_SET_NML_VAL_DIM], args);
|
||||
tmp = build_call_expr (iocall[IOCALL_SET_NML_VAL_DIM], 5,
|
||||
dt_parm_addr,
|
||||
IARG (n_dim),
|
||||
GFC_TYPE_ARRAY_STRIDE (dt, n_dim),
|
||||
GFC_TYPE_ARRAY_LBOUND (dt, n_dim),
|
||||
GFC_TYPE_ARRAY_UBOUND (dt, n_dim));
|
||||
gfc_add_expr_to_block (block, tmp);
|
||||
}
|
||||
|
||||
|
|
@ -1377,8 +1366,6 @@ transfer_namelist_element (stmtblock_t * block, const char * var_name,
|
|||
}
|
||||
|
||||
#undef IARG
|
||||
#undef NML_ADD_ARG
|
||||
#undef NML_FIRST_ARG
|
||||
|
||||
/* Create a data transfer statement. Not all of the fields are valid
|
||||
for both reading and writing, but improper use has been filtered
|
||||
|
|
@ -1509,8 +1496,7 @@ build_dt (tree function, gfc_code * code)
|
|||
set_parameter_const (&block, var, IOPARM_common_flags, mask);
|
||||
|
||||
tmp = build_fold_addr_expr (var);
|
||||
tmp = gfc_chainon_list (NULL_TREE, tmp);
|
||||
tmp = build_function_call_expr (function, tmp);
|
||||
tmp = build_call_expr (function, 1, tmp);
|
||||
gfc_add_expr_to_block (&block, tmp);
|
||||
|
||||
gfc_add_block_to_block (&block, &post_block);
|
||||
|
|
@ -1590,8 +1576,7 @@ gfc_trans_dt_end (gfc_code * code)
|
|||
}
|
||||
|
||||
tmp = build_fold_addr_expr (dt_parm);
|
||||
tmp = gfc_chainon_list (NULL_TREE, tmp);
|
||||
tmp = build_function_call_expr (function, tmp);
|
||||
tmp = build_call_expr (function, 1, tmp);
|
||||
gfc_add_expr_to_block (&block, tmp);
|
||||
gfc_add_block_to_block (&block, dt_post_end_block);
|
||||
gfc_init_block (dt_post_end_block);
|
||||
|
|
@ -1702,7 +1687,7 @@ transfer_array_component (tree expr, gfc_component * cm)
|
|||
static void
|
||||
transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr)
|
||||
{
|
||||
tree args, tmp, function, arg2, field, expr;
|
||||
tree tmp, function, arg2, field, expr;
|
||||
gfc_component *c;
|
||||
int kind;
|
||||
|
||||
|
|
@ -1777,11 +1762,7 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr)
|
|||
}
|
||||
|
||||
tmp = build_fold_addr_expr (dt_parm);
|
||||
args = gfc_chainon_list (NULL_TREE, tmp);
|
||||
args = gfc_chainon_list (args, addr_expr);
|
||||
args = gfc_chainon_list (args, arg2);
|
||||
|
||||
tmp = build_function_call_expr (function, args);
|
||||
tmp = build_call_expr (function, 3, tmp, addr_expr, arg2);
|
||||
gfc_add_expr_to_block (&se->pre, tmp);
|
||||
gfc_add_block_to_block (&se->pre, &se->post);
|
||||
|
||||
|
|
@ -1794,7 +1775,7 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr)
|
|||
static void
|
||||
transfer_array_desc (gfc_se * se, gfc_typespec * ts, tree addr_expr)
|
||||
{
|
||||
tree args, tmp, charlen_arg, kind_arg;
|
||||
tree tmp, charlen_arg, kind_arg;
|
||||
|
||||
if (ts->type == BT_CHARACTER)
|
||||
charlen_arg = se->string_length;
|
||||
|
|
@ -1804,11 +1785,8 @@ transfer_array_desc (gfc_se * se, gfc_typespec * ts, tree addr_expr)
|
|||
kind_arg = build_int_cst (NULL_TREE, ts->kind);
|
||||
|
||||
tmp = build_fold_addr_expr (dt_parm);
|
||||
args = gfc_chainon_list (NULL_TREE, tmp);
|
||||
args = gfc_chainon_list (args, addr_expr);
|
||||
args = gfc_chainon_list (args, kind_arg);
|
||||
args = gfc_chainon_list (args, charlen_arg);
|
||||
tmp = build_function_call_expr (iocall[IOCALL_X_ARRAY], args);
|
||||
tmp = build_call_expr (iocall[IOCALL_X_ARRAY], 4,
|
||||
tmp, addr_expr, kind_arg, charlen_arg);
|
||||
gfc_add_expr_to_block (&se->pre, tmp);
|
||||
gfc_add_block_to_block (&se->pre, &se->post);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -875,7 +875,7 @@ static tree
|
|||
gfc_trans_omp_barrier (void)
|
||||
{
|
||||
tree decl = built_in_decls [BUILT_IN_GOMP_BARRIER];
|
||||
return build_function_call_expr (decl, NULL);
|
||||
return build_call_expr (decl, 0);
|
||||
}
|
||||
|
||||
static tree
|
||||
|
|
@ -1054,7 +1054,7 @@ static tree
|
|||
gfc_trans_omp_flush (void)
|
||||
{
|
||||
tree decl = built_in_decls [BUILT_IN_SYNCHRONIZE];
|
||||
return build_function_call_expr (decl, NULL);
|
||||
return build_call_expr (decl, 0);
|
||||
}
|
||||
|
||||
static tree
|
||||
|
|
|
|||
|
|
@ -295,9 +295,7 @@ gfc_conv_elemental_dependencies (gfc_se * se, gfc_se * loopse,
|
|||
gfc_add_modify_expr (&se->pre, info->offset, offset);
|
||||
|
||||
/* Copy the result back using unpack. */
|
||||
tmp = gfc_chainon_list (NULL_TREE, parmse.expr);
|
||||
tmp = gfc_chainon_list (tmp, data);
|
||||
tmp = build_function_call_expr (gfor_fndecl_in_unpack, tmp);
|
||||
tmp = build_call_expr (gfor_fndecl_in_unpack, 2, parmse.expr, data);
|
||||
gfc_add_expr_to_block (&se->post, tmp);
|
||||
|
||||
gfc_add_block_to_block (&se->post, &parmse.post);
|
||||
|
|
@ -470,9 +468,7 @@ gfc_trans_pause (gfc_code * code)
|
|||
{
|
||||
tree gfc_int4_type_node = gfc_get_int_type (4);
|
||||
gfc_se se;
|
||||
tree args;
|
||||
tree tmp;
|
||||
tree fndecl;
|
||||
|
||||
/* Start a new block for this statement. */
|
||||
gfc_init_se (&se, NULL);
|
||||
|
|
@ -482,18 +478,15 @@ gfc_trans_pause (gfc_code * code)
|
|||
if (code->expr == NULL)
|
||||
{
|
||||
tmp = build_int_cst (gfc_int4_type_node, code->ext.stop_code);
|
||||
args = gfc_chainon_list (NULL_TREE, tmp);
|
||||
fndecl = gfor_fndecl_pause_numeric;
|
||||
tmp = build_call_expr (gfor_fndecl_pause_numeric, 1, tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
gfc_conv_expr_reference (&se, code->expr);
|
||||
args = gfc_chainon_list (NULL_TREE, se.expr);
|
||||
args = gfc_chainon_list (args, se.string_length);
|
||||
fndecl = gfor_fndecl_pause_string;
|
||||
tmp = build_call_expr (gfor_fndecl_pause_string, 2,
|
||||
se.expr, se.string_length);
|
||||
}
|
||||
|
||||
tmp = build_function_call_expr (fndecl, args);
|
||||
gfc_add_expr_to_block (&se.pre, tmp);
|
||||
|
||||
gfc_add_block_to_block (&se.pre, &se.post);
|
||||
|
|
@ -510,9 +503,7 @@ gfc_trans_stop (gfc_code * code)
|
|||
{
|
||||
tree gfc_int4_type_node = gfc_get_int_type (4);
|
||||
gfc_se se;
|
||||
tree args;
|
||||
tree tmp;
|
||||
tree fndecl;
|
||||
|
||||
/* Start a new block for this statement. */
|
||||
gfc_init_se (&se, NULL);
|
||||
|
|
@ -522,18 +513,15 @@ gfc_trans_stop (gfc_code * code)
|
|||
if (code->expr == NULL)
|
||||
{
|
||||
tmp = build_int_cst (gfc_int4_type_node, code->ext.stop_code);
|
||||
args = gfc_chainon_list (NULL_TREE, tmp);
|
||||
fndecl = gfor_fndecl_stop_numeric;
|
||||
tmp = build_call_expr (gfor_fndecl_stop_numeric, 1, tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
gfc_conv_expr_reference (&se, code->expr);
|
||||
args = gfc_chainon_list (NULL_TREE, se.expr);
|
||||
args = gfc_chainon_list (args, se.string_length);
|
||||
fndecl = gfor_fndecl_stop_string;
|
||||
tmp = build_call_expr (gfor_fndecl_stop_string, 2,
|
||||
se.expr, se.string_length);
|
||||
}
|
||||
|
||||
tmp = build_function_call_expr (fndecl, args);
|
||||
gfc_add_expr_to_block (&se.pre, tmp);
|
||||
|
||||
gfc_add_block_to_block (&se.pre, &se.post);
|
||||
|
|
@ -1308,7 +1296,7 @@ gfc_trans_logical_select (gfc_code * code)
|
|||
static tree
|
||||
gfc_trans_character_select (gfc_code *code)
|
||||
{
|
||||
tree init, node, end_label, tmp, type, args, *labels;
|
||||
tree init, node, end_label, tmp, type, *labels;
|
||||
tree case_label;
|
||||
stmtblock_t block, body;
|
||||
gfc_case *cp, *d;
|
||||
|
|
@ -1449,25 +1437,19 @@ gfc_trans_character_select (gfc_code *code)
|
|||
DECL_INITIAL (tmp) = init;
|
||||
init = tmp;
|
||||
|
||||
/* Build an argument list for the library call */
|
||||
/* Build the library call */
|
||||
init = gfc_build_addr_expr (pvoid_type_node, init);
|
||||
args = gfc_chainon_list (NULL_TREE, init);
|
||||
|
||||
tmp = build_int_cst (NULL_TREE, n);
|
||||
args = gfc_chainon_list (args, tmp);
|
||||
|
||||
tmp = gfc_build_addr_expr (pvoid_type_node, end_label);
|
||||
args = gfc_chainon_list (args, tmp);
|
||||
|
||||
gfc_init_se (&se, NULL);
|
||||
gfc_conv_expr_reference (&se, code->expr);
|
||||
|
||||
args = gfc_chainon_list (args, se.expr);
|
||||
args = gfc_chainon_list (args, se.string_length);
|
||||
|
||||
gfc_add_block_to_block (&block, &se.pre);
|
||||
|
||||
tmp = build_function_call_expr (gfor_fndecl_select_string, args);
|
||||
tmp = build_call_expr (gfor_fndecl_select_string, 5,
|
||||
init, build_int_cst (NULL_TREE, n),
|
||||
tmp, se.expr, se.string_length);
|
||||
|
||||
case_label = gfc_create_var (TREE_TYPE (tmp), "case_label");
|
||||
gfc_add_modify_expr (&block, case_label, tmp);
|
||||
|
||||
|
|
@ -1687,7 +1669,6 @@ gfc_do_allocate (tree bytesize, tree size, tree * pdata, stmtblock_t * pblock,
|
|||
tree tmpvar;
|
||||
tree type;
|
||||
tree tmp;
|
||||
tree args;
|
||||
|
||||
if (INTEGER_CST_P (size))
|
||||
{
|
||||
|
|
@ -1710,14 +1691,13 @@ gfc_do_allocate (tree bytesize, tree size, tree * pdata, stmtblock_t * pblock,
|
|||
tmpvar = gfc_create_var (build_pointer_type (type), "temp");
|
||||
*pdata = convert (pvoid_type_node, tmpvar);
|
||||
|
||||
args = gfc_chainon_list (NULL_TREE, bytesize);
|
||||
if (gfc_index_integer_kind == 4)
|
||||
tmp = gfor_fndecl_internal_malloc;
|
||||
else if (gfc_index_integer_kind == 8)
|
||||
tmp = gfor_fndecl_internal_malloc64;
|
||||
else
|
||||
gcc_unreachable ();
|
||||
tmp = build_function_call_expr (tmp, args);
|
||||
tmp = build_call_expr (tmp, 1, bytesize);
|
||||
tmp = convert (TREE_TYPE (tmpvar), tmp);
|
||||
gfc_add_modify_expr (pblock, tmpvar, tmp);
|
||||
}
|
||||
|
|
@ -2229,8 +2209,7 @@ gfc_trans_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2,
|
|||
if (ptemp1)
|
||||
{
|
||||
/* Free the temporary. */
|
||||
tmp = gfc_chainon_list (NULL_TREE, ptemp1);
|
||||
tmp = build_function_call_expr (gfor_fndecl_internal_free, tmp);
|
||||
tmp = build_call_expr (gfor_fndecl_internal_free, 1, ptemp1);
|
||||
gfc_add_expr_to_block (block, tmp);
|
||||
}
|
||||
}
|
||||
|
|
@ -2388,8 +2367,7 @@ gfc_trans_pointer_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2,
|
|||
/* Free the temporary. */
|
||||
if (ptemp1)
|
||||
{
|
||||
tmp = gfc_chainon_list (NULL_TREE, ptemp1);
|
||||
tmp = build_function_call_expr (gfor_fndecl_internal_free, tmp);
|
||||
tmp = build_call_expr (gfor_fndecl_internal_free, 1, ptemp1);
|
||||
gfc_add_expr_to_block (block, tmp);
|
||||
}
|
||||
}
|
||||
|
|
@ -2724,8 +2702,7 @@ gfc_trans_forall_1 (gfc_code * code, forall_info * nested_forall_info)
|
|||
if (pmask)
|
||||
{
|
||||
/* Free the temporary for the mask. */
|
||||
tmp = gfc_chainon_list (NULL_TREE, pmask);
|
||||
tmp = build_function_call_expr (gfor_fndecl_internal_free, tmp);
|
||||
tmp = build_call_expr (gfor_fndecl_internal_free, 1, pmask);
|
||||
gfc_add_expr_to_block (&block, tmp);
|
||||
}
|
||||
if (maskindex)
|
||||
|
|
@ -3322,16 +3299,14 @@ gfc_trans_where_2 (gfc_code * code, tree mask, bool invert,
|
|||
/* If we allocated a pending mask array, deallocate it now. */
|
||||
if (ppmask)
|
||||
{
|
||||
tree args = gfc_chainon_list (NULL_TREE, ppmask);
|
||||
tmp = build_function_call_expr (gfor_fndecl_internal_free, args);
|
||||
tmp = build_call_expr (gfor_fndecl_internal_free, 1, ppmask);
|
||||
gfc_add_expr_to_block (block, tmp);
|
||||
}
|
||||
|
||||
/* If we allocated a current mask array, deallocate it now. */
|
||||
if (pcmask)
|
||||
{
|
||||
tree args = gfc_chainon_list (NULL_TREE, pcmask);
|
||||
tmp = build_function_call_expr (gfor_fndecl_internal_free, args);
|
||||
tmp = build_call_expr (gfor_fndecl_internal_free, 1, pcmask);
|
||||
gfc_add_expr_to_block (block, tmp);
|
||||
}
|
||||
}
|
||||
|
|
@ -3617,9 +3592,7 @@ gfc_trans_allocate (gfc_code * code)
|
|||
if (expr->ts.type == BT_CHARACTER && tmp == NULL_TREE)
|
||||
tmp = se.string_length;
|
||||
|
||||
parm = gfc_chainon_list (NULL_TREE, tmp);
|
||||
parm = gfc_chainon_list (parm, pstat);
|
||||
tmp = build_function_call_expr (gfor_fndecl_allocate, parm);
|
||||
tmp = build_call_expr (gfor_fndecl_allocate, 2, tmp, pstat);
|
||||
tmp = build2 (MODIFY_EXPR, void_type_node, se.expr, tmp);
|
||||
gfc_add_expr_to_block (&se.pre, tmp);
|
||||
|
||||
|
|
@ -3685,7 +3658,7 @@ gfc_trans_deallocate (gfc_code * code)
|
|||
gfc_se se;
|
||||
gfc_alloc *al;
|
||||
gfc_expr *expr;
|
||||
tree apstat, astat, parm, pstat, stat, tmp;
|
||||
tree apstat, astat, pstat, stat, tmp;
|
||||
stmtblock_t block;
|
||||
|
||||
gfc_start_block (&block);
|
||||
|
|
@ -3748,9 +3721,7 @@ gfc_trans_deallocate (gfc_code * code)
|
|||
tmp = gfc_array_deallocate (se.expr, pstat);
|
||||
else
|
||||
{
|
||||
parm = gfc_chainon_list (NULL_TREE, se.expr);
|
||||
parm = gfc_chainon_list (parm, pstat);
|
||||
tmp = build_function_call_expr (gfor_fndecl_deallocate, parm);
|
||||
tmp = build_call_expr (gfor_fndecl_deallocate, 2, se.expr, pstat);
|
||||
gfc_add_expr_to_block (&se.pre, tmp);
|
||||
|
||||
tmp = build2 (MODIFY_EXPR, void_type_node,
|
||||
|
|
|
|||
|
|
@ -318,7 +318,7 @@ gfc_trans_runtime_check (tree cond, const char * msgid, stmtblock_t * pblock,
|
|||
stmtblock_t block;
|
||||
tree body;
|
||||
tree tmp;
|
||||
tree args;
|
||||
tree arg;
|
||||
char * message;
|
||||
int line;
|
||||
|
||||
|
|
@ -342,11 +342,10 @@ gfc_trans_runtime_check (tree cond, const char * msgid, stmtblock_t * pblock,
|
|||
asprintf (&message, "%s (in file '%s', around line %d)", _(msgid),
|
||||
gfc_source_file, input_line + 1);
|
||||
|
||||
tmp = gfc_build_addr_expr (pchar_type_node, gfc_build_cstring_const(message));
|
||||
arg = gfc_build_addr_expr (pchar_type_node, gfc_build_cstring_const(message));
|
||||
gfc_free(message);
|
||||
args = gfc_chainon_list (NULL_TREE, tmp);
|
||||
|
||||
tmp = build_function_call_expr (gfor_fndecl_runtime_error, args);
|
||||
tmp = build_call_expr (gfor_fndecl_runtime_error, 1, arg);
|
||||
gfc_add_expr_to_block (&block, tmp);
|
||||
|
||||
body = gfc_finish_block (&block);
|
||||
|
|
@ -359,9 +358,8 @@ gfc_trans_runtime_check (tree cond, const char * msgid, stmtblock_t * pblock,
|
|||
{
|
||||
/* Tell the compiler that this isn't likely. */
|
||||
cond = fold_convert (long_integer_type_node, cond);
|
||||
tmp = gfc_chainon_list (NULL_TREE, cond);
|
||||
tmp = gfc_chainon_list (tmp, build_int_cst (long_integer_type_node, 0));
|
||||
cond = build_function_call_expr (built_in_decls[BUILT_IN_EXPECT], tmp);
|
||||
tmp = build_int_cst (long_integer_type_node, 0);
|
||||
cond = build_call_expr (built_in_decls[BUILT_IN_EXPECT], 2, cond, tmp);
|
||||
cond = fold_convert (boolean_type_node, cond);
|
||||
|
||||
tmp = build3_v (COND_EXPR, cond, body, build_empty_stmt ());
|
||||
|
|
|
|||
|
|
@ -3203,16 +3203,15 @@ gimplify_parameters (void)
|
|||
}
|
||||
else
|
||||
{
|
||||
tree ptr_type, addr, args;
|
||||
tree ptr_type, addr;
|
||||
|
||||
ptr_type = build_pointer_type (type);
|
||||
addr = create_tmp_var (ptr_type, get_name (parm));
|
||||
DECL_IGNORED_P (addr) = 0;
|
||||
local = build_fold_indirect_ref (addr);
|
||||
|
||||
args = tree_cons (NULL, DECL_SIZE_UNIT (parm), NULL);
|
||||
t = built_in_decls[BUILT_IN_ALLOCA];
|
||||
t = build_function_call_expr (t, args);
|
||||
t = build_call_expr (t, 1, DECL_SIZE_UNIT (parm));
|
||||
t = fold_convert (ptr_type, t);
|
||||
t = build2 (GIMPLE_MODIFY_STMT, void_type_node, addr, t);
|
||||
gimplify_and_add (t, &stmts);
|
||||
|
|
|
|||
|
|
@ -719,7 +719,7 @@ adjust_field_tree_exp (type_p t, options_p opt ATTRIBUTE_UNUSED)
|
|||
|
||||
flds = create_field (NULL, t, "");
|
||||
flds->opt = create_option (nodot, "length",
|
||||
"TREE_CODE_LENGTH (TREE_CODE ((tree) &%0))");
|
||||
"TREE_OPERAND_LENGTH ((tree) &%0)");
|
||||
flds->opt = create_option (flds->opt, "default", "");
|
||||
|
||||
return new_structure ("tree_exp_subunion", 1, &lexer_line, flds, nodot);
|
||||
|
|
@ -1746,16 +1746,27 @@ walk_type (type_p t, struct walk_type_data *d)
|
|||
if (t->u.a.p->kind == TYPE_SCALAR)
|
||||
break;
|
||||
|
||||
/* When walking an array, compute the length and store it in a
|
||||
local variable before walking the array elements, instead of
|
||||
recomputing the length expression each time through the loop.
|
||||
This is necessary to handle tcc_vl_exp objects like CALL_EXPR,
|
||||
where the length is stored in the first array element,
|
||||
because otherwise that operand can get overwritten on the
|
||||
first iteration. */
|
||||
oprintf (d->of, "%*s{\n", d->indent, "");
|
||||
d->indent += 2;
|
||||
oprintf (d->of, "%*ssize_t i%d;\n", d->indent, "", loopcounter);
|
||||
oprintf (d->of, "%*sfor (i%d = 0; i%d != (size_t)(", d->indent, "",
|
||||
loopcounter, loopcounter);
|
||||
oprintf (d->of, "%*ssize_t l%d = (size_t)(",
|
||||
d->indent, "", loopcounter);
|
||||
if (length)
|
||||
output_escaped_param (d, length, "length");
|
||||
else
|
||||
oprintf (d->of, "%s", t->u.a.len);
|
||||
oprintf (d->of, "); i%d++) {\n", loopcounter);
|
||||
oprintf (d->of, ");\n");
|
||||
|
||||
oprintf (d->of, "%*sfor (i%d = 0; i%d != l%d; i%d++) {\n",
|
||||
d->indent, "",
|
||||
loopcounter, loopcounter, loopcounter, loopcounter);
|
||||
d->indent += 2;
|
||||
d->val = newval = xasprintf ("%s[i%d]", oldval, loopcounter);
|
||||
d->used_length = 1;
|
||||
|
|
|
|||
|
|
@ -134,10 +134,9 @@ lower_function_body (void)
|
|||
/* Build 'DISP_VAR = __builtin_setjmp_dispatcher (DISP_LABEL);'
|
||||
and insert. */
|
||||
disp_var = create_tmp_var (ptr_type_node, "setjmpvar");
|
||||
t = build_addr (disp_label, current_function_decl);
|
||||
arg = tree_cons (NULL, t, NULL);
|
||||
arg = build_addr (disp_label, current_function_decl);
|
||||
t = implicit_built_in_decls[BUILT_IN_SETJMP_DISPATCHER];
|
||||
t = build_function_call_expr (t,arg);
|
||||
t = build_call_expr (t, 1, arg);
|
||||
x = build2 (GIMPLE_MODIFY_STMT, void_type_node, disp_var, t);
|
||||
|
||||
/* Build 'goto DISP_VAR;' and insert. */
|
||||
|
|
@ -663,12 +662,9 @@ lower_builtin_setjmp (tree_stmt_iterator *tsi)
|
|||
dest = NULL_TREE;
|
||||
|
||||
/* Build '__builtin_setjmp_setup (BUF, NEXT_LABEL)' and insert. */
|
||||
t = build_addr (next_label, current_function_decl);
|
||||
arg = tree_cons (NULL, t, NULL);
|
||||
t = TREE_VALUE (GENERIC_TREE_OPERAND (stmt, 1));
|
||||
arg = tree_cons (NULL, t, arg);
|
||||
arg = build_addr (next_label, current_function_decl);
|
||||
t = implicit_built_in_decls[BUILT_IN_SETJMP_SETUP];
|
||||
t = build_function_call_expr (t, arg);
|
||||
t = build_call_expr (t, 2, CALL_EXPR_ARG (stmt, 0), arg);
|
||||
SET_EXPR_LOCUS (t, EXPR_LOCUS (stmt));
|
||||
tsi_link_before (tsi, t, TSI_SAME_STMT);
|
||||
|
||||
|
|
@ -689,10 +685,9 @@ lower_builtin_setjmp (tree_stmt_iterator *tsi)
|
|||
tsi_link_before (tsi, t, TSI_SAME_STMT);
|
||||
|
||||
/* Build '__builtin_setjmp_receiver (NEXT_LABEL)' and insert. */
|
||||
t = build_addr (next_label, current_function_decl);
|
||||
arg = tree_cons (NULL, t, NULL);
|
||||
arg = build_addr (next_label, current_function_decl);
|
||||
t = implicit_built_in_decls[BUILT_IN_SETJMP_RECEIVER];
|
||||
t = build_function_call_expr (t, arg);
|
||||
t = build_call_expr (t, 1, arg);
|
||||
SET_EXPR_LOCUS (t, EXPR_LOCUS (stmt));
|
||||
tsi_link_before (tsi, t, TSI_SAME_STMT);
|
||||
|
||||
|
|
|
|||
115
gcc/gimplify.c
115
gcc/gimplify.c
|
|
@ -1040,14 +1040,13 @@ build_stack_save_restore (tree *save, tree *restore)
|
|||
tree save_call, tmp_var;
|
||||
|
||||
save_call =
|
||||
build_function_call_expr (implicit_built_in_decls[BUILT_IN_STACK_SAVE],
|
||||
NULL_TREE);
|
||||
build_call_expr (implicit_built_in_decls[BUILT_IN_STACK_SAVE], 0);
|
||||
tmp_var = create_tmp_var (ptr_type_node, "saved_stack");
|
||||
|
||||
*save = build2 (GIMPLE_MODIFY_STMT, ptr_type_node, tmp_var, save_call);
|
||||
*restore =
|
||||
build_function_call_expr (implicit_built_in_decls[BUILT_IN_STACK_RESTORE],
|
||||
tree_cons (NULL_TREE, tmp_var, NULL_TREE));
|
||||
build_call_expr (implicit_built_in_decls[BUILT_IN_STACK_RESTORE],
|
||||
1, tmp_var);
|
||||
}
|
||||
|
||||
/* Gimplify a BIND_EXPR. Just voidify and recurse. */
|
||||
|
|
@ -1233,7 +1232,7 @@ gimplify_decl_expr (tree *stmt_p)
|
|||
/* This is a variable-sized decl. Simplify its size and mark it
|
||||
for deferred expansion. Note that mudflap depends on the format
|
||||
of the emitted code: see mx_register_decls(). */
|
||||
tree t, args, addr, ptr_type;
|
||||
tree t, addr, ptr_type;
|
||||
|
||||
gimplify_one_sizepos (&DECL_SIZE (decl), stmt_p);
|
||||
gimplify_one_sizepos (&DECL_SIZE_UNIT (decl), stmt_p);
|
||||
|
|
@ -1250,9 +1249,8 @@ gimplify_decl_expr (tree *stmt_p)
|
|||
SET_DECL_VALUE_EXPR (decl, t);
|
||||
DECL_HAS_VALUE_EXPR_P (decl) = 1;
|
||||
|
||||
args = tree_cons (NULL, DECL_SIZE_UNIT (decl), NULL);
|
||||
t = built_in_decls[BUILT_IN_ALLOCA];
|
||||
t = build_function_call_expr (t, args);
|
||||
t = build_call_expr (t, 1, DECL_SIZE_UNIT (decl));
|
||||
t = fold_convert (ptr_type, t);
|
||||
t = build2 (GIMPLE_MODIFY_STMT, void_type_node, addr, t);
|
||||
|
||||
|
|
@ -2031,8 +2029,8 @@ static enum gimplify_status
|
|||
gimplify_call_expr (tree *expr_p, tree *pre_p, bool want_value)
|
||||
{
|
||||
tree decl;
|
||||
tree arglist;
|
||||
enum gimplify_status ret;
|
||||
int i, nargs;
|
||||
|
||||
gcc_assert (TREE_CODE (*expr_p) == CALL_EXPR);
|
||||
|
||||
|
|
@ -2056,8 +2054,7 @@ gimplify_call_expr (tree *expr_p, tree *pre_p, bool want_value)
|
|||
decl = get_callee_fndecl (*expr_p);
|
||||
if (decl && DECL_BUILT_IN (decl))
|
||||
{
|
||||
tree arglist = TREE_OPERAND (*expr_p, 1);
|
||||
tree new = fold_builtin (decl, arglist, !want_value);
|
||||
tree new = fold_call_expr (*expr_p, !want_value);
|
||||
|
||||
if (new && new != *expr_p)
|
||||
{
|
||||
|
|
@ -2071,62 +2068,56 @@ gimplify_call_expr (tree *expr_p, tree *pre_p, bool want_value)
|
|||
if (DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL
|
||||
&& DECL_FUNCTION_CODE (decl) == BUILT_IN_VA_START)
|
||||
{
|
||||
if (!arglist || !TREE_CHAIN (arglist))
|
||||
if (call_expr_nargs (*expr_p) < 2)
|
||||
{
|
||||
error ("too few arguments to function %<va_start%>");
|
||||
*expr_p = build_empty_stmt ();
|
||||
return GS_OK;
|
||||
}
|
||||
|
||||
if (fold_builtin_next_arg (TREE_CHAIN (arglist)))
|
||||
if (fold_builtin_next_arg (*expr_p, true))
|
||||
{
|
||||
*expr_p = build_empty_stmt ();
|
||||
return GS_OK;
|
||||
}
|
||||
/* Avoid gimplifying the second argument to va_start, which needs
|
||||
to be the plain PARM_DECL. */
|
||||
return gimplify_arg (&TREE_VALUE (TREE_OPERAND (*expr_p, 1)), pre_p);
|
||||
return gimplify_arg (&CALL_EXPR_ARG (*expr_p, 0), pre_p);
|
||||
}
|
||||
}
|
||||
|
||||
/* There is a sequence point before the call, so any side effects in
|
||||
the calling expression must occur before the actual call. Force
|
||||
gimplify_expr to use an internal post queue. */
|
||||
ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, NULL,
|
||||
ret = gimplify_expr (&CALL_EXPR_FN (*expr_p), pre_p, NULL,
|
||||
is_gimple_call_addr, fb_rvalue);
|
||||
|
||||
if (PUSH_ARGS_REVERSED)
|
||||
TREE_OPERAND (*expr_p, 1) = nreverse (TREE_OPERAND (*expr_p, 1));
|
||||
for (arglist = TREE_OPERAND (*expr_p, 1); arglist;
|
||||
arglist = TREE_CHAIN (arglist))
|
||||
nargs = call_expr_nargs (*expr_p);
|
||||
|
||||
for (i = (PUSH_ARGS_REVERSED ? nargs - 1 : 0);
|
||||
PUSH_ARGS_REVERSED ? i >= 0 : i < nargs;
|
||||
PUSH_ARGS_REVERSED ? i-- : i++)
|
||||
{
|
||||
enum gimplify_status t;
|
||||
|
||||
t = gimplify_arg (&TREE_VALUE (arglist), pre_p);
|
||||
t = gimplify_arg (&CALL_EXPR_ARG (*expr_p, i), pre_p);
|
||||
|
||||
if (t == GS_ERROR)
|
||||
ret = GS_ERROR;
|
||||
}
|
||||
if (PUSH_ARGS_REVERSED)
|
||||
TREE_OPERAND (*expr_p, 1) = nreverse (TREE_OPERAND (*expr_p, 1));
|
||||
|
||||
/* Try this again in case gimplification exposed something. */
|
||||
if (ret != GS_ERROR)
|
||||
{
|
||||
decl = get_callee_fndecl (*expr_p);
|
||||
if (decl && DECL_BUILT_IN (decl))
|
||||
{
|
||||
tree arglist = TREE_OPERAND (*expr_p, 1);
|
||||
tree new = fold_builtin (decl, arglist, !want_value);
|
||||
tree new = fold_call_expr (*expr_p, !want_value);
|
||||
|
||||
if (new && new != *expr_p)
|
||||
{
|
||||
/* There was a transformation of this call which computes the
|
||||
same value, but in a more efficient way. Return and try
|
||||
again. */
|
||||
*expr_p = new;
|
||||
return GS_OK;
|
||||
}
|
||||
if (new && new != *expr_p)
|
||||
{
|
||||
/* There was a transformation of this call which computes the
|
||||
same value, but in a more efficient way. Return and try
|
||||
again. */
|
||||
*expr_p = new;
|
||||
return GS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2561,20 +2552,16 @@ gimplify_cond_expr (tree *expr_p, tree *pre_p, fallback_t fallback)
|
|||
static enum gimplify_status
|
||||
gimplify_modify_expr_to_memcpy (tree *expr_p, tree size, bool want_value)
|
||||
{
|
||||
tree args, t, to, to_ptr, from;
|
||||
tree t, to, to_ptr, from, from_ptr;
|
||||
|
||||
to = GENERIC_TREE_OPERAND (*expr_p, 0);
|
||||
from = GENERIC_TREE_OPERAND (*expr_p, 1);
|
||||
|
||||
args = tree_cons (NULL, size, NULL);
|
||||
|
||||
t = build_fold_addr_expr (from);
|
||||
args = tree_cons (NULL, t, args);
|
||||
from_ptr = build_fold_addr_expr (from);
|
||||
|
||||
to_ptr = build_fold_addr_expr (to);
|
||||
args = tree_cons (NULL, to_ptr, args);
|
||||
t = implicit_built_in_decls[BUILT_IN_MEMCPY];
|
||||
t = build_function_call_expr (t, args);
|
||||
t = build_call_expr (t, 3, to_ptr, from_ptr, size);
|
||||
|
||||
if (want_value)
|
||||
{
|
||||
|
|
@ -2593,18 +2580,13 @@ gimplify_modify_expr_to_memcpy (tree *expr_p, tree size, bool want_value)
|
|||
static enum gimplify_status
|
||||
gimplify_modify_expr_to_memset (tree *expr_p, tree size, bool want_value)
|
||||
{
|
||||
tree args, t, to, to_ptr;
|
||||
tree t, to, to_ptr;
|
||||
|
||||
to = GENERIC_TREE_OPERAND (*expr_p, 0);
|
||||
|
||||
args = tree_cons (NULL, size, NULL);
|
||||
|
||||
args = tree_cons (NULL, integer_zero_node, args);
|
||||
|
||||
to_ptr = build_fold_addr_expr (to);
|
||||
args = tree_cons (NULL, to_ptr, args);
|
||||
t = implicit_built_in_decls[BUILT_IN_MEMSET];
|
||||
t = build_function_call_expr (t, args);
|
||||
t = build_call_expr (t, 3, to_ptr, integer_zero_node, size);
|
||||
|
||||
if (want_value)
|
||||
{
|
||||
|
|
@ -3687,18 +3669,15 @@ gimplify_variable_sized_compare (tree *expr_p)
|
|||
{
|
||||
tree op0 = TREE_OPERAND (*expr_p, 0);
|
||||
tree op1 = TREE_OPERAND (*expr_p, 1);
|
||||
tree args, t, dest;
|
||||
tree t, arg, dest, src;
|
||||
|
||||
t = TYPE_SIZE_UNIT (TREE_TYPE (op0));
|
||||
t = unshare_expr (t);
|
||||
t = SUBSTITUTE_PLACEHOLDER_IN_EXPR (t, op0);
|
||||
args = tree_cons (NULL, t, NULL);
|
||||
t = build_fold_addr_expr (op1);
|
||||
args = tree_cons (NULL, t, args);
|
||||
arg = TYPE_SIZE_UNIT (TREE_TYPE (op0));
|
||||
arg = unshare_expr (arg);
|
||||
arg = SUBSTITUTE_PLACEHOLDER_IN_EXPR (arg, op0);
|
||||
src = build_fold_addr_expr (op1);
|
||||
dest = build_fold_addr_expr (op0);
|
||||
args = tree_cons (NULL, dest, args);
|
||||
t = implicit_built_in_decls[BUILT_IN_MEMCMP];
|
||||
t = build_function_call_expr (t, args);
|
||||
t = build_call_expr (t, 3, dest, src, arg);
|
||||
*expr_p
|
||||
= build2 (TREE_CODE (*expr_p), TREE_TYPE (*expr_p), t, integer_zero_node);
|
||||
|
||||
|
|
@ -5122,7 +5101,7 @@ static enum gimplify_status
|
|||
gimplify_omp_atomic_fetch_op (tree *expr_p, tree addr, tree rhs, int index)
|
||||
{
|
||||
enum built_in_function base;
|
||||
tree decl, args, itype;
|
||||
tree decl, itype;
|
||||
enum insn_code *optab;
|
||||
|
||||
/* Check for one of the supported fetch-op operations. */
|
||||
|
|
@ -5167,9 +5146,7 @@ gimplify_omp_atomic_fetch_op (tree *expr_p, tree addr, tree rhs, int index)
|
|||
if (optab[TYPE_MODE (itype)] == CODE_FOR_nothing)
|
||||
return GS_UNHANDLED;
|
||||
|
||||
args = tree_cons (NULL, fold_convert (itype, rhs), NULL);
|
||||
args = tree_cons (NULL, addr, args);
|
||||
*expr_p = build_function_call_expr (decl, args);
|
||||
*expr_p = build_call_expr (decl, 2, addr, fold_convert (itype, rhs));
|
||||
return GS_OK;
|
||||
}
|
||||
|
||||
|
|
@ -5234,7 +5211,7 @@ gimplify_omp_atomic_pipeline (tree *expr_p, tree *pre_p, tree addr,
|
|||
tree rhs, int index)
|
||||
{
|
||||
tree oldval, oldival, oldival2, newval, newival, label;
|
||||
tree type, itype, cmpxchg, args, x, iaddr;
|
||||
tree type, itype, cmpxchg, x, iaddr;
|
||||
|
||||
cmpxchg = built_in_decls[BUILT_IN_VAL_COMPARE_AND_SWAP_N + index + 1];
|
||||
type = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (addr)));
|
||||
|
|
@ -5295,10 +5272,8 @@ gimplify_omp_atomic_pipeline (tree *expr_p, tree *pre_p, tree addr,
|
|||
fold_convert (itype, oldival));
|
||||
gimplify_and_add (x, pre_p);
|
||||
|
||||
args = tree_cons (NULL, fold_convert (itype, newival), NULL);
|
||||
args = tree_cons (NULL, fold_convert (itype, oldival), args);
|
||||
args = tree_cons (NULL, iaddr, args);
|
||||
x = build_function_call_expr (cmpxchg, args);
|
||||
x = build_call_expr (cmpxchg, 3, iaddr, fold_convert (itype, oldival),
|
||||
fold_convert (itype, newival));
|
||||
if (oldval == oldival)
|
||||
x = fold_convert (type, x);
|
||||
x = build2 (GIMPLE_MODIFY_STMT, void_type_node, oldival, x);
|
||||
|
|
@ -5342,7 +5317,7 @@ gimplify_omp_atomic_mutex (tree *expr_p, tree *pre_p, tree addr, tree rhs)
|
|||
tree t;
|
||||
|
||||
t = built_in_decls[BUILT_IN_GOMP_ATOMIC_START];
|
||||
t = build_function_call_expr (t, NULL);
|
||||
t = build_call_expr (t, 0);
|
||||
gimplify_and_add (t, pre_p);
|
||||
|
||||
t = build_fold_indirect_ref (addr);
|
||||
|
|
@ -5350,7 +5325,7 @@ gimplify_omp_atomic_mutex (tree *expr_p, tree *pre_p, tree addr, tree rhs)
|
|||
gimplify_and_add (t, pre_p);
|
||||
|
||||
t = built_in_decls[BUILT_IN_GOMP_ATOMIC_END];
|
||||
t = build_function_call_expr (t, NULL);
|
||||
t = build_call_expr (t, 0);
|
||||
gimplify_and_add (t, pre_p);
|
||||
|
||||
*expr_p = NULL;
|
||||
|
|
@ -6458,13 +6433,13 @@ gimplify_function_tree (tree fndecl)
|
|||
x = DECL_SAVED_TREE (fndecl);
|
||||
append_to_statement_list (x, &TREE_OPERAND (tf, 0));
|
||||
x = implicit_built_in_decls[BUILT_IN_PROFILE_FUNC_EXIT];
|
||||
x = build_function_call_expr (x, NULL);
|
||||
x = build_call_expr (x, 0);
|
||||
append_to_statement_list (x, &TREE_OPERAND (tf, 1));
|
||||
|
||||
bind = build3 (BIND_EXPR, void_type_node, NULL, NULL, NULL);
|
||||
TREE_SIDE_EFFECTS (bind) = 1;
|
||||
x = implicit_built_in_decls[BUILT_IN_PROFILE_FUNC_ENTER];
|
||||
x = build_function_call_expr (x, NULL);
|
||||
x = build_call_expr (x, 0);
|
||||
append_to_statement_list (x, &BIND_EXPR_BODY (bind));
|
||||
append_to_statement_list (tf, &BIND_EXPR_BODY (bind));
|
||||
|
||||
|
|
|
|||
|
|
@ -925,8 +925,8 @@ ipcp_update_callgraph (void)
|
|||
if (ipcp_redirect (cs))
|
||||
{
|
||||
cgraph_redirect_edge_callee (cs, orig_callee);
|
||||
TREE_OPERAND (TREE_OPERAND
|
||||
(get_call_expr_in (cs->call_stmt), 0), 0) =
|
||||
TREE_OPERAND (CALL_EXPR_FN (get_call_expr_in (cs->call_stmt)),
|
||||
0) =
|
||||
orig_callee->decl;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -419,15 +419,11 @@ void
|
|||
ipa_callsite_compute_count (struct cgraph_edge *cs)
|
||||
{
|
||||
tree call_tree;
|
||||
tree arg;
|
||||
int arg_num;
|
||||
|
||||
call_tree = get_call_expr_in (ipa_callsite_tree (cs));
|
||||
gcc_assert (TREE_CODE (call_tree) == CALL_EXPR);
|
||||
arg = TREE_OPERAND (call_tree, 1);
|
||||
arg_num = 0;
|
||||
for (; arg != NULL_TREE; arg = TREE_CHAIN (arg))
|
||||
arg_num++;
|
||||
arg_num = call_expr_nargs (call_tree);
|
||||
ipa_callsite_param_count_set (cs, arg_num);
|
||||
}
|
||||
|
||||
|
|
@ -445,38 +441,35 @@ ipa_callsite_compute_param (struct cgraph_edge *cs)
|
|||
struct cgraph_node *mt;
|
||||
tree parm_decl;
|
||||
struct function *curr_cfun;
|
||||
call_expr_arg_iterator iter;
|
||||
|
||||
if (ipa_callsite_param_count (cs) == 0)
|
||||
return;
|
||||
ipa_callsite_param_map_create (cs);
|
||||
call_tree = get_call_expr_in (ipa_callsite_tree (cs));
|
||||
gcc_assert (TREE_CODE (call_tree) == CALL_EXPR);
|
||||
arg = TREE_OPERAND (call_tree, 1);
|
||||
arg_num = 0;
|
||||
|
||||
for (; arg != NULL_TREE; arg = TREE_CHAIN (arg))
|
||||
FOR_EACH_CALL_EXPR_ARG (arg, iter, call_tree)
|
||||
{
|
||||
/* If the formal parameter was passed as argument, we store
|
||||
FORMAL_IPATYPE and its index in the caller as the jump function
|
||||
of this argument. */
|
||||
if ((TREE_CODE (TREE_VALUE (arg)) == SSA_NAME
|
||||
&& TREE_CODE (SSA_NAME_VAR (TREE_VALUE (arg))) == PARM_DECL)
|
||||
|| TREE_CODE (TREE_VALUE (arg)) == PARM_DECL)
|
||||
if ((TREE_CODE (arg) == SSA_NAME
|
||||
&& TREE_CODE (SSA_NAME_VAR (arg)) == PARM_DECL)
|
||||
|| TREE_CODE (arg) == PARM_DECL)
|
||||
{
|
||||
mt = ipa_callsite_caller (cs);
|
||||
parm_decl =
|
||||
TREE_CODE (TREE_VALUE (arg)) ==
|
||||
PARM_DECL ? TREE_VALUE (arg) : SSA_NAME_VAR (TREE_VALUE (arg));
|
||||
parm_decl = TREE_CODE (arg) == PARM_DECL ? arg : SSA_NAME_VAR (arg);
|
||||
|
||||
i = ipa_method_tree_map (mt, parm_decl);
|
||||
if (TREE_CODE (TREE_VALUE (arg)) == SSA_NAME
|
||||
&& IS_VALID_TREE_MAP_INDEX (i))
|
||||
if (TREE_CODE (arg) == SSA_NAME && IS_VALID_TREE_MAP_INDEX (i))
|
||||
{
|
||||
curr_cfun = DECL_STRUCT_FUNCTION (mt->decl);
|
||||
curr_cfun = DECL_STRUCT_FUNCTION (mt->decl);
|
||||
if (!gimple_default_def (curr_cfun, parm_decl)
|
||||
|| gimple_default_def (curr_cfun, parm_decl) != TREE_VALUE (arg))
|
||||
|| gimple_default_def (curr_cfun, parm_decl) != arg)
|
||||
ipa_method_modify_set (mt, i, true);
|
||||
}
|
||||
}
|
||||
if (!IS_VALID_TREE_MAP_INDEX (i) || ipa_method_is_modified (mt, i))
|
||||
ipa_callsite_param_set_type (cs, arg_num, UNKNOWN_IPATYPE);
|
||||
else
|
||||
|
|
@ -488,22 +481,20 @@ ipa_callsite_compute_param (struct cgraph_edge *cs)
|
|||
/* If a constant value was passed as argument,
|
||||
we store CONST_IPATYPE and its value as the jump function
|
||||
of this argument. */
|
||||
else if (TREE_CODE (TREE_VALUE (arg)) == INTEGER_CST
|
||||
|| TREE_CODE (TREE_VALUE (arg)) == REAL_CST)
|
||||
else if (TREE_CODE (arg) == INTEGER_CST
|
||||
|| TREE_CODE (arg) == REAL_CST)
|
||||
{
|
||||
ipa_callsite_param_set_type (cs, arg_num, CONST_IPATYPE);
|
||||
ipa_callsite_param_set_info_type (cs, arg_num,
|
||||
TREE_VALUE (arg));
|
||||
ipa_callsite_param_set_info_type (cs, arg_num, arg);
|
||||
}
|
||||
/* This is for the case of Fortran. If the address of a const_decl
|
||||
was passed as argument then we store
|
||||
CONST_IPATYPE_REF/CONST_IPATYPE_REF and the constant
|
||||
value as the jump function corresponding to this argument. */
|
||||
else if (TREE_CODE (TREE_VALUE (arg)) == ADDR_EXPR
|
||||
&& TREE_CODE (TREE_OPERAND (TREE_VALUE (arg), 0)) ==
|
||||
CONST_DECL)
|
||||
else if (TREE_CODE (arg) == ADDR_EXPR
|
||||
&& TREE_CODE (TREE_OPERAND (arg, 0)) == CONST_DECL)
|
||||
{
|
||||
cst_decl = TREE_OPERAND (TREE_VALUE (arg), 0);
|
||||
cst_decl = TREE_OPERAND (arg, 0);
|
||||
if (TREE_CODE (DECL_INITIAL (cst_decl)) == INTEGER_CST
|
||||
|| TREE_CODE (DECL_INITIAL (cst_decl)) == REAL_CST)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -316,20 +316,15 @@ get_asm_expr_operands (funct_state local, tree stmt)
|
|||
static void
|
||||
check_call (funct_state local, tree call_expr)
|
||||
{
|
||||
int flags = call_expr_flags(call_expr);
|
||||
tree operand_list = TREE_OPERAND (call_expr, 1);
|
||||
int flags = call_expr_flags (call_expr);
|
||||
tree operand;
|
||||
call_expr_arg_iterator iter;
|
||||
tree callee_t = get_callee_fndecl (call_expr);
|
||||
struct cgraph_node* callee;
|
||||
enum availability avail = AVAIL_NOT_AVAILABLE;
|
||||
|
||||
for (operand = operand_list;
|
||||
operand != NULL_TREE;
|
||||
operand = TREE_CHAIN (operand))
|
||||
{
|
||||
tree argument = TREE_VALUE (operand);
|
||||
check_rhs_var (local, argument);
|
||||
}
|
||||
FOR_EACH_CALL_EXPR_ARG (operand, iter, call_expr)
|
||||
check_rhs_var (local, operand);
|
||||
|
||||
/* The const and pure flags are set by a variety of places in the
|
||||
compiler (including here). If someone has already set the flags
|
||||
|
|
@ -452,7 +447,14 @@ scan_function (tree *tp,
|
|||
case ADDR_EXPR:
|
||||
check_rhs_var (local, rhs);
|
||||
break;
|
||||
case CALL_EXPR:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case tcc_vl_exp:
|
||||
switch (TREE_CODE (rhs))
|
||||
{
|
||||
case CALL_EXPR:
|
||||
check_call (local, rhs);
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -436,18 +436,13 @@ static void
|
|||
check_call (ipa_reference_local_vars_info_t local, tree call_expr)
|
||||
{
|
||||
int flags = call_expr_flags (call_expr);
|
||||
tree operand_list = TREE_OPERAND (call_expr, 1);
|
||||
tree operand;
|
||||
tree callee_t = get_callee_fndecl (call_expr);
|
||||
enum availability avail = AVAIL_NOT_AVAILABLE;
|
||||
call_expr_arg_iterator iter;
|
||||
|
||||
for (operand = operand_list;
|
||||
operand != NULL_TREE;
|
||||
operand = TREE_CHAIN (operand))
|
||||
{
|
||||
tree argument = TREE_VALUE (operand);
|
||||
check_rhs_var (local, argument);
|
||||
}
|
||||
FOR_EACH_CALL_EXPR_ARG (operand, iter, call_expr)
|
||||
check_rhs_var (local, operand);
|
||||
|
||||
if (callee_t)
|
||||
{
|
||||
|
|
@ -534,7 +529,14 @@ scan_for_static_refs (tree *tp,
|
|||
case ADDR_EXPR:
|
||||
check_rhs_var (local, rhs);
|
||||
break;
|
||||
case CALL_EXPR:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case tcc_vl_exp:
|
||||
switch (TREE_CODE (rhs))
|
||||
{
|
||||
case CALL_EXPR:
|
||||
check_call (local, rhs);
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -1011,20 +1011,14 @@ static bool
|
|||
check_call (tree call_expr)
|
||||
{
|
||||
int flags = call_expr_flags(call_expr);
|
||||
tree operand_list = TREE_OPERAND (call_expr, 1);
|
||||
tree operand;
|
||||
tree callee_t = get_callee_fndecl (call_expr);
|
||||
tree argument;
|
||||
struct cgraph_node* callee;
|
||||
enum availability avail = AVAIL_NOT_AVAILABLE;
|
||||
call_expr_arg_iterator iter;
|
||||
|
||||
for (operand = operand_list;
|
||||
operand != NULL_TREE;
|
||||
operand = TREE_CHAIN (operand))
|
||||
{
|
||||
tree argument = TREE_VALUE (operand);
|
||||
check_rhs_var (argument);
|
||||
}
|
||||
FOR_EACH_CALL_EXPR_ARG (operand, iter, call_expr)
|
||||
check_rhs_var (operand);
|
||||
|
||||
if (callee_t)
|
||||
{
|
||||
|
|
@ -1037,17 +1031,16 @@ check_call (tree call_expr)
|
|||
parameters. */
|
||||
if (TYPE_ARG_TYPES (TREE_TYPE (callee_t)))
|
||||
{
|
||||
operand = operand_list;
|
||||
for (arg_type = TYPE_ARG_TYPES (TREE_TYPE (callee_t));
|
||||
for (arg_type = TYPE_ARG_TYPES (TREE_TYPE (callee_t)),
|
||||
operand = first_call_expr_arg (call_expr, &iter);
|
||||
arg_type && TREE_VALUE (arg_type) != void_type_node;
|
||||
arg_type = TREE_CHAIN (arg_type))
|
||||
arg_type = TREE_CHAIN (arg_type),
|
||||
operand = next_call_expr_arg (&iter))
|
||||
{
|
||||
if (operand)
|
||||
{
|
||||
argument = TREE_VALUE (operand);
|
||||
last_arg_type = TREE_VALUE(arg_type);
|
||||
check_cast (last_arg_type, argument);
|
||||
operand = TREE_CHAIN (operand);
|
||||
check_cast (last_arg_type, operand);
|
||||
}
|
||||
else
|
||||
/* The code reaches here for some unfortunate
|
||||
|
|
@ -1061,17 +1054,16 @@ check_call (tree call_expr)
|
|||
/* FIXME - According to Geoff Keating, we should never
|
||||
have to do this; the front ends should always process
|
||||
the arg list from the TYPE_ARG_LIST. */
|
||||
operand = operand_list;
|
||||
for (arg_type = DECL_ARGUMENTS (callee_t);
|
||||
for (arg_type = DECL_ARGUMENTS (callee_t),
|
||||
operand = first_call_expr_arg (call_expr, &iter);
|
||||
arg_type;
|
||||
arg_type = TREE_CHAIN (arg_type))
|
||||
arg_type = TREE_CHAIN (arg_type),
|
||||
operand = next_call_expr_arg (&iter))
|
||||
{
|
||||
if (operand)
|
||||
{
|
||||
argument = TREE_VALUE (operand);
|
||||
last_arg_type = TREE_TYPE(arg_type);
|
||||
check_cast (last_arg_type, argument);
|
||||
operand = TREE_CHAIN (operand);
|
||||
check_cast (last_arg_type, operand);
|
||||
}
|
||||
else
|
||||
/* The code reaches here for some unfortunate
|
||||
|
|
@ -1086,11 +1078,10 @@ check_call (tree call_expr)
|
|||
arg_type = last_arg_type;
|
||||
for (;
|
||||
operand != NULL_TREE;
|
||||
operand = TREE_CHAIN (operand))
|
||||
operand = next_call_expr_arg (&iter))
|
||||
{
|
||||
argument = TREE_VALUE (operand);
|
||||
if (arg_type)
|
||||
check_cast (arg_type, argument);
|
||||
check_cast (arg_type, operand);
|
||||
else
|
||||
{
|
||||
/* The code reaches here for some unfortunate
|
||||
|
|
@ -1098,7 +1089,7 @@ check_call (tree call_expr)
|
|||
argument types. Most of these functions have
|
||||
been marked as having their parameters not
|
||||
escape, but for the rest, the type is doomed. */
|
||||
tree type = get_canon_type (TREE_TYPE (argument), false, false);
|
||||
tree type = get_canon_type (TREE_TYPE (operand), false, false);
|
||||
mark_interesting_type (type, FULL_ESCAPE);
|
||||
}
|
||||
}
|
||||
|
|
@ -1114,12 +1105,9 @@ check_call (tree call_expr)
|
|||
{
|
||||
/* If this is a direct call to an external function, mark all of
|
||||
the parameter and return types. */
|
||||
for (operand = operand_list;
|
||||
operand != NULL_TREE;
|
||||
operand = TREE_CHAIN (operand))
|
||||
FOR_EACH_CALL_EXPR_ARG (operand, iter, call_expr)
|
||||
{
|
||||
tree type =
|
||||
get_canon_type (TREE_TYPE (TREE_VALUE (operand)), false, false);
|
||||
tree type = get_canon_type (TREE_TYPE (operand), false, false);
|
||||
mark_interesting_type (type, EXPOSED_PARAMETER);
|
||||
}
|
||||
|
||||
|
|
@ -1257,7 +1245,14 @@ scan_for_refs (tree *tp, int *walk_subtrees, void *data)
|
|||
look_for_casts (lhs, TREE_OPERAND (rhs, 0));
|
||||
check_rhs_var (rhs);
|
||||
break;
|
||||
case CALL_EXPR:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case tcc_vl_exp:
|
||||
switch (TREE_CODE (rhs))
|
||||
{
|
||||
case CALL_EXPR:
|
||||
/* If this is a call to malloc, squirrel away the
|
||||
result so we do mark the resulting cast as being
|
||||
bad. */
|
||||
|
|
|
|||
|
|
@ -1,3 +1,70 @@
|
|||
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 David Daney <ddaney@avtrex.com>
|
||||
|
||||
* Make-lang.in (JAVA_MANFILES): Add doc/gc-analyze.1.
|
||||
|
|
|
|||
|
|
@ -60,7 +60,8 @@ static tree VMSupportsCS8_builtin (tree, tree);
|
|||
/* Functions of this type are used to inline a given call. Such a
|
||||
function should either return an expression, if the call is to be
|
||||
inlined, or NULL_TREE if a real call should be emitted. Arguments
|
||||
are method return type and arguments to call. */
|
||||
are method return type and the original CALL_EXPR containing the
|
||||
arguments to the call. */
|
||||
typedef tree builtin_creator_function (tree, tree);
|
||||
|
||||
/* Hold a char*, before initialization, or a tree, after
|
||||
|
|
@ -130,50 +131,73 @@ static GTY(()) struct builtin_record java_builtins[] =
|
|||
/* Internal functions which implement various builtin conversions. */
|
||||
|
||||
static tree
|
||||
max_builtin (tree method_return_type, tree method_arguments)
|
||||
max_builtin (tree method_return_type, tree orig_call)
|
||||
{
|
||||
/* MAX_EXPR does not handle -0.0 in the Java style. */
|
||||
if (TREE_CODE (method_return_type) == REAL_TYPE)
|
||||
return NULL_TREE;
|
||||
return fold_build2 (MAX_EXPR, method_return_type,
|
||||
TREE_VALUE (method_arguments),
|
||||
TREE_VALUE (TREE_CHAIN (method_arguments)));
|
||||
CALL_EXPR_ARG (orig_call, 0),
|
||||
CALL_EXPR_ARG (orig_call, 1));
|
||||
}
|
||||
|
||||
static tree
|
||||
min_builtin (tree method_return_type, tree method_arguments)
|
||||
min_builtin (tree method_return_type, tree orig_call)
|
||||
{
|
||||
/* MIN_EXPR does not handle -0.0 in the Java style. */
|
||||
if (TREE_CODE (method_return_type) == REAL_TYPE)
|
||||
return NULL_TREE;
|
||||
return fold_build2 (MIN_EXPR, method_return_type,
|
||||
TREE_VALUE (method_arguments),
|
||||
TREE_VALUE (TREE_CHAIN (method_arguments)));
|
||||
CALL_EXPR_ARG (orig_call, 0),
|
||||
CALL_EXPR_ARG (orig_call, 1));
|
||||
}
|
||||
|
||||
static tree
|
||||
abs_builtin (tree method_return_type, tree method_arguments)
|
||||
abs_builtin (tree method_return_type, tree orig_call)
|
||||
{
|
||||
return fold_build1 (ABS_EXPR, method_return_type,
|
||||
TREE_VALUE (method_arguments));
|
||||
CALL_EXPR_ARG (orig_call, 0));
|
||||
}
|
||||
|
||||
/* Mostly copied from ../builtins.c. */
|
||||
/* Construct a new call to FN using the arguments from ORIG_CALL. */
|
||||
|
||||
static tree
|
||||
java_build_function_call_expr (tree fn, tree arglist)
|
||||
java_build_function_call_expr (tree fn, tree orig_call)
|
||||
{
|
||||
tree call_expr;
|
||||
|
||||
call_expr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (fn)), fn);
|
||||
return fold_build3 (CALL_EXPR, TREE_TYPE (TREE_TYPE (fn)),
|
||||
call_expr, arglist, NULL_TREE);
|
||||
int nargs = call_expr_nargs (orig_call);
|
||||
switch (nargs)
|
||||
{
|
||||
/* Although we could handle the 0-3 argument cases using the general
|
||||
logic in the default case, splitting them out permits folding to
|
||||
be performed without constructing a temporary CALL_EXPR. */
|
||||
case 0:
|
||||
return build_call_expr (fn, 0);
|
||||
case 1:
|
||||
return build_call_expr (fn, 1, CALL_EXPR_ARG (orig_call, 0));
|
||||
case 2:
|
||||
return build_call_expr (fn, 2,
|
||||
CALL_EXPR_ARG (orig_call, 0),
|
||||
CALL_EXPR_ARG (orig_call, 1));
|
||||
case 3:
|
||||
return build_call_expr (fn, 3,
|
||||
CALL_EXPR_ARG (orig_call, 0),
|
||||
CALL_EXPR_ARG (orig_call, 1),
|
||||
CALL_EXPR_ARG (orig_call, 2));
|
||||
default:
|
||||
{
|
||||
tree fntype = TREE_TYPE (fn);
|
||||
fn = build1 (ADDR_EXPR, build_pointer_type (fntype), fn);
|
||||
return fold (build_call_array (TREE_TYPE (fntype),
|
||||
fn, nargs, CALL_EXPR_ARGP (orig_call)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static tree
|
||||
convert_real (tree method_return_type, tree method_arguments)
|
||||
convert_real (tree method_return_type, tree orig_call)
|
||||
{
|
||||
return build1 (VIEW_CONVERT_EXPR, method_return_type,
|
||||
TREE_VALUE (method_arguments));
|
||||
CALL_EXPR_ARG (orig_call, 0));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -191,76 +215,51 @@ convert_real (tree method_return_type, tree method_arguments)
|
|||
*/
|
||||
|
||||
|
||||
/* Macros to unmarshal arguments from a TREE_LIST into a few
|
||||
/* Macros to unmarshal arguments from a CALL_EXPR into a few
|
||||
variables. We also convert the offset arg from a long to an
|
||||
integer that is the same size as a pointer. */
|
||||
|
||||
#define UNMARSHAL3(METHOD_ARGUMENTS) \
|
||||
#define UNMARSHAL3(METHOD_CALL) \
|
||||
tree this_arg, obj_arg, offset_arg; \
|
||||
do \
|
||||
{ \
|
||||
tree chain = METHOD_ARGUMENTS; \
|
||||
this_arg = TREE_VALUE (chain); \
|
||||
chain = TREE_CHAIN (chain); \
|
||||
obj_arg = TREE_VALUE (chain); \
|
||||
chain = TREE_CHAIN (chain); \
|
||||
tree orig_method_call = METHOD_CALL; \
|
||||
this_arg = CALL_EXPR_ARG (orig_method_call, 0); \
|
||||
obj_arg = CALL_EXPR_ARG (orig_method_call, 1); \
|
||||
offset_arg = fold_convert (java_type_for_size (POINTER_SIZE, 0), \
|
||||
TREE_VALUE (chain)); \
|
||||
CALL_EXPR_ARG (orig_method_call, 2)); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define UNMARSHAL4(METHOD_ARGUMENTS) \
|
||||
#define UNMARSHAL4(METHOD_CALL) \
|
||||
tree value_type, this_arg, obj_arg, offset_arg, value_arg; \
|
||||
do \
|
||||
{ \
|
||||
tree chain = METHOD_ARGUMENTS; \
|
||||
this_arg = TREE_VALUE (chain); \
|
||||
chain = TREE_CHAIN (chain); \
|
||||
obj_arg = TREE_VALUE (chain); \
|
||||
chain = TREE_CHAIN (chain); \
|
||||
tree orig_method_call = METHOD_CALL; \
|
||||
this_arg = CALL_EXPR_ARG (orig_method_call, 0); \
|
||||
obj_arg = CALL_EXPR_ARG (orig_method_call, 1); \
|
||||
offset_arg = fold_convert (java_type_for_size (POINTER_SIZE, 0), \
|
||||
TREE_VALUE (chain)); \
|
||||
chain = TREE_CHAIN (chain); \
|
||||
value_arg = TREE_VALUE (chain); \
|
||||
CALL_EXPR_ARG (orig_method_call, 2)); \
|
||||
value_arg = CALL_EXPR_ARG (orig_method_call, 3); \
|
||||
value_type = TREE_TYPE (value_arg); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define UNMARSHAL5(METHOD_ARGUMENTS) \
|
||||
#define UNMARSHAL5(METHOD_CALL) \
|
||||
tree value_type, this_arg, obj_arg, offset_arg, expected_arg, value_arg; \
|
||||
do \
|
||||
{ \
|
||||
tree chain = METHOD_ARGUMENTS; \
|
||||
this_arg = TREE_VALUE (chain); \
|
||||
chain = TREE_CHAIN (chain); \
|
||||
obj_arg = TREE_VALUE (chain); \
|
||||
chain = TREE_CHAIN (chain); \
|
||||
tree orig_method_call = METHOD_CALL; \
|
||||
this_arg = CALL_EXPR_ARG (orig_method_call, 0); \
|
||||
obj_arg = CALL_EXPR_ARG (orig_method_call, 1); \
|
||||
offset_arg = fold_convert (java_type_for_size (POINTER_SIZE, 0), \
|
||||
TREE_VALUE (chain)); \
|
||||
chain = TREE_CHAIN (chain); \
|
||||
expected_arg = TREE_VALUE (chain); \
|
||||
chain = TREE_CHAIN (chain); \
|
||||
value_arg = TREE_VALUE (chain); \
|
||||
CALL_EXPR_ARG (orig_method_call, 2)); \
|
||||
expected_arg = CALL_EXPR_ARG (orig_method_call, 3); \
|
||||
value_arg = CALL_EXPR_ARG (orig_method_call, 4); \
|
||||
value_type = TREE_TYPE (value_arg); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* Construct an arglist from a call. */
|
||||
|
||||
static tree
|
||||
build_arglist_for_builtin (tree arg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
tree nextarg;
|
||||
tree newarglist = build_tree_list (NULL_TREE, arg);
|
||||
|
||||
va_start(ap, arg);
|
||||
while ((nextarg = va_arg(ap, tree)))
|
||||
newarglist = tree_cons (NULL_TREE, nextarg, newarglist);
|
||||
|
||||
return nreverse (newarglist);
|
||||
}
|
||||
|
||||
/* Add an address to an offset, forming a sum. */
|
||||
|
||||
static tree
|
||||
|
|
@ -286,10 +285,10 @@ build_check_this (tree stmt, tree this_arg)
|
|||
|
||||
static tree
|
||||
putObject_builtin (tree method_return_type ATTRIBUTE_UNUSED,
|
||||
tree method_arguments)
|
||||
tree orig_call)
|
||||
{
|
||||
tree addr, stmt;
|
||||
UNMARSHAL4 (method_arguments);
|
||||
UNMARSHAL4 (orig_call);
|
||||
|
||||
addr = build_addr_sum (value_type, obj_arg, offset_arg);
|
||||
stmt = fold_build2 (MODIFY_EXPR, value_type,
|
||||
|
|
@ -302,22 +301,18 @@ putObject_builtin (tree method_return_type ATTRIBUTE_UNUSED,
|
|||
|
||||
static tree
|
||||
compareAndSwapInt_builtin (tree method_return_type ATTRIBUTE_UNUSED,
|
||||
tree method_arguments)
|
||||
tree orig_call)
|
||||
{
|
||||
enum machine_mode mode = TYPE_MODE (int_type_node);
|
||||
if (sync_compare_and_swap_cc[mode] != CODE_FOR_nothing
|
||||
|| sync_compare_and_swap[mode] != CODE_FOR_nothing)
|
||||
{
|
||||
tree newarglist, addr, stmt;
|
||||
UNMARSHAL5 (method_arguments);
|
||||
tree addr, stmt;
|
||||
UNMARSHAL5 (orig_call);
|
||||
|
||||
addr = build_addr_sum (int_type_node, obj_arg, offset_arg);
|
||||
|
||||
newarglist
|
||||
= build_arglist_for_builtin (addr, expected_arg, value_arg, NULL_TREE);
|
||||
stmt = (build_function_call_expr
|
||||
(built_in_decls[BUILT_IN_BOOL_COMPARE_AND_SWAP_4],
|
||||
newarglist));
|
||||
stmt = build_call_expr (built_in_decls[BUILT_IN_BOOL_COMPARE_AND_SWAP_4],
|
||||
3, addr, expected_arg, value_arg);
|
||||
|
||||
return build_check_this (stmt, this_arg);
|
||||
}
|
||||
|
|
@ -326,22 +321,18 @@ compareAndSwapInt_builtin (tree method_return_type ATTRIBUTE_UNUSED,
|
|||
|
||||
static tree
|
||||
compareAndSwapLong_builtin (tree method_return_type ATTRIBUTE_UNUSED,
|
||||
tree method_arguments)
|
||||
tree orig_call)
|
||||
{
|
||||
enum machine_mode mode = TYPE_MODE (long_type_node);
|
||||
if (sync_compare_and_swap_cc[mode] != CODE_FOR_nothing
|
||||
|| sync_compare_and_swap[mode] != CODE_FOR_nothing)
|
||||
{
|
||||
tree newarglist, addr, stmt;
|
||||
UNMARSHAL5 (method_arguments);
|
||||
tree addr, stmt;
|
||||
UNMARSHAL5 (orig_call);
|
||||
|
||||
addr = build_addr_sum (long_type_node, obj_arg, offset_arg);
|
||||
|
||||
newarglist
|
||||
= build_arglist_for_builtin (addr, expected_arg, value_arg, NULL_TREE);
|
||||
stmt = (build_function_call_expr
|
||||
(built_in_decls[BUILT_IN_BOOL_COMPARE_AND_SWAP_8],
|
||||
newarglist));
|
||||
stmt = build_call_expr (built_in_decls[BUILT_IN_BOOL_COMPARE_AND_SWAP_8],
|
||||
3, addr, expected_arg, value_arg);
|
||||
|
||||
return build_check_this (stmt, this_arg);
|
||||
}
|
||||
|
|
@ -349,27 +340,23 @@ compareAndSwapLong_builtin (tree method_return_type ATTRIBUTE_UNUSED,
|
|||
}
|
||||
static tree
|
||||
compareAndSwapObject_builtin (tree method_return_type ATTRIBUTE_UNUSED,
|
||||
tree method_arguments)
|
||||
tree orig_call)
|
||||
{
|
||||
enum machine_mode mode = TYPE_MODE (ptr_type_node);
|
||||
if (sync_compare_and_swap_cc[mode] != CODE_FOR_nothing
|
||||
|| sync_compare_and_swap[mode] != CODE_FOR_nothing)
|
||||
{
|
||||
tree newarglist, addr, stmt;
|
||||
tree addr, stmt;
|
||||
int builtin;
|
||||
|
||||
UNMARSHAL5 (method_arguments);
|
||||
UNMARSHAL5 (orig_call);
|
||||
builtin = (POINTER_SIZE == 32
|
||||
? BUILT_IN_BOOL_COMPARE_AND_SWAP_4
|
||||
: BUILT_IN_BOOL_COMPARE_AND_SWAP_8);
|
||||
|
||||
addr = build_addr_sum (value_type, obj_arg, offset_arg);
|
||||
|
||||
newarglist
|
||||
= build_arglist_for_builtin (addr, expected_arg, value_arg, NULL_TREE);
|
||||
stmt = (build_function_call_expr
|
||||
(built_in_decls[builtin],
|
||||
newarglist));
|
||||
stmt = build_call_expr (built_in_decls[builtin],
|
||||
3, addr, expected_arg, value_arg);
|
||||
|
||||
return build_check_this (stmt, this_arg);
|
||||
}
|
||||
|
|
@ -378,20 +365,17 @@ compareAndSwapObject_builtin (tree method_return_type ATTRIBUTE_UNUSED,
|
|||
|
||||
static tree
|
||||
putVolatile_builtin (tree method_return_type ATTRIBUTE_UNUSED,
|
||||
tree method_arguments)
|
||||
tree orig_call)
|
||||
{
|
||||
tree newarglist, addr, stmt, modify_stmt;
|
||||
UNMARSHAL4 (method_arguments);
|
||||
tree addr, stmt, modify_stmt;
|
||||
UNMARSHAL4 (orig_call);
|
||||
|
||||
addr = build_addr_sum (value_type, obj_arg, offset_arg);
|
||||
addr
|
||||
= fold_convert (build_pointer_type (build_type_variant (value_type, 0, 1)),
|
||||
addr);
|
||||
|
||||
newarglist = NULL_TREE;
|
||||
stmt = (build_function_call_expr
|
||||
(built_in_decls[BUILT_IN_SYNCHRONIZE],
|
||||
newarglist));
|
||||
stmt = build_call_expr (built_in_decls[BUILT_IN_SYNCHRONIZE], 0);
|
||||
modify_stmt = fold_build2 (MODIFY_EXPR, value_type,
|
||||
build_java_indirect_ref (value_type, addr,
|
||||
flag_check_references),
|
||||
|
|
@ -404,20 +388,17 @@ putVolatile_builtin (tree method_return_type ATTRIBUTE_UNUSED,
|
|||
|
||||
static tree
|
||||
getVolatile_builtin (tree method_return_type ATTRIBUTE_UNUSED,
|
||||
tree method_arguments)
|
||||
tree orig_call)
|
||||
{
|
||||
tree newarglist, addr, stmt, modify_stmt, tmp;
|
||||
UNMARSHAL3 (method_arguments);
|
||||
tree addr, stmt, modify_stmt, tmp;
|
||||
UNMARSHAL3 (orig_call);
|
||||
|
||||
addr = build_addr_sum (method_return_type, obj_arg, offset_arg);
|
||||
addr
|
||||
= fold_convert (build_pointer_type (build_type_variant
|
||||
(method_return_type, 0, 1)), addr);
|
||||
|
||||
newarglist = NULL_TREE;
|
||||
stmt = (build_function_call_expr
|
||||
(built_in_decls[BUILT_IN_SYNCHRONIZE],
|
||||
newarglist));
|
||||
stmt = build_call_expr (built_in_decls[BUILT_IN_SYNCHRONIZE], 0);
|
||||
|
||||
tmp = build_decl (VAR_DECL, NULL, method_return_type);
|
||||
DECL_IGNORED_P (tmp) = 1;
|
||||
|
|
@ -437,7 +418,7 @@ getVolatile_builtin (tree method_return_type ATTRIBUTE_UNUSED,
|
|||
|
||||
static tree
|
||||
VMSupportsCS8_builtin (tree method_return_type,
|
||||
tree method_arguments ATTRIBUTE_UNUSED)
|
||||
tree orig_call ATTRIBUTE_UNUSED)
|
||||
{
|
||||
enum machine_mode mode = TYPE_MODE (long_type_node);
|
||||
gcc_assert (method_return_type == boolean_type_node);
|
||||
|
|
@ -596,7 +577,6 @@ check_for_builtin (tree method, tree call)
|
|||
if (optimize && TREE_CODE (call) == CALL_EXPR)
|
||||
{
|
||||
int i;
|
||||
tree method_arguments = TREE_OPERAND (call, 1);
|
||||
tree method_class = DECL_NAME (TYPE_NAME (DECL_CONTEXT (method)));
|
||||
tree method_name = DECL_NAME (method);
|
||||
tree method_return_type = TREE_TYPE (TREE_TYPE (method));
|
||||
|
|
@ -611,8 +591,7 @@ check_for_builtin (tree method, tree call)
|
|||
if (java_builtins[i].creator != NULL)
|
||||
{
|
||||
tree result
|
||||
= (*java_builtins[i].creator) (method_return_type,
|
||||
method_arguments);
|
||||
= (*java_builtins[i].creator) (method_return_type, call);
|
||||
return result == NULL_TREE ? call : result;
|
||||
}
|
||||
|
||||
|
|
@ -623,7 +602,7 @@ check_for_builtin (tree method, tree call)
|
|||
fn = built_in_decls[java_builtins[i].builtin_code];
|
||||
if (fn == NULL_TREE)
|
||||
return call;
|
||||
return java_build_function_call_expr (fn, method_arguments);
|
||||
return java_build_function_call_expr (fn, call);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1039,10 +1039,8 @@ cache_this_class_ref (tree fndecl)
|
|||
&& ! DECL_CLINIT_P (fndecl)
|
||||
&& ! CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (fndecl))))
|
||||
{
|
||||
tree init = build3 (CALL_EXPR, void_type_node,
|
||||
build_address_of (soft_initclass_node),
|
||||
build_tree_list (NULL_TREE, this_classdollar),
|
||||
NULL_TREE);
|
||||
tree init = build_call_expr (soft_initclass_node, 1,
|
||||
this_classdollar);
|
||||
java_add_stmt (init);
|
||||
}
|
||||
}
|
||||
|
|
@ -1177,20 +1175,16 @@ build_static_field_ref (tree fdecl)
|
|||
|
||||
int cpool_index = alloc_constant_fieldref (output_class, fdecl);
|
||||
tree cache_entry = build_fieldref_cache_entry (cpool_index, fdecl);
|
||||
tree test
|
||||
= build3 (CALL_EXPR, boolean_type_node,
|
||||
build_address_of (built_in_decls[BUILT_IN_EXPECT]),
|
||||
tree_cons (NULL_TREE, build2 (EQ_EXPR, boolean_type_node,
|
||||
cache_entry, null_pointer_node),
|
||||
build_tree_list (NULL_TREE, boolean_false_node)),
|
||||
NULL_TREE);
|
||||
tree test
|
||||
= build_call_expr (built_in_decls[BUILT_IN_EXPECT], 2,
|
||||
build2 (EQ_EXPR, boolean_type_node,
|
||||
cache_entry, null_pointer_node),
|
||||
boolean_false_node);
|
||||
tree cpool_index_cst = build_int_cst (NULL_TREE, cpool_index);
|
||||
tree init
|
||||
= build3 (CALL_EXPR, ptr_type_node,
|
||||
build_address_of (soft_resolvepoolentry_node),
|
||||
tree_cons (NULL_TREE, build_class_ref (output_class),
|
||||
build_tree_list (NULL_TREE, cpool_index_cst)),
|
||||
NULL_TREE);
|
||||
= build_call_expr (soft_resolvepoolentry_node, 2,
|
||||
build_class_ref (output_class),
|
||||
cpool_index_cst);
|
||||
init = build2 (MODIFY_EXPR, ptr_type_node, cache_entry, init);
|
||||
init = build3 (COND_EXPR, ptr_type_node, test, init, cache_entry);
|
||||
init = fold_convert (build_pointer_type (TREE_TYPE (fdecl)), init);
|
||||
|
|
@ -2693,8 +2687,7 @@ emit_indirect_register_classes (tree *list_p)
|
|||
TREE_PUBLIC (t) = 1;
|
||||
DECL_EXTERNAL (t) = 1;
|
||||
register_class_fn = t;
|
||||
t = tree_cons (NULL, reg_class_list, NULL);
|
||||
t = build_function_call_expr (register_class_fn, t);
|
||||
t = build_call_expr (register_class_fn, 1, reg_class_list);
|
||||
append_to_statement_list (t, list_p);
|
||||
}
|
||||
|
||||
|
|
@ -2759,8 +2752,7 @@ emit_register_classes (tree *list_p)
|
|||
for (i = 0; VEC_iterate (tree, registered_class, i, klass); ++i)
|
||||
{
|
||||
t = build_fold_addr_expr (klass);
|
||||
t = tree_cons (NULL, t, NULL);
|
||||
t = build_function_call_expr (register_class_fn, t);
|
||||
t = build_call_expr (register_class_fn, 1, t);
|
||||
append_to_statement_list (t, list_p);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
270
gcc/java/expr.c
270
gcc/java/expr.c
|
|
@ -716,11 +716,9 @@ build_java_athrow (tree node)
|
|||
{
|
||||
tree call;
|
||||
|
||||
call = build3 (CALL_EXPR,
|
||||
void_type_node,
|
||||
build_address_of (throw_node),
|
||||
build_tree_list (NULL_TREE, node),
|
||||
NULL_TREE);
|
||||
call = build_call_nary (void_type_node,
|
||||
build_address_of (throw_node),
|
||||
1, node);
|
||||
TREE_SIDE_EFFECTS (call) = 1;
|
||||
java_add_stmt (call);
|
||||
java_stack_pop (stack_pointer);
|
||||
|
|
@ -799,9 +797,9 @@ encode_newarray_type (tree type)
|
|||
static tree
|
||||
build_java_throw_out_of_bounds_exception (tree index)
|
||||
{
|
||||
tree node = build3 (CALL_EXPR, int_type_node,
|
||||
build_address_of (soft_badarrayindex_node),
|
||||
build_tree_list (NULL_TREE, index), NULL_TREE);
|
||||
tree node = build_call_nary (int_type_node,
|
||||
build_address_of (soft_badarrayindex_node),
|
||||
1, index);
|
||||
TREE_SIDE_EFFECTS (node) = 1; /* Allows expansion within ANDIF */
|
||||
return (node);
|
||||
}
|
||||
|
|
@ -850,9 +848,9 @@ java_check_reference (tree expr, int check)
|
|||
expr = build3 (COND_EXPR, TREE_TYPE (expr),
|
||||
build2 (EQ_EXPR, boolean_type_node,
|
||||
expr, null_pointer_node),
|
||||
build3 (CALL_EXPR, void_type_node,
|
||||
build_address_of (soft_nullpointer_node),
|
||||
NULL_TREE, NULL_TREE),
|
||||
build_call_nary (void_type_node,
|
||||
build_address_of (soft_nullpointer_node),
|
||||
0),
|
||||
expr);
|
||||
}
|
||||
|
||||
|
|
@ -1014,11 +1012,9 @@ build_java_arraystore_check (tree array, tree object)
|
|||
}
|
||||
|
||||
/* Build an invocation of _Jv_CheckArrayStore */
|
||||
check = build3 (CALL_EXPR, void_type_node,
|
||||
build_address_of (soft_checkarraystore_node),
|
||||
tree_cons (NULL_TREE, array,
|
||||
build_tree_list (NULL_TREE, object)),
|
||||
NULL_TREE);
|
||||
check = build_call_nary (void_type_node,
|
||||
build_address_of (soft_checkarraystore_node),
|
||||
2, array, object);
|
||||
TREE_SIDE_EFFECTS (check) = 1;
|
||||
|
||||
return check;
|
||||
|
|
@ -1060,12 +1056,9 @@ build_newarray (int atype_value, tree length)
|
|||
some work. */
|
||||
type_arg = build_class_ref (prim_type);
|
||||
|
||||
return build3 (CALL_EXPR, promote_type (type),
|
||||
build_address_of (soft_newarray_node),
|
||||
tree_cons (NULL_TREE,
|
||||
type_arg,
|
||||
build_tree_list (NULL_TREE, length)),
|
||||
NULL_TREE);
|
||||
return build_call_nary (promote_type (type),
|
||||
build_address_of (soft_newarray_node),
|
||||
2, type_arg, length);
|
||||
}
|
||||
|
||||
/* Generates anewarray from a given CLASS_TYPE. Gets from the stack the size
|
||||
|
|
@ -1079,13 +1072,12 @@ build_anewarray (tree class_type, tree length)
|
|||
host_integerp (length, 0)
|
||||
? tree_low_cst (length, 0) : -1);
|
||||
|
||||
return build3 (CALL_EXPR, promote_type (type),
|
||||
build_address_of (soft_anewarray_node),
|
||||
tree_cons (NULL_TREE, length,
|
||||
tree_cons (NULL_TREE, build_class_ref (class_type),
|
||||
build_tree_list (NULL_TREE,
|
||||
null_pointer_node))),
|
||||
NULL_TREE);
|
||||
return build_call_nary (promote_type (type),
|
||||
build_address_of (soft_anewarray_node),
|
||||
3,
|
||||
length,
|
||||
build_class_ref (class_type),
|
||||
null_pointer_node);
|
||||
}
|
||||
|
||||
/* Return a node the evaluates 'new TYPE[LENGTH]'. */
|
||||
|
|
@ -1112,14 +1104,15 @@ expand_java_multianewarray (tree class_type, int ndim)
|
|||
for( i = 0; i < ndim; i++ )
|
||||
args = tree_cons (NULL_TREE, pop_value (int_type_node), args);
|
||||
|
||||
push_value (build3 (CALL_EXPR,
|
||||
promote_type (class_type),
|
||||
build_address_of (soft_multianewarray_node),
|
||||
tree_cons (NULL_TREE, build_class_ref (class_type),
|
||||
tree_cons (NULL_TREE,
|
||||
build_int_cst (NULL_TREE, ndim),
|
||||
args)),
|
||||
NULL_TREE));
|
||||
args = tree_cons (NULL_TREE,
|
||||
build_class_ref (class_type),
|
||||
tree_cons (NULL_TREE,
|
||||
build_int_cst (NULL_TREE, ndim),
|
||||
args));
|
||||
|
||||
push_value (build_call_list (promote_type (class_type),
|
||||
build_address_of (soft_multianewarray_node),
|
||||
args));
|
||||
}
|
||||
|
||||
/* ARRAY[INDEX] <- RHS. build_java_check_indexed_type makes sure that
|
||||
|
|
@ -1246,11 +1239,9 @@ expand_java_array_length (void)
|
|||
static tree
|
||||
build_java_monitor (tree call, tree object)
|
||||
{
|
||||
return build3 (CALL_EXPR,
|
||||
void_type_node,
|
||||
build_address_of (call),
|
||||
build_tree_list (NULL_TREE, object),
|
||||
NULL_TREE);
|
||||
return build_call_nary (void_type_node,
|
||||
build_address_of (call),
|
||||
1, object);
|
||||
}
|
||||
|
||||
/* Emit code for one of the PUSHC instructions. */
|
||||
|
|
@ -1347,10 +1338,9 @@ java_create_object (tree type)
|
|||
? alloc_object_node
|
||||
: alloc_no_finalizer_node);
|
||||
|
||||
return build3 (CALL_EXPR, promote_type (type),
|
||||
build_address_of (alloc_node),
|
||||
build_tree_list (NULL_TREE, build_class_ref (type)),
|
||||
NULL_TREE);
|
||||
return build_call_nary (promote_type (type),
|
||||
build_address_of (alloc_node),
|
||||
1, build_class_ref (type));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1363,10 +1353,9 @@ expand_java_NEW (tree type)
|
|||
if (! CLASS_LOADED_P (type))
|
||||
load_class (type, 1);
|
||||
safe_layout_class (type);
|
||||
push_value (build3 (CALL_EXPR, promote_type (type),
|
||||
build_address_of (alloc_node),
|
||||
build_tree_list (NULL_TREE, build_class_ref (type)),
|
||||
NULL_TREE));
|
||||
push_value (build_call_nary (promote_type (type),
|
||||
build_address_of (alloc_node),
|
||||
1, build_class_ref (type)));
|
||||
}
|
||||
|
||||
/* This returns an expression which will extract the class of an
|
||||
|
|
@ -1445,12 +1434,9 @@ build_instanceof (tree value, tree type)
|
|||
}
|
||||
else
|
||||
{
|
||||
expr = build3 (CALL_EXPR, itype,
|
||||
build_address_of (soft_instanceof_node),
|
||||
tree_cons (NULL_TREE, value,
|
||||
build_tree_list (NULL_TREE,
|
||||
build_class_ref (type))),
|
||||
NULL_TREE);
|
||||
expr = build_call_nary (itype,
|
||||
build_address_of (soft_instanceof_node),
|
||||
2, value, build_class_ref (type));
|
||||
}
|
||||
TREE_SIDE_EFFECTS (expr) = TREE_SIDE_EFFECTS (value);
|
||||
return expr;
|
||||
|
|
@ -1468,11 +1454,9 @@ static void
|
|||
expand_java_CHECKCAST (tree type)
|
||||
{
|
||||
tree value = pop_value (ptr_type_node);
|
||||
value = build3 (CALL_EXPR, promote_type (type),
|
||||
build_address_of (soft_checkcast_node),
|
||||
tree_cons (NULL_TREE, build_class_ref (type),
|
||||
build_tree_list (NULL_TREE, value)),
|
||||
NULL_TREE);
|
||||
value = build_call_nary (promote_type (type),
|
||||
build_address_of (soft_checkcast_node),
|
||||
2, build_class_ref (type), value);
|
||||
push_value (value);
|
||||
}
|
||||
|
||||
|
|
@ -1527,12 +1511,7 @@ build_java_soft_divmod (enum tree_code op, tree type, tree op1, tree op2)
|
|||
}
|
||||
|
||||
gcc_assert (call);
|
||||
call = build3 (CALL_EXPR, type,
|
||||
build_address_of (call),
|
||||
tree_cons (NULL_TREE, arg1,
|
||||
build_tree_list (NULL_TREE, arg2)),
|
||||
NULL_TREE);
|
||||
|
||||
call = build_call_nary (type, build_address_of (call), 2, arg1, arg2);
|
||||
return call;
|
||||
}
|
||||
|
||||
|
|
@ -1595,11 +1574,9 @@ build_java_binop (enum tree_code op, tree type, tree arg1, tree arg2)
|
|||
arg1 = convert (double_type_node, arg1);
|
||||
arg2 = convert (double_type_node, arg2);
|
||||
}
|
||||
call = build3 (CALL_EXPR, double_type_node,
|
||||
build_address_of (soft_fmod_node),
|
||||
tree_cons (NULL_TREE, arg1,
|
||||
build_tree_list (NULL_TREE, arg2)),
|
||||
NULL_TREE);
|
||||
call = build_call_nary (double_type_node,
|
||||
build_address_of (soft_fmod_node),
|
||||
2, arg1, arg2);
|
||||
if (type != double_type_node)
|
||||
call = convert (type, call);
|
||||
return call;
|
||||
|
|
@ -1759,10 +1736,9 @@ build_field_ref (tree self_value, tree self_class, tree name)
|
|||
= build3 (COND_EXPR, TREE_TYPE (field_offset),
|
||||
build2 (EQ_EXPR, boolean_type_node,
|
||||
field_offset, integer_zero_node),
|
||||
build3 (CALL_EXPR, void_type_node,
|
||||
build_address_of (soft_nosuchfield_node),
|
||||
build_tree_list (NULL_TREE, otable_index),
|
||||
NULL_TREE),
|
||||
build_call_nary (void_type_node,
|
||||
build_address_of (soft_nosuchfield_node),
|
||||
1, otable_index),
|
||||
field_offset);
|
||||
|
||||
field_offset = fold (convert (sizetype, field_offset));
|
||||
|
|
@ -1998,10 +1974,9 @@ build_class_init (tree clas, tree expr)
|
|||
|
||||
if (always_initialize_class_p)
|
||||
{
|
||||
init = build3 (CALL_EXPR, void_type_node,
|
||||
build_address_of (soft_initclass_node),
|
||||
build_tree_list (NULL_TREE, build_class_ref (clas)),
|
||||
NULL_TREE);
|
||||
init = build_call_nary (void_type_node,
|
||||
build_address_of (soft_initclass_node),
|
||||
1, build_class_ref (clas));
|
||||
TREE_SIDE_EFFECTS (init) = 1;
|
||||
}
|
||||
else
|
||||
|
|
@ -2031,10 +2006,9 @@ build_class_init (tree clas, tree expr)
|
|||
*init_test_decl = decl;
|
||||
}
|
||||
|
||||
init = build3 (CALL_EXPR, void_type_node,
|
||||
build_address_of (soft_initclass_node),
|
||||
build_tree_list (NULL_TREE, build_class_ref (clas)),
|
||||
NULL_TREE);
|
||||
init = build_call_nary (void_type_node,
|
||||
build_address_of (soft_initclass_node),
|
||||
1, build_class_ref (clas));
|
||||
TREE_SIDE_EFFECTS (init) = 1;
|
||||
init = build3 (COND_EXPR, void_type_node,
|
||||
build2 (EQ_EXPR, boolean_type_node,
|
||||
|
|
@ -2084,9 +2058,8 @@ static tree
|
|||
rewrite_arglist_getcaller (tree arglist)
|
||||
{
|
||||
tree retaddr
|
||||
= (build_function_call_expr
|
||||
(built_in_decls[BUILT_IN_RETURN_ADDRESS],
|
||||
build_tree_list (NULL_TREE, integer_zero_node)));
|
||||
= build_call_expr (built_in_decls[BUILT_IN_RETURN_ADDRESS],
|
||||
1, integer_zero_node);
|
||||
|
||||
DECL_INLINE (current_function_decl) = 0;
|
||||
|
||||
|
|
@ -2356,7 +2329,6 @@ static GTY(()) tree class_ident;
|
|||
tree
|
||||
build_invokeinterface (tree dtable, tree method)
|
||||
{
|
||||
tree lookup_arg;
|
||||
tree interface;
|
||||
tree idx;
|
||||
|
||||
|
|
@ -2401,13 +2373,9 @@ build_invokeinterface (tree dtable, tree method)
|
|||
interface = build_class_ref (interface);
|
||||
}
|
||||
|
||||
lookup_arg = tree_cons (NULL_TREE, dtable,
|
||||
tree_cons (NULL_TREE, interface,
|
||||
build_tree_list (NULL_TREE, idx)));
|
||||
|
||||
return build3 (CALL_EXPR, ptr_type_node,
|
||||
build_address_of (soft_lookupinterfacemethod_node),
|
||||
lookup_arg, NULL_TREE);
|
||||
return build_call_nary (ptr_type_node,
|
||||
build_address_of (soft_lookupinterfacemethod_node),
|
||||
3, dtable, interface, idx);
|
||||
}
|
||||
|
||||
/* Expand one of the invoke_* opcodes.
|
||||
|
|
@ -2590,8 +2558,7 @@ expand_invoke (int opcode, int method_ref_index, int nargs ATTRIBUTE_UNUSED)
|
|||
else
|
||||
func = build1 (NOP_EXPR, build_pointer_type (method_type), func);
|
||||
|
||||
call = build3 (CALL_EXPR, TREE_TYPE (method_type),
|
||||
func, arg_list, NULL_TREE);
|
||||
call = build_call_list (TREE_TYPE (method_type), func, arg_list);
|
||||
TREE_SIDE_EFFECTS (call) = 1;
|
||||
call = check_for_builtin (method, call);
|
||||
|
||||
|
|
@ -2616,7 +2583,8 @@ expand_invoke (int opcode, int method_ref_index, int nargs ATTRIBUTE_UNUSED)
|
|||
tree
|
||||
build_jni_stub (tree method)
|
||||
{
|
||||
tree jnifunc, call, args, body, lookup_arg, method_sig, arg_types;
|
||||
tree jnifunc, call, args, body, method_sig, arg_types;
|
||||
tree jniarg0, jniarg1, jniarg2, jniarg3;
|
||||
tree jni_func_type, tem;
|
||||
tree env_var, res_var = NULL_TREE, block;
|
||||
tree method_args, res_type;
|
||||
|
|
@ -2671,10 +2639,9 @@ build_jni_stub (tree method)
|
|||
|
||||
/* Compute the local `env' by calling _Jv_GetJNIEnvNewFrame. */
|
||||
body = build2 (MODIFY_EXPR, ptr_type_node, env_var,
|
||||
build3 (CALL_EXPR, ptr_type_node,
|
||||
build_address_of (soft_getjnienvnewframe_node),
|
||||
build_tree_list (NULL_TREE, klass),
|
||||
NULL_TREE));
|
||||
build_call_nary (ptr_type_node,
|
||||
build_address_of (soft_getjnienvnewframe_node),
|
||||
1, klass));
|
||||
CAN_COMPLETE_NORMALLY (body) = 1;
|
||||
|
||||
/* All the arguments to this method become arguments to the
|
||||
|
|
@ -2713,18 +2680,14 @@ build_jni_stub (tree method)
|
|||
/* We call _Jv_LookupJNIMethod to find the actual underlying
|
||||
function pointer. _Jv_LookupJNIMethod will throw the appropriate
|
||||
exception if this function is not found at runtime. */
|
||||
tem = build_tree_list (NULL_TREE, build_int_cst (NULL_TREE, args_size));
|
||||
method_sig = build_java_signature (TREE_TYPE (method));
|
||||
lookup_arg = tree_cons (NULL_TREE,
|
||||
build_utf8_ref (unmangle_classname
|
||||
(IDENTIFIER_POINTER (method_sig),
|
||||
IDENTIFIER_LENGTH (method_sig))),
|
||||
tem);
|
||||
tem = DECL_NAME (method);
|
||||
lookup_arg
|
||||
= tree_cons (NULL_TREE, klass,
|
||||
tree_cons (NULL_TREE, build_utf8_ref (tem), lookup_arg));
|
||||
|
||||
jniarg0 = klass;
|
||||
jniarg1 = build_utf8_ref (DECL_NAME (method));
|
||||
jniarg2 = build_utf8_ref (unmangle_classname
|
||||
(IDENTIFIER_POINTER (method_sig),
|
||||
IDENTIFIER_LENGTH (method_sig)));
|
||||
jniarg3 = build_int_cst (NULL_TREE, args_size);
|
||||
|
||||
tem = build_function_type (TREE_TYPE (TREE_TYPE (method)), arg_types);
|
||||
|
||||
#ifdef MODIFY_JNI_METHOD_CALL
|
||||
|
|
@ -2736,16 +2699,18 @@ build_jni_stub (tree method)
|
|||
jnifunc = build3 (COND_EXPR, ptr_type_node,
|
||||
meth_var, meth_var,
|
||||
build2 (MODIFY_EXPR, ptr_type_node, meth_var,
|
||||
build3 (CALL_EXPR, ptr_type_node,
|
||||
build_address_of
|
||||
(soft_lookupjnimethod_node),
|
||||
lookup_arg, NULL_TREE)));
|
||||
build_call_nary (ptr_type_node,
|
||||
build_address_of
|
||||
(soft_lookupjnimethod_node),
|
||||
4,
|
||||
jniarg0, jniarg1,
|
||||
jniarg2, jniarg3)));
|
||||
|
||||
/* Now we make the actual JNI call via the resulting function
|
||||
pointer. */
|
||||
call = build3 (CALL_EXPR, TREE_TYPE (TREE_TYPE (method)),
|
||||
build1 (NOP_EXPR, jni_func_type, jnifunc),
|
||||
args, NULL_TREE);
|
||||
call = build_call_list (TREE_TYPE (TREE_TYPE (method)),
|
||||
build1 (NOP_EXPR, jni_func_type, jnifunc),
|
||||
args);
|
||||
|
||||
/* If the JNI call returned a result, capture it here. If we had to
|
||||
unwrap JNI object results, we would do that here. */
|
||||
|
|
@ -2754,10 +2719,9 @@ build_jni_stub (tree method)
|
|||
/* If the call returns an object, it may return a JNI weak
|
||||
reference, in which case we must unwrap it. */
|
||||
if (! JPRIMITIVE_TYPE_P (TREE_TYPE (TREE_TYPE (method))))
|
||||
call = build3 (CALL_EXPR, TREE_TYPE (TREE_TYPE (method)),
|
||||
build_address_of (soft_unwrapjni_node),
|
||||
build_tree_list (NULL_TREE, call),
|
||||
NULL_TREE);
|
||||
call = build_call_nary (TREE_TYPE (TREE_TYPE (method)),
|
||||
build_address_of (soft_unwrapjni_node),
|
||||
1, call);
|
||||
call = build2 (MODIFY_EXPR, TREE_TYPE (TREE_TYPE (method)),
|
||||
res_var, call);
|
||||
}
|
||||
|
|
@ -2769,10 +2733,9 @@ build_jni_stub (tree method)
|
|||
TREE_SIDE_EFFECTS (body) = 1;
|
||||
|
||||
/* Now free the environment we allocated. */
|
||||
call = build3 (CALL_EXPR, ptr_type_node,
|
||||
build_address_of (soft_jnipopsystemframe_node),
|
||||
build_tree_list (NULL_TREE, env_var),
|
||||
NULL_TREE);
|
||||
call = build_call_nary (ptr_type_node,
|
||||
build_address_of (soft_jnipopsystemframe_node),
|
||||
1, env_var);
|
||||
TREE_SIDE_EFFECTS (call) = 1;
|
||||
CAN_COMPLETE_NORMALLY (call) = 1;
|
||||
body = build2 (COMPOUND_EXPR, void_type_node, body, call);
|
||||
|
|
@ -2805,11 +2768,8 @@ build_jni_stub (tree method)
|
|||
&& (! METHOD_PRIVATE (method)
|
||||
|| INNER_CLASS_P (DECL_CONTEXT (method))))
|
||||
{
|
||||
tree init = build3 (CALL_EXPR, void_type_node,
|
||||
build_address_of (soft_initclass_node),
|
||||
build_tree_list (NULL_TREE,
|
||||
klass),
|
||||
NULL_TREE);
|
||||
tree init = build_call_expr (soft_initclass_node, 1,
|
||||
klass);
|
||||
body = build2 (COMPOUND_EXPR, void_type_node, init, body);
|
||||
TREE_SIDE_EFFECTS (body) = 1;
|
||||
}
|
||||
|
|
@ -2943,11 +2903,8 @@ expand_java_field_op (int is_static, int is_putting, int field_ref_index)
|
|||
field_ref, new_value);
|
||||
|
||||
if (TREE_THIS_VOLATILE (field_decl))
|
||||
java_add_stmt
|
||||
(build3
|
||||
(CALL_EXPR, void_type_node,
|
||||
build_address_of (built_in_decls[BUILT_IN_SYNCHRONIZE]),
|
||||
NULL_TREE, NULL_TREE));
|
||||
java_add_stmt
|
||||
(build_call_expr (built_in_decls[BUILT_IN_SYNCHRONIZE], 0));
|
||||
|
||||
java_add_stmt (modify_expr);
|
||||
}
|
||||
|
|
@ -2965,10 +2922,7 @@ expand_java_field_op (int is_static, int is_putting, int field_ref_index)
|
|||
|
||||
if (TREE_THIS_VOLATILE (field_decl))
|
||||
java_add_stmt
|
||||
(build3
|
||||
(CALL_EXPR, void_type_node,
|
||||
build_address_of (built_in_decls[BUILT_IN_SYNCHRONIZE]),
|
||||
NULL_TREE, NULL_TREE));
|
||||
(build_call_expr (built_in_decls[BUILT_IN_SYNCHRONIZE], 0));
|
||||
|
||||
push_value (temp);
|
||||
}
|
||||
|
|
@ -3725,40 +3679,36 @@ force_evaluation_order (tree node)
|
|||
&& TREE_CODE (TREE_OPERAND (node, 0)) == CALL_EXPR
|
||||
&& TREE_CODE (TREE_OPERAND (node, 1)) == SAVE_EXPR))
|
||||
{
|
||||
tree arg, cmp;
|
||||
tree call, cmp;
|
||||
int i, nargs;
|
||||
|
||||
arg = node;
|
||||
|
||||
/* Position arg properly, account for wrapped around ctors. */
|
||||
/* Account for wrapped around ctors. */
|
||||
if (TREE_CODE (node) == COMPOUND_EXPR)
|
||||
arg = TREE_OPERAND (node, 0);
|
||||
|
||||
arg = TREE_OPERAND (arg, 1);
|
||||
|
||||
/* An empty argument list is ok, just ignore it. */
|
||||
if (!arg)
|
||||
return node;
|
||||
call = TREE_OPERAND (node, 0);
|
||||
else
|
||||
call = node;
|
||||
|
||||
/* Not having a list of arguments here is an error. */
|
||||
gcc_assert (TREE_CODE (arg) == TREE_LIST);
|
||||
nargs = call_expr_nargs (call);
|
||||
|
||||
/* This reverses the evaluation order. This is a desired effect. */
|
||||
for (cmp = NULL_TREE; arg; arg = TREE_CHAIN (arg))
|
||||
for (i = 0, cmp = NULL_TREE; i < nargs; i++)
|
||||
{
|
||||
tree arg = CALL_EXPR_ARG (call, i);
|
||||
/* Promote types smaller than integer. This is required by
|
||||
some ABIs. */
|
||||
tree type = TREE_TYPE (TREE_VALUE (arg));
|
||||
tree type = TREE_TYPE (arg);
|
||||
tree saved;
|
||||
if (targetm.calls.promote_prototypes (type)
|
||||
&& INTEGRAL_TYPE_P (type)
|
||||
&& INT_CST_LT_UNSIGNED (TYPE_SIZE (type),
|
||||
TYPE_SIZE (integer_type_node)))
|
||||
TREE_VALUE (arg) = fold_convert (integer_type_node, TREE_VALUE (arg));
|
||||
arg = fold_convert (integer_type_node, arg);
|
||||
|
||||
saved = save_expr (force_evaluation_order (TREE_VALUE (arg)));
|
||||
saved = save_expr (force_evaluation_order (arg));
|
||||
cmp = (cmp == NULL_TREE ? saved :
|
||||
build2 (COMPOUND_EXPR, void_type_node, cmp, saved));
|
||||
TREE_VALUE (arg) = saved;
|
||||
|
||||
CALL_EXPR_ARG (call, i) = saved;
|
||||
}
|
||||
|
||||
if (cmp && TREE_CODE (cmp) == COMPOUND_EXPR)
|
||||
|
|
|
|||
|
|
@ -212,10 +212,7 @@ java_gimplify_component_ref (tree *expr_p, tree *pre_p, tree *post_p)
|
|||
if (stat == GS_ERROR)
|
||||
return stat;
|
||||
|
||||
sync_expr
|
||||
= build3 (CALL_EXPR, void_type_node,
|
||||
build_address_of (built_in_decls[BUILT_IN_SYNCHRONIZE]),
|
||||
NULL_TREE, NULL_TREE);
|
||||
sync_expr = build_call_expr (built_in_decls[BUILT_IN_SYNCHRONIZE], 0);
|
||||
TREE_SIDE_EFFECTS (sync_expr) = 1;
|
||||
*expr_p = build2 (COMPOUND_EXPR, TREE_TYPE (*expr_p),
|
||||
sync_expr, *expr_p);
|
||||
|
|
@ -255,10 +252,8 @@ java_gimplify_modify_expr (tree *modify_expr_p, tree *pre_p, tree *post_p)
|
|||
*/
|
||||
|
||||
enum gimplify_status stat;
|
||||
tree sync_expr
|
||||
= build3 (CALL_EXPR, void_type_node,
|
||||
build_address_of (built_in_decls[BUILT_IN_SYNCHRONIZE]),
|
||||
NULL_TREE, NULL_TREE);
|
||||
tree sync_expr =
|
||||
build_call_expr (built_in_decls[BUILT_IN_SYNCHRONIZE], 0);
|
||||
TREE_SIDE_EFFECTS (sync_expr) = 1;
|
||||
|
||||
stat = gimplify_expr (&rhs, pre_p, post_p,
|
||||
|
|
|
|||
|
|
@ -1626,20 +1626,18 @@ extern tree *type_map;
|
|||
|
||||
#define BUILD_MONITOR_ENTER(WHERE, ARG) \
|
||||
{ \
|
||||
(WHERE) = build3 (CALL_EXPR, int_type_node, \
|
||||
build_address_of (soft_monitorenter_node), \
|
||||
build_tree_list (NULL_TREE, (ARG)), \
|
||||
NULL_TREE); \
|
||||
(WHERE) = build_call_nary (int_type_node, \
|
||||
build_address_of (soft_monitorenter_node), \
|
||||
1, (ARG)); \
|
||||
TREE_SIDE_EFFECTS (WHERE) = 1; \
|
||||
}
|
||||
|
||||
#define BUILD_MONITOR_EXIT(WHERE, ARG) \
|
||||
{ \
|
||||
(WHERE) = build3 (CALL_EXPR, int_type_node, \
|
||||
build_address_of (soft_monitorexit_node), \
|
||||
build_tree_list (NULL_TREE, (ARG)), \
|
||||
NULL_TREE); \
|
||||
TREE_SIDE_EFFECTS (WHERE) = 1; \
|
||||
#define BUILD_MONITOR_EXIT(WHERE, ARG) \
|
||||
{ \
|
||||
(WHERE) = build_call_nary (int_type_node, \
|
||||
build_address_of (soft_monitorexit_node), \
|
||||
1, (ARG)); \
|
||||
TREE_SIDE_EFFECTS (WHERE) = 1; \
|
||||
}
|
||||
|
||||
/* True when we can perform static class initialization optimization */
|
||||
|
|
|
|||
|
|
@ -989,7 +989,7 @@ java_get_callee_fndecl (tree call_expr)
|
|||
|
||||
if (TREE_CODE (call_expr) != CALL_EXPR)
|
||||
return NULL;
|
||||
method = TREE_OPERAND (call_expr, 0);
|
||||
method = CALL_EXPR_FN (call_expr);
|
||||
STRIP_NOPS (method);
|
||||
if (TREE_CODE (method) != ARRAY_REF)
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -116,8 +116,7 @@ write_resource_constructor (tree *list_p)
|
|||
for (iter = nreverse (resources); iter ; iter = TREE_CHAIN (iter))
|
||||
{
|
||||
t = build_fold_addr_expr (TREE_VALUE (iter));
|
||||
t = tree_cons (NULL, t, NULL);
|
||||
t = build_function_call_expr (register_resource_fn, t);
|
||||
t = build_call_expr (register_resource_fn, 1, t);
|
||||
append_to_statement_list (t, list_p);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,10 @@
|
|||
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-01-23 Andrew Pinski <pinskia@gmail.com>
|
||||
|
||||
PR objc/27438
|
||||
|
|
|
|||
|
|
@ -6131,7 +6131,7 @@ receiver_is_class_object (tree receiver, int self, int super)
|
|||
/* The receiver is a function call that returns an id. Check if
|
||||
it is a call to objc_getClass, if so, pick up the class name. */
|
||||
if (TREE_CODE (receiver) == CALL_EXPR
|
||||
&& (exp = TREE_OPERAND (receiver, 0))
|
||||
&& (exp = CALL_EXPR_FN (receiver))
|
||||
&& TREE_CODE (exp) == ADDR_EXPR
|
||||
&& (exp = TREE_OPERAND (exp, 0))
|
||||
&& TREE_CODE (exp) == FUNCTION_DECL
|
||||
|
|
@ -6141,9 +6141,7 @@ receiver_is_class_object (tree receiver, int self, int super)
|
|||
&& TREE_TYPE (exp) == TREE_TYPE (objc_get_class_decl)
|
||||
&& !strcmp (IDENTIFIER_POINTER (DECL_NAME (exp)), TAG_GETCLASS)
|
||||
/* We have a call to objc_get_class/objc_getClass! */
|
||||
&& (arg = TREE_OPERAND (receiver, 1))
|
||||
&& TREE_CODE (arg) == TREE_LIST
|
||||
&& (arg = TREE_VALUE (arg)))
|
||||
&& (arg = CALL_EXPR_ARG (receiver, 0)))
|
||||
{
|
||||
STRIP_NOPS (arg);
|
||||
if (TREE_CODE (arg) == ADDR_EXPR
|
||||
|
|
@ -9517,7 +9515,7 @@ objc_gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p)
|
|||
tree
|
||||
objc_get_callee_fndecl (tree call_expr)
|
||||
{
|
||||
tree addr = TREE_OPERAND (call_expr, 0);
|
||||
tree addr = CALL_EXPR_FN (call_expr);
|
||||
if (TREE_CODE (addr) != OBJ_TYPE_REF)
|
||||
return 0;
|
||||
|
||||
|
|
|
|||
148
gcc/omp-low.c
148
gcc/omp-low.c
|
|
@ -1427,10 +1427,7 @@ scan_omp (tree *stmt_p, omp_context *ctx)
|
|||
static void
|
||||
build_omp_barrier (tree *stmt_list)
|
||||
{
|
||||
tree t;
|
||||
|
||||
t = built_in_decls[BUILT_IN_GOMP_BARRIER];
|
||||
t = build_function_call_expr (t, NULL);
|
||||
tree t = build_call_expr (built_in_decls[BUILT_IN_GOMP_BARRIER], 0);
|
||||
gimplify_and_add (t, stmt_list);
|
||||
}
|
||||
|
||||
|
|
@ -1604,7 +1601,7 @@ lower_rec_input_clauses (tree clauses, tree *ilist, tree *dlist,
|
|||
omp_context *ctx)
|
||||
{
|
||||
tree_stmt_iterator diter;
|
||||
tree c, dtor, copyin_seq, x, args, ptr;
|
||||
tree c, dtor, copyin_seq, x, ptr;
|
||||
bool copyin_by_ref = false;
|
||||
bool lastprivate_firstprivate = false;
|
||||
int pass;
|
||||
|
|
@ -1676,9 +1673,7 @@ lower_rec_input_clauses (tree clauses, tree *ilist, tree *dlist,
|
|||
gcc_assert (DECL_P (ptr));
|
||||
|
||||
x = TYPE_SIZE_UNIT (TREE_TYPE (new_var));
|
||||
args = tree_cons (NULL, x, NULL);
|
||||
x = built_in_decls[BUILT_IN_ALLOCA];
|
||||
x = build_function_call_expr (x, args);
|
||||
x = build_call_expr (built_in_decls[BUILT_IN_ALLOCA], 1, x);
|
||||
x = fold_convert (TREE_TYPE (ptr), x);
|
||||
x = build2 (GIMPLE_MODIFY_STMT, void_type_node, ptr, x);
|
||||
gimplify_and_add (x, ilist);
|
||||
|
|
@ -1710,9 +1705,7 @@ lower_rec_input_clauses (tree clauses, tree *ilist, tree *dlist,
|
|||
}
|
||||
else
|
||||
{
|
||||
args = tree_cons (NULL, x, NULL);
|
||||
x = built_in_decls[BUILT_IN_ALLOCA];
|
||||
x = build_function_call_expr (x, args);
|
||||
x = build_call_expr (built_in_decls[BUILT_IN_ALLOCA], 1, x);
|
||||
x = fold_convert (TREE_TYPE (new_var), x);
|
||||
}
|
||||
|
||||
|
|
@ -1815,8 +1808,7 @@ lower_rec_input_clauses (tree clauses, tree *ilist, tree *dlist,
|
|||
but it certainly is to C++ operator=. */
|
||||
if (copyin_seq)
|
||||
{
|
||||
x = built_in_decls[BUILT_IN_OMP_GET_THREAD_NUM];
|
||||
x = build_function_call_expr (x, NULL);
|
||||
x = build_call_expr (built_in_decls[BUILT_IN_OMP_GET_THREAD_NUM], 0);
|
||||
x = build2 (NE_EXPR, boolean_type_node, x,
|
||||
build_int_cst (TREE_TYPE (x), 0));
|
||||
x = build3 (COND_EXPR, void_type_node, x, copyin_seq, NULL);
|
||||
|
|
@ -1969,14 +1961,12 @@ lower_reduction_clauses (tree clauses, tree *stmt_list, omp_context *ctx)
|
|||
}
|
||||
}
|
||||
|
||||
x = built_in_decls[BUILT_IN_GOMP_ATOMIC_START];
|
||||
x = build_function_call_expr (x, NULL);
|
||||
x = build_call_expr (built_in_decls[BUILT_IN_GOMP_ATOMIC_START], 0);
|
||||
gimplify_and_add (x, stmt_list);
|
||||
|
||||
gimplify_and_add (sub_list, stmt_list);
|
||||
|
||||
x = built_in_decls[BUILT_IN_GOMP_ATOMIC_END];
|
||||
x = build_function_call_expr (x, NULL);
|
||||
x = build_call_expr (built_in_decls[BUILT_IN_GOMP_ATOMIC_END], 0);
|
||||
gimplify_and_add (x, stmt_list);
|
||||
}
|
||||
|
||||
|
|
@ -2155,7 +2145,7 @@ static void
|
|||
expand_parallel_call (struct omp_region *region, basic_block bb,
|
||||
tree entry_stmt, tree ws_args)
|
||||
{
|
||||
tree t, args, val, cond, c, list, clauses;
|
||||
tree t, t1, t2, val, cond, c, list, clauses;
|
||||
block_stmt_iterator si;
|
||||
int start_ix;
|
||||
|
||||
|
|
@ -2261,21 +2251,23 @@ expand_parallel_call (struct omp_region *region, basic_block bb,
|
|||
}
|
||||
|
||||
list = NULL_TREE;
|
||||
args = tree_cons (NULL, val, NULL);
|
||||
t = OMP_PARALLEL_DATA_ARG (entry_stmt);
|
||||
if (t == NULL)
|
||||
t = null_pointer_node;
|
||||
t1 = null_pointer_node;
|
||||
else
|
||||
t = build_fold_addr_expr (t);
|
||||
args = tree_cons (NULL, t, args);
|
||||
t = build_fold_addr_expr (OMP_PARALLEL_FN (entry_stmt));
|
||||
args = tree_cons (NULL, t, args);
|
||||
t1 = build_fold_addr_expr (t);
|
||||
t2 = build_fold_addr_expr (OMP_PARALLEL_FN (entry_stmt));
|
||||
|
||||
if (ws_args)
|
||||
args = chainon (args, ws_args);
|
||||
{
|
||||
tree args = tree_cons (NULL, t2,
|
||||
tree_cons (NULL, t1,
|
||||
tree_cons (NULL, val, ws_args)));
|
||||
t = build_function_call_expr (built_in_decls[start_ix], args);
|
||||
}
|
||||
else
|
||||
t = build_call_expr (built_in_decls[start_ix], 3, t2, t1, val);
|
||||
|
||||
t = built_in_decls[start_ix];
|
||||
t = build_function_call_expr (t, args);
|
||||
gimplify_and_add (t, &list);
|
||||
|
||||
t = OMP_PARALLEL_DATA_ARG (entry_stmt);
|
||||
|
|
@ -2283,12 +2275,10 @@ expand_parallel_call (struct omp_region *region, basic_block bb,
|
|||
t = null_pointer_node;
|
||||
else
|
||||
t = build_fold_addr_expr (t);
|
||||
args = tree_cons (NULL, t, NULL);
|
||||
t = build_function_call_expr (OMP_PARALLEL_FN (entry_stmt), args);
|
||||
t = build_call_expr (OMP_PARALLEL_FN (entry_stmt), 1, t);
|
||||
gimplify_and_add (t, &list);
|
||||
|
||||
t = built_in_decls[BUILT_IN_GOMP_PARALLEL_END];
|
||||
t = build_function_call_expr (t, NULL);
|
||||
t = build_call_expr (built_in_decls[BUILT_IN_GOMP_PARALLEL_END], 0);
|
||||
gimplify_and_add (t, &list);
|
||||
|
||||
si = bsi_last (bb);
|
||||
|
|
@ -2313,10 +2303,7 @@ maybe_catch_exception (tree *stmt_p)
|
|||
if (lang_protect_cleanup_actions)
|
||||
t = lang_protect_cleanup_actions ();
|
||||
else
|
||||
{
|
||||
t = built_in_decls[BUILT_IN_TRAP];
|
||||
t = build_function_call_expr (t, NULL);
|
||||
}
|
||||
t = build_call_expr (built_in_decls[BUILT_IN_TRAP], 0);
|
||||
f = build2 (EH_FILTER_EXPR, void_type_node, NULL, NULL);
|
||||
EH_FILTER_MUST_NOT_THROW (f) = 1;
|
||||
gimplify_and_add (t, &EH_FILTER_FAILURE (f));
|
||||
|
|
@ -2583,7 +2570,7 @@ expand_omp_for_generic (struct omp_region *region,
|
|||
{
|
||||
tree l0, l1, l2 = NULL, l3 = NULL;
|
||||
tree type, istart0, iend0, iend;
|
||||
tree t, args, list;
|
||||
tree t, list;
|
||||
basic_block entry_bb, cont_bb, exit_bb, l0_bb, l1_bb;
|
||||
basic_block l2_bb = NULL, l3_bb = NULL;
|
||||
block_stmt_iterator si;
|
||||
|
|
@ -2621,25 +2608,24 @@ expand_omp_for_generic (struct omp_region *region,
|
|||
gcc_assert (TREE_CODE (bsi_stmt (si)) == OMP_FOR);
|
||||
if (!in_combined_parallel)
|
||||
{
|
||||
tree t0, t1, t2, t3, t4;
|
||||
/* If this is not a combined parallel loop, emit a call to
|
||||
GOMP_loop_foo_start in ENTRY_BB. */
|
||||
list = alloc_stmt_list ();
|
||||
t = build_fold_addr_expr (iend0);
|
||||
args = tree_cons (NULL, t, NULL);
|
||||
t = build_fold_addr_expr (istart0);
|
||||
args = tree_cons (NULL, t, args);
|
||||
t4 = build_fold_addr_expr (iend0);
|
||||
t3 = build_fold_addr_expr (istart0);
|
||||
t2 = fold_convert (long_integer_type_node, fd->step);
|
||||
t1 = fold_convert (long_integer_type_node, fd->n2);
|
||||
t0 = fold_convert (long_integer_type_node, fd->n1);
|
||||
if (fd->chunk_size)
|
||||
{
|
||||
t = fold_convert (long_integer_type_node, fd->chunk_size);
|
||||
args = tree_cons (NULL, t, args);
|
||||
t = build_call_expr (built_in_decls[start_fn], 6,
|
||||
t0, t1, t2, t, t3, t4);
|
||||
}
|
||||
t = fold_convert (long_integer_type_node, fd->step);
|
||||
args = tree_cons (NULL, t, args);
|
||||
t = fold_convert (long_integer_type_node, fd->n2);
|
||||
args = tree_cons (NULL, t, args);
|
||||
t = fold_convert (long_integer_type_node, fd->n1);
|
||||
args = tree_cons (NULL, t, args);
|
||||
t = build_function_call_expr (built_in_decls[start_fn], args);
|
||||
else
|
||||
t = build_call_expr (built_in_decls[start_fn], 5,
|
||||
t0, t1, t2, t3, t4);
|
||||
t = get_formal_tmp_var (t, &list);
|
||||
if (cont_bb)
|
||||
{
|
||||
|
|
@ -2697,11 +2683,9 @@ expand_omp_for_generic (struct omp_region *region,
|
|||
/* Emit code to get the next parallel iteration in L2_BB. */
|
||||
list = alloc_stmt_list ();
|
||||
|
||||
t = build_fold_addr_expr (iend0);
|
||||
args = tree_cons (NULL, t, NULL);
|
||||
t = build_fold_addr_expr (istart0);
|
||||
args = tree_cons (NULL, t, args);
|
||||
t = build_function_call_expr (built_in_decls[next_fn], args);
|
||||
t = build_call_expr (built_in_decls[next_fn], 2,
|
||||
build_fold_addr_expr (istart0),
|
||||
build_fold_addr_expr (iend0));
|
||||
t = get_formal_tmp_var (t, &list);
|
||||
t = build3 (COND_EXPR, void_type_node, t, build_and_jump (&l0),
|
||||
build_and_jump (&l3));
|
||||
|
|
@ -2716,7 +2700,7 @@ expand_omp_for_generic (struct omp_region *region,
|
|||
t = built_in_decls[BUILT_IN_GOMP_LOOP_END_NOWAIT];
|
||||
else
|
||||
t = built_in_decls[BUILT_IN_GOMP_LOOP_END];
|
||||
t = build_function_call_expr (t, NULL);
|
||||
t = build_call_expr (t, 0);
|
||||
bsi_insert_after (&si, t, BSI_SAME_STMT);
|
||||
bsi_remove (&si, true);
|
||||
|
||||
|
|
@ -2795,13 +2779,11 @@ expand_omp_for_static_nochunk (struct omp_region *region,
|
|||
/* Iteration space partitioning goes in ENTRY_BB. */
|
||||
list = alloc_stmt_list ();
|
||||
|
||||
t = built_in_decls[BUILT_IN_OMP_GET_NUM_THREADS];
|
||||
t = build_function_call_expr (t, NULL);
|
||||
t = build_call_expr (built_in_decls[BUILT_IN_OMP_GET_NUM_THREADS], 0);
|
||||
t = fold_convert (type, t);
|
||||
nthreads = get_formal_tmp_var (t, &list);
|
||||
|
||||
t = built_in_decls[BUILT_IN_OMP_GET_THREAD_NUM];
|
||||
t = build_function_call_expr (t, NULL);
|
||||
t = build_call_expr (built_in_decls[BUILT_IN_OMP_GET_THREAD_NUM], 0);
|
||||
t = fold_convert (type, t);
|
||||
threadid = get_formal_tmp_var (t, &list);
|
||||
|
||||
|
|
@ -2972,13 +2954,11 @@ expand_omp_for_static_chunk (struct omp_region *region, struct omp_for_data *fd)
|
|||
/* Trip and adjustment setup goes in ENTRY_BB. */
|
||||
list = alloc_stmt_list ();
|
||||
|
||||
t = built_in_decls[BUILT_IN_OMP_GET_NUM_THREADS];
|
||||
t = build_function_call_expr (t, NULL);
|
||||
t = build_call_expr (built_in_decls[BUILT_IN_OMP_GET_NUM_THREADS], 0);
|
||||
t = fold_convert (type, t);
|
||||
nthreads = get_formal_tmp_var (t, &list);
|
||||
|
||||
t = built_in_decls[BUILT_IN_OMP_GET_THREAD_NUM];
|
||||
t = build_function_call_expr (t, NULL);
|
||||
t = build_call_expr (built_in_decls[BUILT_IN_OMP_GET_THREAD_NUM], 0);
|
||||
t = fold_convert (type, t);
|
||||
threadid = get_formal_tmp_var (t, &list);
|
||||
|
||||
|
|
@ -3224,9 +3204,8 @@ expand_omp_sections (struct omp_region *region)
|
|||
/* If we are not inside a combined parallel+sections region,
|
||||
call GOMP_sections_start. */
|
||||
t = build_int_cst (unsigned_type_node, len);
|
||||
t = tree_cons (NULL, t, NULL);
|
||||
u = built_in_decls[BUILT_IN_GOMP_SECTIONS_START];
|
||||
t = build_function_call_expr (u, t);
|
||||
t = build_call_expr (u, 1, t);
|
||||
t = build2 (GIMPLE_MODIFY_STMT, void_type_node, v, t);
|
||||
bsi_insert_after (&si, t, BSI_SAME_STMT);
|
||||
}
|
||||
|
|
@ -3284,8 +3263,7 @@ expand_omp_sections (struct omp_region *region)
|
|||
make_edge (l0_bb, default_bb, 0);
|
||||
|
||||
si = bsi_start (default_bb);
|
||||
t = built_in_decls[BUILT_IN_TRAP];
|
||||
t = build_function_call_expr (t, NULL);
|
||||
t = build_call_expr (built_in_decls[BUILT_IN_TRAP], 0);
|
||||
bsi_insert_after (&si, t, BSI_CONTINUE_LINKING);
|
||||
|
||||
/* Code to get the next section goes in L1_BB. */
|
||||
|
|
@ -3294,8 +3272,7 @@ expand_omp_sections (struct omp_region *region)
|
|||
si = bsi_last (l1_bb);
|
||||
gcc_assert (TREE_CODE (bsi_stmt (si)) == OMP_CONTINUE);
|
||||
|
||||
t = built_in_decls[BUILT_IN_GOMP_SECTIONS_NEXT];
|
||||
t = build_function_call_expr (t, NULL);
|
||||
t = build_call_expr (built_in_decls[BUILT_IN_GOMP_SECTIONS_NEXT], 0);
|
||||
t = build2 (GIMPLE_MODIFY_STMT, void_type_node, v, t);
|
||||
bsi_insert_after (&si, t, BSI_SAME_STMT);
|
||||
bsi_remove (&si, true);
|
||||
|
|
@ -3309,7 +3286,7 @@ expand_omp_sections (struct omp_region *region)
|
|||
t = built_in_decls[BUILT_IN_GOMP_SECTIONS_END_NOWAIT];
|
||||
else
|
||||
t = built_in_decls[BUILT_IN_GOMP_SECTIONS_END];
|
||||
t = build_function_call_expr (t, NULL);
|
||||
t = build_call_expr (t, 0);
|
||||
bsi_insert_after (&si, t, BSI_SAME_STMT);
|
||||
bsi_remove (&si, true);
|
||||
}
|
||||
|
|
@ -3680,8 +3657,7 @@ lower_omp_single_simple (tree single_stmt, tree *pre_p)
|
|||
{
|
||||
tree t;
|
||||
|
||||
t = built_in_decls[BUILT_IN_GOMP_SINGLE_START];
|
||||
t = build_function_call_expr (t, NULL);
|
||||
t = build_call_expr (built_in_decls[BUILT_IN_GOMP_SINGLE_START], 0);
|
||||
t = build3 (COND_EXPR, void_type_node, t,
|
||||
OMP_SINGLE_BODY (single_stmt), NULL);
|
||||
gimplify_and_add (t, pre_p);
|
||||
|
|
@ -3720,7 +3696,7 @@ lower_omp_single_simple (tree single_stmt, tree *pre_p)
|
|||
static void
|
||||
lower_omp_single_copy (tree single_stmt, tree *pre_p, omp_context *ctx)
|
||||
{
|
||||
tree ptr_type, t, args, l0, l1, l2, copyin_seq;
|
||||
tree ptr_type, t, l0, l1, l2, copyin_seq;
|
||||
|
||||
ctx->sender_decl = create_tmp_var (ctx->record_type, ".omp_copy_o");
|
||||
|
||||
|
|
@ -3731,8 +3707,7 @@ lower_omp_single_copy (tree single_stmt, tree *pre_p, omp_context *ctx)
|
|||
l1 = create_artificial_label ();
|
||||
l2 = create_artificial_label ();
|
||||
|
||||
t = built_in_decls[BUILT_IN_GOMP_SINGLE_COPY_START];
|
||||
t = build_function_call_expr (t, NULL);
|
||||
t = build_call_expr (built_in_decls[BUILT_IN_GOMP_SINGLE_COPY_START], 0);
|
||||
t = fold_convert (ptr_type, t);
|
||||
t = build2 (GIMPLE_MODIFY_STMT, void_type_node, ctx->receiver_decl, t);
|
||||
gimplify_and_add (t, pre_p);
|
||||
|
|
@ -3753,9 +3728,7 @@ lower_omp_single_copy (tree single_stmt, tree *pre_p, omp_context *ctx)
|
|||
©in_seq, ctx);
|
||||
|
||||
t = build_fold_addr_expr (ctx->sender_decl);
|
||||
args = tree_cons (NULL, t, NULL);
|
||||
t = built_in_decls[BUILT_IN_GOMP_SINGLE_COPY_END];
|
||||
t = build_function_call_expr (t, args);
|
||||
t = build_call_expr (built_in_decls[BUILT_IN_GOMP_SINGLE_COPY_END], 1, t);
|
||||
gimplify_and_add (t, pre_p);
|
||||
|
||||
t = build_and_jump (&l2);
|
||||
|
|
@ -3828,8 +3801,7 @@ lower_omp_master (tree *stmt_p, omp_context *ctx)
|
|||
|
||||
append_to_statement_list (stmt, &BIND_EXPR_BODY (bind));
|
||||
|
||||
x = built_in_decls[BUILT_IN_OMP_GET_THREAD_NUM];
|
||||
x = build_function_call_expr (x, NULL);
|
||||
x = build_call_expr (built_in_decls[BUILT_IN_OMP_GET_THREAD_NUM], 0);
|
||||
x = build2 (EQ_EXPR, boolean_type_node, x, integer_zero_node);
|
||||
x = build3 (COND_EXPR, void_type_node, x, NULL, build_and_jump (&lab));
|
||||
gimplify_and_add (x, &BIND_EXPR_BODY (bind));
|
||||
|
|
@ -3868,8 +3840,7 @@ lower_omp_ordered (tree *stmt_p, omp_context *ctx)
|
|||
|
||||
append_to_statement_list (stmt, &BIND_EXPR_BODY (bind));
|
||||
|
||||
x = built_in_decls[BUILT_IN_GOMP_ORDERED_START];
|
||||
x = build_function_call_expr (x, NULL);
|
||||
x = build_call_expr (built_in_decls[BUILT_IN_GOMP_ORDERED_START], 0);
|
||||
gimplify_and_add (x, &BIND_EXPR_BODY (bind));
|
||||
|
||||
lower_omp (&OMP_ORDERED_BODY (stmt), ctx);
|
||||
|
|
@ -3877,8 +3848,7 @@ lower_omp_ordered (tree *stmt_p, omp_context *ctx)
|
|||
append_to_statement_list (OMP_ORDERED_BODY (stmt), &BIND_EXPR_BODY (bind));
|
||||
OMP_ORDERED_BODY (stmt) = NULL;
|
||||
|
||||
x = built_in_decls[BUILT_IN_GOMP_ORDERED_END];
|
||||
x = build_function_call_expr (x, NULL);
|
||||
x = build_call_expr (built_in_decls[BUILT_IN_GOMP_ORDERED_END], 0);
|
||||
gimplify_and_add (x, &BIND_EXPR_BODY (bind));
|
||||
|
||||
x = make_node (OMP_RETURN);
|
||||
|
|
@ -3909,7 +3879,7 @@ lower_omp_critical (tree *stmt_p, omp_context *ctx)
|
|||
name = OMP_CRITICAL_NAME (stmt);
|
||||
if (name)
|
||||
{
|
||||
tree decl, args;
|
||||
tree decl;
|
||||
splay_tree_node n;
|
||||
|
||||
if (!critical_name_mutexes)
|
||||
|
|
@ -3939,21 +3909,19 @@ lower_omp_critical (tree *stmt_p, omp_context *ctx)
|
|||
else
|
||||
decl = (tree) n->value;
|
||||
|
||||
args = tree_cons (NULL, build_fold_addr_expr (decl), NULL);
|
||||
lock = built_in_decls[BUILT_IN_GOMP_CRITICAL_NAME_START];
|
||||
lock = build_function_call_expr (lock, args);
|
||||
lock = build_call_expr (lock, 1, build_fold_addr_expr (decl));
|
||||
|
||||
args = tree_cons (NULL, build_fold_addr_expr (decl), NULL);
|
||||
unlock = built_in_decls[BUILT_IN_GOMP_CRITICAL_NAME_END];
|
||||
unlock = build_function_call_expr (unlock, args);
|
||||
unlock = build_call_expr (unlock, 1, build_fold_addr_expr (decl));
|
||||
}
|
||||
else
|
||||
{
|
||||
lock = built_in_decls[BUILT_IN_GOMP_CRITICAL_START];
|
||||
lock = build_function_call_expr (lock, NULL);
|
||||
lock = build_call_expr (lock, 0);
|
||||
|
||||
unlock = built_in_decls[BUILT_IN_GOMP_CRITICAL_END];
|
||||
unlock = build_function_call_expr (unlock, NULL);
|
||||
unlock = build_call_expr (unlock, 0);
|
||||
}
|
||||
|
||||
push_gimplify_context ();
|
||||
|
|
|
|||
|
|
@ -410,7 +410,7 @@ expand_widen_pattern_expr (tree exp, rtx op0, rtx op1, rtx wide_op, rtx target,
|
|||
rtx temp;
|
||||
rtx pat;
|
||||
rtx xop0, xop1, wxop;
|
||||
int nops = TREE_CODE_LENGTH (TREE_CODE (exp));
|
||||
int nops = TREE_OPERAND_LENGTH (exp);
|
||||
|
||||
oprnd0 = TREE_OPERAND (exp, 0);
|
||||
tmode0 = TYPE_MODE (TREE_TYPE (oprnd0));
|
||||
|
|
|
|||
|
|
@ -913,16 +913,14 @@ expr_expected_value (tree expr, bitmap visited)
|
|||
if (DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL
|
||||
&& DECL_FUNCTION_CODE (decl) == BUILT_IN_EXPECT)
|
||||
{
|
||||
tree arglist = TREE_OPERAND (expr, 1);
|
||||
tree val;
|
||||
|
||||
if (arglist == NULL_TREE
|
||||
|| TREE_CHAIN (arglist) == NULL_TREE)
|
||||
return NULL;
|
||||
val = TREE_VALUE (TREE_CHAIN (TREE_OPERAND (expr, 1)));
|
||||
if (call_expr_nargs (expr) != 2)
|
||||
return NULL;
|
||||
val = CALL_EXPR_ARG (expr, 0);
|
||||
if (TREE_CONSTANT (val))
|
||||
return val;
|
||||
return TREE_VALUE (TREE_CHAIN (TREE_OPERAND (expr, 1)));
|
||||
return CALL_EXPR_ARG (expr, 1);
|
||||
}
|
||||
}
|
||||
if (BINARY_CLASS_P (expr) || COMPARISON_CLASS_P (expr))
|
||||
|
|
@ -965,17 +963,17 @@ strip_builtin_expect (void)
|
|||
{
|
||||
tree stmt = bsi_stmt (bi);
|
||||
tree fndecl;
|
||||
tree arglist;
|
||||
tree call;
|
||||
|
||||
if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
|
||||
&& TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)) == CALL_EXPR
|
||||
&& (fndecl = get_callee_fndecl (GIMPLE_STMT_OPERAND (stmt, 1)))
|
||||
&& (call = GIMPLE_STMT_OPERAND (stmt, 1))
|
||||
&& TREE_CODE (call) == CALL_EXPR
|
||||
&& (fndecl = get_callee_fndecl (call))
|
||||
&& DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
|
||||
&& DECL_FUNCTION_CODE (fndecl) == BUILT_IN_EXPECT
|
||||
&& (arglist = TREE_OPERAND (GIMPLE_STMT_OPERAND (stmt, 1), 1))
|
||||
&& TREE_CHAIN (arglist))
|
||||
&& call_expr_nargs (call) == 2)
|
||||
{
|
||||
GIMPLE_STMT_OPERAND (stmt, 1) = TREE_VALUE (arglist);
|
||||
GIMPLE_STMT_OPERAND (stmt, 1) = CALL_EXPR_ARG (call, 0);
|
||||
update_stmt (stmt);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -661,6 +661,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
|
|||
case tcc_binary:
|
||||
case tcc_reference:
|
||||
case tcc_statement:
|
||||
case tcc_vl_exp:
|
||||
if (TREE_CODE (node) == BIT_FIELD_REF && BIT_FIELD_REF_UNSIGNED (node))
|
||||
fputs (" unsigned", file);
|
||||
if (TREE_CODE (node) == BIND_EXPR)
|
||||
|
|
@ -670,17 +671,34 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
|
|||
print_node (file, "block", TREE_OPERAND (node, 2), indent + 4);
|
||||
break;
|
||||
}
|
||||
|
||||
len = TREE_CODE_LENGTH (TREE_CODE (node));
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
if (TREE_CODE (node) == CALL_EXPR)
|
||||
{
|
||||
char temp[10];
|
||||
|
||||
sprintf (temp, "arg %d", i);
|
||||
print_node (file, temp, TREE_OPERAND (node, i), indent + 4);
|
||||
call_expr_arg_iterator iter;
|
||||
tree arg;
|
||||
print_node (file, "fn", CALL_EXPR_FN (node), indent + 4);
|
||||
print_node (file, "static_chain", CALL_EXPR_STATIC_CHAIN (node),
|
||||
indent + 4);
|
||||
i = 0;
|
||||
FOR_EACH_CALL_EXPR_ARG (arg, iter, node)
|
||||
{
|
||||
char temp[10];
|
||||
sprintf (temp, "arg %d", i);
|
||||
print_node (file, temp, arg, indent + 4);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
len = TREE_OPERAND_LENGTH (node);
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
char temp[10];
|
||||
|
||||
sprintf (temp, "arg %d", i);
|
||||
print_node (file, temp, TREE_OPERAND (node, i), indent + 4);
|
||||
}
|
||||
}
|
||||
print_node (file, "chain", TREE_CHAIN (node), indent + 4);
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -1477,7 +1477,7 @@ warn_if_unused_value (tree exp, location_t locus)
|
|||
/* If this is an expression which has no operands, there is no value
|
||||
to be unused. There are no such language-independent codes,
|
||||
but front ends may define such. */
|
||||
if (EXPRESSION_CLASS_P (exp) && TREE_CODE_LENGTH (TREE_CODE (exp)) == 0)
|
||||
if (EXPRESSION_CLASS_P (exp) && TREE_OPERAND_LENGTH (exp) == 0)
|
||||
return 0;
|
||||
|
||||
warn:
|
||||
|
|
|
|||
|
|
@ -432,7 +432,7 @@ default_external_stack_protect_fail (void)
|
|||
stack_chk_fail_decl = t;
|
||||
}
|
||||
|
||||
return build_function_call_expr (t, NULL_TREE);
|
||||
return build_call_expr (t, 0);
|
||||
}
|
||||
|
||||
tree
|
||||
|
|
@ -465,7 +465,7 @@ default_hidden_stack_protect_fail (void)
|
|||
stack_chk_fail_decl = t;
|
||||
}
|
||||
|
||||
return build_function_call_expr (t, NULL_TREE);
|
||||
return build_call_expr (t, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -730,45 +730,16 @@ store_child_info (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
|
|||
node = *tp;
|
||||
|
||||
/* 'node' is the parent of 'TREE_OPERAND (node, *)'. */
|
||||
if (EXPRESSION_CLASS_P (node))
|
||||
if (EXPR_P (node))
|
||||
{
|
||||
|
||||
#define STORE_CHILD(N) do { \
|
||||
tree op = TREE_OPERAND (node, N); \
|
||||
slot = htab_find_slot (TB_up_ht, op, INSERT); \
|
||||
*slot = (void *) node; \
|
||||
} while (0)
|
||||
|
||||
switch (TREE_CODE_LENGTH (TREE_CODE (node)))
|
||||
int n = TREE_OPERAND_LENGTH (node);
|
||||
int i;
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
case 4:
|
||||
STORE_CHILD (0);
|
||||
STORE_CHILD (1);
|
||||
STORE_CHILD (2);
|
||||
STORE_CHILD (3);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
STORE_CHILD (0);
|
||||
STORE_CHILD (1);
|
||||
STORE_CHILD (2);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
STORE_CHILD (0);
|
||||
STORE_CHILD (1);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
STORE_CHILD (0);
|
||||
break;
|
||||
|
||||
case 0:
|
||||
default:
|
||||
/* No children: nothing to do. */
|
||||
break;
|
||||
tree op = TREE_OPERAND (node, i);
|
||||
slot = htab_find_slot (TB_up_ht, op, INSERT);
|
||||
*slot = (void *) node;
|
||||
}
|
||||
#undef STORE_CHILD
|
||||
}
|
||||
|
||||
/* Never stop walk_tree. */
|
||||
|
|
@ -787,46 +758,14 @@ TB_parent_eq (const void *p1, const void *p2)
|
|||
if (p1 == NULL || p2 == NULL)
|
||||
return 0;
|
||||
|
||||
if (EXPRESSION_CLASS_P (parent))
|
||||
if (EXPR_P (parent))
|
||||
{
|
||||
|
||||
#define TEST_CHILD(N) do { \
|
||||
if (node == TREE_OPERAND (parent, N)) \
|
||||
return 1; \
|
||||
} while (0)
|
||||
|
||||
switch (TREE_CODE_LENGTH (TREE_CODE (parent)))
|
||||
{
|
||||
case 4:
|
||||
TEST_CHILD (0);
|
||||
TEST_CHILD (1);
|
||||
TEST_CHILD (2);
|
||||
TEST_CHILD (3);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
TEST_CHILD (0);
|
||||
TEST_CHILD (1);
|
||||
TEST_CHILD (2);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
TEST_CHILD (0);
|
||||
TEST_CHILD (1);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
TEST_CHILD (0);
|
||||
break;
|
||||
|
||||
case 0:
|
||||
default:
|
||||
/* No children: nothing to do. */
|
||||
break;
|
||||
}
|
||||
#undef TEST_CHILD
|
||||
int n = TREE_OPERAND_LENGTH (parent);
|
||||
int i;
|
||||
for (i = 0; i < n; i++)
|
||||
if (node == TREE_OPERAND (parent, i))
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -860,6 +860,8 @@ is_multivariate_chrec (tree chrec)
|
|||
bool
|
||||
chrec_contains_symbols (tree chrec)
|
||||
{
|
||||
int i, n;
|
||||
|
||||
if (chrec == NULL_TREE)
|
||||
return false;
|
||||
|
||||
|
|
@ -871,24 +873,12 @@ chrec_contains_symbols (tree chrec)
|
|||
|| TREE_CODE (chrec) == RESULT_DECL
|
||||
|| TREE_CODE (chrec) == FIELD_DECL)
|
||||
return true;
|
||||
|
||||
switch (TREE_CODE_LENGTH (TREE_CODE (chrec)))
|
||||
{
|
||||
case 3:
|
||||
if (chrec_contains_symbols (TREE_OPERAND (chrec, 2)))
|
||||
return true;
|
||||
|
||||
case 2:
|
||||
if (chrec_contains_symbols (TREE_OPERAND (chrec, 1)))
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
if (chrec_contains_symbols (TREE_OPERAND (chrec, 0)))
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
n = TREE_OPERAND_LENGTH (chrec);
|
||||
for (i = 0; i < n; i++)
|
||||
if (chrec_contains_symbols (TREE_OPERAND (chrec, i)))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Determines whether the chrec contains undetermined coefficients. */
|
||||
|
|
@ -896,28 +886,18 @@ chrec_contains_symbols (tree chrec)
|
|||
bool
|
||||
chrec_contains_undetermined (tree chrec)
|
||||
{
|
||||
int i, n;
|
||||
|
||||
if (chrec == chrec_dont_know
|
||||
|| chrec == chrec_not_analyzed_yet
|
||||
|| chrec == NULL_TREE)
|
||||
return true;
|
||||
|
||||
switch (TREE_CODE_LENGTH (TREE_CODE (chrec)))
|
||||
{
|
||||
case 3:
|
||||
if (chrec_contains_undetermined (TREE_OPERAND (chrec, 2)))
|
||||
return true;
|
||||
|
||||
case 2:
|
||||
if (chrec_contains_undetermined (TREE_OPERAND (chrec, 1)))
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
if (chrec_contains_undetermined (TREE_OPERAND (chrec, 0)))
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
n = TREE_OPERAND_LENGTH (chrec);
|
||||
for (i = 0; i < n; i++)
|
||||
if (chrec_contains_undetermined (TREE_OPERAND (chrec, i)))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Determines whether the tree EXPR contains chrecs, and increment
|
||||
|
|
@ -927,6 +907,8 @@ chrec_contains_undetermined (tree chrec)
|
|||
bool
|
||||
tree_contains_chrecs (tree expr, int *size)
|
||||
{
|
||||
int i, n;
|
||||
|
||||
if (expr == NULL_TREE)
|
||||
return false;
|
||||
|
||||
|
|
@ -936,23 +918,11 @@ tree_contains_chrecs (tree expr, int *size)
|
|||
if (tree_is_chrec (expr))
|
||||
return true;
|
||||
|
||||
switch (TREE_CODE_LENGTH (TREE_CODE (expr)))
|
||||
{
|
||||
case 3:
|
||||
if (tree_contains_chrecs (TREE_OPERAND (expr, 2), size))
|
||||
return true;
|
||||
|
||||
case 2:
|
||||
if (tree_contains_chrecs (TREE_OPERAND (expr, 1), size))
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
if (tree_contains_chrecs (TREE_OPERAND (expr, 0), size))
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
n = TREE_OPERAND_LENGTH (expr);
|
||||
for (i = 0; i < n; i++)
|
||||
if (tree_contains_chrecs (TREE_OPERAND (expr, i), size))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Recursive helper function. */
|
||||
|
|
@ -978,7 +948,7 @@ evolution_function_is_invariant_rec_p (tree chrec, int loopnum)
|
|||
return true;
|
||||
}
|
||||
|
||||
switch (TREE_CODE_LENGTH (TREE_CODE (chrec)))
|
||||
switch (TREE_OPERAND_LENGTH (chrec))
|
||||
{
|
||||
case 2:
|
||||
if (!evolution_function_is_invariant_rec_p (TREE_OPERAND (chrec, 1),
|
||||
|
|
|
|||
|
|
@ -885,12 +885,7 @@ expand_complex_libcall (block_stmt_iterator *bsi, tree ar, tree ai,
|
|||
{
|
||||
enum machine_mode mode;
|
||||
enum built_in_function bcode;
|
||||
tree args, fn, stmt, type;
|
||||
|
||||
args = tree_cons (NULL, bi, NULL);
|
||||
args = tree_cons (NULL, br, args);
|
||||
args = tree_cons (NULL, ai, args);
|
||||
args = tree_cons (NULL, ar, args);
|
||||
tree fn, stmt, type;
|
||||
|
||||
stmt = bsi_stmt (*bsi);
|
||||
type = TREE_TYPE (GIMPLE_STMT_OPERAND (stmt, 1));
|
||||
|
|
@ -905,8 +900,7 @@ expand_complex_libcall (block_stmt_iterator *bsi, tree ar, tree ai,
|
|||
gcc_unreachable ();
|
||||
fn = built_in_decls[bcode];
|
||||
|
||||
GIMPLE_STMT_OPERAND (stmt, 1)
|
||||
= build3 (CALL_EXPR, type, build_fold_addr_expr (fn), args, NULL);
|
||||
GIMPLE_STMT_OPERAND (stmt, 1) = build_call_expr (fn, 4, ar, ai, br, bi);
|
||||
update_stmt (stmt);
|
||||
|
||||
if (gimple_in_ssa_p (cfun))
|
||||
|
|
|
|||
|
|
@ -4249,7 +4249,8 @@ get_references_in_stmt (tree stmt, VEC (data_ref_loc, heap) **references)
|
|||
{
|
||||
bool clobbers_memory = false;
|
||||
data_ref_loc *ref;
|
||||
tree *op0, *op1, args, call;
|
||||
tree *op0, *op1, arg, call;
|
||||
call_expr_arg_iterator iter;
|
||||
|
||||
*references = NULL;
|
||||
|
||||
|
|
@ -4290,9 +4291,9 @@ get_references_in_stmt (tree stmt, VEC (data_ref_loc, heap) **references)
|
|||
|
||||
if (call)
|
||||
{
|
||||
for (args = TREE_OPERAND (call, 1); args; args = TREE_CHAIN (args))
|
||||
FOR_EACH_CALL_EXPR_ARG (arg, iter, call)
|
||||
{
|
||||
op0 = &TREE_VALUE (args);
|
||||
op0 = &arg;
|
||||
if (DECL_P (*op0)
|
||||
|| REFERENCE_CLASS_P (*op0))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -607,8 +607,19 @@ dequeue_and_dump (dump_info_p di)
|
|||
break;
|
||||
|
||||
case CALL_EXPR:
|
||||
dump_child ("fn", TREE_OPERAND (t, 0));
|
||||
dump_child ("args", TREE_OPERAND (t, 1));
|
||||
{
|
||||
int i = 0;
|
||||
tree arg;
|
||||
call_expr_arg_iterator iter;
|
||||
dump_child ("fn", CALL_EXPR_FN (t));
|
||||
FOR_EACH_CALL_EXPR_ARG (arg, iter, t)
|
||||
{
|
||||
char buffer[32];
|
||||
sprintf (buffer, "%u", i);
|
||||
dump_child (buffer, arg);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case CONSTRUCTOR:
|
||||
|
|
|
|||
|
|
@ -420,7 +420,7 @@ is_gimple_cast (tree t)
|
|||
|| TREE_CODE (t) == FIX_TRUNC_EXPR);
|
||||
}
|
||||
|
||||
/* Return true if T is a valid op0 of a CALL_EXPR. */
|
||||
/* Return true if T is a valid function operand of a CALL_EXPR. */
|
||||
|
||||
bool
|
||||
is_gimple_call_addr (tree t)
|
||||
|
|
@ -474,7 +474,7 @@ void
|
|||
recalculate_side_effects (tree t)
|
||||
{
|
||||
enum tree_code code = TREE_CODE (t);
|
||||
int len = TREE_CODE_LENGTH (code);
|
||||
int len = TREE_OPERAND_LENGTH (t);
|
||||
int i;
|
||||
|
||||
switch (TREE_CODE_CLASS (code))
|
||||
|
|
@ -502,6 +502,7 @@ recalculate_side_effects (tree t)
|
|||
case tcc_unary: /* a unary arithmetic expression */
|
||||
case tcc_binary: /* a binary arithmetic expression */
|
||||
case tcc_reference: /* a reference */
|
||||
case tcc_vl_exp: /* a function call */
|
||||
TREE_SIDE_EFFECTS (t) = TREE_THIS_VOLATILE (t);
|
||||
for (i = 0; i < len; ++i)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1430,10 +1430,10 @@ setup_one_parameter (copy_body_data *id, tree p, tree value, tree fn,
|
|||
}
|
||||
|
||||
/* Generate code to initialize the parameters of the function at the
|
||||
top of the stack in ID from the ARGS (presented as a TREE_LIST). */
|
||||
top of the stack in ID from the CALL_EXPR EXP. */
|
||||
|
||||
static void
|
||||
initialize_inlined_parameters (copy_body_data *id, tree args, tree static_chain,
|
||||
initialize_inlined_parameters (copy_body_data *id, tree exp,
|
||||
tree fn, basic_block bb)
|
||||
{
|
||||
tree parms;
|
||||
|
|
@ -1441,14 +1441,16 @@ initialize_inlined_parameters (copy_body_data *id, tree args, tree static_chain,
|
|||
tree p;
|
||||
tree vars = NULL_TREE;
|
||||
int argnum = 0;
|
||||
call_expr_arg_iterator iter;
|
||||
tree static_chain = CALL_EXPR_STATIC_CHAIN (exp);
|
||||
|
||||
/* Figure out what the parameters are. */
|
||||
parms = DECL_ARGUMENTS (fn);
|
||||
|
||||
/* Loop through the parameter declarations, replacing each with an
|
||||
equivalent VAR_DECL, appropriately initialized. */
|
||||
for (p = parms, a = args; p;
|
||||
a = a ? TREE_CHAIN (a) : a, p = TREE_CHAIN (p))
|
||||
for (p = parms, a = first_call_expr_arg (exp, &iter); p;
|
||||
a = next_call_expr_arg (&iter), p = TREE_CHAIN (p))
|
||||
{
|
||||
tree value;
|
||||
|
||||
|
|
@ -1456,7 +1458,7 @@ initialize_inlined_parameters (copy_body_data *id, tree args, tree static_chain,
|
|||
|
||||
/* Find the initializer. */
|
||||
value = lang_hooks.tree_inlining.convert_parm_for_inlining
|
||||
(p, a ? TREE_VALUE (a) : NULL_TREE, fn, argnum);
|
||||
(p, a, fn, argnum);
|
||||
|
||||
setup_one_parameter (id, p, value, fn, bb, &vars);
|
||||
}
|
||||
|
|
@ -2172,7 +2174,6 @@ estimate_num_insns_1 (tree *tp, int *walk_subtrees, void *data)
|
|||
case CALL_EXPR:
|
||||
{
|
||||
tree decl = get_callee_fndecl (x);
|
||||
tree arg;
|
||||
|
||||
cost = d->weights->call_cost;
|
||||
if (decl && DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL)
|
||||
|
|
@ -2195,11 +2196,14 @@ estimate_num_insns_1 (tree *tp, int *walk_subtrees, void *data)
|
|||
that does use function declaration to figure out the arguments. */
|
||||
if (!decl)
|
||||
{
|
||||
for (arg = TREE_OPERAND (x, 1); arg; arg = TREE_CHAIN (arg))
|
||||
d->count += estimate_move_cost (TREE_TYPE (TREE_VALUE (arg)));
|
||||
tree a;
|
||||
call_expr_arg_iterator iter;
|
||||
FOR_EACH_CALL_EXPR_ARG (a, iter, x)
|
||||
d->count += estimate_move_cost (TREE_TYPE (a));
|
||||
}
|
||||
else
|
||||
{
|
||||
tree arg;
|
||||
for (arg = DECL_ARGUMENTS (decl); arg; arg = TREE_CHAIN (arg))
|
||||
d->count += estimate_move_cost (TREE_TYPE (arg));
|
||||
}
|
||||
|
|
@ -2337,7 +2341,6 @@ expand_call_inline (basic_block bb, tree stmt, tree *tp, void *data)
|
|||
tree use_retvar;
|
||||
tree fn;
|
||||
splay_tree st;
|
||||
tree args;
|
||||
tree return_slot;
|
||||
tree modify_dest;
|
||||
location_t saved_location;
|
||||
|
|
@ -2495,15 +2498,12 @@ expand_call_inline (basic_block bb, tree stmt, tree *tp, void *data)
|
|||
id->decl_map = splay_tree_new (splay_tree_compare_pointers,
|
||||
NULL, NULL);
|
||||
|
||||
/* Initialize the parameters. */
|
||||
args = TREE_OPERAND (t, 1);
|
||||
|
||||
/* Record the function we are about to inline. */
|
||||
id->src_fn = fn;
|
||||
id->src_node = cg_edge->callee;
|
||||
id->src_cfun = DECL_STRUCT_FUNCTION (fn);
|
||||
|
||||
initialize_inlined_parameters (id, args, TREE_OPERAND (t, 2), fn, bb);
|
||||
initialize_inlined_parameters (id, t, fn, bb);
|
||||
|
||||
if (DECL_INITIAL (fn))
|
||||
add_lexical_block (id->block, remap_blocks (DECL_INITIAL (fn), id));
|
||||
|
|
|
|||
|
|
@ -656,20 +656,13 @@ mf_build_check_statement_for (tree base, tree limit,
|
|||
refresh *_l vars.
|
||||
|
||||
This is the body of the conditional. */
|
||||
|
||||
u = tree_cons (NULL_TREE,
|
||||
mf_file_function_line_tree (locus == NULL ? UNKNOWN_LOCATION
|
||||
: *locus),
|
||||
NULL_TREE);
|
||||
u = tree_cons (NULL_TREE, dirflag, u);
|
||||
|
||||
u = mf_file_function_line_tree (locus == NULL ? UNKNOWN_LOCATION : *locus);
|
||||
/* NB: we pass the overall [base..limit] range to mf_check. */
|
||||
u = tree_cons (NULL_TREE,
|
||||
fold_build2 (PLUS_EXPR, integer_type_node,
|
||||
fold_build2 (MINUS_EXPR, mf_uintptr_type, mf_limit, mf_base),
|
||||
integer_one_node),
|
||||
u);
|
||||
u = tree_cons (NULL_TREE, mf_base, u);
|
||||
t = build_function_call_expr (mf_check_fndecl, u);
|
||||
v = fold_build2 (PLUS_EXPR, integer_type_node,
|
||||
fold_build2 (MINUS_EXPR, mf_uintptr_type, mf_limit, mf_base),
|
||||
integer_one_node);
|
||||
t = build_call_expr (mf_check_fndecl, 4, mf_base, v, dirflag, u);
|
||||
gimplify_to_stmt_list (&t);
|
||||
head = tsi_start (t);
|
||||
tsi = tsi_last (t);
|
||||
|
|
@ -996,48 +989,38 @@ mx_register_decls (tree decl, tree *stmt_list)
|
|||
&& ! TREE_STATIC (decl))
|
||||
{
|
||||
tree size = NULL_TREE, variable_name;
|
||||
tree unregister_fncall, unregister_fncall_params;
|
||||
tree register_fncall, register_fncall_params;
|
||||
tree unregister_fncall, unregister_fncall_param;
|
||||
tree register_fncall, register_fncall_param;
|
||||
|
||||
size = convert (size_type_node, TYPE_SIZE_UNIT (TREE_TYPE (decl)));
|
||||
|
||||
/* (& VARIABLE, sizeof (VARIABLE), __MF_TYPE_STACK) */
|
||||
unregister_fncall_params =
|
||||
tree_cons (NULL_TREE,
|
||||
convert (ptr_type_node,
|
||||
mf_mark (build1 (ADDR_EXPR,
|
||||
build_pointer_type (TREE_TYPE (decl)),
|
||||
decl))),
|
||||
tree_cons (NULL_TREE,
|
||||
size,
|
||||
tree_cons (NULL_TREE,
|
||||
/* __MF_TYPE_STACK */
|
||||
build_int_cst (NULL_TREE, 3),
|
||||
NULL_TREE)));
|
||||
/* __mf_unregister (...) */
|
||||
unregister_fncall = build_function_call_expr (mf_unregister_fndecl,
|
||||
unregister_fncall_params);
|
||||
|
||||
/* (& VARIABLE, sizeof (VARIABLE), __MF_TYPE_STACK, "name") */
|
||||
unregister_fncall_param =
|
||||
convert (ptr_type_node,
|
||||
mf_mark (build1 (ADDR_EXPR,
|
||||
build_pointer_type (TREE_TYPE (decl)),
|
||||
decl)));
|
||||
/* __mf_unregister (&VARIABLE, sizeof (VARIABLE), __MF_TYPE_STACK) */
|
||||
unregister_fncall = build_call_expr (mf_unregister_fndecl, 3,
|
||||
unregister_fncall_param,
|
||||
size,
|
||||
build_int_cst (NULL_TREE, 3));
|
||||
|
||||
|
||||
variable_name = mf_varname_tree (decl);
|
||||
register_fncall_params =
|
||||
tree_cons (NULL_TREE,
|
||||
convert (ptr_type_node,
|
||||
mf_mark (build1 (ADDR_EXPR,
|
||||
build_pointer_type (TREE_TYPE (decl)),
|
||||
decl))),
|
||||
tree_cons (NULL_TREE,
|
||||
size,
|
||||
tree_cons (NULL_TREE,
|
||||
/* __MF_TYPE_STACK */
|
||||
build_int_cst (NULL_TREE, 3),
|
||||
tree_cons (NULL_TREE,
|
||||
variable_name,
|
||||
NULL_TREE))));
|
||||
register_fncall_param =
|
||||
convert (ptr_type_node,
|
||||
mf_mark (build1 (ADDR_EXPR,
|
||||
build_pointer_type (TREE_TYPE (decl)),
|
||||
decl)));
|
||||
/* __mf_register (&VARIABLE, sizeof (VARIABLE), __MF_TYPE_STACK,
|
||||
"name") */
|
||||
register_fncall = build_call_expr (mf_register_fndecl, 4,
|
||||
register_fncall_param,
|
||||
size,
|
||||
build_int_cst (NULL_TREE, 3),
|
||||
variable_name);
|
||||
|
||||
/* __mf_register (...) */
|
||||
register_fncall = build_function_call_expr (mf_register_fndecl,
|
||||
register_fncall_params);
|
||||
|
||||
/* Accumulate the two calls. */
|
||||
/* ??? Set EXPR_LOCATION. */
|
||||
|
|
@ -1172,21 +1155,17 @@ static GTY (()) tree enqueued_call_stmt_chain;
|
|||
static void
|
||||
mudflap_register_call (tree obj, tree object_size, tree varname)
|
||||
{
|
||||
tree arg, args, call_stmt;
|
||||
|
||||
args = tree_cons (NULL_TREE, varname, NULL_TREE);
|
||||
|
||||
arg = build_int_cst (NULL_TREE, 4); /* __MF_TYPE_STATIC */
|
||||
args = tree_cons (NULL_TREE, arg, args);
|
||||
|
||||
arg = convert (size_type_node, object_size);
|
||||
args = tree_cons (NULL_TREE, arg, args);
|
||||
tree arg, call_stmt;
|
||||
|
||||
arg = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (obj)), obj);
|
||||
arg = convert (ptr_type_node, arg);
|
||||
args = tree_cons (NULL_TREE, arg, args);
|
||||
|
||||
call_stmt = build_function_call_expr (mf_register_fndecl, args);
|
||||
call_stmt = build_call_expr (mf_register_fndecl, 4,
|
||||
arg,
|
||||
convert (size_type_node, object_size),
|
||||
/* __MF_TYPE_STATIC */
|
||||
build_int_cst (NULL_TREE, 4),
|
||||
varname);
|
||||
|
||||
append_to_statement_list (call_stmt, &enqueued_call_stmt_chain);
|
||||
}
|
||||
|
|
@ -1243,16 +1222,15 @@ mudflap_finish_file (void)
|
|||
|
||||
/* Insert a call to __mf_init. */
|
||||
{
|
||||
tree call2_stmt = build_function_call_expr (mf_init_fndecl, NULL_TREE);
|
||||
tree call2_stmt = build_call_expr (mf_init_fndecl, 0);
|
||||
append_to_statement_list (call2_stmt, &ctor_statements);
|
||||
}
|
||||
|
||||
/* If appropriate, call __mf_set_options to pass along read-ignore mode. */
|
||||
if (flag_mudflap_ignore_reads)
|
||||
{
|
||||
tree arg = tree_cons (NULL_TREE,
|
||||
mf_build_string ("-ignore-reads"), NULL_TREE);
|
||||
tree call_stmt = build_function_call_expr (mf_set_options_fndecl, arg);
|
||||
tree arg = mf_build_string ("-ignore-reads");
|
||||
tree call_stmt = build_call_expr (mf_set_options_fndecl, 1, arg);
|
||||
append_to_statement_list (call_stmt, &ctor_statements);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1437,7 +1437,7 @@ convert_nl_goto_reference (tree *tp, int *walk_subtrees, void *data)
|
|||
{
|
||||
struct walk_stmt_info *wi = (struct walk_stmt_info *) data;
|
||||
struct nesting_info *info = wi->info, *i;
|
||||
tree t = *tp, label, new_label, target_context, x, arg, field;
|
||||
tree t = *tp, label, new_label, target_context, x, field;
|
||||
void **slot;
|
||||
|
||||
*walk_subtrees = 0;
|
||||
|
|
@ -1475,11 +1475,8 @@ convert_nl_goto_reference (tree *tp, int *walk_subtrees, void *data)
|
|||
x = get_frame_field (info, target_context, field, &wi->tsi);
|
||||
x = build_addr (x, target_context);
|
||||
x = tsi_gimplify_val (info, x, &wi->tsi);
|
||||
arg = tree_cons (NULL, x, NULL);
|
||||
x = build_addr (new_label, target_context);
|
||||
arg = tree_cons (NULL, x, arg);
|
||||
x = implicit_built_in_decls[BUILT_IN_NONLOCAL_GOTO];
|
||||
x = build_function_call_expr (x, arg);
|
||||
x = build_call_expr (implicit_built_in_decls[BUILT_IN_NONLOCAL_GOTO], 2,
|
||||
build_addr (new_label, target_context), x);
|
||||
|
||||
SET_EXPR_LOCUS (x, EXPR_LOCUS (tsi_stmt (wi->tsi)));
|
||||
*tsi_stmt_ptr (wi->tsi) = x;
|
||||
|
|
@ -1537,7 +1534,7 @@ convert_tramp_reference (tree *tp, int *walk_subtrees, void *data)
|
|||
{
|
||||
struct walk_stmt_info *wi = (struct walk_stmt_info *) data;
|
||||
struct nesting_info *info = wi->info, *i;
|
||||
tree t = *tp, decl, target_context, x, arg;
|
||||
tree t = *tp, decl, target_context, x;
|
||||
|
||||
*walk_subtrees = 0;
|
||||
switch (TREE_CODE (t))
|
||||
|
|
@ -1573,12 +1570,11 @@ convert_tramp_reference (tree *tp, int *walk_subtrees, void *data)
|
|||
x = get_frame_field (info, target_context, x, &wi->tsi);
|
||||
x = build_addr (x, target_context);
|
||||
x = tsi_gimplify_val (info, x, &wi->tsi);
|
||||
arg = tree_cons (NULL, x, NULL);
|
||||
|
||||
/* Do machine-specific ugliness. Normally this will involve
|
||||
computing extra alignment, but it can really be anything. */
|
||||
x = implicit_built_in_decls[BUILT_IN_ADJUST_TRAMPOLINE];
|
||||
x = build_function_call_expr (x, arg);
|
||||
x = build_call_expr (implicit_built_in_decls[BUILT_IN_ADJUST_TRAMPOLINE],
|
||||
1, x);
|
||||
x = init_tmp_var (info, x, &wi->tsi);
|
||||
|
||||
/* Cast back to the proper function type. */
|
||||
|
|
@ -1591,7 +1587,12 @@ convert_tramp_reference (tree *tp, int *walk_subtrees, void *data)
|
|||
case CALL_EXPR:
|
||||
/* Only walk call arguments, lest we generate trampolines for
|
||||
direct calls. */
|
||||
walk_tree (&TREE_OPERAND (t, 1), convert_tramp_reference, wi, NULL);
|
||||
{
|
||||
int nargs = call_expr_nargs (t);
|
||||
int i;
|
||||
for (i = 0; i < nargs; i++)
|
||||
walk_tree (&CALL_EXPR_ARG (t, i), convert_tramp_reference, wi, NULL);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -1626,7 +1627,7 @@ convert_call_expr (tree *tp, int *walk_subtrees, void *data)
|
|||
target_context = decl_function_context (decl);
|
||||
if (target_context && !DECL_NO_STATIC_CHAIN (decl))
|
||||
{
|
||||
TREE_OPERAND (t, 2)
|
||||
CALL_EXPR_STATIC_CHAIN (t)
|
||||
= get_static_chain (info, target_context, &wi->tsi);
|
||||
info->static_chain_added
|
||||
|= (1 << (info->context != target_context));
|
||||
|
|
@ -1777,29 +1778,25 @@ finalize_nesting_tree_1 (struct nesting_info *root)
|
|||
struct nesting_info *i;
|
||||
for (i = root->inner; i ; i = i->next)
|
||||
{
|
||||
tree arg, x, field;
|
||||
tree arg1, arg2, arg3, x, field;
|
||||
|
||||
field = lookup_tramp_for_decl (root, i->context, NO_INSERT);
|
||||
if (!field)
|
||||
continue;
|
||||
|
||||
if (DECL_NO_STATIC_CHAIN (i->context))
|
||||
x = null_pointer_node;
|
||||
arg3 = null_pointer_node;
|
||||
else
|
||||
x = build_addr (root->frame_decl, context);
|
||||
arg = tree_cons (NULL, x, NULL);
|
||||
arg3 = build_addr (root->frame_decl, context);
|
||||
|
||||
x = build_addr (i->context, context);
|
||||
arg = tree_cons (NULL, x, arg);
|
||||
arg2 = build_addr (i->context, context);
|
||||
|
||||
x = build3 (COMPONENT_REF, TREE_TYPE (field),
|
||||
root->frame_decl, field, NULL_TREE);
|
||||
x = build_addr (x, context);
|
||||
arg = tree_cons (NULL, x, arg);
|
||||
arg1 = build_addr (x, context);
|
||||
|
||||
x = implicit_built_in_decls[BUILT_IN_INIT_TRAMPOLINE];
|
||||
x = build_function_call_expr (x, arg);
|
||||
|
||||
x = build_call_expr (x, 3, arg1, arg2, arg3);
|
||||
append_to_statement_list (x, &stmt_list);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -228,49 +228,41 @@ addr_object_size (tree ptr, int object_size_type)
|
|||
static unsigned HOST_WIDE_INT
|
||||
alloc_object_size (tree call, int object_size_type)
|
||||
{
|
||||
tree callee, arglist, a, bytes = NULL_TREE;
|
||||
unsigned int arg_mask = 0;
|
||||
tree callee, bytes = NULL_TREE;
|
||||
|
||||
gcc_assert (TREE_CODE (call) == CALL_EXPR);
|
||||
|
||||
callee = get_callee_fndecl (call);
|
||||
arglist = TREE_OPERAND (call, 1);
|
||||
if (callee
|
||||
&& DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL)
|
||||
switch (DECL_FUNCTION_CODE (callee))
|
||||
{
|
||||
case BUILT_IN_MALLOC:
|
||||
case BUILT_IN_ALLOCA:
|
||||
arg_mask = 1;
|
||||
if (call_expr_nargs (call) == 1
|
||||
&& TREE_CODE (CALL_EXPR_ARG (call, 0)) == INTEGER_CST)
|
||||
bytes = fold_convert (sizetype, CALL_EXPR_ARG (call, 0));
|
||||
break;
|
||||
/*
|
||||
case BUILT_IN_REALLOC:
|
||||
arg_mask = 2;
|
||||
if (call_expr_nargs (call) == 2
|
||||
&& TREE_CODE (CALL_EXPR_ARG (call, 1)) == INTEGER_CST)
|
||||
bytes = fold_convert (sizetype, CALL_EXPR_ARG (call, 1));
|
||||
break;
|
||||
*/
|
||||
case BUILT_IN_CALLOC:
|
||||
arg_mask = 3;
|
||||
if (call_expr_nargs (call) == 2
|
||||
&& TREE_CODE (CALL_EXPR_ARG (call, 0)) == INTEGER_CST
|
||||
&& TREE_CODE (CALL_EXPR_ARG (call, 1)) == INTEGER_CST)
|
||||
bytes = size_binop (MULT_EXPR,
|
||||
fold_convert (sizetype, CALL_EXPR_ARG (call, 0)),
|
||||
fold_convert (sizetype, CALL_EXPR_ARG (call, 1)));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
for (a = arglist; arg_mask && a; arg_mask >>= 1, a = TREE_CHAIN (a))
|
||||
if (arg_mask & 1)
|
||||
{
|
||||
tree arg = TREE_VALUE (a);
|
||||
|
||||
if (TREE_CODE (arg) != INTEGER_CST)
|
||||
break;
|
||||
|
||||
if (! bytes)
|
||||
bytes = fold_convert (sizetype, arg);
|
||||
else
|
||||
bytes = size_binop (MULT_EXPR, bytes,
|
||||
fold_convert (sizetype, arg));
|
||||
}
|
||||
|
||||
if (! arg_mask && bytes && host_integerp (bytes, 1))
|
||||
if (bytes && host_integerp (bytes, 1))
|
||||
return tree_low_cst (bytes, 1);
|
||||
|
||||
return unknown[object_size_type];
|
||||
|
|
@ -285,7 +277,6 @@ static tree
|
|||
pass_through_call (tree call)
|
||||
{
|
||||
tree callee = get_callee_fndecl (call);
|
||||
tree arglist = TREE_OPERAND (call, 1);
|
||||
|
||||
if (callee
|
||||
&& DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL)
|
||||
|
|
@ -305,8 +296,8 @@ pass_through_call (tree call)
|
|||
case BUILT_IN_STRNCPY_CHK:
|
||||
case BUILT_IN_STRCAT_CHK:
|
||||
case BUILT_IN_STRNCAT_CHK:
|
||||
if (arglist)
|
||||
return TREE_VALUE (arglist);
|
||||
if (call_expr_nargs (call) >= 1)
|
||||
return CALL_EXPR_ARG (call, 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
@ -1043,17 +1034,13 @@ compute_object_sizes (void)
|
|||
continue;
|
||||
|
||||
init_object_sizes ();
|
||||
result = fold_builtin (callee, TREE_OPERAND (call, 1), false);
|
||||
result = fold_call_expr (call, false);
|
||||
if (!result)
|
||||
{
|
||||
tree arglist = TREE_OPERAND (call, 1);
|
||||
|
||||
if (arglist != NULL
|
||||
&& POINTER_TYPE_P (TREE_TYPE (TREE_VALUE (arglist)))
|
||||
&& TREE_CHAIN (arglist) != NULL
|
||||
&& TREE_CHAIN (TREE_CHAIN (arglist)) == NULL)
|
||||
if (call_expr_nargs (call) == 2
|
||||
&& POINTER_TYPE_P (TREE_TYPE (CALL_EXPR_ARG (call, 0))))
|
||||
{
|
||||
tree ost = TREE_VALUE (TREE_CHAIN (arglist));
|
||||
tree ost = CALL_EXPR_ARG (call, 1);
|
||||
|
||||
if (host_integerp (ost, 1))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ do_niy (pretty_printer *buffer, tree node)
|
|||
|
||||
if (EXPR_P (node))
|
||||
{
|
||||
len = TREE_CODE_LENGTH (TREE_CODE (node));
|
||||
len = TREE_OPERAND_LENGTH (node);
|
||||
for (i = 0; i < len; ++i)
|
||||
{
|
||||
newline_and_indent (buffer, 2);
|
||||
|
|
@ -1173,12 +1173,22 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
|
|||
/* Print parameters. */
|
||||
pp_space (buffer);
|
||||
pp_character (buffer, '(');
|
||||
op1 = TREE_OPERAND (node, 1);
|
||||
if (op1)
|
||||
dump_generic_node (buffer, op1, spc, flags, false);
|
||||
{
|
||||
tree arg;
|
||||
call_expr_arg_iterator iter;
|
||||
FOR_EACH_CALL_EXPR_ARG (arg, iter, node)
|
||||
{
|
||||
dump_generic_node (buffer, arg, spc, flags, false);
|
||||
if (more_call_expr_args_p (&iter))
|
||||
{
|
||||
pp_character (buffer, ',');
|
||||
pp_space (buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
pp_character (buffer, ')');
|
||||
|
||||
op1 = TREE_OPERAND (node, 2);
|
||||
op1 = CALL_EXPR_STATIC_CHAIN (node);
|
||||
if (op1)
|
||||
{
|
||||
pp_string (buffer, " [static-chain: ");
|
||||
|
|
@ -2528,7 +2538,7 @@ print_call_name (pretty_printer *buffer, tree node)
|
|||
|
||||
gcc_assert (TREE_CODE (node) == CALL_EXPR);
|
||||
|
||||
op0 = TREE_OPERAND (node, 0);
|
||||
op0 = CALL_EXPR_FN (node);
|
||||
|
||||
if (TREE_CODE (op0) == NON_LVALUE_EXPR)
|
||||
op0 = TREE_OPERAND (op0, 0);
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ tree_gen_interval_profiler (histogram_value value, unsigned tag, unsigned base)
|
|||
tree stmt = value->hvalue.stmt;
|
||||
block_stmt_iterator bsi = bsi_for_stmt (stmt);
|
||||
tree ref = tree_coverage_counter_ref (tag, base), ref_ptr;
|
||||
tree args, call, val;
|
||||
tree call, val;
|
||||
tree start = build_int_cst_type (integer_type_node, value->hdata.intvl.int_start);
|
||||
tree steps = build_int_cst_type (unsigned_type_node, value->hdata.intvl.steps);
|
||||
|
||||
|
|
@ -211,12 +211,8 @@ tree_gen_interval_profiler (histogram_value value, unsigned tag, unsigned base)
|
|||
build_addr (ref, current_function_decl),
|
||||
true, NULL_TREE);
|
||||
val = prepare_instrumented_value (&bsi, value);
|
||||
args = tree_cons (NULL_TREE, ref_ptr,
|
||||
tree_cons (NULL_TREE, val,
|
||||
tree_cons (NULL_TREE, start,
|
||||
tree_cons (NULL_TREE, steps,
|
||||
NULL_TREE))));
|
||||
call = build_function_call_expr (tree_interval_profiler_fn, args);
|
||||
call = build_call_expr (tree_interval_profiler_fn, 4,
|
||||
ref_ptr, val, start, steps);
|
||||
bsi_insert_before (&bsi, call, BSI_SAME_STMT);
|
||||
}
|
||||
|
||||
|
|
@ -230,16 +226,13 @@ tree_gen_pow2_profiler (histogram_value value, unsigned tag, unsigned base)
|
|||
tree stmt = value->hvalue.stmt;
|
||||
block_stmt_iterator bsi = bsi_for_stmt (stmt);
|
||||
tree ref = tree_coverage_counter_ref (tag, base), ref_ptr;
|
||||
tree args, call, val;
|
||||
tree call, val;
|
||||
|
||||
ref_ptr = force_gimple_operand_bsi (&bsi,
|
||||
build_addr (ref, current_function_decl),
|
||||
true, NULL_TREE);
|
||||
val = prepare_instrumented_value (&bsi, value);
|
||||
args = tree_cons (NULL_TREE, ref_ptr,
|
||||
tree_cons (NULL_TREE, val,
|
||||
NULL_TREE));
|
||||
call = build_function_call_expr (tree_pow2_profiler_fn, args);
|
||||
call = build_call_expr (tree_pow2_profiler_fn, 2, ref_ptr, val);
|
||||
bsi_insert_before (&bsi, call, BSI_SAME_STMT);
|
||||
}
|
||||
|
||||
|
|
@ -253,16 +246,13 @@ tree_gen_one_value_profiler (histogram_value value, unsigned tag, unsigned base)
|
|||
tree stmt = value->hvalue.stmt;
|
||||
block_stmt_iterator bsi = bsi_for_stmt (stmt);
|
||||
tree ref = tree_coverage_counter_ref (tag, base), ref_ptr;
|
||||
tree args, call, val;
|
||||
tree call, val;
|
||||
|
||||
ref_ptr = force_gimple_operand_bsi (&bsi,
|
||||
build_addr (ref, current_function_decl),
|
||||
true, NULL_TREE);
|
||||
val = prepare_instrumented_value (&bsi, value);
|
||||
args = tree_cons (NULL_TREE, ref_ptr,
|
||||
tree_cons (NULL_TREE, val,
|
||||
NULL_TREE));
|
||||
call = build_function_call_expr (tree_one_value_profiler_fn, args);
|
||||
call = build_call_expr (tree_one_value_profiler_fn, 2, ref_ptr, val);
|
||||
bsi_insert_before (&bsi, call, BSI_SAME_STMT);
|
||||
}
|
||||
|
||||
|
|
@ -320,7 +310,7 @@ tree_gen_ic_func_profiler (void)
|
|||
basic_block bb;
|
||||
edge_iterator ei;
|
||||
tree stmt1;
|
||||
tree args, tree_uid, cur_func;
|
||||
tree tree_uid, cur_func;
|
||||
|
||||
if (flag_unit_at_a_time)
|
||||
{
|
||||
|
|
@ -339,13 +329,11 @@ tree_gen_ic_func_profiler (void)
|
|||
current_function_decl),
|
||||
true, NULL_TREE);
|
||||
tree_uid = build_int_cst (gcov_type_node, c_node->pid);
|
||||
args = tree_cons (NULL_TREE, ic_gcov_type_ptr_var,
|
||||
tree_cons (NULL_TREE, tree_uid,
|
||||
tree_cons (NULL_TREE, cur_func,
|
||||
tree_cons (NULL_TREE,
|
||||
ic_void_ptr_var,
|
||||
NULL_TREE))));
|
||||
stmt1 = build_function_call_expr (tree_indirect_call_profiler_fn, args);
|
||||
stmt1 = build_call_expr (tree_indirect_call_profiler_fn, 4,
|
||||
ic_gcov_type_ptr_var,
|
||||
tree_uid,
|
||||
cur_func,
|
||||
ic_void_ptr_var);
|
||||
bsi_insert_after (&bsi, stmt1, BSI_SAME_STMT);
|
||||
}
|
||||
}
|
||||
|
|
@ -377,14 +365,13 @@ tree_gen_average_profiler (histogram_value value, unsigned tag, unsigned base)
|
|||
tree stmt = value->hvalue.stmt;
|
||||
block_stmt_iterator bsi = bsi_for_stmt (stmt);
|
||||
tree ref = tree_coverage_counter_ref (tag, base), ref_ptr;
|
||||
tree args, call, val;
|
||||
tree call, val;
|
||||
|
||||
ref_ptr = force_gimple_operand_bsi (&bsi,
|
||||
build_addr (ref, current_function_decl),
|
||||
true, NULL_TREE);
|
||||
val = prepare_instrumented_value (&bsi, value);
|
||||
args = tree_cons (NULL_TREE, ref_ptr, tree_cons (NULL_TREE, val, NULL_TREE));
|
||||
call = build_function_call_expr (tree_average_profiler_fn, args);
|
||||
call = build_call_expr (tree_average_profiler_fn, 2, ref_ptr, val);
|
||||
bsi_insert_before (&bsi, call, BSI_SAME_STMT);
|
||||
}
|
||||
|
||||
|
|
@ -398,14 +385,13 @@ tree_gen_ior_profiler (histogram_value value, unsigned tag, unsigned base)
|
|||
tree stmt = value->hvalue.stmt;
|
||||
block_stmt_iterator bsi = bsi_for_stmt (stmt);
|
||||
tree ref = tree_coverage_counter_ref (tag, base), ref_ptr;
|
||||
tree args, call, val;
|
||||
tree call, val;
|
||||
|
||||
ref_ptr = force_gimple_operand_bsi (&bsi,
|
||||
build_addr (ref, current_function_decl),
|
||||
true, NULL_TREE);
|
||||
val = prepare_instrumented_value (&bsi, value);
|
||||
args = tree_cons (NULL_TREE, ref_ptr, tree_cons (NULL_TREE, val, NULL_TREE));
|
||||
call = build_function_call_expr (tree_ior_profiler_fn, args);
|
||||
call = build_call_expr (tree_ior_profiler_fn, 2, ref_ptr, val);
|
||||
bsi_insert_before (&bsi, call, BSI_SAME_STMT);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -357,6 +357,8 @@ find_var_scev_info (tree var)
|
|||
bool
|
||||
chrec_contains_symbols_defined_in_loop (tree chrec, unsigned loop_nb)
|
||||
{
|
||||
int i, n;
|
||||
|
||||
if (chrec == NULL_TREE)
|
||||
return false;
|
||||
|
||||
|
|
@ -386,26 +388,12 @@ chrec_contains_symbols_defined_in_loop (tree chrec, unsigned loop_nb)
|
|||
return false;
|
||||
}
|
||||
|
||||
switch (TREE_CODE_LENGTH (TREE_CODE (chrec)))
|
||||
{
|
||||
case 3:
|
||||
if (chrec_contains_symbols_defined_in_loop (TREE_OPERAND (chrec, 2),
|
||||
loop_nb))
|
||||
return true;
|
||||
|
||||
case 2:
|
||||
if (chrec_contains_symbols_defined_in_loop (TREE_OPERAND (chrec, 1),
|
||||
loop_nb))
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
if (chrec_contains_symbols_defined_in_loop (TREE_OPERAND (chrec, 0),
|
||||
loop_nb))
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
n = TREE_OPERAND_LENGTH (chrec);
|
||||
for (i = 0; i < n; i++)
|
||||
if (chrec_contains_symbols_defined_in_loop (TREE_OPERAND (chrec, i),
|
||||
loop_nb))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Return true when PHI is a loop-phi-node. */
|
||||
|
|
@ -2317,6 +2305,7 @@ instantiate_parameters_1 (struct loop *loop, tree chrec, int flags, htab_t cache
|
|||
break;
|
||||
}
|
||||
|
||||
gcc_assert (!VL_EXP_CLASS_P (chrec));
|
||||
switch (TREE_CODE_LENGTH (TREE_CODE (chrec)))
|
||||
{
|
||||
case 3:
|
||||
|
|
|
|||
|
|
@ -867,7 +867,10 @@ static void
|
|||
sra_walk_call_expr (tree expr, block_stmt_iterator *bsi,
|
||||
const struct sra_walk_fns *fns)
|
||||
{
|
||||
sra_walk_tree_list (TREE_OPERAND (expr, 1), bsi, false, fns);
|
||||
int i;
|
||||
int nargs = call_expr_nargs (expr);
|
||||
for (i = 0; i < nargs; i++)
|
||||
sra_walk_expr (&CALL_EXPR_ARG (expr, i), bsi, false, fns);
|
||||
}
|
||||
|
||||
/* Walk the inputs and outputs of an ASM_EXPR looking for scalarizable
|
||||
|
|
|
|||
|
|
@ -3080,11 +3080,13 @@ find_used_portions (tree *tp, int *walk_subtrees, void *lhs_p)
|
|||
break;
|
||||
case CALL_EXPR:
|
||||
{
|
||||
tree *arg;
|
||||
for (arg = &TREE_OPERAND (*tp, 1); *arg; arg = &TREE_CHAIN (*arg))
|
||||
int i;
|
||||
int nargs = call_expr_nargs (*tp);
|
||||
for (i = 0; i < nargs; i++)
|
||||
{
|
||||
if (TREE_CODE (TREE_VALUE (*arg)) != ADDR_EXPR)
|
||||
find_used_portions (&TREE_VALUE (*arg), walk_subtrees, NULL);
|
||||
tree *arg = &CALL_EXPR_ARG (*tp, i);
|
||||
if (TREE_CODE (*arg) != ADDR_EXPR)
|
||||
find_used_portions (arg, walk_subtrees, NULL);
|
||||
}
|
||||
*walk_subtrees = 0;
|
||||
return NULL_TREE;
|
||||
|
|
|
|||
|
|
@ -939,15 +939,13 @@ ccp_fold (tree stmt)
|
|||
/* We may be able to fold away calls to builtin functions if their
|
||||
arguments are constants. */
|
||||
else if (code == CALL_EXPR
|
||||
&& TREE_CODE (TREE_OPERAND (rhs, 0)) == ADDR_EXPR
|
||||
&& (TREE_CODE (TREE_OPERAND (TREE_OPERAND (rhs, 0), 0))
|
||||
== FUNCTION_DECL)
|
||||
&& DECL_BUILT_IN (TREE_OPERAND (TREE_OPERAND (rhs, 0), 0)))
|
||||
&& TREE_CODE (CALL_EXPR_FN (rhs)) == ADDR_EXPR
|
||||
&& TREE_CODE (TREE_OPERAND (CALL_EXPR_FN (rhs), 0)) == FUNCTION_DECL
|
||||
&& DECL_BUILT_IN (TREE_OPERAND (CALL_EXPR_FN (rhs), 0)))
|
||||
{
|
||||
if (!ZERO_SSA_OPERANDS (stmt, SSA_OP_USE))
|
||||
{
|
||||
tree *orig, var;
|
||||
tree fndecl, arglist;
|
||||
size_t i = 0;
|
||||
ssa_op_iter iter;
|
||||
use_operand_p var_p;
|
||||
|
|
@ -959,9 +957,7 @@ ccp_fold (tree stmt)
|
|||
|
||||
/* Substitute operands with their values and try to fold. */
|
||||
replace_uses_in (stmt, NULL, const_val);
|
||||
fndecl = get_callee_fndecl (rhs);
|
||||
arglist = TREE_OPERAND (rhs, 1);
|
||||
retval = fold_builtin (fndecl, arglist, false);
|
||||
retval = fold_call_expr (rhs, false);
|
||||
|
||||
/* Restore operands to their original form. */
|
||||
i = 0;
|
||||
|
|
@ -2219,18 +2215,18 @@ static tree
|
|||
ccp_fold_builtin (tree stmt, tree fn)
|
||||
{
|
||||
tree result, val[3];
|
||||
tree callee, arglist, a;
|
||||
tree callee, a;
|
||||
int arg_mask, i, type;
|
||||
bitmap visited;
|
||||
bool ignore;
|
||||
call_expr_arg_iterator iter;
|
||||
int nargs;
|
||||
|
||||
ignore = TREE_CODE (stmt) != GIMPLE_MODIFY_STMT;
|
||||
|
||||
/* First try the generic builtin folder. If that succeeds, return the
|
||||
result directly. */
|
||||
callee = get_callee_fndecl (fn);
|
||||
arglist = TREE_OPERAND (fn, 1);
|
||||
result = fold_builtin (callee, arglist, ignore);
|
||||
result = fold_call_expr (fn, ignore);
|
||||
if (result)
|
||||
{
|
||||
if (ignore)
|
||||
|
|
@ -2239,12 +2235,14 @@ ccp_fold_builtin (tree stmt, tree fn)
|
|||
}
|
||||
|
||||
/* Ignore MD builtins. */
|
||||
callee = get_callee_fndecl (fn);
|
||||
if (DECL_BUILT_IN_CLASS (callee) == BUILT_IN_MD)
|
||||
return NULL_TREE;
|
||||
|
||||
/* If the builtin could not be folded, and it has no argument list,
|
||||
we're done. */
|
||||
if (!arglist)
|
||||
nargs = call_expr_nargs (fn);
|
||||
if (nargs == 0)
|
||||
return NULL_TREE;
|
||||
|
||||
/* Limit the work only for builtins we know how to simplify. */
|
||||
|
|
@ -2287,15 +2285,17 @@ ccp_fold_builtin (tree stmt, tree fn)
|
|||
visited = BITMAP_ALLOC (NULL);
|
||||
|
||||
memset (val, 0, sizeof (val));
|
||||
for (i = 0, a = arglist;
|
||||
arg_mask;
|
||||
i++, arg_mask >>= 1, a = TREE_CHAIN (a))
|
||||
if (arg_mask & 1)
|
||||
{
|
||||
bitmap_clear (visited);
|
||||
if (!get_maxval_strlen (TREE_VALUE (a), &val[i], visited, type))
|
||||
val[i] = NULL_TREE;
|
||||
}
|
||||
init_call_expr_arg_iterator (fn, &iter);
|
||||
for (i = 0; arg_mask; i++, arg_mask >>= 1)
|
||||
{
|
||||
a = next_call_expr_arg (&iter);
|
||||
if (arg_mask & 1)
|
||||
{
|
||||
bitmap_clear (visited);
|
||||
if (!get_maxval_strlen (a, &val[i], visited, type))
|
||||
val[i] = NULL_TREE;
|
||||
}
|
||||
}
|
||||
|
||||
BITMAP_FREE (visited);
|
||||
|
||||
|
|
@ -2317,23 +2317,32 @@ ccp_fold_builtin (tree stmt, tree fn)
|
|||
break;
|
||||
|
||||
case BUILT_IN_STRCPY:
|
||||
if (val[1] && is_gimple_val (val[1]))
|
||||
result = fold_builtin_strcpy (callee, arglist, val[1]);
|
||||
if (val[1] && is_gimple_val (val[1]) && nargs == 2)
|
||||
result = fold_builtin_strcpy (callee,
|
||||
CALL_EXPR_ARG (fn, 0),
|
||||
CALL_EXPR_ARG (fn, 1),
|
||||
val[1]);
|
||||
break;
|
||||
|
||||
case BUILT_IN_STRNCPY:
|
||||
if (val[1] && is_gimple_val (val[1]))
|
||||
result = fold_builtin_strncpy (callee, arglist, val[1]);
|
||||
if (val[1] && is_gimple_val (val[1]) && nargs == 3)
|
||||
result = fold_builtin_strncpy (callee,
|
||||
CALL_EXPR_ARG (fn, 0),
|
||||
CALL_EXPR_ARG (fn, 1),
|
||||
CALL_EXPR_ARG (fn, 2),
|
||||
val[1]);
|
||||
break;
|
||||
|
||||
case BUILT_IN_FPUTS:
|
||||
result = fold_builtin_fputs (arglist,
|
||||
result = fold_builtin_fputs (CALL_EXPR_ARG (fn, 0),
|
||||
CALL_EXPR_ARG (fn, 1),
|
||||
TREE_CODE (stmt) != GIMPLE_MODIFY_STMT, 0,
|
||||
val[0]);
|
||||
break;
|
||||
|
||||
case BUILT_IN_FPUTS_UNLOCKED:
|
||||
result = fold_builtin_fputs (arglist,
|
||||
result = fold_builtin_fputs (CALL_EXPR_ARG (fn, 0),
|
||||
CALL_EXPR_ARG (fn, 1),
|
||||
TREE_CODE (stmt) != GIMPLE_MODIFY_STMT, 1,
|
||||
val[0]);
|
||||
break;
|
||||
|
|
@ -2343,26 +2352,39 @@ ccp_fold_builtin (tree stmt, tree fn)
|
|||
case BUILT_IN_MEMMOVE_CHK:
|
||||
case BUILT_IN_MEMSET_CHK:
|
||||
if (val[2] && is_gimple_val (val[2]))
|
||||
result = fold_builtin_memory_chk (callee, arglist, val[2], ignore,
|
||||
result = fold_builtin_memory_chk (callee,
|
||||
CALL_EXPR_ARG (fn, 0),
|
||||
CALL_EXPR_ARG (fn, 1),
|
||||
CALL_EXPR_ARG (fn, 2),
|
||||
CALL_EXPR_ARG (fn, 3),
|
||||
val[2], ignore,
|
||||
DECL_FUNCTION_CODE (callee));
|
||||
break;
|
||||
|
||||
case BUILT_IN_STRCPY_CHK:
|
||||
case BUILT_IN_STPCPY_CHK:
|
||||
if (val[1] && is_gimple_val (val[1]))
|
||||
result = fold_builtin_stxcpy_chk (callee, arglist, val[1], ignore,
|
||||
result = fold_builtin_stxcpy_chk (callee,
|
||||
CALL_EXPR_ARG (fn, 0),
|
||||
CALL_EXPR_ARG (fn, 1),
|
||||
CALL_EXPR_ARG (fn, 2),
|
||||
val[1], ignore,
|
||||
DECL_FUNCTION_CODE (callee));
|
||||
break;
|
||||
|
||||
case BUILT_IN_STRNCPY_CHK:
|
||||
if (val[2] && is_gimple_val (val[2]))
|
||||
result = fold_builtin_strncpy_chk (arglist, val[2]);
|
||||
result = fold_builtin_strncpy_chk (CALL_EXPR_ARG (fn, 0),
|
||||
CALL_EXPR_ARG (fn, 1),
|
||||
CALL_EXPR_ARG (fn, 2),
|
||||
CALL_EXPR_ARG (fn, 3),
|
||||
val[2]);
|
||||
break;
|
||||
|
||||
case BUILT_IN_SNPRINTF_CHK:
|
||||
case BUILT_IN_VSNPRINTF_CHK:
|
||||
if (val[1] && is_gimple_val (val[1]))
|
||||
result = fold_builtin_snprintf_chk (arglist, val[1],
|
||||
result = fold_builtin_snprintf_chk (fn, val[1],
|
||||
DECL_FUNCTION_CODE (callee));
|
||||
break;
|
||||
|
||||
|
|
@ -2398,9 +2420,7 @@ fold_stmt (tree *stmt_p)
|
|||
then we may need to fold instances of *&VAR into VAR, etc. */
|
||||
if (walk_tree (stmt_p, fold_stmt_r, &fold_stmt_r_data, NULL))
|
||||
{
|
||||
*stmt_p
|
||||
= build_function_call_expr (implicit_built_in_decls[BUILT_IN_TRAP],
|
||||
NULL);
|
||||
*stmt_p = build_call_expr (implicit_built_in_decls[BUILT_IN_TRAP], 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -2428,8 +2448,8 @@ fold_stmt (tree *stmt_p)
|
|||
copying EH region info to the new node. Easier to just do it
|
||||
here where we can just smash the call operand. Also
|
||||
CALL_EXPR_RETURN_SLOT_OPT needs to be handled correctly and
|
||||
copied, fold_ternary does not have not information. */
|
||||
callee = TREE_OPERAND (rhs, 0);
|
||||
copied, fold_call_expr does not have not information. */
|
||||
callee = CALL_EXPR_FN (rhs);
|
||||
if (TREE_CODE (callee) == OBJ_TYPE_REF
|
||||
&& lang_hooks.fold_obj_type_ref
|
||||
&& TREE_CODE (OBJ_TYPE_REF_OBJECT (callee)) == ADDR_EXPR
|
||||
|
|
@ -2447,7 +2467,7 @@ fold_stmt (tree *stmt_p)
|
|||
t = lang_hooks.fold_obj_type_ref (callee, t);
|
||||
if (t)
|
||||
{
|
||||
TREE_OPERAND (rhs, 0) = t;
|
||||
CALL_EXPR_FN (rhs) = t;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -342,10 +342,11 @@ outermost_invariant_loop_expr (tree expr, struct loop *loop)
|
|||
if (class != tcc_unary
|
||||
&& class != tcc_binary
|
||||
&& class != tcc_expression
|
||||
&& class != tcc_vl_exp
|
||||
&& class != tcc_comparison)
|
||||
return NULL;
|
||||
|
||||
nops = TREE_CODE_LENGTH (TREE_CODE (expr));
|
||||
nops = TREE_OPERAND_LENGTH (expr);
|
||||
for (i = 0; i < nops; i++)
|
||||
{
|
||||
aloop = outermost_invariant_loop_expr (TREE_OPERAND (expr, i), loop);
|
||||
|
|
@ -817,10 +818,11 @@ force_move_till_expr (tree expr, struct loop *orig_loop, struct loop *loop)
|
|||
if (class != tcc_unary
|
||||
&& class != tcc_binary
|
||||
&& class != tcc_expression
|
||||
&& class != tcc_vl_exp
|
||||
&& class != tcc_comparison)
|
||||
return;
|
||||
|
||||
nops = TREE_CODE_LENGTH (TREE_CODE (expr));
|
||||
nops = TREE_OPERAND_LENGTH (expr);
|
||||
for (i = 0; i < nops; i++)
|
||||
force_move_till_expr (TREE_OPERAND (expr, i), orig_loop, loop);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1272,7 +1272,7 @@ expr_invariant_in_loop_p (struct loop *loop, tree expr)
|
|||
if (!EXPR_P (expr) && !GIMPLE_STMT_P (expr))
|
||||
return false;
|
||||
|
||||
len = TREE_CODE_LENGTH (TREE_CODE (expr));
|
||||
len = TREE_OPERAND_LENGTH (expr);
|
||||
for (i = 0; i < len; i++)
|
||||
if (!expr_invariant_in_loop_p (loop, TREE_OPERAND (expr, i)))
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -655,7 +655,7 @@ simplify_replace_tree (tree expr, tree old, tree new)
|
|||
if (!EXPR_P (expr) && !GIMPLE_STMT_P (expr))
|
||||
return expr;
|
||||
|
||||
n = TREE_CODE_LENGTH (TREE_CODE (expr));
|
||||
n = TREE_OPERAND_LENGTH (expr);
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
e = TREE_OPERAND (expr, i);
|
||||
|
|
@ -691,7 +691,7 @@ expand_simple_operations (tree expr)
|
|||
code = TREE_CODE (expr);
|
||||
if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code)))
|
||||
{
|
||||
n = TREE_CODE_LENGTH (code);
|
||||
n = TREE_OPERAND_LENGTH (expr);
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
e = TREE_OPERAND (expr, i);
|
||||
|
|
@ -1882,11 +1882,12 @@ infer_loop_bounds_from_array (struct loop *loop, tree stmt)
|
|||
call = get_call_expr_in (stmt);
|
||||
if (call)
|
||||
{
|
||||
tree args;
|
||||
tree arg;
|
||||
call_expr_arg_iterator iter;
|
||||
|
||||
for (args = TREE_OPERAND (call, 1); args; args = TREE_CHAIN (args))
|
||||
if (REFERENCE_CLASS_P (TREE_VALUE (args)))
|
||||
infer_loop_bounds_from_ref (loop, stmt, TREE_VALUE (args));
|
||||
FOR_EACH_CALL_EXPR_ARG (arg, iter, call)
|
||||
if (REFERENCE_CLASS_P (arg))
|
||||
infer_loop_bounds_from_ref (loop, stmt, arg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -815,7 +815,7 @@ static void
|
|||
issue_prefetch_ref (struct mem_ref *ref, unsigned unroll_factor, unsigned ahead)
|
||||
{
|
||||
HOST_WIDE_INT delta;
|
||||
tree addr, addr_base, prefetch, params, write_p;
|
||||
tree addr, addr_base, prefetch, write_p;
|
||||
block_stmt_iterator bsi;
|
||||
unsigned n_prefetches, ap;
|
||||
|
||||
|
|
@ -839,11 +839,8 @@ issue_prefetch_ref (struct mem_ref *ref, unsigned unroll_factor, unsigned ahead)
|
|||
addr = force_gimple_operand_bsi (&bsi, unshare_expr (addr), true, NULL);
|
||||
|
||||
/* Create the prefetch instruction. */
|
||||
params = tree_cons (NULL_TREE, addr,
|
||||
tree_cons (NULL_TREE, write_p, NULL_TREE));
|
||||
|
||||
prefetch = build_function_call_expr (built_in_decls[BUILT_IN_PREFETCH],
|
||||
params);
|
||||
prefetch = build_call_expr (built_in_decls[BUILT_IN_PREFETCH],
|
||||
2, addr, write_p);
|
||||
bsi_insert_before (&bsi, prefetch, BSI_SAME_STMT);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -606,7 +606,7 @@ execute_cse_sincos_1 (tree name)
|
|||
if (!fndecl)
|
||||
return;
|
||||
res = make_rename_temp (TREE_TYPE (TREE_TYPE (fndecl)), "sincostmp");
|
||||
call = build_function_call_expr (fndecl, build_tree_list (NULL_TREE, name));
|
||||
call = build_call_expr (fndecl, 1, name);
|
||||
stmt = build2 (GIMPLE_MODIFY_STMT, NULL_TREE, res, call);
|
||||
def_stmt = SSA_NAME_DEF_STMT (name);
|
||||
if (bb_for_stmt (def_stmt) == top_bb
|
||||
|
|
@ -684,7 +684,7 @@ execute_cse_sincos (void)
|
|||
CASE_FLT_FN (BUILT_IN_SIN):
|
||||
CASE_FLT_FN (BUILT_IN_CEXPI):
|
||||
arg = GIMPLE_STMT_OPERAND (stmt, 1);
|
||||
arg = TREE_VALUE (TREE_OPERAND (arg, 1));
|
||||
arg = CALL_EXPR_ARG (arg, 0);
|
||||
if (TREE_CODE (arg) == SSA_NAME)
|
||||
execute_cse_sincos_1 (arg);
|
||||
break;
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue