Commit aa00059c by Richard Biener Committed by Richard Biener

tree-nested.h (build_addr): Adjust prototype.

2015-10-16  Richard Biener  <rguenther@suse.de>

	* tree-nested.h (build_addr): Adjust prototype.
	* tree-nested.c (build_addr): Remove context argument and use
	mark_addressable.
	(get_static_chain): Adjust calls to build_addr.
	(convert_nl_goto_reference): Likewise.
	(convert_tramp_reference_op): Likewise.
	(finalize_nesting_tree_1): Likewise.
	* value-prof.c (gimple_ic): Likewise.
	* gimple-low.c (lower_builtin_setjmp): Likewise.
	* tree-parloops.c (take_address_of): Likewise.
	(create_call_for_reduction_1): Likewise.
	* tree-profile.c (gimple_gen_interval_profiler): Likewise.
	(gimple_gen_ic_func_profiler): Likewise.

	fortran/
	* trans-intrinsic.c (gfc_conv_intrinsic_lib_function): Adjust
	calls to build_addr.
	(gfc_conv_intrinsic_mod): Likewise.
	(gfc_conv_intrinsic_ctime): Likewise.
	(gfc_conv_intrinsic_fdate): Likewise.
	(gfc_conv_intrinsic_ttynam): Likewise.
	(gfc_conv_intrinsic_minmax_char): Likewise.
	(gfc_conv_intrinsic_index_scan_verify): Likewise.
	(gfc_conv_intrinsic_trim): Likewise.

From-SVN: r228862
parent 4856a1f0
2015-10-16 Richard Biener <rguenther@suse.de>
* tree-nested.h (build_addr): Adjust prototype.
* tree-nested.c (build_addr): Remove context argument and use
mark_addressable.
(get_static_chain): Adjust calls to build_addr.
(convert_nl_goto_reference): Likewise.
(convert_tramp_reference_op): Likewise.
(finalize_nesting_tree_1): Likewise.
* value-prof.c (gimple_ic): Likewise.
* gimple-low.c (lower_builtin_setjmp): Likewise.
* tree-parloops.c (take_address_of): Likewise.
(create_call_for_reduction_1): Likewise.
* tree-profile.c (gimple_gen_interval_profiler): Likewise.
(gimple_gen_ic_func_profiler): Likewise.
2015-10-11 Jan Hubicka <hubicka@ucw.cz> 2015-10-11 Jan Hubicka <hubicka@ucw.cz>
* ipa-icf-gimple.c (func_checker::compare_operand): Compare only * ipa-icf-gimple.c (func_checker::compare_operand): Compare only
2015-10-16 Richard Biener <rguenther@suse.de>
* trans-intrinsic.c (gfc_conv_intrinsic_lib_function): Adjust
calls to build_addr.
(gfc_conv_intrinsic_mod): Likewise.
(gfc_conv_intrinsic_ctime): Likewise.
(gfc_conv_intrinsic_fdate): Likewise.
(gfc_conv_intrinsic_ttynam): Likewise.
(gfc_conv_intrinsic_minmax_char): Likewise.
(gfc_conv_intrinsic_index_scan_verify): Likewise.
(gfc_conv_intrinsic_trim): Likewise.
2015-10-14 Maxim Ostapenko <m.ostapenko@partner.samsung.com> 2015-10-14 Maxim Ostapenko <m.ostapenko@partner.samsung.com>
* parse.c (decode_statement): Initialize M to MATCH_NO. * parse.c (decode_statement): Initialize M to MATCH_NO.
......
...@@ -873,7 +873,7 @@ gfc_conv_intrinsic_lib_function (gfc_se * se, gfc_expr * expr) ...@@ -873,7 +873,7 @@ gfc_conv_intrinsic_lib_function (gfc_se * se, gfc_expr * expr)
fndecl = gfc_get_intrinsic_lib_fndecl (m, expr); fndecl = gfc_get_intrinsic_lib_fndecl (m, expr);
rettype = TREE_TYPE (TREE_TYPE (fndecl)); rettype = TREE_TYPE (TREE_TYPE (fndecl));
fndecl = build_addr (fndecl, current_function_decl); fndecl = build_addr (fndecl);
se->expr = build_call_array_loc (input_location, rettype, fndecl, num_args, args); se->expr = build_call_array_loc (input_location, rettype, fndecl, num_args, args);
} }
...@@ -2294,7 +2294,7 @@ gfc_conv_intrinsic_mod (gfc_se * se, gfc_expr * expr, int modulo) ...@@ -2294,7 +2294,7 @@ gfc_conv_intrinsic_mod (gfc_se * se, gfc_expr * expr, int modulo)
/* The builtin should always be available. */ /* The builtin should always be available. */
gcc_assert (fmod != NULL_TREE); gcc_assert (fmod != NULL_TREE);
tmp = build_addr (fmod, current_function_decl); tmp = build_addr (fmod);
se->expr = build_call_array_loc (input_location, se->expr = build_call_array_loc (input_location,
TREE_TYPE (TREE_TYPE (fmod)), TREE_TYPE (TREE_TYPE (fmod)),
tmp, 2, args); tmp, 2, args);
...@@ -2600,7 +2600,7 @@ gfc_conv_intrinsic_ctime (gfc_se * se, gfc_expr * expr) ...@@ -2600,7 +2600,7 @@ gfc_conv_intrinsic_ctime (gfc_se * se, gfc_expr * expr)
args[0] = gfc_build_addr_expr (NULL_TREE, var); args[0] = gfc_build_addr_expr (NULL_TREE, var);
args[1] = gfc_build_addr_expr (NULL_TREE, len); args[1] = gfc_build_addr_expr (NULL_TREE, len);
fndecl = build_addr (gfor_fndecl_ctime, current_function_decl); fndecl = build_addr (gfor_fndecl_ctime);
tmp = build_call_array_loc (input_location, tmp = build_call_array_loc (input_location,
TREE_TYPE (TREE_TYPE (gfor_fndecl_ctime)), TREE_TYPE (TREE_TYPE (gfor_fndecl_ctime)),
fndecl, num_args, args); fndecl, num_args, args);
...@@ -2639,7 +2639,7 @@ gfc_conv_intrinsic_fdate (gfc_se * se, gfc_expr * expr) ...@@ -2639,7 +2639,7 @@ gfc_conv_intrinsic_fdate (gfc_se * se, gfc_expr * expr)
args[0] = gfc_build_addr_expr (NULL_TREE, var); args[0] = gfc_build_addr_expr (NULL_TREE, var);
args[1] = gfc_build_addr_expr (NULL_TREE, len); args[1] = gfc_build_addr_expr (NULL_TREE, len);
fndecl = build_addr (gfor_fndecl_fdate, current_function_decl); fndecl = build_addr (gfor_fndecl_fdate);
tmp = build_call_array_loc (input_location, tmp = build_call_array_loc (input_location,
TREE_TYPE (TREE_TYPE (gfor_fndecl_fdate)), TREE_TYPE (TREE_TYPE (gfor_fndecl_fdate)),
fndecl, num_args, args); fndecl, num_args, args);
...@@ -2849,7 +2849,7 @@ gfc_conv_intrinsic_ttynam (gfc_se * se, gfc_expr * expr) ...@@ -2849,7 +2849,7 @@ gfc_conv_intrinsic_ttynam (gfc_se * se, gfc_expr * expr)
args[0] = gfc_build_addr_expr (NULL_TREE, var); args[0] = gfc_build_addr_expr (NULL_TREE, var);
args[1] = gfc_build_addr_expr (NULL_TREE, len); args[1] = gfc_build_addr_expr (NULL_TREE, len);
fndecl = build_addr (gfor_fndecl_ttynam, current_function_decl); fndecl = build_addr (gfor_fndecl_ttynam);
tmp = build_call_array_loc (input_location, tmp = build_call_array_loc (input_location,
TREE_TYPE (TREE_TYPE (gfor_fndecl_ttynam)), TREE_TYPE (TREE_TYPE (gfor_fndecl_ttynam)),
fndecl, num_args, args); fndecl, num_args, args);
...@@ -2992,7 +2992,7 @@ gfc_conv_intrinsic_minmax_char (gfc_se * se, gfc_expr * expr, int op) ...@@ -2992,7 +2992,7 @@ gfc_conv_intrinsic_minmax_char (gfc_se * se, gfc_expr * expr, int op)
gcc_unreachable (); gcc_unreachable ();
/* Make the function call. */ /* Make the function call. */
fndecl = build_addr (function, current_function_decl); fndecl = build_addr (function);
tmp = build_call_array_loc (input_location, tmp = build_call_array_loc (input_location,
TREE_TYPE (TREE_TYPE (function)), fndecl, TREE_TYPE (TREE_TYPE (function)), fndecl,
nargs + 4, args); nargs + 4, args);
...@@ -5350,7 +5350,7 @@ gfc_conv_intrinsic_index_scan_verify (gfc_se * se, gfc_expr * expr, ...@@ -5350,7 +5350,7 @@ gfc_conv_intrinsic_index_scan_verify (gfc_se * se, gfc_expr * expr,
else else
args[4] = convert (logical4_type_node, args[4]); args[4] = convert (logical4_type_node, args[4]);
fndecl = build_addr (function, current_function_decl); fndecl = build_addr (function);
se->expr = build_call_array_loc (input_location, se->expr = build_call_array_loc (input_location,
TREE_TYPE (TREE_TYPE (function)), fndecl, TREE_TYPE (TREE_TYPE (function)), fndecl,
5, args); 5, args);
...@@ -6936,7 +6936,7 @@ gfc_conv_intrinsic_trim (gfc_se * se, gfc_expr * expr) ...@@ -6936,7 +6936,7 @@ gfc_conv_intrinsic_trim (gfc_se * se, gfc_expr * expr)
else else
gcc_unreachable (); gcc_unreachable ();
fndecl = build_addr (function, current_function_decl); fndecl = build_addr (function);
tmp = build_call_array_loc (input_location, tmp = build_call_array_loc (input_location,
TREE_TYPE (TREE_TYPE (function)), fndecl, TREE_TYPE (TREE_TYPE (function)), fndecl,
num_args, args); num_args, args);
......
...@@ -751,7 +751,7 @@ lower_builtin_setjmp (gimple_stmt_iterator *gsi) ...@@ -751,7 +751,7 @@ lower_builtin_setjmp (gimple_stmt_iterator *gsi)
dest = gimple_call_lhs (stmt); dest = gimple_call_lhs (stmt);
/* Build '__builtin_setjmp_setup (BUF, NEXT_LABEL)' and insert. */ /* Build '__builtin_setjmp_setup (BUF, NEXT_LABEL)' and insert. */
arg = build_addr (next_label, current_function_decl); arg = build_addr (next_label);
t = builtin_decl_implicit (BUILT_IN_SETJMP_SETUP); t = builtin_decl_implicit (BUILT_IN_SETJMP_SETUP);
g = gimple_build_call (t, 2, gimple_call_arg (stmt, 0), arg); g = gimple_build_call (t, 2, gimple_call_arg (stmt, 0), arg);
gimple_set_location (g, loc); gimple_set_location (g, loc);
...@@ -776,7 +776,7 @@ lower_builtin_setjmp (gimple_stmt_iterator *gsi) ...@@ -776,7 +776,7 @@ lower_builtin_setjmp (gimple_stmt_iterator *gsi)
gsi_insert_before (gsi, g, GSI_SAME_STMT); gsi_insert_before (gsi, g, GSI_SAME_STMT);
/* Build '__builtin_setjmp_receiver (NEXT_LABEL)' and insert. */ /* Build '__builtin_setjmp_receiver (NEXT_LABEL)' and insert. */
arg = build_addr (next_label, current_function_decl); arg = build_addr (next_label);
t = builtin_decl_implicit (BUILT_IN_SETJMP_RECEIVER); t = builtin_decl_implicit (BUILT_IN_SETJMP_RECEIVER);
g = gimple_build_call (t, 1, arg); g = gimple_build_call (t, 1, arg);
gimple_set_location (g, loc); gimple_set_location (g, loc);
......
...@@ -180,30 +180,10 @@ create_tmp_var_for (struct nesting_info *info, tree type, const char *prefix) ...@@ -180,30 +180,10 @@ create_tmp_var_for (struct nesting_info *info, tree type, const char *prefix)
Mark it for addressability as necessary. */ Mark it for addressability as necessary. */
tree tree
build_addr (tree exp, tree context) build_addr (tree exp)
{ {
tree base = exp; mark_addressable (exp);
tree save_context; return build_fold_addr_expr (exp);
tree retval;
while (handled_component_p (base))
base = TREE_OPERAND (base, 0);
if (DECL_P (base))
TREE_ADDRESSABLE (base) = 1;
/* Building the ADDR_EXPR will compute a set of properties for
that ADDR_EXPR. Those properties are unfortunately context
specific, i.e., they are dependent on CURRENT_FUNCTION_DECL.
Temporarily set CURRENT_FUNCTION_DECL to the desired context,
build the ADDR_EXPR, then restore CURRENT_FUNCTION_DECL. That
way the properties are for the ADDR_EXPR are computed properly. */
save_context = current_function_decl;
current_function_decl = context;
retval = build_fold_addr_expr (exp);
current_function_decl = save_context;
return retval;
} }
/* Insert FIELD into TYPE, sorted by alignment requirements. */ /* Insert FIELD into TYPE, sorted by alignment requirements. */
...@@ -766,7 +746,7 @@ get_static_chain (struct nesting_info *info, tree target_context, ...@@ -766,7 +746,7 @@ get_static_chain (struct nesting_info *info, tree target_context,
if (info->context == target_context) if (info->context == target_context)
{ {
x = build_addr (info->frame_decl, target_context); x = build_addr (info->frame_decl);
info->static_chain_added |= 1; info->static_chain_added |= 1;
} }
else else
...@@ -2162,10 +2142,10 @@ convert_nl_goto_reference (gimple_stmt_iterator *gsi, bool *handled_ops_p, ...@@ -2162,10 +2142,10 @@ convert_nl_goto_reference (gimple_stmt_iterator *gsi, bool *handled_ops_p,
/* Build: __builtin_nl_goto(new_label, &chain->nl_goto_field). */ /* Build: __builtin_nl_goto(new_label, &chain->nl_goto_field). */
field = get_nl_goto_field (i); field = get_nl_goto_field (i);
x = get_frame_field (info, target_context, field, gsi); x = get_frame_field (info, target_context, field, gsi);
x = build_addr (x, target_context); x = build_addr (x);
x = gsi_gimplify_val (info, x, gsi); x = gsi_gimplify_val (info, x, gsi);
call = gimple_build_call (builtin_decl_implicit (BUILT_IN_NONLOCAL_GOTO), call = gimple_build_call (builtin_decl_implicit (BUILT_IN_NONLOCAL_GOTO),
2, build_addr (new_label, target_context), x); 2, build_addr (new_label), x);
gsi_replace (gsi, call, false); gsi_replace (gsi, call, false);
/* We have handled all of STMT's operands, no need to keep going. */ /* We have handled all of STMT's operands, no need to keep going. */
...@@ -2271,7 +2251,7 @@ convert_tramp_reference_op (tree *tp, int *walk_subtrees, void *data) ...@@ -2271,7 +2251,7 @@ convert_tramp_reference_op (tree *tp, int *walk_subtrees, void *data)
/* Compute the address of the field holding the trampoline. */ /* Compute the address of the field holding the trampoline. */
x = get_frame_field (info, target_context, x, &wi->gsi); x = get_frame_field (info, target_context, x, &wi->gsi);
x = build_addr (x, target_context); x = build_addr (x);
x = gsi_gimplify_val (info, x, &wi->gsi); x = gsi_gimplify_val (info, x, &wi->gsi);
/* Do machine-specific ugliness. Normally this will involve /* Do machine-specific ugliness. Normally this will involve
...@@ -2809,7 +2789,7 @@ finalize_nesting_tree_1 (struct nesting_info *root) ...@@ -2809,7 +2789,7 @@ finalize_nesting_tree_1 (struct nesting_info *root)
continue; continue;
if (use_pointer_in_frame (p)) if (use_pointer_in_frame (p))
x = build_addr (p, context); x = build_addr (p);
else else
x = p; x = p;
...@@ -2852,13 +2832,13 @@ finalize_nesting_tree_1 (struct nesting_info *root) ...@@ -2852,13 +2832,13 @@ finalize_nesting_tree_1 (struct nesting_info *root)
continue; continue;
gcc_assert (DECL_STATIC_CHAIN (i->context)); gcc_assert (DECL_STATIC_CHAIN (i->context));
arg3 = build_addr (root->frame_decl, context); arg3 = build_addr (root->frame_decl);
arg2 = build_addr (i->context, context); arg2 = build_addr (i->context);
x = build3 (COMPONENT_REF, TREE_TYPE (field), x = build3 (COMPONENT_REF, TREE_TYPE (field),
root->frame_decl, field, NULL_TREE); root->frame_decl, field, NULL_TREE);
arg1 = build_addr (x, context); arg1 = build_addr (x);
x = builtin_decl_implicit (BUILT_IN_INIT_TRAMPOLINE); x = builtin_decl_implicit (BUILT_IN_INIT_TRAMPOLINE);
stmt = gimple_build_call (x, 3, arg1, arg2, arg3); stmt = gimple_build_call (x, 3, arg1, arg2, arg3);
......
...@@ -20,7 +20,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -20,7 +20,7 @@ along with GCC; see the file COPYING3. If not see
#ifndef GCC_TREE_NESTED_H #ifndef GCC_TREE_NESTED_H
#define GCC_TREE_NESTED_H #define GCC_TREE_NESTED_H
extern tree build_addr (tree, tree); extern tree build_addr (tree);
extern void insert_field_into_struct (tree, tree); extern void insert_field_into_struct (tree, tree);
extern void lower_nested_functions (tree); extern void lower_nested_functions (tree);
......
...@@ -540,7 +540,7 @@ take_address_of (tree obj, tree type, edge entry, ...@@ -540,7 +540,7 @@ take_address_of (tree obj, tree type, edge entry,
if (gsi == NULL) if (gsi == NULL)
return build_fold_addr_expr_with_type (obj, type); return build_fold_addr_expr_with_type (obj, type);
name = force_gimple_operand (build_addr (obj, current_function_decl), name = force_gimple_operand (build_addr (obj),
&stmts, true, NULL_TREE); &stmts, true, NULL_TREE);
if (!gimple_seq_empty_p (stmts)) if (!gimple_seq_empty_p (stmts))
gsi_insert_seq_before (gsi, stmts, GSI_SAME_STMT); gsi_insert_seq_before (gsi, stmts, GSI_SAME_STMT);
...@@ -1094,7 +1094,7 @@ create_call_for_reduction_1 (reduction_info **slot, struct clsn_data *clsn_data) ...@@ -1094,7 +1094,7 @@ create_call_for_reduction_1 (reduction_info **slot, struct clsn_data *clsn_data)
load_struct = build_simple_mem_ref (clsn_data->load); load_struct = build_simple_mem_ref (clsn_data->load);
t = build3 (COMPONENT_REF, type, load_struct, reduc->field, NULL_TREE); t = build3 (COMPONENT_REF, type, load_struct, reduc->field, NULL_TREE);
addr = build_addr (t, current_function_decl); addr = build_addr (t);
/* Create phi node. */ /* Create phi node. */
bb = clsn_data->load_bb; bb = clsn_data->load_bb;
......
...@@ -296,7 +296,7 @@ gimple_gen_interval_profiler (histogram_value value, unsigned tag, unsigned base ...@@ -296,7 +296,7 @@ gimple_gen_interval_profiler (histogram_value value, unsigned tag, unsigned base
value->hdata.intvl.steps); value->hdata.intvl.steps);
ref_ptr = force_gimple_operand_gsi (&gsi, ref_ptr = force_gimple_operand_gsi (&gsi,
build_addr (ref, current_function_decl), build_addr (ref),
true, NULL_TREE, true, GSI_SAME_STMT); true, NULL_TREE, true, GSI_SAME_STMT);
val = prepare_instrumented_value (&gsi, value); val = prepare_instrumented_value (&gsi, value);
call = gimple_build_call (tree_interval_profiler_fn, 4, call = gimple_build_call (tree_interval_profiler_fn, 4,
...@@ -415,8 +415,7 @@ gimple_gen_ic_func_profiler (void) ...@@ -415,8 +415,7 @@ gimple_gen_ic_func_profiler (void)
(ENTRY_BLOCK_PTR_FOR_FN (cfun)))); (ENTRY_BLOCK_PTR_FOR_FN (cfun))));
cur_func = force_gimple_operand_gsi (&gsi, cur_func = force_gimple_operand_gsi (&gsi,
build_addr (current_function_decl, build_addr (current_function_decl),
current_function_decl),
true, NULL_TREE, true, NULL_TREE,
true, GSI_SAME_STMT); true, GSI_SAME_STMT);
tree_uid = build_int_cst tree_uid = build_int_cst
......
...@@ -1376,8 +1376,7 @@ gimple_ic (gcall *icall_stmt, struct cgraph_node *direct_call, ...@@ -1376,8 +1376,7 @@ gimple_ic (gcall *icall_stmt, struct cgraph_node *direct_call,
load_stmt = gimple_build_assign (tmp0, tmp); load_stmt = gimple_build_assign (tmp0, tmp);
gsi_insert_before (&gsi, load_stmt, GSI_SAME_STMT); gsi_insert_before (&gsi, load_stmt, GSI_SAME_STMT);
tmp = fold_convert (optype, build_addr (direct_call->decl, tmp = fold_convert (optype, build_addr (direct_call->decl));
current_function_decl));
load_stmt = gimple_build_assign (tmp1, tmp); load_stmt = gimple_build_assign (tmp1, tmp);
gsi_insert_before (&gsi, load_stmt, GSI_SAME_STMT); gsi_insert_before (&gsi, load_stmt, GSI_SAME_STMT);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment