This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
revised PATCH: CALL_EXPR representation changes, part 3/9 (middle-end)
- From: Sandra Loosemore <sandra at codesourcery dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Brooks Moses <brooks dot moses at codesourcery dot com>, Lee Millward <lee dot millward at codesourcery dot com>
- Date: Wed, 14 Feb 2007 12:43:05 -0500
- Subject: revised PATCH: CALL_EXPR representation changes, part 3/9 (middle-end)
2007-02-14 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.
Index: gcc/tree-dump.c
===================================================================
*** gcc/tree-dump.c (revision 121818)
--- gcc/tree-dump.c (working copy)
*************** dequeue_and_dump (dump_info_p di)
*** 607,614 ****
break;
case CALL_EXPR:
! dump_child ("fn", TREE_OPERAND (t, 0));
! dump_child ("args", TREE_OPERAND (t, 1));
break;
case CONSTRUCTOR:
--- 607,625 ----
break;
case CALL_EXPR:
! {
! 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:
Index: gcc/tree-pretty-print.c
===================================================================
*** gcc/tree-pretty-print.c (revision 121818)
--- gcc/tree-pretty-print.c (working copy)
*************** do_niy (pretty_printer *buffer, tree nod
*** 74,80 ****
if (EXPR_P (node))
{
! len = TREE_CODE_LENGTH (TREE_CODE (node));
for (i = 0; i < len; ++i)
{
newline_and_indent (buffer, 2);
--- 74,80 ----
if (EXPR_P (node))
{
! len = TREE_OPERAND_LENGTH (node);
for (i = 0; i < len; ++i)
{
newline_and_indent (buffer, 2);
*************** dump_generic_node (pretty_printer *buffe
*** 1173,1184 ****
/* Print parameters. */
pp_space (buffer);
pp_character (buffer, '(');
! op1 = TREE_OPERAND (node, 1);
! if (op1)
! dump_generic_node (buffer, op1, spc, flags, false);
pp_character (buffer, ')');
! op1 = TREE_OPERAND (node, 2);
if (op1)
{
pp_string (buffer, " [static-chain: ");
--- 1173,1194 ----
/* Print parameters. */
pp_space (buffer);
pp_character (buffer, '(');
! {
! 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 = CALL_EXPR_STATIC_CHAIN (node);
if (op1)
{
pp_string (buffer, " [static-chain: ");
*************** print_call_name (pretty_printer *buffer,
*** 2528,2534 ****
gcc_assert (TREE_CODE (node) == CALL_EXPR);
! op0 = TREE_OPERAND (node, 0);
if (TREE_CODE (op0) == NON_LVALUE_EXPR)
op0 = TREE_OPERAND (op0, 0);
--- 2538,2544 ----
gcc_assert (TREE_CODE (node) == CALL_EXPR);
! op0 = CALL_EXPR_FN (node);
if (TREE_CODE (op0) == NON_LVALUE_EXPR)
op0 = TREE_OPERAND (op0, 0);
Index: gcc/print-tree.c
===================================================================
*** gcc/print-tree.c (revision 121818)
--- gcc/print-tree.c (working copy)
*************** print_node (FILE *file, const char *pref
*** 661,666 ****
--- 661,667 ----
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)
*************** print_node (FILE *file, const char *pref
*** 670,686 ****
print_node (file, "block", TREE_OPERAND (node, 2), indent + 4);
break;
}
!
! len = TREE_CODE_LENGTH (TREE_CODE (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;
--- 671,704 ----
print_node (file, "block", TREE_OPERAND (node, 2), indent + 4);
break;
}
! if (TREE_CODE (node) == CALL_EXPR)
{
! 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;
Index: gcc/tree-vrp.c
===================================================================
*** gcc/tree-vrp.c (revision 121818)
--- gcc/tree-vrp.c (working copy)
*************** stmt_interesting_for_vrp (tree stmt)
*** 3738,3746 ****
&& (INTEGRAL_TYPE_P (TREE_TYPE (lhs))
|| POINTER_TYPE_P (TREE_TYPE (lhs)))
&& ((TREE_CODE (rhs) == CALL_EXPR
! && TREE_CODE (TREE_OPERAND (rhs, 0)) == ADDR_EXPR
! && DECL_P (TREE_OPERAND (TREE_OPERAND (rhs, 0), 0))
! && DECL_IS_BUILTIN (TREE_OPERAND (TREE_OPERAND (rhs, 0), 0)))
|| ZERO_SSA_OPERANDS (stmt, SSA_OP_ALL_VIRTUALS)))
return true;
}
--- 3738,3746 ----
&& (INTEGRAL_TYPE_P (TREE_TYPE (lhs))
|| POINTER_TYPE_P (TREE_TYPE (lhs)))
&& ((TREE_CODE (rhs) == CALL_EXPR
! && TREE_CODE (CALL_EXPR_FN (rhs)) == ADDR_EXPR
! && DECL_P (TREE_OPERAND (CALL_EXPR_FN (rhs), 0))
! && DECL_IS_BUILTIN (TREE_OPERAND (CALL_EXPR_FN (rhs), 0)))
|| ZERO_SSA_OPERANDS (stmt, SSA_OP_ALL_VIRTUALS)))
return true;
}
*************** vrp_visit_stmt (tree stmt, edge *taken_e
*** 4233,4241 ****
for deriving ranges, with the obvious exception of calls to
builtin functions. */
if ((TREE_CODE (rhs) == CALL_EXPR
! && TREE_CODE (TREE_OPERAND (rhs, 0)) == ADDR_EXPR
! && DECL_P (TREE_OPERAND (TREE_OPERAND (rhs, 0), 0))
! && DECL_IS_BUILTIN (TREE_OPERAND (TREE_OPERAND (rhs, 0), 0)))
|| ZERO_SSA_OPERANDS (stmt, SSA_OP_ALL_VIRTUALS))
return vrp_visit_assignment (stmt, output_p);
}
--- 4233,4241 ----
for deriving ranges, with the obvious exception of calls to
builtin functions. */
if ((TREE_CODE (rhs) == CALL_EXPR
! && TREE_CODE (CALL_EXPR_FN (rhs)) == ADDR_EXPR
! && DECL_P (TREE_OPERAND (CALL_EXPR_FN (rhs), 0))
! && DECL_IS_BUILTIN (TREE_OPERAND (CALL_EXPR_FN (rhs), 0)))
|| ZERO_SSA_OPERANDS (stmt, SSA_OP_ALL_VIRTUALS))
return vrp_visit_assignment (stmt, output_p);
}
Index: gcc/tree-ssa-loop-im.c
===================================================================
*** gcc/tree-ssa-loop-im.c (revision 121818)
--- gcc/tree-ssa-loop-im.c (working copy)
*************** outermost_invariant_loop_expr (tree expr
*** 342,351 ****
if (class != tcc_unary
&& class != tcc_binary
&& class != tcc_expression
&& class != tcc_comparison)
return NULL;
! nops = TREE_CODE_LENGTH (TREE_CODE (expr));
for (i = 0; i < nops; i++)
{
aloop = outermost_invariant_loop_expr (TREE_OPERAND (expr, i), loop);
--- 342,352 ----
if (class != tcc_unary
&& class != tcc_binary
&& class != tcc_expression
+ && class != tcc_vl_exp
&& class != tcc_comparison)
return NULL;
! nops = TREE_OPERAND_LENGTH (expr);
for (i = 0; i < nops; i++)
{
aloop = outermost_invariant_loop_expr (TREE_OPERAND (expr, i), loop);
*************** force_move_till_expr (tree expr, struct
*** 817,826 ****
if (class != tcc_unary
&& class != tcc_binary
&& class != tcc_expression
&& class != tcc_comparison)
return;
! nops = TREE_CODE_LENGTH (TREE_CODE (expr));
for (i = 0; i < nops; i++)
force_move_till_expr (TREE_OPERAND (expr, i), orig_loop, loop);
}
--- 818,828 ----
if (class != tcc_unary
&& class != tcc_binary
&& class != tcc_expression
+ && class != tcc_vl_exp
&& class != tcc_comparison)
return;
! nops = TREE_OPERAND_LENGTH (expr);
for (i = 0; i < nops; i++)
force_move_till_expr (TREE_OPERAND (expr, i), orig_loop, loop);
}
Index: gcc/targhooks.c
===================================================================
*** gcc/targhooks.c (revision 121818)
--- gcc/targhooks.c (working copy)
*************** default_external_stack_protect_fail (voi
*** 432,438 ****
stack_chk_fail_decl = t;
}
! return build_function_call_expr (t, NULL_TREE);
}
tree
--- 432,438 ----
stack_chk_fail_decl = t;
}
! return build_call_expr (t, 0);
}
tree
*************** default_hidden_stack_protect_fail (void)
*** 465,471 ****
stack_chk_fail_decl = t;
}
! return build_function_call_expr (t, NULL_TREE);
#endif
}
--- 465,471 ----
stack_chk_fail_decl = t;
}
! return build_call_expr (t, 0);
#endif
}
Index: gcc/tree-complex.c
===================================================================
*** gcc/tree-complex.c (revision 121818)
--- gcc/tree-complex.c (working copy)
*************** expand_complex_libcall (block_stmt_itera
*** 885,896 ****
{
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);
stmt = bsi_stmt (*bsi);
type = TREE_TYPE (GIMPLE_STMT_OPERAND (stmt, 1));
--- 885,891 ----
{
enum machine_mode mode;
enum built_in_function bcode;
! tree fn, stmt, type;
stmt = bsi_stmt (*bsi);
type = TREE_TYPE (GIMPLE_STMT_OPERAND (stmt, 1));
*************** expand_complex_libcall (block_stmt_itera
*** 905,912 ****
gcc_unreachable ();
fn = built_in_decls[bcode];
! GIMPLE_STMT_OPERAND (stmt, 1)
! = build3 (CALL_EXPR, type, build_fold_addr_expr (fn), args, NULL);
update_stmt (stmt);
if (gimple_in_ssa_p (cfun))
--- 900,906 ----
gcc_unreachable ();
fn = built_in_decls[bcode];
! GIMPLE_STMT_OPERAND (stmt, 1) = build_call_expr (fn, 4, ar, ai, br, bi);
update_stmt (stmt);
if (gimple_in_ssa_p (cfun))
Index: gcc/cgraphbuild.c
===================================================================
*** gcc/cgraphbuild.c (revision 121818)
--- gcc/cgraphbuild.c (working copy)
*************** build_cgraph_edges (void)
*** 131,136 ****
--- 131,138 ----
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)
*************** build_cgraph_edges (void)
*** 138,145 ****
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);
if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
walk_tree (&GIMPLE_STMT_OPERAND (stmt, 0),
record_reference, node, visited_nodes);
--- 140,148 ----
cgraph_create_edge (node, cgraph_node (decl), stmt,
bb->count, freq,
bb->loop_depth);
! 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);
Index: gcc/tree-ssa-loop-niter.c
===================================================================
*** gcc/tree-ssa-loop-niter.c (revision 121818)
--- gcc/tree-ssa-loop-niter.c (working copy)
*************** simplify_replace_tree (tree expr, tree o
*** 655,661 ****
if (!EXPR_P (expr) && !GIMPLE_STMT_P (expr))
return expr;
! n = TREE_CODE_LENGTH (TREE_CODE (expr));
for (i = 0; i < n; i++)
{
e = TREE_OPERAND (expr, i);
--- 655,661 ----
if (!EXPR_P (expr) && !GIMPLE_STMT_P (expr))
return expr;
! n = TREE_OPERAND_LENGTH (expr);
for (i = 0; i < n; i++)
{
e = TREE_OPERAND (expr, i);
*************** expand_simple_operations (tree expr)
*** 691,697 ****
code = TREE_CODE (expr);
if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code)))
{
! n = TREE_CODE_LENGTH (code);
for (i = 0; i < n; i++)
{
e = TREE_OPERAND (expr, i);
--- 691,697 ----
code = TREE_CODE (expr);
if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code)))
{
! n = TREE_OPERAND_LENGTH (expr);
for (i = 0; i < n; i++)
{
e = TREE_OPERAND (expr, i);
*************** infer_loop_bounds_from_array (struct loo
*** 1858,1868 ****
call = get_call_expr_in (stmt);
if (call)
{
! tree args;
! 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));
}
}
--- 1858,1869 ----
call = get_call_expr_in (stmt);
if (call)
{
! tree arg;
! call_expr_arg_iterator iter;
! FOR_EACH_CALL_EXPR_ARG (arg, iter, call)
! if (REFERENCE_CLASS_P (arg))
! infer_loop_bounds_from_ref (loop, stmt, arg);
}
}
Index: gcc/gengtype.c
===================================================================
*** gcc/gengtype.c (revision 121818)
--- gcc/gengtype.c (working copy)
*************** adjust_field_tree_exp (type_p t, options
*** 719,725 ****
flds = create_field (NULL, t, "");
flds->opt = create_option (nodot, "length",
! "TREE_CODE_LENGTH (TREE_CODE ((tree) &%0))");
flds->opt = create_option (flds->opt, "default", "");
return new_structure ("tree_exp_subunion", 1, &lexer_line, flds, nodot);
--- 719,725 ----
flds = create_field (NULL, t, "");
flds->opt = create_option (nodot, "length",
! "TREE_OPERAND_LENGTH ((tree) &%0)");
flds->opt = create_option (flds->opt, "default", "");
return new_structure ("tree_exp_subunion", 1, &lexer_line, flds, nodot);
*************** walk_type (type_p t, struct walk_type_da
*** 1746,1761 ****
if (t->u.a.p->kind == TYPE_SCALAR)
break;
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);
if (length)
output_escaped_param (d, length, "length");
else
oprintf (d->of, "%s", t->u.a.len);
! oprintf (d->of, "); i%d++) {\n", loopcounter);
d->indent += 2;
d->val = newval = xasprintf ("%s[i%d]", oldval, loopcounter);
d->used_length = 1;
--- 1746,1772 ----
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, "%*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, ");\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;
Index: gcc/optabs.c
===================================================================
*** gcc/optabs.c (revision 121818)
--- gcc/optabs.c (working copy)
*************** expand_widen_pattern_expr (tree exp, rtx
*** 410,416 ****
rtx temp;
rtx pat;
rtx xop0, xop1, wxop;
! int nops = TREE_CODE_LENGTH (TREE_CODE (exp));
oprnd0 = TREE_OPERAND (exp, 0);
tmode0 = TYPE_MODE (TREE_TYPE (oprnd0));
--- 410,416 ----
rtx temp;
rtx pat;
rtx xop0, xop1, wxop;
! int nops = TREE_OPERAND_LENGTH (exp);
oprnd0 = TREE_OPERAND (exp, 0);
tmode0 = TYPE_MODE (TREE_TYPE (oprnd0));
Index: gcc/value-prof.c
===================================================================
*** gcc/value-prof.c (revision 121818)
--- gcc/value-prof.c (working copy)
*************** tree_ic (tree stmt, tree call, struct cg
*** 1073,1079 ****
tmpv = create_tmp_var (optype, "PROF");
tmp1 = create_tmp_var (optype, "PROF");
stmt1 = build2 (GIMPLE_MODIFY_STMT, optype, tmpv,
! unshare_expr (TREE_OPERAND (call, 0)));
stmt2 = build2 (GIMPLE_MODIFY_STMT, optype, tmp1,
fold_convert (optype, build_addr (direct_call->decl,
current_function_decl)));
--- 1073,1079 ----
tmpv = create_tmp_var (optype, "PROF");
tmp1 = create_tmp_var (optype, "PROF");
stmt1 = build2 (GIMPLE_MODIFY_STMT, optype, tmpv,
! unshare_expr (CALL_EXPR_FN (call)));
stmt2 = build2 (GIMPLE_MODIFY_STMT, optype, tmp1,
fold_convert (optype, build_addr (direct_call->decl,
current_function_decl)));
*************** tree_ic (tree stmt, tree call, struct cg
*** 1089,1096 ****
label1 = build1 (LABEL_EXPR, void_type_node, label_decl1);
stmt1 = unshare_expr (stmt);
new_call = get_call_expr_in (stmt1);
! TREE_OPERAND (new_call, 0) = build_addr (direct_call->decl,
! current_function_decl);
bsi_insert_before (&bsi, label1, BSI_SAME_STMT);
bsi_insert_before (&bsi, stmt1, BSI_SAME_STMT);
bb2end = stmt1;
--- 1089,1096 ----
label1 = build1 (LABEL_EXPR, void_type_node, label_decl1);
stmt1 = unshare_expr (stmt);
new_call = get_call_expr_in (stmt1);
! CALL_EXPR_FN (new_call) = build_addr (direct_call->decl,
! current_function_decl);
bsi_insert_before (&bsi, label1, BSI_SAME_STMT);
bsi_insert_before (&bsi, stmt1, BSI_SAME_STMT);
bb2end = stmt1;
*************** tree_ic_transform (tree stmt)
*** 1165,1171 ****
if (!call || TREE_CODE (call) != CALL_EXPR)
return false;
! callee = TREE_OPERAND (call, 0);
if (TREE_CODE (callee) == ADDR_EXPR)
return false;
--- 1165,1171 ----
if (!call || TREE_CODE (call) != CALL_EXPR)
return false;
! callee = CALL_EXPR_FN (call);
if (TREE_CODE (callee) == ADDR_EXPR)
return false;
*************** tree_ic_transform (tree stmt)
*** 1205,1213 ****
return true;
}
! /* Return true if the stringop FNDECL with ARGLIST shall be profiled. */
static bool
! interesting_stringop_to_profile_p (tree fndecl, tree arglist)
{
enum built_in_function fcode = DECL_FUNCTION_CODE (fndecl);
--- 1205,1213 ----
return true;
}
! /* Return true if the stringop CALL with FNDECL shall be profiled. */
static bool
! interesting_stringop_to_profile_p (tree fndecl, tree call)
{
enum built_in_function fcode = DECL_FUNCTION_CODE (fndecl);
*************** interesting_stringop_to_profile_p (tree
*** 1219,1236 ****
{
case BUILT_IN_MEMCPY:
case BUILT_IN_MEMPCPY:
! return validate_arglist (arglist,
! POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE,
! VOID_TYPE);
case BUILT_IN_MEMSET:
! return validate_arglist (arglist,
! POINTER_TYPE, INTEGER_TYPE, INTEGER_TYPE,
! VOID_TYPE);
case BUILT_IN_BZERO:
! return validate_arglist (arglist, POINTER_TYPE, INTEGER_TYPE,
! VOID_TYPE);
default:
! gcc_unreachable ();
}
}
--- 1219,1236 ----
{
case BUILT_IN_MEMCPY:
case BUILT_IN_MEMPCPY:
! return validate_arglist (call,
! POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE,
! VOID_TYPE);
case BUILT_IN_MEMSET:
! return validate_arglist (call,
! POINTER_TYPE, INTEGER_TYPE, INTEGER_TYPE,
! VOID_TYPE);
case BUILT_IN_BZERO:
! return validate_arglist (call, POINTER_TYPE, INTEGER_TYPE,
! VOID_TYPE);
default:
! gcc_unreachable ();
}
}
*************** tree_stringop_fixed_value (tree stmt, tr
*** 1256,1263 ****
edge e12, e13, e23, e24, e34;
block_stmt_iterator bsi;
tree call = get_call_expr_in (stmt);
! tree arglist = TREE_OPERAND (call, 1);
! tree blck_size = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
tree optype = TREE_TYPE (blck_size);
int region;
--- 1256,1262 ----
edge e12, e13, e23, e24, e34;
block_stmt_iterator bsi;
tree call = get_call_expr_in (stmt);
! tree blck_size = CALL_EXPR_ARG (call, 2);
tree optype = TREE_TYPE (blck_size);
int region;
*************** tree_stringop_fixed_value (tree stmt, tr
*** 1295,1302 ****
label1 = build1 (LABEL_EXPR, void_type_node, label_decl1);
stmt1 = unshare_expr (stmt);
call = get_call_expr_in (stmt1);
! arglist = TREE_OPERAND (call, 1);
! TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist))) = value;
bsi_insert_before (&bsi, label1, BSI_SAME_STMT);
bsi_insert_before (&bsi, stmt1, BSI_SAME_STMT);
region = lookup_stmt_eh_region (stmt);
--- 1294,1300 ----
label1 = build1 (LABEL_EXPR, void_type_node, label_decl1);
stmt1 = unshare_expr (stmt);
call = get_call_expr_in (stmt1);
! CALL_EXPR_ARG (call, 2) = value;
bsi_insert_before (&bsi, label1, BSI_SAME_STMT);
bsi_insert_before (&bsi, stmt1, BSI_SAME_STMT);
region = lookup_stmt_eh_region (stmt);
*************** tree_stringops_transform (block_stmt_ite
*** 1342,1348 ****
tree stmt = bsi_stmt (*bsi);
tree call = get_call_expr_in (stmt);
tree fndecl;
- tree arglist;
tree blck_size;
enum built_in_function fcode;
histogram_value histogram;
--- 1340,1345 ----
*************** tree_stringops_transform (block_stmt_ite
*** 1359,1372 ****
if (!fndecl)
return false;
fcode = DECL_FUNCTION_CODE (fndecl);
! arglist = TREE_OPERAND (call, 1);
! if (!interesting_stringop_to_profile_p (fndecl, arglist))
return false;
if (fcode == BUILT_IN_BZERO)
! blck_size = TREE_VALUE (TREE_CHAIN (arglist));
else
! blck_size = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
if (TREE_CODE (blck_size) == INTEGER_CST)
return false;
--- 1356,1368 ----
if (!fndecl)
return false;
fcode = DECL_FUNCTION_CODE (fndecl);
! if (!interesting_stringop_to_profile_p (fndecl, call))
return false;
if (fcode == BUILT_IN_BZERO)
! blck_size = CALL_EXPR_ARG (call, 1);
else
! blck_size = CALL_EXPR_ARG (call, 2);
if (TREE_CODE (blck_size) == INTEGER_CST)
return false;
*************** tree_stringops_transform (block_stmt_ite
*** 1386,1405 ****
if (check_counter (stmt, "value", all, bb_for_stmt (stmt)->count))
return false;
prob = (count * REG_BR_PROB_BASE + all / 2) / all;
! dest = TREE_VALUE (arglist);
dest_align = get_pointer_alignment (dest, BIGGEST_ALIGNMENT);
switch (fcode)
{
case BUILT_IN_MEMCPY:
case BUILT_IN_MEMPCPY:
! src = TREE_VALUE (TREE_CHAIN (arglist));
src_align = get_pointer_alignment (src, BIGGEST_ALIGNMENT);
if (!can_move_by_pieces (val, MIN (dest_align, src_align)))
return false;
break;
case BUILT_IN_MEMSET:
if (!can_store_by_pieces (val, builtin_memset_read_str,
! TREE_VALUE (TREE_CHAIN (arglist)),
dest_align))
return false;
break;
--- 1382,1401 ----
if (check_counter (stmt, "value", all, bb_for_stmt (stmt)->count))
return false;
prob = (count * REG_BR_PROB_BASE + all / 2) / all;
! dest = CALL_EXPR_ARG (call, 0);
dest_align = get_pointer_alignment (dest, BIGGEST_ALIGNMENT);
switch (fcode)
{
case BUILT_IN_MEMCPY:
case BUILT_IN_MEMPCPY:
! src = CALL_EXPR_ARG (call, 1);
src_align = get_pointer_alignment (src, BIGGEST_ALIGNMENT);
if (!can_move_by_pieces (val, MIN (dest_align, src_align)))
return false;
break;
case BUILT_IN_MEMSET:
if (!can_store_by_pieces (val, builtin_memset_read_str,
! CALL_EXPR_ARG (call, 1),
dest_align))
return false;
break;
*************** tree_indirect_call_to_profile (tree stmt
*** 1561,1567 ****
if (!call || TREE_CODE (call) != CALL_EXPR)
return;
! callee = TREE_OPERAND (call, 0);
if (TREE_CODE (callee) == ADDR_EXPR)
return;
--- 1557,1563 ----
if (!call || TREE_CODE (call) != CALL_EXPR)
return;
! callee = CALL_EXPR_FN (call);
if (TREE_CODE (callee) == ADDR_EXPR)
return;
*************** tree_stringops_values_to_profile (tree s
*** 1582,1588 ****
{
tree call = get_call_expr_in (stmt);
tree fndecl;
- tree arglist;
tree blck_size;
tree dest;
enum built_in_function fcode;
--- 1578,1583 ----
*************** tree_stringops_values_to_profile (tree s
*** 1593,1608 ****
if (!fndecl)
return;
fcode = DECL_FUNCTION_CODE (fndecl);
- arglist = TREE_OPERAND (call, 1);
! if (!interesting_stringop_to_profile_p (fndecl, arglist))
return;
! dest = TREE_VALUE (arglist);
if (fcode == BUILT_IN_BZERO)
! blck_size = TREE_VALUE (TREE_CHAIN (arglist));
else
! blck_size = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
if (TREE_CODE (blck_size) != INTEGER_CST)
{
--- 1588,1602 ----
if (!fndecl)
return;
fcode = DECL_FUNCTION_CODE (fndecl);
! if (!interesting_stringop_to_profile_p (fndecl, call))
return;
! dest = CALL_EXPR_ARG (call, 0);
if (fcode == BUILT_IN_BZERO)
! blck_size = CALL_EXPR_ARG (call, 1);
else
! blck_size = CALL_EXPR_ARG (call, 2);
if (TREE_CODE (blck_size) != INTEGER_CST)
{
Index: gcc/tree-tailcall.c
===================================================================
*** gcc/tree-tailcall.c (revision 121818)
--- gcc/tree-tailcall.c (working copy)
*************** propagate_through_phis (tree var, edge e
*** 374,380 ****
static void
find_tail_calls (basic_block bb, struct tailcall **ret)
{
! tree ass_var, ret_var, stmt, func, param, args, call = NULL_TREE;
block_stmt_iterator bsi, absi;
bool tail_recursion;
struct tailcall *nw;
--- 374,380 ----
static void
find_tail_calls (basic_block bb, struct tailcall **ret)
{
! tree ass_var, ret_var, stmt, func, param, call = NULL_TREE;
block_stmt_iterator bsi, absi;
bool tail_recursion;
struct tailcall *nw;
*************** find_tail_calls (basic_block bb, struct
*** 433,443 ****
func = get_callee_fndecl (call);
if (func == current_function_decl)
{
! for (param = DECL_ARGUMENTS (func), args = TREE_OPERAND (call, 1);
! param && args;
! param = TREE_CHAIN (param), args = TREE_CHAIN (args))
{
- tree arg = TREE_VALUE (args);
if (param != arg)
{
/* Make sure there are no problems with copying. The parameter
--- 433,445 ----
func = get_callee_fndecl (call);
if (func == current_function_decl)
{
! call_expr_arg_iterator iter;
! tree arg;
! for (param = DECL_ARGUMENTS (func),
! arg = first_call_expr_arg (call, &iter);
! param && arg;
! param = TREE_CHAIN (param), arg = next_call_expr_arg (&iter))
{
if (param != arg)
{
/* Make sure there are no problems with copying. The parameter
*************** find_tail_calls (basic_block bb, struct
*** 460,466 ****
break;
}
}
! if (!args && !param)
tail_recursion = true;
}
--- 462,468 ----
break;
}
}
! if (!arg && !param)
tail_recursion = true;
}
*************** arg_needs_copy_p (tree param)
*** 714,720 ****
static void
eliminate_tail_call (struct tailcall *t)
{
! tree param, stmt, args, rslt, call;
basic_block bb, first;
edge e;
tree phi;
--- 716,724 ----
static void
eliminate_tail_call (struct tailcall *t)
{
! tree param, stmt, rslt, call;
! tree arg;
! call_expr_arg_iterator iter;
basic_block bb, first;
edge e;
tree phi;
*************** eliminate_tail_call (struct tailcall *t)
*** 769,785 ****
/* Add phi node entries for arguments. The ordering of the phi nodes should
be the same as the ordering of the arguments. */
for (param = DECL_ARGUMENTS (current_function_decl),
! args = TREE_OPERAND (stmt, 1),
! phi = phi_nodes (first);
param;
! param = TREE_CHAIN (param),
! args = TREE_CHAIN (args))
{
if (!arg_needs_copy_p (param))
continue;
gcc_assert (param == SSA_NAME_VAR (PHI_RESULT (phi)));
! add_phi_arg (phi, TREE_VALUE (args), e);
phi = PHI_CHAIN (phi);
}
--- 773,788 ----
/* Add phi node entries for arguments. The ordering of the phi nodes should
be the same as the ordering of the arguments. */
for (param = DECL_ARGUMENTS (current_function_decl),
! arg = first_call_expr_arg (stmt, &iter),
! phi = phi_nodes (first);
param;
! param = TREE_CHAIN (param), arg = next_call_expr_arg (&iter))
{
if (!arg_needs_copy_p (param))
continue;
gcc_assert (param == SSA_NAME_VAR (PHI_RESULT (phi)));
! add_phi_arg (phi, arg, e);
phi = PHI_CHAIN (phi);
}
Index: gcc/ipa-cp.c
===================================================================
*** gcc/ipa-cp.c (revision 121818)
--- gcc/ipa-cp.c (working copy)
*************** ipcp_update_callgraph (void)
*** 925,932 ****
if (ipcp_redirect (cs))
{
cgraph_redirect_edge_callee (cs, orig_callee);
! TREE_OPERAND (TREE_OPERAND
! (get_call_expr_in (cs->call_stmt), 0), 0) =
orig_callee->decl;
}
}
--- 925,932 ----
if (ipcp_redirect (cs))
{
cgraph_redirect_edge_callee (cs, orig_callee);
! TREE_OPERAND (CALL_EXPR_FN (get_call_expr_in (cs->call_stmt)),
! 0) =
orig_callee->decl;
}
}
Index: gcc/tree-scalar-evolution.c
===================================================================
*** gcc/tree-scalar-evolution.c (revision 121818)
--- gcc/tree-scalar-evolution.c (working copy)
*************** find_var_scev_info (tree var)
*** 357,362 ****
--- 357,364 ----
bool
chrec_contains_symbols_defined_in_loop (tree chrec, unsigned loop_nb)
{
+ int i, n;
+
if (chrec == NULL_TREE)
return false;
*************** chrec_contains_symbols_defined_in_loop (
*** 386,411 ****
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;
! }
}
/* Return true when PHI is a loop-phi-node. */
--- 388,399 ----
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. */
*************** instantiate_parameters_1 (struct loop *l
*** 2317,2322 ****
--- 2305,2311 ----
break;
}
+ gcc_assert (!VL_EXP_CLASS_P (chrec));
switch (TREE_CODE_LENGTH (TREE_CODE (chrec)))
{
case 3:
Index: gcc/omp-low.c
===================================================================
*** gcc/omp-low.c (revision 121818)
--- gcc/omp-low.c (working copy)
*************** scan_omp (tree *stmt_p, omp_context *ctx
*** 1427,1436 ****
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);
gimplify_and_add (t, stmt_list);
}
--- 1427,1433 ----
static void
build_omp_barrier (tree *stmt_list)
{
! tree t = build_call_expr (built_in_decls[BUILT_IN_GOMP_BARRIER], 0);
gimplify_and_add (t, stmt_list);
}
*************** lower_rec_input_clauses (tree clauses, t
*** 1604,1610 ****
omp_context *ctx)
{
tree_stmt_iterator diter;
! tree c, dtor, copyin_seq, x, args, ptr;
bool copyin_by_ref = false;
bool lastprivate_firstprivate = false;
int pass;
--- 1601,1607 ----
omp_context *ctx)
{
tree_stmt_iterator diter;
! tree c, dtor, copyin_seq, x, ptr;
bool copyin_by_ref = false;
bool lastprivate_firstprivate = false;
int pass;
*************** lower_rec_input_clauses (tree clauses, t
*** 1676,1684 ****
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 = fold_convert (TREE_TYPE (ptr), x);
x = build2 (GIMPLE_MODIFY_STMT, void_type_node, ptr, x);
gimplify_and_add (x, ilist);
--- 1673,1679 ----
gcc_assert (DECL_P (ptr));
x = TYPE_SIZE_UNIT (TREE_TYPE (new_var));
! 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);
*************** lower_rec_input_clauses (tree clauses, t
*** 1710,1718 ****
}
else
{
! args = tree_cons (NULL, x, NULL);
! x = built_in_decls[BUILT_IN_ALLOCA];
! x = build_function_call_expr (x, args);
x = fold_convert (TREE_TYPE (new_var), x);
}
--- 1705,1711 ----
}
else
{
! x = build_call_expr (built_in_decls[BUILT_IN_ALLOCA], 1, x);
x = fold_convert (TREE_TYPE (new_var), x);
}
*************** lower_rec_input_clauses (tree clauses, t
*** 1815,1822 ****
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 = 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);
--- 1808,1814 ----
but it certainly is to C++ operator=. */
if (copyin_seq)
{
! 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);
*************** lower_reduction_clauses (tree clauses, t
*** 1969,1982 ****
}
}
! x = built_in_decls[BUILT_IN_GOMP_ATOMIC_START];
! x = build_function_call_expr (x, NULL);
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);
gimplify_and_add (x, stmt_list);
}
--- 1961,1972 ----
}
}
! 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 = build_call_expr (built_in_decls[BUILT_IN_GOMP_ATOMIC_END], 0);
gimplify_and_add (x, stmt_list);
}
*************** static void
*** 2155,2161 ****
expand_parallel_call (struct omp_region *region, basic_block bb,
tree entry_stmt, tree ws_args)
{
! tree t, args, val, cond, c, list, clauses;
block_stmt_iterator si;
int start_ix;
--- 2145,2151 ----
expand_parallel_call (struct omp_region *region, basic_block bb,
tree entry_stmt, tree ws_args)
{
! tree t, t1, t2, val, cond, c, list, clauses;
block_stmt_iterator si;
int start_ix;
*************** expand_parallel_call (struct omp_region
*** 2261,2281 ****
}
list = NULL_TREE;
- args = tree_cons (NULL, val, NULL);
t = OMP_PARALLEL_DATA_ARG (entry_stmt);
if (t == NULL)
! t = 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);
if (ws_args)
! args = chainon (args, ws_args);
- 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);
--- 2251,2273 ----
}
list = NULL_TREE;
t = OMP_PARALLEL_DATA_ARG (entry_stmt);
if (t == NULL)
! t1 = null_pointer_node;
else
! t1 = build_fold_addr_expr (t);
! t2 = build_fold_addr_expr (OMP_PARALLEL_FN (entry_stmt));
if (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);
gimplify_and_add (t, &list);
t = OMP_PARALLEL_DATA_ARG (entry_stmt);
*************** expand_parallel_call (struct omp_region
*** 2283,2294 ****
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);
gimplify_and_add (t, &list);
! t = built_in_decls[BUILT_IN_GOMP_PARALLEL_END];
! t = build_function_call_expr (t, NULL);
gimplify_and_add (t, &list);
si = bsi_last (bb);
--- 2275,2284 ----
t = null_pointer_node;
else
t = build_fold_addr_expr (t);
! t = build_call_expr (OMP_PARALLEL_FN (entry_stmt), 1, t);
gimplify_and_add (t, &list);
! t = build_call_expr (built_in_decls[BUILT_IN_GOMP_PARALLEL_END], 0);
gimplify_and_add (t, &list);
si = bsi_last (bb);
*************** maybe_catch_exception (tree *stmt_p)
*** 2313,2322 ****
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);
! }
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));
--- 2303,2309 ----
if (lang_protect_cleanup_actions)
t = lang_protect_cleanup_actions ();
else
! 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));
*************** expand_omp_for_generic (struct omp_regio
*** 2583,2589 ****
{
tree l0, l1, l2 = NULL, l3 = NULL;
tree type, istart0, iend0, iend;
! tree t, args, 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;
--- 2570,2576 ----
{
tree l0, l1, l2 = NULL, l3 = NULL;
tree type, istart0, iend0, iend;
! 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;
*************** expand_omp_for_generic (struct omp_regio
*** 2621,2645 ****
gcc_assert (TREE_CODE (bsi_stmt (si)) == OMP_FOR);
if (!in_combined_parallel)
{
/* 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);
if (fd->chunk_size)
{
t = fold_convert (long_integer_type_node, fd->chunk_size);
! args = tree_cons (NULL, t, args);
}
! 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);
t = get_formal_tmp_var (t, &list);
if (cont_bb)
{
--- 2608,2631 ----
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 ();
! 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);
! t = build_call_expr (built_in_decls[start_fn], 6,
! t0, t1, t2, t, t3, t4);
}
! 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)
{
*************** expand_omp_for_generic (struct omp_regio
*** 2697,2707 ****
/* 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 = get_formal_tmp_var (t, &list);
t = build3 (COND_EXPR, void_type_node, t, build_and_jump (&l0),
build_and_jump (&l3));
--- 2683,2691 ----
/* Emit code to get the next parallel iteration in L2_BB. */
list = alloc_stmt_list ();
! 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));
*************** expand_omp_for_generic (struct omp_regio
*** 2716,2722 ****
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);
bsi_insert_after (&si, t, BSI_SAME_STMT);
bsi_remove (&si, true);
--- 2700,2706 ----
t = built_in_decls[BUILT_IN_GOMP_LOOP_END_NOWAIT];
else
t = built_in_decls[BUILT_IN_GOMP_LOOP_END];
! t = build_call_expr (t, 0);
bsi_insert_after (&si, t, BSI_SAME_STMT);
bsi_remove (&si, true);
*************** expand_omp_for_static_nochunk (struct om
*** 2795,2807 ****
/* 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 = 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 = fold_convert (type, t);
threadid = get_formal_tmp_var (t, &list);
--- 2779,2789 ----
/* Iteration space partitioning goes in ENTRY_BB. */
list = alloc_stmt_list ();
! 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 = 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);
*************** expand_omp_for_static_chunk (struct omp_
*** 2972,2984 ****
/* 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 = 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 = fold_convert (type, t);
threadid = get_formal_tmp_var (t, &list);
--- 2954,2964 ----
/* Trip and adjustment setup goes in ENTRY_BB. */
list = alloc_stmt_list ();
! 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 = 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);
*************** expand_omp_sections (struct omp_region *
*** 3224,3232 ****
/* 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 = build2 (GIMPLE_MODIFY_STMT, void_type_node, v, t);
bsi_insert_after (&si, t, BSI_SAME_STMT);
}
--- 3204,3211 ----
/* If we are not inside a combined parallel+sections region,
call GOMP_sections_start. */
t = build_int_cst (unsigned_type_node, len);
u = built_in_decls[BUILT_IN_GOMP_SECTIONS_START];
! 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);
}
*************** expand_omp_sections (struct omp_region *
*** 3284,3291 ****
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);
bsi_insert_after (&si, t, BSI_CONTINUE_LINKING);
/* Code to get the next section goes in L1_BB. */
--- 3263,3269 ----
make_edge (l0_bb, default_bb, 0);
si = bsi_start (default_bb);
! 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. */
*************** expand_omp_sections (struct omp_region *
*** 3294,3301 ****
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 = build2 (GIMPLE_MODIFY_STMT, void_type_node, v, t);
bsi_insert_after (&si, t, BSI_SAME_STMT);
bsi_remove (&si, true);
--- 3272,3278 ----
si = bsi_last (l1_bb);
gcc_assert (TREE_CODE (bsi_stmt (si)) == OMP_CONTINUE);
! 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);
*************** expand_omp_sections (struct omp_region *
*** 3309,3315 ****
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);
bsi_insert_after (&si, t, BSI_SAME_STMT);
bsi_remove (&si, true);
}
--- 3286,3292 ----
t = built_in_decls[BUILT_IN_GOMP_SECTIONS_END_NOWAIT];
else
t = built_in_decls[BUILT_IN_GOMP_SECTIONS_END];
! t = build_call_expr (t, 0);
bsi_insert_after (&si, t, BSI_SAME_STMT);
bsi_remove (&si, true);
}
*************** lower_omp_single_simple (tree single_stm
*** 3680,3687 ****
{
tree t;
! t = built_in_decls[BUILT_IN_GOMP_SINGLE_START];
! t = build_function_call_expr (t, NULL);
t = build3 (COND_EXPR, void_type_node, t,
OMP_SINGLE_BODY (single_stmt), NULL);
gimplify_and_add (t, pre_p);
--- 3657,3663 ----
{
tree t;
! 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);
*************** lower_omp_single_simple (tree single_stm
*** 3720,3726 ****
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;
ctx->sender_decl = create_tmp_var (ctx->record_type, ".omp_copy_o");
--- 3696,3702 ----
static void
lower_omp_single_copy (tree single_stmt, tree *pre_p, omp_context *ctx)
{
! tree ptr_type, t, l0, l1, l2, copyin_seq;
ctx->sender_decl = create_tmp_var (ctx->record_type, ".omp_copy_o");
*************** lower_omp_single_copy (tree single_stmt,
*** 3731,3738 ****
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 = fold_convert (ptr_type, t);
t = build2 (GIMPLE_MODIFY_STMT, void_type_node, ctx->receiver_decl, t);
gimplify_and_add (t, pre_p);
--- 3707,3713 ----
l1 = create_artificial_label ();
l2 = create_artificial_label ();
! 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);
*************** lower_omp_single_copy (tree single_stmt,
*** 3753,3761 ****
©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);
gimplify_and_add (t, pre_p);
t = build_and_jump (&l2);
--- 3728,3734 ----
©in_seq, ctx);
t = build_fold_addr_expr (ctx->sender_decl);
! 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);
*************** lower_omp_master (tree *stmt_p, omp_cont
*** 3828,3835 ****
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 = 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));
--- 3801,3807 ----
append_to_statement_list (stmt, &BIND_EXPR_BODY (bind));
! 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));
*************** lower_omp_ordered (tree *stmt_p, omp_con
*** 3868,3875 ****
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);
gimplify_and_add (x, &BIND_EXPR_BODY (bind));
lower_omp (&OMP_ORDERED_BODY (stmt), ctx);
--- 3840,3846 ----
append_to_statement_list (stmt, &BIND_EXPR_BODY (bind));
! 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);
*************** lower_omp_ordered (tree *stmt_p, omp_con
*** 3877,3884 ****
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);
gimplify_and_add (x, &BIND_EXPR_BODY (bind));
x = make_node (OMP_RETURN);
--- 3848,3854 ----
append_to_statement_list (OMP_ORDERED_BODY (stmt), &BIND_EXPR_BODY (bind));
OMP_ORDERED_BODY (stmt) = 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);
*************** lower_omp_critical (tree *stmt_p, omp_co
*** 3909,3915 ****
name = OMP_CRITICAL_NAME (stmt);
if (name)
{
! tree decl, args;
splay_tree_node n;
if (!critical_name_mutexes)
--- 3879,3885 ----
name = OMP_CRITICAL_NAME (stmt);
if (name)
{
! tree decl;
splay_tree_node n;
if (!critical_name_mutexes)
*************** lower_omp_critical (tree *stmt_p, omp_co
*** 3939,3959 ****
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);
- 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);
}
else
{
lock = built_in_decls[BUILT_IN_GOMP_CRITICAL_START];
! lock = build_function_call_expr (lock, NULL);
unlock = built_in_decls[BUILT_IN_GOMP_CRITICAL_END];
! unlock = build_function_call_expr (unlock, NULL);
}
push_gimplify_context ();
--- 3909,3927 ----
else
decl = (tree) n->value;
lock = built_in_decls[BUILT_IN_GOMP_CRITICAL_NAME_START];
! lock = build_call_expr (lock, 1, build_fold_addr_expr (decl));
unlock = built_in_decls[BUILT_IN_GOMP_CRITICAL_NAME_END];
! unlock = build_call_expr (unlock, 1, build_fold_addr_expr (decl));
}
else
{
lock = built_in_decls[BUILT_IN_GOMP_CRITICAL_START];
! lock = build_call_expr (lock, 0);
unlock = built_in_decls[BUILT_IN_GOMP_CRITICAL_END];
! unlock = build_call_expr (unlock, 0);
}
push_gimplify_context ();
Index: gcc/ipa-reference.c
===================================================================
*** gcc/ipa-reference.c (revision 121818)
--- gcc/ipa-reference.c (working copy)
*************** static void
*** 436,453 ****
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;
! for (operand = operand_list;
! operand != NULL_TREE;
! operand = TREE_CHAIN (operand))
! {
! tree argument = TREE_VALUE (operand);
! check_rhs_var (local, argument);
! }
if (callee_t)
{
--- 436,448 ----
check_call (ipa_reference_local_vars_info_t local, tree call_expr)
{
int flags = call_expr_flags (call_expr);
tree operand;
tree callee_t = get_callee_fndecl (call_expr);
enum availability avail = AVAIL_NOT_AVAILABLE;
+ call_expr_arg_iterator iter;
! FOR_EACH_CALL_EXPR_ARG (operand, iter, call_expr)
! check_rhs_var (local, operand);
if (callee_t)
{
*************** scan_for_static_refs (tree *tp,
*** 534,540 ****
case ADDR_EXPR:
check_rhs_var (local, rhs);
break;
! case CALL_EXPR:
check_call (local, rhs);
break;
default:
--- 529,542 ----
case ADDR_EXPR:
check_rhs_var (local, rhs);
break;
! default:
! break;
! }
! break;
! case tcc_vl_exp:
! switch (TREE_CODE (rhs))
! {
! case CALL_EXPR:
check_call (local, rhs);
break;
default:
Index: gcc/tree-gimple.c
===================================================================
*** gcc/tree-gimple.c (revision 121818)
--- gcc/tree-gimple.c (working copy)
*************** is_gimple_cast (tree t)
*** 420,426 ****
|| TREE_CODE (t) == FIX_TRUNC_EXPR);
}
! /* Return true if T is a valid op0 of a CALL_EXPR. */
bool
is_gimple_call_addr (tree t)
--- 420,426 ----
|| TREE_CODE (t) == FIX_TRUNC_EXPR);
}
! /* Return true if T is a valid function operand of a CALL_EXPR. */
bool
is_gimple_call_addr (tree t)
*************** void
*** 474,480 ****
recalculate_side_effects (tree t)
{
enum tree_code code = TREE_CODE (t);
! int len = TREE_CODE_LENGTH (code);
int i;
switch (TREE_CODE_CLASS (code))
--- 474,480 ----
recalculate_side_effects (tree t)
{
enum tree_code code = TREE_CODE (t);
! int len = TREE_OPERAND_LENGTH (t);
int i;
switch (TREE_CODE_CLASS (code))
*************** recalculate_side_effects (tree t)
*** 502,507 ****
--- 502,508 ----
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)
{
Index: gcc/tree-chrec.c
===================================================================
*** gcc/tree-chrec.c (revision 121818)
--- gcc/tree-chrec.c (working copy)
*************** is_multivariate_chrec (tree chrec)
*** 860,865 ****
--- 860,867 ----
bool
chrec_contains_symbols (tree chrec)
{
+ int i, n;
+
if (chrec == NULL_TREE)
return false;
*************** chrec_contains_symbols (tree chrec)
*** 871,894 ****
|| 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;
! }
}
/* Determines whether the chrec contains undetermined coefficients. */
--- 873,884 ----
|| TREE_CODE (chrec) == RESULT_DECL
|| TREE_CODE (chrec) == FIELD_DECL)
return true;
!
! 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. */
*************** chrec_contains_symbols (tree chrec)
*** 896,923 ****
bool
chrec_contains_undetermined (tree chrec)
{
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;
! }
}
/* Determines whether the tree EXPR contains chrecs, and increment
--- 886,903 ----
bool
chrec_contains_undetermined (tree chrec)
{
+ int i, n;
+
if (chrec == chrec_dont_know
|| chrec == chrec_not_analyzed_yet
|| chrec == NULL_TREE)
return true;
!
! 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
*************** chrec_contains_undetermined (tree chrec)
*** 927,932 ****
--- 907,914 ----
bool
tree_contains_chrecs (tree expr, int *size)
{
+ int i, n;
+
if (expr == NULL_TREE)
return false;
*************** tree_contains_chrecs (tree expr, int *si
*** 936,958 ****
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;
! }
}
/* Recursive helper function. */
--- 918,928 ----
if (tree_is_chrec (expr))
return true;
! 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. */
*************** evolution_function_is_invariant_rec_p (t
*** 978,984 ****
return true;
}
! switch (TREE_CODE_LENGTH (TREE_CODE (chrec)))
{
case 2:
if (!evolution_function_is_invariant_rec_p (TREE_OPERAND (chrec, 1),
--- 948,954 ----
return true;
}
! switch (TREE_OPERAND_LENGTH (chrec))
{
case 2:
if (!evolution_function_is_invariant_rec_p (TREE_OPERAND (chrec, 1),
Index: gcc/cgraphunit.c
===================================================================
*** gcc/cgraphunit.c (revision 121818)
--- gcc/cgraphunit.c (working copy)
*************** update_call_expr (struct cgraph_node *ne
*** 1386,1392 ****
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;
}
--- 1386,1392 ----
for (e = new_version->callers; e; e = e->next_caller)
/* Update the call expr on the edges
to call the new version. */
! TREE_OPERAND (CALL_EXPR_FN (get_call_expr_in (e->call_stmt)), 0) = new_version->decl;
}
Index: gcc/tree-ssa-ccp.c
===================================================================
*** gcc/tree-ssa-ccp.c (revision 121818)
--- gcc/tree-ssa-ccp.c (working copy)
*************** ccp_fold (tree stmt)
*** 938,952 ****
/* 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)))
{
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;
--- 938,950 ----
/* We may be able to fold away calls to builtin functions if their
arguments are constants. */
else if (code == CALL_EXPR
! && 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;
size_t i = 0;
ssa_op_iter iter;
use_operand_p var_p;
*************** ccp_fold (tree stmt)
*** 958,966 ****
/* 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);
/* Restore operands to their original form. */
i = 0;
--- 956,962 ----
/* Substitute operands with their values and try to fold. */
replace_uses_in (stmt, NULL, const_val);
! retval = fold_call_expr (rhs, false);
/* Restore operands to their original form. */
i = 0;
*************** static tree
*** 2204,2221 ****
ccp_fold_builtin (tree stmt, tree fn)
{
tree result, val[3];
! tree callee, arglist, a;
int arg_mask, i, type;
bitmap visited;
bool ignore;
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);
if (result)
{
if (ignore)
--- 2200,2217 ----
ccp_fold_builtin (tree stmt, tree fn)
{
tree result, val[3];
! 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. */
! result = fold_call_expr (fn, ignore);
if (result)
{
if (ignore)
*************** ccp_fold_builtin (tree stmt, tree fn)
*** 2224,2235 ****
}
/* Ignore MD builtins. */
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)
return NULL_TREE;
/* Limit the work only for builtins we know how to simplify. */
--- 2220,2233 ----
}
/* 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. */
! nargs = call_expr_nargs (fn);
! if (nargs == 0)
return NULL_TREE;
/* Limit the work only for builtins we know how to simplify. */
*************** ccp_fold_builtin (tree stmt, tree fn)
*** 2272,2286 ****
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;
! }
BITMAP_FREE (visited);
--- 2270,2286 ----
visited = BITMAP_ALLOC (NULL);
memset (val, 0, sizeof (val));
! 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);
*************** ccp_fold_builtin (tree stmt, tree fn)
*** 2302,2324 ****
break;
case BUILT_IN_STRCPY:
! if (val[1] && is_gimple_val (val[1]))
! result = fold_builtin_strcpy (callee, arglist, val[1]);
break;
case BUILT_IN_STRNCPY:
! if (val[1] && is_gimple_val (val[1]))
! result = fold_builtin_strncpy (callee, arglist, val[1]);
break;
case BUILT_IN_FPUTS:
! result = fold_builtin_fputs (arglist,
TREE_CODE (stmt) != GIMPLE_MODIFY_STMT, 0,
val[0]);
break;
case BUILT_IN_FPUTS_UNLOCKED:
! result = fold_builtin_fputs (arglist,
TREE_CODE (stmt) != GIMPLE_MODIFY_STMT, 1,
val[0]);
break;
--- 2302,2333 ----
break;
case BUILT_IN_STRCPY:
! 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]) && 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 (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 (CALL_EXPR_ARG (fn, 0),
! CALL_EXPR_ARG (fn, 1),
TREE_CODE (stmt) != GIMPLE_MODIFY_STMT, 1,
val[0]);
break;
*************** ccp_fold_builtin (tree stmt, tree fn)
*** 2328,2353 ****
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,
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,
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]);
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],
DECL_FUNCTION_CODE (callee));
break;
--- 2337,2375 ----
case BUILT_IN_MEMMOVE_CHK:
case BUILT_IN_MEMSET_CHK:
if (val[2] && is_gimple_val (val[2]))
! 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,
! 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 (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 (fn, val[1],
DECL_FUNCTION_CODE (callee));
break;
*************** fold_stmt (tree *stmt_p)
*** 2382,2390 ****
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);
return true;
}
--- 2404,2410 ----
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_call_expr (implicit_built_in_decls[BUILT_IN_TRAP], 0);
return true;
}
*************** fold_stmt (tree *stmt_p)
*** 2412,2419 ****
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);
if (TREE_CODE (callee) == OBJ_TYPE_REF
&& lang_hooks.fold_obj_type_ref
&& TREE_CODE (OBJ_TYPE_REF_OBJECT (callee)) == ADDR_EXPR
--- 2432,2439 ----
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_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
*************** fold_stmt (tree *stmt_p)
*** 2431,2437 ****
t = lang_hooks.fold_obj_type_ref (callee, t);
if (t)
{
! TREE_OPERAND (rhs, 0) = t;
changed = true;
}
}
--- 2451,2457 ----
t = lang_hooks.fold_obj_type_ref (callee, t);
if (t)
{
! CALL_EXPR_FN (rhs) = t;
changed = true;
}
}
Index: gcc/tree-ssa-loop-ivopts.c
===================================================================
*** gcc/tree-ssa-loop-ivopts.c (revision 121818)
--- gcc/tree-ssa-loop-ivopts.c (working copy)
*************** expr_invariant_in_loop_p (struct loop *l
*** 1272,1278 ****
if (!EXPR_P (expr) && !GIMPLE_STMT_P (expr))
return false;
! len = TREE_CODE_LENGTH (TREE_CODE (expr));
for (i = 0; i < len; i++)
if (!expr_invariant_in_loop_p (loop, TREE_OPERAND (expr, i)))
return false;
--- 1272,1278 ----
if (!EXPR_P (expr) && !GIMPLE_STMT_P (expr))
return false;
! len = TREE_OPERAND_LENGTH (expr);
for (i = 0; i < len; i++)
if (!expr_invariant_in_loop_p (loop, TREE_OPERAND (expr, i)))
return false;
Index: gcc/ipa-pure-const.c
===================================================================
*** gcc/ipa-pure-const.c (revision 121818)
--- gcc/ipa-pure-const.c (working copy)
*************** get_asm_expr_operands (funct_state local
*** 316,335 ****
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);
tree operand;
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);
! }
/* The const and pure flags are set by a variety of places in the
compiler (including here). If someone has already set the flags
--- 316,330 ----
static void
check_call (funct_state local, tree call_expr)
{
! 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_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
*************** scan_function (tree *tp,
*** 452,458 ****
case ADDR_EXPR:
check_rhs_var (local, rhs);
break;
! case CALL_EXPR:
check_call (local, rhs);
break;
default:
--- 447,460 ----
case ADDR_EXPR:
check_rhs_var (local, rhs);
break;
! default:
! break;
! }
! break;
! case tcc_vl_exp:
! switch (TREE_CODE (rhs))
! {
! case CALL_EXPR:
check_call (local, rhs);
break;
default:
Index: gcc/tree-stdarg.c
===================================================================
*** gcc/tree-stdarg.c (revision 121818)
--- gcc/tree-stdarg.c (working copy)
*************** execute_optimize_stdarg (void)
*** 660,666 ****
}
si.va_start_count++;
! ap = TREE_VALUE (TREE_OPERAND (call, 1));
if (TREE_CODE (ap) != ADDR_EXPR)
{
--- 660,666 ----
}
si.va_start_count++;
! ap = CALL_EXPR_ARG (call, 0);
if (TREE_CODE (ap) != ADDR_EXPR)
{
Index: gcc/tree-ssa-math-opts.c
===================================================================
*** gcc/tree-ssa-math-opts.c (revision 121818)
--- gcc/tree-ssa-math-opts.c (working copy)
*************** execute_cse_sincos_1 (tree name)
*** 606,612 ****
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));
stmt = build2 (GIMPLE_MODIFY_STMT, NULL_TREE, res, call);
def_stmt = SSA_NAME_DEF_STMT (name);
if (bb_for_stmt (def_stmt) == top_bb
--- 606,612 ----
if (!fndecl)
return;
res = make_rename_temp (TREE_TYPE (TREE_TYPE (fndecl)), "sincostmp");
! 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
*************** execute_cse_sincos (void)
*** 684,690 ****
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));
if (TREE_CODE (arg) == SSA_NAME)
execute_cse_sincos_1 (arg);
break;
--- 684,690 ----
CASE_FLT_FN (BUILT_IN_SIN):
CASE_FLT_FN (BUILT_IN_CEXPI):
arg = GIMPLE_STMT_OPERAND (stmt, 1);
! arg = CALL_EXPR_ARG (arg, 0);
if (TREE_CODE (arg) == SSA_NAME)
execute_cse_sincos_1 (arg);
break;
Index: gcc/tree-ssa-alias.c
===================================================================
*** gcc/tree-ssa-alias.c (revision 121818)
--- gcc/tree-ssa-alias.c (working copy)
*************** find_used_portions (tree *tp, int *walk_
*** 3080,3090 ****
break;
case CALL_EXPR:
{
! tree *arg;
! for (arg = &TREE_OPERAND (*tp, 1); *arg; arg = &TREE_CHAIN (*arg))
{
! if (TREE_CODE (TREE_VALUE (*arg)) != ADDR_EXPR)
! find_used_portions (&TREE_VALUE (*arg), walk_subtrees, NULL);
}
*walk_subtrees = 0;
return NULL_TREE;
--- 3080,3092 ----
break;
case CALL_EXPR:
{
! int i;
! int nargs = call_expr_nargs (*tp);
! for (i = 0; i < nargs; i++)
{
! 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;
Index: gcc/gimple-low.c
===================================================================
*** gcc/gimple-low.c (revision 121818)
--- gcc/gimple-low.c (working copy)
*************** lower_function_body (void)
*** 134,143 ****
/* 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);
t = implicit_built_in_decls[BUILT_IN_SETJMP_DISPATCHER];
! t = build_function_call_expr (t,arg);
x = build2 (GIMPLE_MODIFY_STMT, void_type_node, disp_var, t);
/* Build 'goto DISP_VAR;' and insert. */
--- 134,142 ----
/* Build 'DISP_VAR = __builtin_setjmp_dispatcher (DISP_LABEL);'
and insert. */
disp_var = create_tmp_var (ptr_type_node, "setjmpvar");
! arg = build_addr (disp_label, current_function_decl);
t = implicit_built_in_decls[BUILT_IN_SETJMP_DISPATCHER];
! t = build_call_expr (t, 1, arg);
x = build2 (GIMPLE_MODIFY_STMT, void_type_node, disp_var, t);
/* Build 'goto DISP_VAR;' and insert. */
*************** lower_builtin_setjmp (tree_stmt_iterator
*** 663,674 ****
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);
t = implicit_built_in_decls[BUILT_IN_SETJMP_SETUP];
! t = build_function_call_expr (t, arg);
SET_EXPR_LOCUS (t, EXPR_LOCUS (stmt));
tsi_link_before (tsi, t, TSI_SAME_STMT);
--- 662,670 ----
dest = NULL_TREE;
/* Build '__builtin_setjmp_setup (BUF, NEXT_LABEL)' and insert. */
! arg = build_addr (next_label, current_function_decl);
t = implicit_built_in_decls[BUILT_IN_SETJMP_SETUP];
! 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);
*************** lower_builtin_setjmp (tree_stmt_iterator
*** 689,698 ****
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);
t = implicit_built_in_decls[BUILT_IN_SETJMP_RECEIVER];
! t = build_function_call_expr (t, arg);
SET_EXPR_LOCUS (t, EXPR_LOCUS (stmt));
tsi_link_before (tsi, t, TSI_SAME_STMT);
--- 685,693 ----
tsi_link_before (tsi, t, TSI_SAME_STMT);
/* Build '__builtin_setjmp_receiver (NEXT_LABEL)' and insert. */
! arg = build_addr (next_label, current_function_decl);
t = implicit_built_in_decls[BUILT_IN_SETJMP_RECEIVER];
! t = build_call_expr (t, 1, arg);
SET_EXPR_LOCUS (t, EXPR_LOCUS (stmt));
tsi_link_before (tsi, t, TSI_SAME_STMT);
Index: gcc/expr.c
===================================================================
*** gcc/expr.c (revision 121818)
--- gcc/expr.c (working copy)
*************** rtx
*** 1355,1361 ****
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;
enum machine_mode size_mode;
rtx retval;
--- 1355,1361 ----
emit_block_move_via_libcall (rtx dst, rtx src, rtx size, bool tailcall)
{
rtx dst_addr, src_addr;
! tree call_expr, fn, src_tree, dst_tree, size_tree;
enum machine_mode size_mode;
rtx retval;
*************** emit_block_move_via_libcall (rtx dst, rt
*** 1386,1399 ****
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_TAILCALL (call_expr) = tailcall;
retval = expand_normal (call_expr);
--- 1386,1392 ----
size_tree = make_tree (sizetype, size);
fn = emit_block_move_libcall_fn (true);
! call_expr = build_call_expr (fn, 3, dst_tree, src_tree, size_tree);
CALL_EXPR_TAILCALL (call_expr) = tailcall;
retval = expand_normal (call_expr);
*************** clear_storage (rtx object, rtx size, enu
*** 2576,2582 ****
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;
enum machine_mode size_mode;
rtx retval;
--- 2569,2575 ----
rtx
set_storage_via_libcall (rtx object, rtx size, rtx val, bool tailcall)
{
! tree call_expr, fn, object_tree, size_tree, val_tree;
enum machine_mode size_mode;
rtx retval;
*************** set_storage_via_libcall (rtx object, rtx
*** 2602,2615 ****
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_TAILCALL (call_expr) = tailcall;
retval = expand_normal (call_expr);
--- 2595,2602 ----
val_tree = make_tree (integer_type_node, val);
fn = clear_storage_libcall_fn (true);
! 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);
*************** safe_from_p (rtx x, tree exp, int top_p)
*** 6225,6230 ****
--- 6212,6218 ----
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
*************** safe_from_p (rtx x, tree exp, int top_p)
*** 6287,6293 ****
if (exp_rtl)
break;
! nops = TREE_CODE_LENGTH (TREE_CODE (exp));
for (i = 0; i < nops; i++)
if (TREE_OPERAND (exp, i) != 0
&& ! safe_from_p (x, TREE_OPERAND (exp, i), 0))
--- 6275,6281 ----
if (exp_rtl)
break;
! 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))
*************** expand_expr_real_1 (tree exp, rtx target
*** 7760,7771 ****
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))
== FUNCTION_DECL)
! && DECL_BUILT_IN (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))
{
! if (DECL_BUILT_IN_CLASS (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))
== BUILT_IN_FRONTEND)
return lang_hooks.expand_expr (exp, original_target,
tmode, modifier,
--- 7748,7759 ----
case CALL_EXPR:
/* Check for a built-in function. */
! 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 (CALL_EXPR_FN (exp), 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,
Index: gcc/tree-browser.c
===================================================================
*** gcc/tree-browser.c (revision 121818)
--- gcc/tree-browser.c (working copy)
*************** store_child_info (tree *tp, int *walk_su
*** 730,774 ****
node = *tp;
/* 'node' is the parent of 'TREE_OPERAND (node, *)'. */
! if (EXPRESSION_CLASS_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)))
{
! 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;
}
- #undef STORE_CHILD
}
/* Never stop walk_tree. */
--- 730,745 ----
node = *tp;
/* 'node' is the parent of 'TREE_OPERAND (node, *)'. */
! if (EXPR_P (node))
{
! int n = TREE_OPERAND_LENGTH (node);
! int i;
! for (i = 0; i < n; i++)
{
! tree op = TREE_OPERAND (node, i);
! slot = htab_find_slot (TB_up_ht, op, INSERT);
! *slot = (void *) node;
}
}
/* Never stop walk_tree. */
*************** TB_parent_eq (const void *p1, const void
*** 787,832 ****
if (p1 == NULL || p2 == NULL)
return 0;
! if (EXPRESSION_CLASS_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
}
-
return 0;
}
--- 758,771 ----
if (p1 == NULL || p2 == NULL)
return 0;
! if (EXPR_P (parent))
{
! int n = TREE_OPERAND_LENGTH (parent);
! int i;
! for (i = 0; i < n; i++)
! if (node == TREE_OPERAND (parent, i))
! return 1;
}
return 0;
}
Index: gcc/predict.c
===================================================================
*** gcc/predict.c (revision 121818)
--- gcc/predict.c (working copy)
*************** expr_expected_value (tree expr, bitmap v
*** 913,928 ****
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 (TREE_CONSTANT (val))
return val;
! return TREE_VALUE (TREE_CHAIN (TREE_OPERAND (expr, 1)));
}
}
if (BINARY_CLASS_P (expr) || COMPARISON_CLASS_P (expr))
--- 913,926 ----
if (DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL
&& DECL_FUNCTION_CODE (decl) == BUILT_IN_EXPECT)
{
tree val;
! if (call_expr_nargs (expr) != 2)
! return NULL;
! val = CALL_EXPR_ARG (expr, 0);
if (TREE_CONSTANT (val))
return val;
! return CALL_EXPR_ARG (expr, 1);
}
}
if (BINARY_CLASS_P (expr) || COMPARISON_CLASS_P (expr))
*************** strip_builtin_expect (void)
*** 965,981 ****
{
tree stmt = bsi_stmt (bi);
tree fndecl;
! tree arglist;
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)))
&& 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))
{
! GIMPLE_STMT_OPERAND (stmt, 1) = TREE_VALUE (arglist);
update_stmt (stmt);
}
}
--- 963,979 ----
{
tree stmt = bsi_stmt (bi);
tree fndecl;
! tree call;
if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
! && (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
! && call_expr_nargs (call) == 2)
{
! GIMPLE_STMT_OPERAND (stmt, 1) = CALL_EXPR_ARG (call, 0);
update_stmt (stmt);
}
}
Index: gcc/function.c
===================================================================
*** gcc/function.c (revision 121818)
--- gcc/function.c (working copy)
*************** gimplify_parameters (void)
*** 3208,3223 ****
}
else
{
! tree ptr_type, addr, args;
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 = fold_convert (ptr_type, t);
t = build2 (GIMPLE_MODIFY_STMT, void_type_node, addr, t);
gimplify_and_add (t, &stmts);
--- 3208,3222 ----
}
else
{
! 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);
t = built_in_decls[BUILT_IN_ALLOCA];
! 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);
Index: gcc/tree-vectorizer.c
===================================================================
*** gcc/tree-vectorizer.c (revision 121818)
--- gcc/tree-vectorizer.c (working copy)
*************** vect_is_simple_reduction (struct loop *l
*** 1975,1981 ****
return NULL_TREE;
}
! op_type = TREE_CODE_LENGTH (code);
if (op_type != binary_op)
{
if (vect_print_dump_info (REPORT_DETAILS))
--- 1975,1981 ----
return NULL_TREE;
}
! op_type = TREE_OPERAND_LENGTH (operation);
if (op_type != binary_op)
{
if (vect_print_dump_info (REPORT_DETAILS))
Index: gcc/ipa-type-escape.c
===================================================================
*** gcc/ipa-type-escape.c (revision 121818)
--- gcc/ipa-type-escape.c (working copy)
*************** static bool
*** 1011,1030 ****
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;
! for (operand = operand_list;
! operand != NULL_TREE;
! operand = TREE_CHAIN (operand))
! {
! tree argument = TREE_VALUE (operand);
! check_rhs_var (argument);
! }
if (callee_t)
{
--- 1011,1024 ----
check_call (tree call_expr)
{
int flags = call_expr_flags(call_expr);
tree operand;
tree callee_t = get_callee_fndecl (call_expr);
struct cgraph_node* callee;
enum availability avail = AVAIL_NOT_AVAILABLE;
+ call_expr_arg_iterator iter;
! FOR_EACH_CALL_EXPR_ARG (operand, iter, call_expr)
! check_rhs_var (operand);
if (callee_t)
{
*************** check_call (tree call_expr)
*** 1037,1053 ****
parameters. */
if (TYPE_ARG_TYPES (TREE_TYPE (callee_t)))
{
! operand = operand_list;
! for (arg_type = TYPE_ARG_TYPES (TREE_TYPE (callee_t));
arg_type && TREE_VALUE (arg_type) != void_type_node;
! arg_type = TREE_CHAIN (arg_type))
{
if (operand)
{
- argument = TREE_VALUE (operand);
last_arg_type = TREE_VALUE(arg_type);
! check_cast (last_arg_type, argument);
! operand = TREE_CHAIN (operand);
}
else
/* The code reaches here for some unfortunate
--- 1031,1046 ----
parameters. */
if (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),
! operand = next_call_expr_arg (&iter))
{
if (operand)
{
last_arg_type = TREE_VALUE(arg_type);
! check_cast (last_arg_type, operand);
}
else
/* The code reaches here for some unfortunate
*************** check_call (tree call_expr)
*** 1061,1077 ****
/* 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);
arg_type;
! arg_type = TREE_CHAIN (arg_type))
{
if (operand)
{
- argument = TREE_VALUE (operand);
last_arg_type = TREE_TYPE(arg_type);
! check_cast (last_arg_type, argument);
! operand = TREE_CHAIN (operand);
}
else
/* The code reaches here for some unfortunate
--- 1054,1069 ----
/* 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. */
! for (arg_type = DECL_ARGUMENTS (callee_t),
! operand = first_call_expr_arg (call_expr, &iter);
arg_type;
! arg_type = TREE_CHAIN (arg_type),
! operand = next_call_expr_arg (&iter))
{
if (operand)
{
last_arg_type = TREE_TYPE(arg_type);
! check_cast (last_arg_type, operand);
}
else
/* The code reaches here for some unfortunate
*************** check_call (tree call_expr)
*** 1086,1096 ****
arg_type = last_arg_type;
for (;
operand != NULL_TREE;
! operand = TREE_CHAIN (operand))
{
- argument = TREE_VALUE (operand);
if (arg_type)
! check_cast (arg_type, argument);
else
{
/* The code reaches here for some unfortunate
--- 1078,1087 ----
arg_type = last_arg_type;
for (;
operand != NULL_TREE;
! operand = next_call_expr_arg (&iter))
{
if (arg_type)
! check_cast (arg_type, operand);
else
{
/* The code reaches here for some unfortunate
*************** check_call (tree call_expr)
*** 1098,1104 ****
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);
mark_interesting_type (type, FULL_ESCAPE);
}
}
--- 1089,1095 ----
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 (operand), false, false);
mark_interesting_type (type, FULL_ESCAPE);
}
}
*************** check_call (tree call_expr)
*** 1114,1125 ****
{
/* 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))
{
! tree type =
! get_canon_type (TREE_TYPE (TREE_VALUE (operand)), false, false);
mark_interesting_type (type, EXPOSED_PARAMETER);
}
--- 1105,1113 ----
{
/* If this is a direct call to an external function, mark all of
the parameter and return types. */
! FOR_EACH_CALL_EXPR_ARG (operand, iter, call_expr)
{
! tree type = get_canon_type (TREE_TYPE (operand), false, false);
mark_interesting_type (type, EXPOSED_PARAMETER);
}
*************** scan_for_refs (tree *tp, int *walk_subtr
*** 1257,1263 ****
look_for_casts (lhs, TREE_OPERAND (rhs, 0));
check_rhs_var (rhs);
break;
! case CALL_EXPR:
/* If this is a call to malloc, squirrel away the
result so we do mark the resulting cast as being
bad. */
--- 1245,1258 ----
look_for_casts (lhs, TREE_OPERAND (rhs, 0));
check_rhs_var (rhs);
break;
! 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. */
Index: gcc/tree-data-ref.c
===================================================================
*** gcc/tree-data-ref.c (revision 121818)
--- gcc/tree-data-ref.c (working copy)
*************** get_references_in_stmt (tree stmt, VEC (
*** 4237,4243 ****
{
bool clobbers_memory = false;
data_ref_loc *ref;
! tree *op0, *op1, args, call;
*references = NULL;
--- 4237,4244 ----
{
bool clobbers_memory = false;
data_ref_loc *ref;
! tree *op0, *op1, arg, call;
! call_expr_arg_iterator iter;
*references = NULL;
*************** get_references_in_stmt (tree stmt, VEC (
*** 4278,4286 ****
if (call)
{
! for (args = TREE_OPERAND (call, 1); args; args = TREE_CHAIN (args))
{
! op0 = &TREE_VALUE (args);
if (DECL_P (*op0)
|| REFERENCE_CLASS_P (*op0))
{
--- 4279,4287 ----
if (call)
{
! FOR_EACH_CALL_EXPR_ARG (arg, iter, call)
{
! op0 = &arg;
if (DECL_P (*op0)
|| REFERENCE_CLASS_P (*op0))
{
Index: gcc/gimplify.c
===================================================================
*** gcc/gimplify.c (revision 121818)
--- gcc/gimplify.c (working copy)
*************** build_stack_save_restore (tree *save, tr
*** 1040,1053 ****
tree save_call, tmp_var;
save_call =
! build_function_call_expr (implicit_built_in_decls[BUILT_IN_STACK_SAVE],
! NULL_TREE);
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));
}
/* Gimplify a BIND_EXPR. Just voidify and recurse. */
--- 1040,1052 ----
tree save_call, tmp_var;
save_call =
! 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_call_expr (implicit_built_in_decls[BUILT_IN_STACK_RESTORE],
! 1, tmp_var);
}
/* Gimplify a BIND_EXPR. Just voidify and recurse. */
*************** gimplify_decl_expr (tree *stmt_p)
*** 1233,1239 ****
/* 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;
gimplify_one_sizepos (&DECL_SIZE (decl), stmt_p);
gimplify_one_sizepos (&DECL_SIZE_UNIT (decl), stmt_p);
--- 1232,1238 ----
/* 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, addr, ptr_type;
gimplify_one_sizepos (&DECL_SIZE (decl), stmt_p);
gimplify_one_sizepos (&DECL_SIZE_UNIT (decl), stmt_p);
*************** gimplify_decl_expr (tree *stmt_p)
*** 1250,1258 ****
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 = fold_convert (ptr_type, t);
t = build2 (GIMPLE_MODIFY_STMT, void_type_node, addr, t);
--- 1249,1256 ----
SET_DECL_VALUE_EXPR (decl, t);
DECL_HAS_VALUE_EXPR_P (decl) = 1;
t = built_in_decls[BUILT_IN_ALLOCA];
! 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);
*************** static enum gimplify_status
*** 2031,2038 ****
gimplify_call_expr (tree *expr_p, tree *pre_p, bool want_value)
{
tree decl;
- tree arglist;
enum gimplify_status ret;
gcc_assert (TREE_CODE (*expr_p) == CALL_EXPR);
--- 2029,2036 ----
gimplify_call_expr (tree *expr_p, tree *pre_p, bool want_value)
{
tree decl;
enum gimplify_status ret;
+ int i, nargs;
gcc_assert (TREE_CODE (*expr_p) == CALL_EXPR);
*************** gimplify_call_expr (tree *expr_p, tree *
*** 2056,2063 ****
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);
if (new && new != *expr_p)
{
--- 2054,2060 ----
decl = get_callee_fndecl (*expr_p);
if (decl && DECL_BUILT_IN (decl))
{
! tree new = fold_call_expr (*expr_p, !want_value);
if (new && new != *expr_p)
{
*************** gimplify_call_expr (tree *expr_p, tree *
*** 2071,2132 ****
if (DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL
&& DECL_FUNCTION_CODE (decl) == BUILT_IN_VA_START)
{
! if (!arglist || !TREE_CHAIN (arglist))
{
error ("too few arguments to function %<va_start%>");
*expr_p = build_empty_stmt ();
return GS_OK;
}
! if (fold_builtin_next_arg (TREE_CHAIN (arglist)))
{
*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);
}
}
/* 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,
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))
{
enum gimplify_status t;
! t = gimplify_arg (&TREE_VALUE (arglist), 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);
! 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;
! }
}
}
--- 2068,2123 ----
if (DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL
&& DECL_FUNCTION_CODE (decl) == BUILT_IN_VA_START)
{
! 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 (*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 (&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 (&CALL_EXPR_FN (*expr_p), pre_p, NULL,
is_gimple_call_addr, fb_rvalue);
! 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 (&CALL_EXPR_ARG (*expr_p, i), pre_p);
if (t == GS_ERROR)
ret = GS_ERROR;
}
/* Try this again in case gimplification exposed something. */
if (ret != GS_ERROR)
{
! 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;
}
}
*************** gimplify_cond_expr (tree *expr_p, tree *
*** 2561,2580 ****
static enum gimplify_status
gimplify_modify_expr_to_memcpy (tree *expr_p, tree size, bool want_value)
{
! tree args, t, to, to_ptr, from;
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);
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);
if (want_value)
{
--- 2552,2567 ----
static enum gimplify_status
gimplify_modify_expr_to_memcpy (tree *expr_p, tree size, bool want_value)
{
! tree t, to, to_ptr, from, from_ptr;
to = GENERIC_TREE_OPERAND (*expr_p, 0);
from = GENERIC_TREE_OPERAND (*expr_p, 1);
! from_ptr = build_fold_addr_expr (from);
to_ptr = build_fold_addr_expr (to);
t = implicit_built_in_decls[BUILT_IN_MEMCPY];
! t = build_call_expr (t, 3, to_ptr, from_ptr, size);
if (want_value)
{
*************** gimplify_modify_expr_to_memcpy (tree *ex
*** 2593,2610 ****
static enum gimplify_status
gimplify_modify_expr_to_memset (tree *expr_p, tree size, bool want_value)
{
! tree args, 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);
if (want_value)
{
--- 2580,2592 ----
static enum gimplify_status
gimplify_modify_expr_to_memset (tree *expr_p, tree size, bool want_value)
{
! tree t, to, to_ptr;
to = GENERIC_TREE_OPERAND (*expr_p, 0);
to_ptr = build_fold_addr_expr (to);
t = implicit_built_in_decls[BUILT_IN_MEMSET];
! t = build_call_expr (t, 3, to_ptr, integer_zero_node, size);
if (want_value)
{
*************** gimplify_variable_sized_compare (tree *e
*** 3674,3691 ****
{
tree op0 = TREE_OPERAND (*expr_p, 0);
tree op1 = TREE_OPERAND (*expr_p, 1);
! tree args, t, dest;
! 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);
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);
*expr_p
= build2 (TREE_CODE (*expr_p), TREE_TYPE (*expr_p), t, integer_zero_node);
--- 3656,3670 ----
{
tree op0 = TREE_OPERAND (*expr_p, 0);
tree op1 = TREE_OPERAND (*expr_p, 1);
! tree t, arg, dest, src;
! 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);
t = implicit_built_in_decls[BUILT_IN_MEMCMP];
! t = build_call_expr (t, 3, dest, src, arg);
*expr_p
= build2 (TREE_CODE (*expr_p), TREE_TYPE (*expr_p), t, integer_zero_node);
*************** static enum gimplify_status
*** 5109,5115 ****
gimplify_omp_atomic_fetch_op (tree *expr_p, tree addr, tree rhs, int index)
{
enum built_in_function base;
! tree decl, args, itype;
enum insn_code *optab;
/* Check for one of the supported fetch-op operations. */
--- 5088,5094 ----
gimplify_omp_atomic_fetch_op (tree *expr_p, tree addr, tree rhs, int index)
{
enum built_in_function base;
! tree decl, itype;
enum insn_code *optab;
/* Check for one of the supported fetch-op operations. */
*************** gimplify_omp_atomic_fetch_op (tree *expr
*** 5154,5162 ****
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);
return GS_OK;
}
--- 5133,5139 ----
if (optab[TYPE_MODE (itype)] == CODE_FOR_nothing)
return GS_UNHANDLED;
! *expr_p = build_call_expr (decl, 2, addr, fold_convert (itype, rhs));
return GS_OK;
}
*************** gimplify_omp_atomic_pipeline (tree *expr
*** 5221,5227 ****
tree rhs, int index)
{
tree oldval, oldival, oldival2, newval, newival, label;
! tree type, itype, cmpxchg, args, x, iaddr;
cmpxchg = built_in_decls[BUILT_IN_VAL_COMPARE_AND_SWAP_N + index + 1];
type = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (addr)));
--- 5198,5204 ----
tree rhs, int index)
{
tree oldval, oldival, oldival2, newval, newival, label;
! 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)));
*************** gimplify_omp_atomic_pipeline (tree *expr
*** 5282,5291 ****
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);
if (oldval == oldival)
x = fold_convert (type, x);
x = build2 (GIMPLE_MODIFY_STMT, void_type_node, oldival, x);
--- 5259,5266 ----
fold_convert (itype, oldival));
gimplify_and_add (x, pre_p);
! 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);
*************** gimplify_omp_atomic_mutex (tree *expr_p,
*** 5329,5335 ****
tree t;
t = built_in_decls[BUILT_IN_GOMP_ATOMIC_START];
! t = build_function_call_expr (t, NULL);
gimplify_and_add (t, pre_p);
t = build_fold_indirect_ref (addr);
--- 5304,5310 ----
tree t;
t = built_in_decls[BUILT_IN_GOMP_ATOMIC_START];
! t = build_call_expr (t, 0);
gimplify_and_add (t, pre_p);
t = build_fold_indirect_ref (addr);
*************** gimplify_omp_atomic_mutex (tree *expr_p,
*** 5337,5343 ****
gimplify_and_add (t, pre_p);
t = built_in_decls[BUILT_IN_GOMP_ATOMIC_END];
! t = build_function_call_expr (t, NULL);
gimplify_and_add (t, pre_p);
*expr_p = NULL;
--- 5312,5318 ----
gimplify_and_add (t, pre_p);
t = built_in_decls[BUILT_IN_GOMP_ATOMIC_END];
! t = build_call_expr (t, 0);
gimplify_and_add (t, pre_p);
*expr_p = NULL;
*************** gimplify_function_tree (tree fndecl)
*** 6445,6457 ****
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);
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);
append_to_statement_list (x, &BIND_EXPR_BODY (bind));
append_to_statement_list (tf, &BIND_EXPR_BODY (bind));
--- 6420,6432 ----
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_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_call_expr (x, 0);
append_to_statement_list (x, &BIND_EXPR_BODY (bind));
append_to_statement_list (tf, &BIND_EXPR_BODY (bind));
Index: gcc/calls.c
===================================================================
*** gcc/calls.c (revision 121818)
--- gcc/calls.c (working copy)
*************** bool
*** 553,563 ****
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))
return true;
return false;
}
--- 553,562 ----
alloca_call_p (tree exp)
{
if (TREE_CODE (exp) == CALL_EXPR
! && 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;
}
*************** call_expr_flags (tree t)
*** 626,632 ****
flags = flags_from_decl_or_type (decl);
else
{
! t = TREE_TYPE (TREE_OPERAND (t, 0));
if (t && TREE_CODE (t) == POINTER_TYPE)
flags = flags_from_decl_or_type (TREE_TYPE (t));
else
--- 625,631 ----
flags = flags_from_decl_or_type (decl);
else
{
! t = TREE_TYPE (CALL_EXPR_FN (t));
if (t && TREE_CODE (t) == POINTER_TYPE)
flags = flags_from_decl_or_type (TREE_TYPE (t));
else
*************** precompute_arguments (int flags, int num
*** 1280,1286 ****
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)
{
/* See if we have or want to preallocate stack space.
--- 1279,1286 ----
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)
{
/* See if we have or want to preallocate stack space.
*************** shift_return_value (enum machine_mode mo
*** 1809,1815 ****
return true;
}
! /* Generate all the code for a function call
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.
--- 1809,1815 ----
return true;
}
! /* 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.
*************** expand_call (tree exp, rtx target, int i
*** 1822,1828 ****
static int currently_expanding_call = 0;
/* List of actual parameters. */
! tree actparms = TREE_OPERAND (exp, 1);
/* RTX for the function to be called. */
rtx funexp;
/* Sequence of insns to perform a normal "call". */
--- 1822,1829 ----
static int currently_expanding_call = 0;
/* List of actual parameters. */
! /* 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". */
*************** expand_call (tree exp, rtx target, int i
*** 1923,1930 ****
int old_stack_pointer_delta = 0;
rtx call_fusage;
! tree p = TREE_OPERAND (exp, 0);
! tree addr = TREE_OPERAND (exp, 0);
int i;
/* The alignment of the stack, in bits. */
unsigned HOST_WIDE_INT preferred_stack_boundary;
--- 1924,1931 ----
int old_stack_pointer_delta = 0;
rtx call_fusage;
! 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;
*************** expand_call (tree exp, rtx target, int i
*** 2585,2592 ****
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));
else
static_chain_value = 0;
--- 2586,2593 ----
once we have started filling any specific hard regs. */
precompute_register_parameters (num_actuals, args, ®_parm_seen);
! if (CALL_EXPR_STATIC_CHAIN (exp))
! static_chain_value = expand_normal (CALL_EXPR_STATIC_CHAIN (exp));
else
static_chain_value = 0;
Index: gcc/except.c
===================================================================
*** gcc/except.c (revision 121818)
--- gcc/except.c (working copy)
*************** expand_builtin_unwind_init (void)
*** 2864,2872 ****
}
rtx
! expand_builtin_eh_return_data_regno (tree arglist)
{
! tree which = TREE_VALUE (arglist);
unsigned HOST_WIDE_INT iwhich;
if (TREE_CODE (which) != INTEGER_CST)
--- 2864,2872 ----
}
rtx
! expand_builtin_eh_return_data_regno (tree exp)
{
! tree which = CALL_EXPR_ARG (exp, 0);
unsigned HOST_WIDE_INT iwhich;
if (TREE_CODE (which) != INTEGER_CST)
Index: gcc/coverage.c
===================================================================
*** gcc/coverage.c (revision 121818)
--- gcc/coverage.c (working copy)
*************** create_coverage (void)
*** 949,956 ****
/* 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);
append_to_statement_list (t, &body);
/* Generate a constructor to run it. */
--- 949,955 ----
/* Generate a call to __gcov_init(&gcov_info). */
body = NULL;
t = build_fold_addr_expr (gcov_info);
! t = build_call_expr (gcov_init, 1, t);
append_to_statement_list (t, &body);
/* Generate a constructor to run it. */
Index: gcc/tree-ssa-pre.c
===================================================================
*** gcc/tree-ssa-pre.c (revision 121818)
--- gcc/tree-ssa-pre.c (working copy)
*************** Boston, MA 02110-1301, USA. */
*** 38,43 ****
--- 38,44 ----
#include "tree-iterator.h"
#include "real.h"
#include "alloc-pool.h"
+ #include "obstack.h"
#include "tree-pass.h"
#include "flags.h"
#include "bitmap.h"
*************** static alloc_pool binary_node_pool;
*** 387,397 ****
static alloc_pool unary_node_pool;
static alloc_pool reference_node_pool;
static alloc_pool comparison_node_pool;
- static alloc_pool expression_node_pool;
- static alloc_pool list_node_pool;
static alloc_pool modify_expr_node_pool;
static bitmap_obstack grand_bitmap_obstack;
/* To avoid adding 300 temporary variables when we only need one, we
only create one temporary variable, on demand, and build ssa names
off that. We do have to change the variable if the types don't
--- 388,402 ----
static alloc_pool unary_node_pool;
static alloc_pool reference_node_pool;
static alloc_pool comparison_node_pool;
static alloc_pool modify_expr_node_pool;
static bitmap_obstack grand_bitmap_obstack;
+ /* We can't use allocation pools to hold temporary CALL_EXPR objects, since
+ they are not of fixed size. Instead, use an obstack. */
+
+ static struct obstack temp_call_expr_obstack;
+
+
/* To avoid adding 300 temporary variables when we only need one, we
only create one temporary variable, on demand, and build ssa names
off that. We do have to change the variable if the types don't
*************** fully_constant_expression (tree t)
*** 881,912 ****
return t;
}
! /* Return a copy of a chain of nodes, chained through the TREE_CHAIN field.
! For example, this can copy a list made of TREE_LIST nodes.
! Allocates the nodes in list_node_pool*/
static tree
! pool_copy_list (tree list)
{
! tree head;
! tree prev, next;
!
! if (list == 0)
! return 0;
! head = (tree) pool_alloc (list_node_pool);
!
! memcpy (head, list, tree_size (list));
! prev = head;
!
! next = TREE_CHAIN (list);
! while (next)
! {
! TREE_CHAIN (prev) = (tree) pool_alloc (list_node_pool);
! memcpy (TREE_CHAIN (prev), next, tree_size (next));
! prev = TREE_CHAIN (prev);
! next = TREE_CHAIN (next);
! }
! return head;
}
/* Translate the vuses in the VUSES vector backwards through phi nodes
--- 886,897 ----
return t;
}
! /* Make a temporary copy of a CALL_EXPR object NODE. */
static tree
! temp_copy_call_expr (tree node)
{
! return (tree) obstack_copy (&temp_call_expr_obstack, node, tree_size (node));
}
/* Translate the vuses in the VUSES vector backwards through phi nodes
*************** phi_translate (tree expr, bitmap_set_t s
*** 1005,1064 ****
switch (TREE_CODE_CLASS (TREE_CODE (expr)))
{
case tcc_expression:
{
if (TREE_CODE (expr) != CALL_EXPR)
return NULL;
else
{
! tree oldop0 = TREE_OPERAND (expr, 0);
! tree oldval0 = oldop0;
! tree oldarglist = TREE_OPERAND (expr, 1);
! tree oldop2 = TREE_OPERAND (expr, 2);
! tree oldval2 = oldop2;
! tree newop0;
! tree newarglist;
! tree newop2 = NULL;
! tree oldwalker;
! tree newwalker;
! tree newexpr;
tree vh = get_value_handle (expr);
- bool listchanged = false;
bool invariantarg = false;
VEC (tree, gc) *vuses = VALUE_HANDLE_VUSES (vh);
VEC (tree, gc) *tvuses;
! /* Call expressions are kind of weird because they have an
! argument list. We don't want to value number the list
! as one value number, because that doesn't make much
! sense, and just breaks the support functions we call,
! which expect TREE_OPERAND (call_expr, 2) to be a
! TREE_LIST. */
! oldval0 = find_leader_in_sets (oldop0, set1, set2);
! newop0 = phi_translate (oldval0, set1, set2, pred, phiblock);
! if (newop0 == NULL)
return NULL;
! if (oldop2)
{
! oldop2 = find_leader_in_sets (oldop2, set1, set2);
! newop2 = phi_translate (oldop2, set1, set2, pred, phiblock);
! if (newop2 == NULL)
return NULL;
}
! /* phi translate the argument list piece by piece.
!
! We could actually build the list piece by piece here,
! but it's likely to not be worth the memory we will save,
! unless you have millions of call arguments. */
!
! newarglist = pool_copy_list (oldarglist);
! for (oldwalker = oldarglist, newwalker = newarglist;
! oldwalker && newwalker;
! oldwalker = TREE_CHAIN (oldwalker),
! newwalker = TREE_CHAIN (newwalker))
{
!
! tree oldval = TREE_VALUE (oldwalker);
tree newval;
if (oldval)
{
--- 990,1041 ----
switch (TREE_CODE_CLASS (TREE_CODE (expr)))
{
case tcc_expression:
+ return NULL;
+
+ case tcc_vl_exp:
{
if (TREE_CODE (expr) != CALL_EXPR)
return NULL;
else
{
! tree oldfn = CALL_EXPR_FN (expr);
! tree oldsc = CALL_EXPR_STATIC_CHAIN (expr);
! tree newfn, newsc = NULL;
! tree newexpr = NULL_TREE;
tree vh = get_value_handle (expr);
bool invariantarg = false;
+ int i, nargs;
VEC (tree, gc) *vuses = VALUE_HANDLE_VUSES (vh);
VEC (tree, gc) *tvuses;
! newfn = phi_translate (find_leader_in_sets (oldfn, set1, set2),
! set1, set2, pred, phiblock);
! if (newfn == NULL)
return NULL;
! if (newfn != oldfn)
{
! newexpr = temp_copy_call_expr (expr);
! CALL_EXPR_FN (newexpr) = get_value_handle (newfn);
! }
! if (oldsc)
! {
! newsc = phi_translate (find_leader_in_sets (oldsc, set1, set2),
! set1, set2, pred, phiblock);
! if (newsc == NULL)
return NULL;
+ if (newsc != oldsc)
+ {
+ if (!newexpr)
+ newexpr = temp_copy_call_expr (expr);
+ CALL_EXPR_STATIC_CHAIN (newexpr) = get_value_handle (newsc);
+ }
}
! /* phi translate the argument list piece by piece. */
! nargs = call_expr_nargs (expr);
! for (i = 0; i < nargs; i++)
{
! tree oldval = CALL_EXPR_ARG (expr, i);
tree newval;
if (oldval)
{
*************** phi_translate (tree expr, bitmap_set_t s
*** 1081,1120 ****
return NULL;
if (newval != oldval)
{
- listchanged = true;
invariantarg |= is_gimple_min_invariant (newval);
! TREE_VALUE (newwalker) = get_value_handle (newval);
}
}
}
/* In case of new invariant args we might try to fold the call
again. */
! if (invariantarg)
{
! tree tmp = fold_ternary (CALL_EXPR, TREE_TYPE (expr),
! newop0, newarglist, newop2);
! if (tmp)
{
! STRIP_TYPE_NOPS (tmp);
! if (is_gimple_min_invariant (tmp))
! return tmp;
}
}
- if (listchanged)
- vn_lookup_or_add (newarglist, NULL);
-
tvuses = translate_vuses_through_block (vuses, phiblock, pred);
! if (listchanged || (newop0 != oldop0) || (oldop2 != newop2)
! || vuses != tvuses)
{
- newexpr = (tree) pool_alloc (expression_node_pool);
- memcpy (newexpr, expr, tree_size (expr));
- TREE_OPERAND (newexpr, 0) = newop0 == oldop0 ? oldval0 : get_value_handle (newop0);
- TREE_OPERAND (newexpr, 1) = listchanged ? newarglist : oldarglist;
- TREE_OPERAND (newexpr, 2) = newop2 == oldop2 ? oldval2 : get_value_handle (newop2);
newexpr->base.ann = NULL;
vn_lookup_or_add_with_vuses (newexpr, tvuses);
expr = newexpr;
--- 1058,1093 ----
return NULL;
if (newval != oldval)
{
invariantarg |= is_gimple_min_invariant (newval);
! if (!newexpr)
! newexpr = temp_copy_call_expr (expr);
! CALL_EXPR_ARG (newexpr, i) = get_value_handle (newval);
}
}
}
/* In case of new invariant args we might try to fold the call
again. */
! if (invariantarg && !newsc)
{
! tree tmp1 = build_call_array (TREE_TYPE (expr),
! newfn, call_expr_nargs (newexpr),
! CALL_EXPR_ARGP (newexpr));
! tree tmp2 = fold (tmp1);
! if (tmp2 != tmp1)
{
! STRIP_TYPE_NOPS (tmp2);
! if (is_gimple_min_invariant (tmp2))
! return tmp2;
}
}
tvuses = translate_vuses_through_block (vuses, phiblock, pred);
+ if (vuses != tvuses && ! newexpr)
+ newexpr = temp_copy_call_expr (expr);
! if (newexpr)
{
newexpr->base.ann = NULL;
vn_lookup_or_add_with_vuses (newexpr, tvuses);
expr = newexpr;
*************** valid_in_sets (bitmap_set_t set1, bitmap
*** 1498,1519 ****
}
case tcc_expression:
{
if (TREE_CODE (expr) == CALL_EXPR)
{
! tree op0 = TREE_OPERAND (expr, 0);
! tree arglist = TREE_OPERAND (expr, 1);
! tree op2 = TREE_OPERAND (expr, 2);
!
! /* Check the non-list operands first. */
! if (!union_contains_value (set1, set2, op0)
! || (op2 && !union_contains_value (set1, set2, op2)))
return false;
/* Now check the operands. */
! for (; arglist; arglist = TREE_CHAIN (arglist))
{
- tree arg = TREE_VALUE (arglist);
if (!union_contains_value (set1, set2, arg))
return false;
}
--- 1471,1495 ----
}
case tcc_expression:
+ return false;
+
+ case tcc_vl_exp:
{
if (TREE_CODE (expr) == CALL_EXPR)
{
! tree fn = CALL_EXPR_FN (expr);
! tree sc = CALL_EXPR_STATIC_CHAIN (expr);
! tree arg;
! call_expr_arg_iterator iter;
!
! /* Check the non-argument operands first. */
! if (!union_contains_value (set1, set2, fn)
! || (sc && !union_contains_value (set1, set2, sc)))
return false;
/* Now check the operands. */
! FOR_EACH_CALL_EXPR_ARG (arg, iter, expr)
{
if (!union_contains_value (set1, set2, arg))
return false;
}
*************** create_expression_by_pieces (basic_block
*** 2512,2550 ****
switch (TREE_CODE_CLASS (TREE_CODE (expr)))
{
! case tcc_expression:
{
! tree op0, op2;
! tree arglist;
! tree genop0, genop2;
! tree genarglist;
! tree walker, genwalker;
gcc_assert (TREE_CODE (expr) == CALL_EXPR);
- genop2 = NULL;
! op0 = TREE_OPERAND (expr, 0);
! arglist = TREE_OPERAND (expr, 1);
! op2 = TREE_OPERAND (expr, 2);
!
! genop0 = find_or_generate_expression (block, op0, stmts);
! genarglist = copy_list (arglist);
! for (walker = arglist, genwalker = genarglist;
! genwalker && walker;
! genwalker = TREE_CHAIN (genwalker), walker = TREE_CHAIN (walker))
{
! TREE_VALUE (genwalker)
! = find_or_generate_expression (block, TREE_VALUE (walker),
! stmts);
}
! if (op2)
! genop2 = find_or_generate_expression (block, op2, stmts);
! folded = fold_build3 (TREE_CODE (expr), TREE_TYPE (expr),
! genop0, genarglist, genop2);
break;
-
-
}
break;
case tcc_reference:
--- 2488,2522 ----
switch (TREE_CODE_CLASS (TREE_CODE (expr)))
{
! case tcc_vl_exp:
{
! tree fn, sc;
! tree genfn;
! int i, nargs;
! tree *buffer;
gcc_assert (TREE_CODE (expr) == CALL_EXPR);
! fn = CALL_EXPR_FN (expr);
! sc = CALL_EXPR_STATIC_CHAIN (expr);
!
! genfn = find_or_generate_expression (block, fn, stmts);
!
! nargs = call_expr_nargs (expr);
! buffer = alloca (nargs * sizeof (tree));
!
! for (i = 0; i < nargs; i++)
{
! tree arg = CALL_EXPR_ARG (expr, i);
! buffer[i] = find_or_generate_expression (block, arg, stmts);
}
! folded = build_call_array (TREE_TYPE (expr), genfn, nargs, buffer);
! if (sc)
! CALL_EXPR_STATIC_CHAIN (folded) =
! find_or_generate_expression (block, sc, stmts);
! folded = fold (folded);
break;
}
break;
case tcc_reference:
*************** create_value_expr_from (tree expr, basic
*** 3236,3241 ****
--- 3208,3214 ----
|| TREE_CODE_CLASS (code) == tcc_comparison
|| TREE_CODE_CLASS (code) == tcc_reference
|| TREE_CODE_CLASS (code) == tcc_expression
+ || TREE_CODE_CLASS (code) == tcc_vl_exp
|| TREE_CODE_CLASS (code) == tcc_exceptional
|| TREE_CODE_CLASS (code) == tcc_declaration);
*************** create_value_expr_from (tree expr, basic
*** 3247,3310 ****
pool = binary_node_pool;
else if (TREE_CODE_CLASS (code) == tcc_comparison)
pool = comparison_node_pool;
- else if (TREE_CODE_CLASS (code) == tcc_exceptional)
- {
- gcc_assert (code == TREE_LIST);
- pool = list_node_pool;
- }
else
! {
! gcc_assert (code == CALL_EXPR);
! pool = expression_node_pool;
! }
! vexpr = (tree) pool_alloc (pool);
! memcpy (vexpr, expr, tree_size (expr));
!
! /* This case is only for TREE_LIST's that appear as part of
! CALL_EXPR's. Anything else is a bug, but we can't easily verify
! this, hence this comment. TREE_LIST is not handled by the
! general case below because they don't have a fixed length, or
! operands, so you can't access purpose/value/chain through
! TREE_OPERAND macros. */
!
! if (code == TREE_LIST)
{
! tree op = NULL_TREE;
! tree temp = NULL_TREE;
! if (TREE_CHAIN (vexpr))
! temp = create_value_expr_from (TREE_CHAIN (vexpr), block, stmt);
! TREE_CHAIN (vexpr) = temp ? temp : TREE_CHAIN (vexpr);
!
!
! /* Recursively value-numberize reference ops. */
! if (REFERENCE_CLASS_P (TREE_VALUE (vexpr)))
! {
! tree tempop;
! op = TREE_VALUE (vexpr);
! tempop = create_value_expr_from (op, block, stmt);
! op = tempop ? tempop : op;
!
! TREE_VALUE (vexpr) = vn_lookup_or_add (op, stmt);
! }
! else
! {
! op = TREE_VALUE (vexpr);
! TREE_VALUE (vexpr) = vn_lookup_or_add (TREE_VALUE (vexpr), NULL);
! }
! /* This is the equivalent of inserting op into EXP_GEN like we
! do below */
! if (!is_undefined_value (op))
! bitmap_value_insert_into_set (EXP_GEN (block), op);
!
! efi = find_existing_value_expr (vexpr, stmt);
! if (efi)
! return efi;
! get_or_alloc_expression_id (vexpr);
! return vexpr;
}
! for (i = 0; i < TREE_CODE_LENGTH (code); i++)
{
tree val, op;
--- 3220,3237 ----
pool = binary_node_pool;
else if (TREE_CODE_CLASS (code) == tcc_comparison)
pool = comparison_node_pool;
else
! gcc_assert (code == CALL_EXPR);
! if (code == CALL_EXPR)
! vexpr = temp_copy_call_expr (expr);
! else
{
! vexpr = (tree) pool_alloc (pool);
! memcpy (vexpr, expr, tree_size (expr));
}
! for (i = 0; i < TREE_OPERAND_LENGTH (expr); i++)
{
tree val, op;
*************** create_value_expr_from (tree expr, basic
*** 3319,3338 ****
op = tempop ? tempop : op;
val = vn_lookup_or_add (op, stmt);
}
- else if (TREE_CODE (op) == TREE_LIST)
- {
- tree tempop;
-
- gcc_assert (TREE_CODE (expr) == CALL_EXPR);
- tempop = create_value_expr_from (op, block, stmt);
-
- op = tempop ? tempop : op;
- vn_lookup_or_add (op, NULL);
- /* Unlike everywhere else, we do *not* want to replace the
- TREE_LIST itself with a value number, because support
- functions we call will blow up. */
- val = op;
- }
else
/* Create a value handle for OP and add it to VEXPR. */
val = vn_lookup_or_add (op, NULL);
--- 3246,3251 ----
*************** init_pre (bool do_fre)
*** 4100,4114 ****
tree_code_size (NEGATE_EXPR), 30);
reference_node_pool = create_alloc_pool ("Reference tree nodes",
tree_code_size (ARRAY_REF), 30);
- expression_node_pool = create_alloc_pool ("Expression tree nodes",
- tree_code_size (CALL_EXPR), 30);
- list_node_pool = create_alloc_pool ("List tree nodes",
- tree_code_size (TREE_LIST), 30);
comparison_node_pool = create_alloc_pool ("Comparison tree nodes",
tree_code_size (EQ_EXPR), 30);
modify_expr_node_pool = create_alloc_pool ("GIMPLE_MODIFY_STMT nodes",
tree_code_size (GIMPLE_MODIFY_STMT),
! 30);
modify_expr_template = NULL;
FOR_ALL_BB (bb)
--- 4013,4024 ----
tree_code_size (NEGATE_EXPR), 30);
reference_node_pool = create_alloc_pool ("Reference tree nodes",
tree_code_size (ARRAY_REF), 30);
comparison_node_pool = create_alloc_pool ("Comparison tree nodes",
tree_code_size (EQ_EXPR), 30);
modify_expr_node_pool = create_alloc_pool ("GIMPLE_MODIFY_STMT nodes",
tree_code_size (GIMPLE_MODIFY_STMT),
! 30);
! obstack_init (&temp_call_expr_obstack);
modify_expr_template = NULL;
FOR_ALL_BB (bb)
*************** fini_pre (bool do_fre)
*** 4140,4147 ****
free_alloc_pool (binary_node_pool);
free_alloc_pool (reference_node_pool);
free_alloc_pool (unary_node_pool);
- free_alloc_pool (list_node_pool);
- free_alloc_pool (expression_node_pool);
free_alloc_pool (comparison_node_pool);
free_alloc_pool (modify_expr_node_pool);
htab_delete (phi_translate_table);
--- 4050,4055 ----
Index: gcc/tree-sra.c
===================================================================
*** gcc/tree-sra.c (revision 121818)
--- gcc/tree-sra.c (working copy)
*************** static void
*** 852,858 ****
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);
}
/* Walk the inputs and outputs of an ASM_EXPR looking for scalarizable
--- 852,861 ----
sra_walk_call_expr (tree expr, block_stmt_iterator *bsi,
const struct sra_walk_fns *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
Index: gcc/tree-mudflap.c
===================================================================
*** gcc/tree-mudflap.c (revision 121818)
--- gcc/tree-mudflap.c (working copy)
*************** mf_build_check_statement_for (tree base,
*** 656,675 ****
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);
/* 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);
gimplify_to_stmt_list (&t);
head = tsi_start (t);
tsi = tsi_last (t);
--- 656,668 ----
refresh *_l vars.
This is the body of the conditional. */
!
! u = mf_file_function_line_tree (locus == NULL ? UNKNOWN_LOCATION : *locus);
/* NB: we pass the overall [base..limit] range to mf_check. */
! 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);
*************** mx_register_decls (tree decl, tree *stmt
*** 996,1043 ****
&& ! TREE_STATIC (decl))
{
tree size = NULL_TREE, variable_name;
! tree unregister_fncall, unregister_fncall_params;
! tree register_fncall, register_fncall_params;
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") */
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))));
!
! /* __mf_register (...) */
! register_fncall = build_function_call_expr (mf_register_fndecl,
! register_fncall_params);
/* Accumulate the two calls. */
/* ??? Set EXPR_LOCATION. */
--- 989,1026 ----
&& ! TREE_STATIC (decl))
{
tree size = NULL_TREE, variable_name;
! tree unregister_fncall, unregister_fncall_param;
! tree register_fncall, register_fncall_param;
size = convert (size_type_node, TYPE_SIZE_UNIT (TREE_TYPE (decl)));
! 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_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);
!
/* Accumulate the two calls. */
/* ??? Set EXPR_LOCATION. */
*************** static GTY (()) tree enqueued_call_stmt_
*** 1172,1192 ****
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);
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);
append_to_statement_list (call_stmt, &enqueued_call_stmt_chain);
}
--- 1155,1171 ----
static void
mudflap_register_call (tree obj, tree object_size, tree varname)
{
! tree arg, call_stmt;
arg = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (obj)), obj);
arg = convert (ptr_type_node, arg);
! 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);
}
*************** mudflap_finish_file (void)
*** 1243,1258 ****
/* Insert a call to __mf_init. */
{
! tree call2_stmt = build_function_call_expr (mf_init_fndecl, NULL_TREE);
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);
append_to_statement_list (call_stmt, &ctor_statements);
}
--- 1222,1236 ----
/* Insert a call to __mf_init. */
{
! 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 = 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);
}
Index: gcc/ipa-prop.c
===================================================================
*** gcc/ipa-prop.c (revision 121818)
--- gcc/ipa-prop.c (working copy)
*************** void
*** 419,433 ****
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++;
ipa_callsite_param_count_set (cs, arg_num);
}
--- 419,429 ----
ipa_callsite_compute_count (struct cgraph_edge *cs)
{
tree call_tree;
int arg_num;
call_tree = get_call_expr_in (ipa_callsite_tree (cs));
gcc_assert (TREE_CODE (call_tree) == CALL_EXPR);
! arg_num = call_expr_nargs (call_tree);
ipa_callsite_param_count_set (cs, arg_num);
}
*************** ipa_callsite_compute_param (struct cgrap
*** 445,482 ****
struct cgraph_node *mt;
tree parm_decl;
struct function *curr_cfun;
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))
{
/* 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)
{
mt = ipa_callsite_caller (cs);
! parm_decl =
! TREE_CODE (TREE_VALUE (arg)) ==
! PARM_DECL ? TREE_VALUE (arg) : SSA_NAME_VAR (TREE_VALUE (arg));
i = ipa_method_tree_map (mt, parm_decl);
! if (TREE_CODE (TREE_VALUE (arg)) == SSA_NAME
! && IS_VALID_TREE_MAP_INDEX (i))
{
! 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))
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
--- 441,475 ----
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_num = 0;
! 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 (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 (arg) == PARM_DECL ? arg : SSA_NAME_VAR (arg);
i = ipa_method_tree_map (mt, parm_decl);
! if (TREE_CODE (arg) == SSA_NAME && IS_VALID_TREE_MAP_INDEX (i))
{
! curr_cfun = DECL_STRUCT_FUNCTION (mt->decl);
if (!gimple_default_def (curr_cfun, parm_decl)
! || 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
*************** ipa_callsite_compute_param (struct cgrap
*** 488,509 ****
/* 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)
{
ipa_callsite_param_set_type (cs, arg_num, CONST_IPATYPE);
! ipa_callsite_param_set_info_type (cs, arg_num,
! TREE_VALUE (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)
{
! cst_decl = TREE_OPERAND (TREE_VALUE (arg), 0);
if (TREE_CODE (DECL_INITIAL (cst_decl)) == INTEGER_CST
|| TREE_CODE (DECL_INITIAL (cst_decl)) == REAL_CST)
{
--- 481,500 ----
/* 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 (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, 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 (arg) == ADDR_EXPR
! && TREE_CODE (TREE_OPERAND (arg, 0)) == CONST_DECL)
{
! cst_decl = TREE_OPERAND (arg, 0);
if (TREE_CODE (DECL_INITIAL (cst_decl)) == INTEGER_CST
|| TREE_CODE (DECL_INITIAL (cst_decl)) == REAL_CST)
{
Index: gcc/tree-vect-patterns.c
===================================================================
*** gcc/tree-vect-patterns.c (revision 121818)
--- gcc/tree-vect-patterns.c (working copy)
*************** vect_recog_pow_pattern (tree last_stmt,
*** 434,440 ****
{
tree expr;
tree type;
! tree fn, arglist, base, exp;
if (TREE_CODE (last_stmt) != GIMPLE_MODIFY_STMT)
return NULL;
--- 434,440 ----
{
tree expr;
tree type;
! tree fn, base, exp;
if (TREE_CODE (last_stmt) != GIMPLE_MODIFY_STMT)
return NULL;
*************** vect_recog_pow_pattern (tree last_stmt,
*** 446,460 ****
return NULL_TREE;
fn = get_callee_fndecl (expr);
- arglist = TREE_OPERAND (expr, 1);
switch (DECL_FUNCTION_CODE (fn))
{
case BUILT_IN_POWIF:
case BUILT_IN_POWI:
case BUILT_IN_POWF:
case BUILT_IN_POW:
! base = TREE_VALUE (arglist);
! exp = TREE_VALUE (TREE_CHAIN (arglist));
if (TREE_CODE (exp) != REAL_CST
&& TREE_CODE (exp) != INTEGER_CST)
return NULL_TREE;
--- 446,459 ----
return NULL_TREE;
fn = get_callee_fndecl (expr);
switch (DECL_FUNCTION_CODE (fn))
{
case BUILT_IN_POWIF:
case BUILT_IN_POWI:
case BUILT_IN_POWF:
case BUILT_IN_POW:
! base = CALL_EXPR_ARG (expr, 0);
! exp = CALL_EXPR_ARG (expr, 1);
if (TREE_CODE (exp) != REAL_CST
&& TREE_CODE (exp) != INTEGER_CST)
return NULL_TREE;
*************** vect_recog_pow_pattern (tree last_stmt,
*** 484,494 ****
&& REAL_VALUES_EQUAL (TREE_REAL_CST (exp), dconsthalf))
{
tree newfn = mathfn_built_in (TREE_TYPE (base), BUILT_IN_SQRT);
- tree newarglist = build_tree_list (NULL_TREE, base);
*type_in = get_vectype_for_scalar_type (TREE_TYPE (base));
if (*type_in)
{
! newfn = build_function_call_expr (newfn, newarglist);
if (vectorizable_function (newfn, *type_in, *type_in) != NULL_TREE)
return newfn;
}
--- 483,492 ----
&& REAL_VALUES_EQUAL (TREE_REAL_CST (exp), dconsthalf))
{
tree newfn = mathfn_built_in (TREE_TYPE (base), BUILT_IN_SQRT);
*type_in = get_vectype_for_scalar_type (TREE_TYPE (base));
if (*type_in)
{
! newfn = build_call_expr (newfn, 1, base);
if (vectorizable_function (newfn, *type_in, *type_in) != NULL_TREE)
return newfn;
}
Index: gcc/tree-nested.c
===================================================================
*** gcc/tree-nested.c (revision 121818)
--- gcc/tree-nested.c (working copy)
*************** convert_nl_goto_reference (tree *tp, int
*** 1437,1443 ****
{
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;
void **slot;
*walk_subtrees = 0;
--- 1437,1443 ----
{
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, field;
void **slot;
*walk_subtrees = 0;
*************** convert_nl_goto_reference (tree *tp, int
*** 1475,1485 ****
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);
SET_EXPR_LOCUS (x, EXPR_LOCUS (tsi_stmt (wi->tsi)));
*tsi_stmt_ptr (wi->tsi) = x;
--- 1475,1482 ----
x = get_frame_field (info, target_context, field, &wi->tsi);
x = build_addr (x, target_context);
x = tsi_gimplify_val (info, x, &wi->tsi);
! 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;
*************** convert_tramp_reference (tree *tp, int *
*** 1537,1543 ****
{
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;
*walk_subtrees = 0;
switch (TREE_CODE (t))
--- 1534,1540 ----
{
struct walk_stmt_info *wi = (struct walk_stmt_info *) data;
struct nesting_info *info = wi->info, *i;
! tree t = *tp, decl, target_context, x;
*walk_subtrees = 0;
switch (TREE_CODE (t))
*************** convert_tramp_reference (tree *tp, int *
*** 1573,1584 ****
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 = init_tmp_var (info, x, &wi->tsi);
/* Cast back to the proper function type. */
--- 1570,1580 ----
x = get_frame_field (info, target_context, x, &wi->tsi);
x = build_addr (x, target_context);
x = tsi_gimplify_val (info, x, &wi->tsi);
/* Do machine-specific ugliness. Normally this will involve
computing extra alignment, but it can really be anything. */
! 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. */
*************** convert_tramp_reference (tree *tp, int *
*** 1591,1597 ****
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);
break;
default:
--- 1587,1598 ----
case CALL_EXPR:
/* Only walk call arguments, lest we generate trampolines for
direct calls. */
! {
! 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:
*************** convert_call_expr (tree *tp, int *walk_s
*** 1626,1632 ****
target_context = decl_function_context (decl);
if (target_context && !DECL_NO_STATIC_CHAIN (decl))
{
! TREE_OPERAND (t, 2)
= get_static_chain (info, target_context, &wi->tsi);
info->static_chain_added
|= (1 << (info->context != target_context));
--- 1627,1633 ----
target_context = decl_function_context (decl);
if (target_context && !DECL_NO_STATIC_CHAIN (decl))
{
! CALL_EXPR_STATIC_CHAIN (t)
= get_static_chain (info, target_context, &wi->tsi);
info->static_chain_added
|= (1 << (info->context != target_context));
*************** finalize_nesting_tree_1 (struct nesting_
*** 1777,1805 ****
struct nesting_info *i;
for (i = root->inner; i ; i = i->next)
{
! tree arg, 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;
else
! x = build_addr (root->frame_decl, context);
! arg = tree_cons (NULL, x, NULL);
! x = build_addr (i->context, context);
! arg = tree_cons (NULL, x, arg);
x = build3 (COMPONENT_REF, TREE_TYPE (field),
root->frame_decl, field, NULL_TREE);
! x = build_addr (x, context);
! arg = tree_cons (NULL, x, arg);
x = implicit_built_in_decls[BUILT_IN_INIT_TRAMPOLINE];
! x = build_function_call_expr (x, arg);
!
append_to_statement_list (x, &stmt_list);
}
}
--- 1778,1802 ----
struct nesting_info *i;
for (i = root->inner; i ; i = i->next)
{
! 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))
! arg3 = null_pointer_node;
else
! arg3 = build_addr (root->frame_decl, context);
! arg2 = build_addr (i->context, context);
x = build3 (COMPONENT_REF, TREE_TYPE (field),
root->frame_decl, field, NULL_TREE);
! arg1 = build_addr (x, context);
x = implicit_built_in_decls[BUILT_IN_INIT_TRAMPOLINE];
! x = build_call_expr (x, 3, arg1, arg2, arg3);
append_to_statement_list (x, &stmt_list);
}
}
Index: gcc/tree-ssa.c
===================================================================
*** gcc/tree-ssa.c (revision 121818)
--- gcc/tree-ssa.c (working copy)
*************** tree_ssa_useless_type_conversion (tree e
*** 935,944 ****
if (TREE_CODE (expr) == NOP_EXPR || TREE_CODE (expr) == CONVERT_EXPR
|| TREE_CODE (expr) == VIEW_CONVERT_EXPR
|| TREE_CODE (expr) == NON_LVALUE_EXPR)
! return tree_ssa_useless_type_conversion_1 (TREE_TYPE (expr),
! TREE_TYPE (TREE_OPERAND (expr,
! 0)));
!
return false;
}
--- 935,946 ----
if (TREE_CODE (expr) == NOP_EXPR || TREE_CODE (expr) == CONVERT_EXPR
|| TREE_CODE (expr) == VIEW_CONVERT_EXPR
|| TREE_CODE (expr) == NON_LVALUE_EXPR)
! /* FIXME: Use of GENERIC_TREE_TYPE here is a temporary measure to work
! around known bugs with GIMPLE_MODIFY_STMTs appearing in places
! they shouldn't. See PR 30391. */
! return tree_ssa_useless_type_conversion_1
! (TREE_TYPE (expr),
! GENERIC_TREE_TYPE (TREE_OPERAND (expr, 0)));
return false;
}
Index: gcc/tree-ssa-loop-prefetch.c
===================================================================
*** gcc/tree-ssa-loop-prefetch.c (revision 121818)
--- gcc/tree-ssa-loop-prefetch.c (working copy)
*************** static void
*** 815,821 ****
issue_prefetch_ref (struct mem_ref *ref, unsigned unroll_factor, unsigned ahead)
{
HOST_WIDE_INT delta;
! tree addr, addr_base, prefetch, params, write_p;
block_stmt_iterator bsi;
unsigned n_prefetches, ap;
--- 815,821 ----
issue_prefetch_ref (struct mem_ref *ref, unsigned unroll_factor, unsigned ahead)
{
HOST_WIDE_INT delta;
! tree addr, addr_base, prefetch, write_p;
block_stmt_iterator bsi;
unsigned n_prefetches, ap;
*************** issue_prefetch_ref (struct mem_ref *ref,
*** 839,849 ****
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);
bsi_insert_before (&bsi, prefetch, BSI_SAME_STMT);
}
}
--- 839,846 ----
addr = force_gimple_operand_bsi (&bsi, unshare_expr (addr), true, NULL);
/* Create the prefetch instruction. */
! prefetch = build_call_expr (built_in_decls[BUILT_IN_PREFETCH],
! 2, addr, write_p);
bsi_insert_before (&bsi, prefetch, BSI_SAME_STMT);
}
}
Index: gcc/tree-inline.c
===================================================================
*** gcc/tree-inline.c (revision 121818)
--- gcc/tree-inline.c (working copy)
*************** setup_one_parameter (copy_body_data *id,
*** 1430,1439 ****
}
/* 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). */
static void
! initialize_inlined_parameters (copy_body_data *id, tree args, tree static_chain,
tree fn, basic_block bb)
{
tree parms;
--- 1430,1439 ----
}
/* Generate code to initialize the parameters of the function at the
! top of the stack in ID from the CALL_EXPR EXP. */
static void
! initialize_inlined_parameters (copy_body_data *id, tree exp,
tree fn, basic_block bb)
{
tree parms;
*************** initialize_inlined_parameters (copy_body
*** 1441,1454 ****
tree p;
tree vars = NULL_TREE;
int argnum = 0;
/* 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))
{
tree value;
--- 1441,1456 ----
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 = first_call_expr_arg (exp, &iter); p;
! a = next_call_expr_arg (&iter), p = TREE_CHAIN (p))
{
tree value;
*************** initialize_inlined_parameters (copy_body
*** 1456,1462 ****
/* Find the initializer. */
value = lang_hooks.tree_inlining.convert_parm_for_inlining
! (p, a ? TREE_VALUE (a) : NULL_TREE, fn, argnum);
setup_one_parameter (id, p, value, fn, bb, &vars);
}
--- 1458,1464 ----
/* Find the initializer. */
value = lang_hooks.tree_inlining.convert_parm_for_inlining
! (p, a, fn, argnum);
setup_one_parameter (id, p, value, fn, bb, &vars);
}
*************** estimate_num_insns_1 (tree *tp, int *wal
*** 2172,2178 ****
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)
--- 2174,2179 ----
*************** estimate_num_insns_1 (tree *tp, int *wal
*** 2195,2205 ****
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)));
}
else
{
for (arg = DECL_ARGUMENTS (decl); arg; arg = TREE_CHAIN (arg))
d->count += estimate_move_cost (TREE_TYPE (arg));
}
--- 2196,2209 ----
that does use function declaration to figure out the arguments. */
if (!decl)
{
! 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));
}
*************** expand_call_inline (basic_block bb, tree
*** 2337,2343 ****
tree use_retvar;
tree fn;
splay_tree st;
- tree args;
tree return_slot;
tree modify_dest;
location_t saved_location;
--- 2341,2346 ----
*************** expand_call_inline (basic_block bb, tree
*** 2495,2509 ****
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);
if (DECL_INITIAL (fn))
add_lexical_block (id->block, remap_blocks (DECL_INITIAL (fn), id));
--- 2498,2509 ----
id->decl_map = splay_tree_new (splay_tree_compare_pointers,
NULL, NULL);
/* 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, t, fn, bb);
if (DECL_INITIAL (fn))
add_lexical_block (id->block, remap_blocks (DECL_INITIAL (fn), id));
Index: gcc/tree-vect-transform.c
===================================================================
*** gcc/tree-vect-transform.c (revision 121818)
--- gcc/tree-vect-transform.c (working copy)
*************** vect_create_epilog_for_reduction (tree v
*** 1143,1149 ****
tree operation = GIMPLE_STMT_OPERAND (stmt, 1);
int op_type;
! op_type = TREE_CODE_LENGTH (TREE_CODE (operation));
reduction_op = TREE_OPERAND (operation, op_type-1);
vectype = get_vectype_for_scalar_type (TREE_TYPE (reduction_op));
mode = TYPE_MODE (vectype);
--- 1143,1149 ----
tree operation = GIMPLE_STMT_OPERAND (stmt, 1);
int op_type;
! op_type = TREE_OPERAND_LENGTH (operation);
reduction_op = TREE_OPERAND (operation, op_type-1);
vectype = get_vectype_for_scalar_type (TREE_TYPE (reduction_op));
mode = TYPE_MODE (vectype);
*************** vectorizable_reduction (tree stmt, block
*** 1557,1563 ****
operation = GIMPLE_STMT_OPERAND (stmt, 1);
code = TREE_CODE (operation);
! op_type = TREE_CODE_LENGTH (code);
if (op_type != binary_op && op_type != ternary_op)
return false;
scalar_dest = GIMPLE_STMT_OPERAND (stmt, 0);
--- 1557,1563 ----
operation = GIMPLE_STMT_OPERAND (stmt, 1);
code = TREE_CODE (operation);
! op_type = TREE_OPERAND_LENGTH (operation);
if (op_type != binary_op && op_type != ternary_op)
return false;
scalar_dest = GIMPLE_STMT_OPERAND (stmt, 0);
*************** vectorizable_call (tree stmt, block_stmt
*** 1803,1815 ****
tree vec_dest;
tree scalar_dest;
tree operation;
! tree args, type;
stmt_vec_info stmt_info = vinfo_for_stmt (stmt), prev_stmt_info;
tree vectype_out, vectype_in;
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
tree fndecl, rhs, new_temp, def, def_stmt, rhs_type, lhs_type;
enum vect_def_type dt[2];
int ncopies, j, nargs;
/* Is STMT a vectorizable call? */
if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
--- 1803,1816 ----
tree vec_dest;
tree scalar_dest;
tree operation;
! tree op, type;
stmt_vec_info stmt_info = vinfo_for_stmt (stmt), prev_stmt_info;
tree vectype_out, vectype_in;
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
tree fndecl, rhs, new_temp, def, def_stmt, rhs_type, lhs_type;
enum vect_def_type dt[2];
int ncopies, j, nargs;
+ call_expr_arg_iterator iter;
/* Is STMT a vectorizable call? */
if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
*************** vectorizable_call (tree stmt, block_stmt
*** 1824,1838 ****
/* Process function arguments. */
rhs_type = NULL_TREE;
! for (args = TREE_OPERAND (operation, 1), nargs = 0;
! args; args = TREE_CHAIN (args), ++nargs)
{
! tree op = TREE_VALUE (args);
/* Bail out if the function has more than two arguments, we
do not have interesting builtin functions to vectorize with
more than two arguments. */
! if (nargs >= 2)
return false;
/* We can only handle calls with arguments of the same type. */
--- 1825,1839 ----
/* Process function arguments. */
rhs_type = NULL_TREE;
! nargs = 0;
! FOR_EACH_CALL_EXPR_ARG (op, iter, operation)
{
! ++nargs;
/* Bail out if the function has more than two arguments, we
do not have interesting builtin functions to vectorize with
more than two arguments. */
! if (nargs > 2)
return false;
/* We can only handle calls with arguments of the same type. */
*************** vectorizable_call (tree stmt, block_stmt
*** 1911,1921 ****
int n;
/* Build argument list for the vectorized call. */
vargs = NULL_TREE;
! for (args = TREE_OPERAND (operation, 1), n = 0;
! args; args = TREE_CHAIN (args), ++n)
{
! tree op = TREE_VALUE (args);
if (j == 0)
vec_oprnd[n] = vect_get_vec_def_for_operand (op, stmt, NULL);
--- 1912,1924 ----
int n;
/* Build argument list for the vectorized call. */
+ /* FIXME: Rewrite this so that it doesn't construct a temporary
+ list. */
vargs = NULL_TREE;
! n = -1;
! FOR_EACH_CALL_EXPR_ARG (op, iter, operation)
{
! ++n;
if (j == 0)
vec_oprnd[n] = vect_get_vec_def_for_operand (op, stmt, NULL);
*************** vectorizable_conversion (tree stmt, bloc
*** 1979,1985 ****
int ncopies, j;
tree vectype_out, vectype_in;
tree rhs_type, lhs_type;
! tree builtin_decl, params;
stmt_vec_info prev_stmt_info;
/* Is STMT a vectorizable conversion? */
--- 1982,1988 ----
int ncopies, j;
tree vectype_out, vectype_in;
tree rhs_type, lhs_type;
! tree builtin_decl;
stmt_vec_info prev_stmt_info;
/* Is STMT a vectorizable conversion? */
*************** vectorizable_conversion (tree stmt, bloc
*** 2073,2083 ****
vec_oprnd0 = vect_get_vec_def_for_operand (op0, stmt, NULL);
else
vec_oprnd0 = vect_get_vec_def_for_stmt_copy (dt0, vec_oprnd0);
- params = build_tree_list (NULL_TREE, vec_oprnd0);
builtin_decl =
targetm.vectorize.builtin_conversion (code, vectype_in);
! new_stmt = build_function_call_expr (builtin_decl, params);
/* Arguments are ready. create the new vector stmt. */
new_stmt = build2 (GIMPLE_MODIFY_STMT, void_type_node, vec_dest,
--- 2076,2085 ----
vec_oprnd0 = vect_get_vec_def_for_operand (op0, stmt, NULL);
else
vec_oprnd0 = vect_get_vec_def_for_stmt_copy (dt0, vec_oprnd0);
builtin_decl =
targetm.vectorize.builtin_conversion (code, vectype_in);
! new_stmt = build_call_expr (builtin_decl, 1, vec_oprnd0);
/* Arguments are ready. create the new vector stmt. */
new_stmt = build2 (GIMPLE_MODIFY_STMT, void_type_node, vec_dest,
*************** vectorizable_operation (tree stmt, block
*** 2272,2278 ****
optab = optab_for_tree_code (code, vectype);
/* Support only unary or binary operations. */
! op_type = TREE_CODE_LENGTH (code);
if (op_type != unary_op && op_type != binary_op)
{
if (vect_print_dump_info (REPORT_DETAILS))
--- 2274,2280 ----
optab = optab_for_tree_code (code, vectype);
/* Support only unary or binary operations. */
! op_type = TREE_OPERAND_LENGTH (operation);
if (op_type != unary_op && op_type != binary_op)
{
if (vect_print_dump_info (REPORT_DETAILS))
*************** vect_gen_widened_results_half (enum tree
*** 2642,2648 ****
tree vec_dest, block_stmt_iterator *bsi,
tree stmt)
{
- tree vec_params;
tree expr;
tree new_stmt;
tree new_temp;
--- 2644,2649 ----
*************** vect_gen_widened_results_half (enum tree
*** 2653,2662 ****
if (code == CALL_EXPR)
{
/* Target specific support */
! vec_params = build_tree_list (NULL_TREE, vec_oprnd0);
! if (op_type == binary_op)
! vec_params = tree_cons (NULL_TREE, vec_oprnd1, vec_params);
! expr = build_function_call_expr (decl, vec_params);
}
else
{
--- 2654,2663 ----
if (code == CALL_EXPR)
{
/* Target specific support */
! if (op_type == binary_op)
! expr = build_call_expr (decl, 2, vec_oprnd0, vec_oprnd1);
! else
! expr = build_call_expr (decl, 1, vec_oprnd0);
}
else
{
*************** vect_setup_realignment (tree stmt, block
*** 3378,3387 ****
if (targetm.vectorize.builtin_mask_for_load)
{
tree builtin_decl;
- tree params = build_tree_list (NULL_TREE, init_addr);
builtin_decl = targetm.vectorize.builtin_mask_for_load ();
! new_stmt = build_function_call_expr (builtin_decl, params);
vec_dest = vect_create_destination_var (scalar_dest,
TREE_TYPE (new_stmt));
new_stmt = build2 (GIMPLE_MODIFY_STMT, void_type_node, vec_dest,
--- 3379,3387 ----
if (targetm.vectorize.builtin_mask_for_load)
{
tree builtin_decl;
builtin_decl = targetm.vectorize.builtin_mask_for_load ();
! new_stmt = build_call_expr (builtin_decl, 1, init_addr);
vec_dest = vect_create_destination_var (scalar_dest,
TREE_TYPE (new_stmt));
new_stmt = build2 (GIMPLE_MODIFY_STMT, void_type_node, vec_dest,
*************** vectorizable_live_operation (tree stmt,
*** 4011,4017 ****
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
int i;
- enum tree_code code;
int op_type;
tree op;
tree def, def_stmt;
--- 4011,4016 ----
*************** vectorizable_live_operation (tree stmt,
*** 4027,4035 ****
return false;
operation = GIMPLE_STMT_OPERAND (stmt, 1);
! code = TREE_CODE (operation);
!
! op_type = TREE_CODE_LENGTH (code);
/* FORNOW: support only if all uses are invariant. This means
that the scalar operations can remain in place, unvectorized.
--- 4026,4032 ----
return false;
operation = GIMPLE_STMT_OPERAND (stmt, 1);
! op_type = TREE_OPERAND_LENGTH (operation);
/* FORNOW: support only if all uses are invariant. This means
that the scalar operations can remain in place, unvectorized.
Index: gcc/tree-object-size.c
===================================================================
*** gcc/tree-object-size.c (revision 121818)
--- gcc/tree-object-size.c (working copy)
*************** addr_object_size (tree ptr, int object_s
*** 228,276 ****
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;
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;
break;
/*
case BUILT_IN_REALLOC:
! arg_mask = 2;
break;
*/
case BUILT_IN_CALLOC:
! arg_mask = 3;
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))
return tree_low_cst (bytes, 1);
return unknown[object_size_type];
--- 228,268 ----
static unsigned HOST_WIDE_INT
alloc_object_size (tree call, int object_size_type)
{
! tree callee, bytes = NULL_TREE;
gcc_assert (TREE_CODE (call) == CALL_EXPR);
callee = get_callee_fndecl (call);
if (callee
&& DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL)
switch (DECL_FUNCTION_CODE (callee))
{
case BUILT_IN_MALLOC:
case BUILT_IN_ALLOCA:
! 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:
! 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:
! 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;
}
! if (bytes && host_integerp (bytes, 1))
return tree_low_cst (bytes, 1);
return unknown[object_size_type];
*************** static tree
*** 285,291 ****
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)
--- 277,282 ----
*************** pass_through_call (tree call)
*** 305,312 ****
case BUILT_IN_STRNCPY_CHK:
case BUILT_IN_STRCAT_CHK:
case BUILT_IN_STRNCAT_CHK:
! if (arglist)
! return TREE_VALUE (arglist);
break;
default:
break;
--- 296,303 ----
case BUILT_IN_STRNCPY_CHK:
case BUILT_IN_STRCAT_CHK:
case BUILT_IN_STRNCAT_CHK:
! if (call_expr_nargs (call) >= 1)
! return CALL_EXPR_ARG (call, 0);
break;
default:
break;
*************** compute_object_sizes (void)
*** 1043,1059 ****
continue;
init_object_sizes ();
! result = fold_builtin (callee, TREE_OPERAND (call, 1), 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)
{
! tree ost = TREE_VALUE (TREE_CHAIN (arglist));
if (host_integerp (ost, 1))
{
--- 1034,1046 ----
continue;
init_object_sizes ();
! result = fold_call_expr (call, false);
if (!result)
{
! if (call_expr_nargs (call) == 2
! && POINTER_TYPE_P (TREE_TYPE (CALL_EXPR_ARG (call, 0))))
{
! tree ost = CALL_EXPR_ARG (call, 1);
if (host_integerp (ost, 1))
{
Index: gcc/tree-profile.c
===================================================================
*** gcc/tree-profile.c (revision 121818)
--- gcc/tree-profile.c (working copy)
*************** tree_gen_interval_profiler (histogram_va
*** 203,209 ****
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 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);
--- 203,209 ----
tree stmt = value->hvalue.stmt;
block_stmt_iterator bsi = bsi_for_stmt (stmt);
tree ref = tree_coverage_counter_ref (tag, base), ref_ptr;
! 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);
*************** tree_gen_interval_profiler (histogram_va
*** 211,222 ****
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);
bsi_insert_before (&bsi, call, BSI_SAME_STMT);
}
--- 211,218 ----
build_addr (ref, current_function_decl),
true, NULL_TREE);
val = prepare_instrumented_value (&bsi, value);
! call = build_call_expr (tree_interval_profiler_fn, 4,
! ref_ptr, val, start, steps);
bsi_insert_before (&bsi, call, BSI_SAME_STMT);
}
*************** tree_gen_pow2_profiler (histogram_value
*** 230,245 ****
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;
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);
bsi_insert_before (&bsi, call, BSI_SAME_STMT);
}
--- 226,238 ----
tree stmt = value->hvalue.stmt;
block_stmt_iterator bsi = bsi_for_stmt (stmt);
tree ref = tree_coverage_counter_ref (tag, base), ref_ptr;
! 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);
! call = build_call_expr (tree_pow2_profiler_fn, 2, ref_ptr, val);
bsi_insert_before (&bsi, call, BSI_SAME_STMT);
}
*************** tree_gen_one_value_profiler (histogram_v
*** 253,268 ****
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;
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);
bsi_insert_before (&bsi, call, BSI_SAME_STMT);
}
--- 246,258 ----
tree stmt = value->hvalue.stmt;
block_stmt_iterator bsi = bsi_for_stmt (stmt);
tree ref = tree_coverage_counter_ref (tag, base), ref_ptr;
! 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);
! call = build_call_expr (tree_one_value_profiler_fn, 2, ref_ptr, val);
bsi_insert_before (&bsi, call, BSI_SAME_STMT);
}
*************** tree_gen_ic_func_profiler (void)
*** 320,326 ****
basic_block bb;
edge_iterator ei;
tree stmt1;
! tree args, tree_uid, cur_func;
if (flag_unit_at_a_time)
{
--- 310,316 ----
basic_block bb;
edge_iterator ei;
tree stmt1;
! tree tree_uid, cur_func;
if (flag_unit_at_a_time)
{
*************** tree_gen_ic_func_profiler (void)
*** 339,351 ****
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);
bsi_insert_after (&bsi, stmt1, BSI_SAME_STMT);
}
}
--- 329,339 ----
current_function_decl),
true, NULL_TREE);
tree_uid = build_int_cst (gcov_type_node, c_node->pid);
! 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);
}
}
*************** tree_gen_average_profiler (histogram_val
*** 377,390 ****
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;
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);
bsi_insert_before (&bsi, call, BSI_SAME_STMT);
}
--- 365,377 ----
tree stmt = value->hvalue.stmt;
block_stmt_iterator bsi = bsi_for_stmt (stmt);
tree ref = tree_coverage_counter_ref (tag, base), ref_ptr;
! 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);
! call = build_call_expr (tree_average_profiler_fn, 2, ref_ptr, val);
bsi_insert_before (&bsi, call, BSI_SAME_STMT);
}
*************** tree_gen_ior_profiler (histogram_value v
*** 398,411 ****
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;
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);
bsi_insert_before (&bsi, call, BSI_SAME_STMT);
}
--- 385,397 ----
tree stmt = value->hvalue.stmt;
block_stmt_iterator bsi = bsi_for_stmt (stmt);
tree ref = tree_coverage_counter_ref (tag, base), ref_ptr;
! 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);
! call = build_call_expr (tree_ior_profiler_fn, 2, ref_ptr, val);
bsi_insert_before (&bsi, call, BSI_SAME_STMT);
}
Index: gcc/tree-ssa-structalias.c
===================================================================
*** gcc/tree-ssa-structalias.c (revision 121818)
--- gcc/tree-ssa-structalias.c (working copy)
*************** get_constraint_for (tree t, VEC (ce_s, h
*** 2512,2517 ****
--- 2512,2518 ----
switch (TREE_CODE_CLASS (TREE_CODE (t)))
{
case tcc_expression:
+ case tcc_vl_exp:
{
switch (TREE_CODE (t))
{
*************** find_func_aliases (tree origt)
*** 3339,3345 ****
{
tree lhsop;
tree rhsop;
! tree arglist;
varinfo_t fi;
int i = 1;
tree decl;
--- 3340,3347 ----
{
tree lhsop;
tree rhsop;
! tree arg;
! call_expr_arg_iterator iter;
varinfo_t fi;
int i = 1;
tree decl;
*************** find_func_aliases (tree origt)
*** 3364,3380 ****
}
else
{
! decl = TREE_OPERAND (rhsop, 0);
fi = get_vi_for_tree (decl);
}
/* Assign all the passed arguments to the appropriate incoming
parameters of the function. */
- arglist = TREE_OPERAND (rhsop, 1);
! for (;arglist; arglist = TREE_CHAIN (arglist))
! {
! tree arg = TREE_VALUE (arglist);
struct constraint_expr lhs ;
struct constraint_expr *rhsp;
--- 3366,3380 ----
}
else
{
! decl = CALL_EXPR_FN (rhsop);
fi = get_vi_for_tree (decl);
}
/* Assign all the passed arguments to the appropriate incoming
parameters of the function. */
! FOR_EACH_CALL_EXPR_ARG (arg, iter, rhsop)
! {
struct constraint_expr lhs ;
struct constraint_expr *rhsp;
*************** find_func_aliases (tree origt)
*** 3455,3460 ****
--- 3455,3461 ----
case tcc_constant:
case tcc_exceptional:
case tcc_expression:
+ case tcc_vl_exp:
case tcc_unary:
{
unsigned int j;
*************** find_func_aliases (tree origt)
*** 3488,3494 ****
to process expressions other than simple operands
(e.g. INDIRECT_REF, ADDR_EXPR, CALL_EXPR). */
default:
! for (i = 0; i < TREE_CODE_LENGTH (TREE_CODE (rhsop)); i++)
{
tree op = TREE_OPERAND (rhsop, i);
unsigned int j;
--- 3489,3495 ----
to process expressions other than simple operands
(e.g. INDIRECT_REF, ADDR_EXPR, CALL_EXPR). */
default:
! for (i = 0; i < TREE_OPERAND_LENGTH (rhsop); i++)
{
tree op = TREE_OPERAND (rhsop, i);
unsigned int j;
Index: gcc/tree-ssa-reassoc.c
===================================================================
*** gcc/tree-ssa-reassoc.c (revision 121818)
--- gcc/tree-ssa-reassoc.c (working copy)
*************** get_rank (tree e)
*** 233,238 ****
--- 233,239 ----
tree rhs;
long rank, maxrank;
int i;
+ int n;
if (TREE_CODE (SSA_NAME_VAR (e)) == PARM_DECL
&& SSA_NAME_IS_DEFAULT_DEF (e))
*************** get_rank (tree e)
*** 256,267 ****
rank = 0;
maxrank = bb_rank[bb_for_stmt(stmt)->index];
rhs = GIMPLE_STMT_OPERAND (stmt, 1);
! if (TREE_CODE_LENGTH (TREE_CODE (rhs)) == 0)
rank = MAX (rank, get_rank (rhs));
else
{
for (i = 0;
! i < TREE_CODE_LENGTH (TREE_CODE (rhs))
&& TREE_OPERAND (rhs, i)
&& rank != maxrank;
i++)
--- 257,269 ----
rank = 0;
maxrank = bb_rank[bb_for_stmt(stmt)->index];
rhs = GIMPLE_STMT_OPERAND (stmt, 1);
! n = TREE_OPERAND_LENGTH (rhs);
! if (n == 0)
rank = MAX (rank, get_rank (rhs));
else
{
for (i = 0;
! i < n
&& TREE_OPERAND (rhs, i)
&& rank != maxrank;
i++)
Index: gcc/stmt.c
===================================================================
*** gcc/stmt.c (revision 121818)
--- gcc/stmt.c (working copy)
*************** warn_if_unused_value (tree exp, location
*** 1477,1483 ****
/* 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)
return 0;
warn:
--- 1477,1483 ----
/* 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_OPERAND_LENGTH (exp) == 0)
return 0;
warn:
Index: gcc/convert.c
===================================================================
*** gcc/convert.c (revision 121818)
--- gcc/convert.c (working copy)
*************** convert_to_real (tree type, tree expr)
*** 173,179 ****
CASE_MATHFN (Y1)
#undef CASE_MATHFN
{
! tree arg0 = strip_float_extensions (TREE_VALUE (TREE_OPERAND (expr, 1)));
tree newtype = type;
/* We have (outertype)sqrt((innertype)x). Choose the wider mode from
--- 173,179 ----
CASE_MATHFN (Y1)
#undef CASE_MATHFN
{
! tree arg0 = strip_float_extensions (CALL_EXPR_ARG (expr, 0));
tree newtype = type;
/* We have (outertype)sqrt((innertype)x). Choose the wider mode from
*************** convert_to_real (tree type, tree expr)
*** 188,200 ****
&& (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);
if (newtype == type)
return expr;
}
--- 188,199 ----
&& (TYPE_MODE (newtype) == TYPE_MODE (double_type_node)
|| TYPE_MODE (newtype) == TYPE_MODE (float_type_node)))
{
tree fn = mathfn_built_in (newtype, fcode);
if (fn)
{
! tree arg = fold (convert_to_real (newtype, arg0));
! expr = build_call_expr (fn, 1, arg);
if (newtype == type)
return expr;
}
*************** convert_to_real (tree type, tree expr)
*** 225,242 ****
if (fn)
{
! tree arg
! = strip_float_extensions (TREE_VALUE (TREE_OPERAND (expr, 1)));
/* 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))));
}
}
--- 224,237 ----
if (fn)
{
! 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_call_expr (fn, 1, fold (convert_to_real (type, arg)));
}
}
*************** convert_to_integer (tree type, tree expr
*** 434,443 ****
break;
CASE_FLT_FN (BUILT_IN_TRUNC):
! {
! tree arglist = TREE_OPERAND (s_expr, 1);
! return convert_to_integer (type, TREE_VALUE (arglist));
! }
default:
break;
--- 429,435 ----
break;
CASE_FLT_FN (BUILT_IN_TRUNC):
! return convert_to_integer (type, CALL_EXPR_ARG (s_expr, 0));
default:
break;
*************** convert_to_integer (tree type, tree expr
*** 445,452 ****
if (fn)
{
! tree arglist = TREE_OPERAND (s_expr, 1);
! tree newexpr = build_function_call_expr (fn, arglist);
return convert_to_integer (type, newexpr);
}
}
--- 437,443 ----
if (fn)
{
! tree newexpr = build_call_expr (fn, 1, CALL_EXPR_ARG (s_expr, 0));
return convert_to_integer (type, newexpr);
}
}
Index: gcc/tree-ssa-operands.c
===================================================================
*** gcc/tree-ssa-operands.c (revision 121818)
--- gcc/tree-ssa-operands.c (working copy)
*************** add_call_read_ops (tree stmt, tree calle
*** 1871,1878 ****
static void
get_call_expr_operands (tree stmt, tree expr)
{
- tree op;
int call_flags = call_expr_flags (expr);
stmt_ann_t ann = stmt_ann (stmt);
ann->references_memory = true;
--- 1871,1878 ----
static void
get_call_expr_operands (tree stmt, tree expr)
{
int call_flags = call_expr_flags (expr);
+ int i, nargs;
stmt_ann_t ann = stmt_ann (stmt);
ann->references_memory = true;
*************** get_call_expr_operands (tree stmt, tree
*** 1894,1905 ****
}
/* Find uses in the called function. */
! get_expr_operands (stmt, &TREE_OPERAND (expr, 0), opf_use);
!
! for (op = TREE_OPERAND (expr, 1); op; op = TREE_CHAIN (op))
! get_expr_operands (stmt, &TREE_VALUE (op), opf_use);
! get_expr_operands (stmt, &TREE_OPERAND (expr, 2), opf_use);
}
--- 1894,1905 ----
}
/* Find uses in the called function. */
! get_expr_operands (stmt, &CALL_EXPR_FN (expr), opf_use);
! nargs = call_expr_nargs (expr);
! for (i = 0; i < nargs; i++)
! get_expr_operands (stmt, &CALL_EXPR_ARG (expr, i), opf_use);
! get_expr_operands (stmt, &CALL_EXPR_STATIC_CHAIN (expr), opf_use);
}