Commit 556e9ba0 by Jan Hubicka Committed by Jan Hubicka

ipa-split.c (split_function): For aggregate values set return_slot_opt...

	* ipa-split.c (split_function): For aggregate values set return_slot_opt;
	when passing DECL_BY_REFERENCE produce *<retval> = fncall.part ()
	(execute_split_functions): Do not care about DECL_BY_REFERENCE.

From-SVN: r161756
parent b3b7bbce
2010-07-02 Jan Hubicka <jh@suse.cz>
* ipa-split.c (split_function): For aggregate values set return_slot_opt;
when passing DECL_BY_REFERENCE produce *<retval> = fncall.part ()
(execute_split_functions): Do not care about DECL_BY_REFERENCE.
2010-07-02 Sandra Loosemore <sandra@codesourcery.com> 2010-07-02 Sandra Loosemore <sandra@codesourcery.com>
* config/arm/neon.md (UNSPEC_VAND): Delete. * config/arm/neon.md (UNSPEC_VAND): Delete.
...@@ -60,8 +66,8 @@ ...@@ -60,8 +66,8 @@
2010-07-02 Jan Hubicka <jh@suse.cz> 2010-07-02 Jan Hubicka <jh@suse.cz>
* ipa-split.c (verify_non_ssa_vars): Break out from ...; perform DFS * ipa-split.c (verify_non_ssa_vars): Break out from ...; perform DFS walk
walk backwards from entry_bb to check only those basic block of header backwards from entry_bb to check only those basic block of header
that might lead to execution of split part. that might lead to execution of split part.
(consider_split) ... here. (consider_split) ... here.
(find_return_bb): Allow assignment in return BB. (find_return_bb): Allow assignment in return BB.
......
...@@ -3558,7 +3558,7 @@ override_options (bool main_args_p) ...@@ -3558,7 +3558,7 @@ override_options (bool main_args_p)
/* Enable sw prefetching at -O3 for CPUS that prefetching is helpful. */ /* Enable sw prefetching at -O3 for CPUS that prefetching is helpful. */
if (flag_prefetch_loop_arrays < 0 if (flag_prefetch_loop_arrays < 0
&& HAVE_prefetch && HAVE_prefetch
&& optimize >= 3 && (optimize >= 3 || flag_profile_use)
&& software_prefetching_beneficial_p ()) && software_prefetching_beneficial_p ())
flag_prefetch_loop_arrays = 1; flag_prefetch_loop_arrays = 1;
......
...@@ -949,6 +949,13 @@ split_function (struct split_point *split_point) ...@@ -949,6 +949,13 @@ split_function (struct split_point *split_point)
call = gimple_build_call_vec (node->decl, args_to_pass); call = gimple_build_call_vec (node->decl, args_to_pass);
gimple_set_block (call, DECL_INITIAL (current_function_decl)); gimple_set_block (call, DECL_INITIAL (current_function_decl));
/* We avoid address being taken on any variable used by split part,
so return slot optimization is always possible. Moreover this is
required to make DECL_BY_REFERENCE work. */
if (aggregate_value_p (DECL_RESULT (current_function_decl),
TREE_TYPE (current_function_decl)))
gimple_call_set_return_slot_opt (call, true);
/* Update return value. This is bit tricky. When we do not return, /* Update return value. This is bit tricky. When we do not return,
do nothing. When we return we might need to update return_bb do nothing. When we return we might need to update return_bb
or produce a new return statement. */ or produce a new return statement. */
...@@ -1002,6 +1009,9 @@ split_function (struct split_point *split_point) ...@@ -1002,6 +1009,9 @@ split_function (struct split_point *split_point)
update_stmt (gsi_stmt (bsi)); update_stmt (gsi_stmt (bsi));
} }
} }
if (DECL_BY_REFERENCE (DECL_RESULT (current_function_decl)))
gimple_call_set_lhs (call, build_simple_mem_ref (retval));
else
gimple_call_set_lhs (call, retval); gimple_call_set_lhs (call, retval);
} }
gsi_insert_after (&gsi, call, GSI_NEW_STMT); gsi_insert_after (&gsi, call, GSI_NEW_STMT);
...@@ -1021,6 +1031,9 @@ split_function (struct split_point *split_point) ...@@ -1021,6 +1031,9 @@ split_function (struct split_point *split_point)
retval = create_tmp_reg (TREE_TYPE (retval), NULL); retval = create_tmp_reg (TREE_TYPE (retval), NULL);
if (is_gimple_reg (retval)) if (is_gimple_reg (retval))
retval = make_ssa_name (retval, call); retval = make_ssa_name (retval, call);
if (DECL_BY_REFERENCE (DECL_RESULT (current_function_decl)))
gimple_call_set_lhs (call, build_simple_mem_ref (retval));
else
gimple_call_set_lhs (call, retval); gimple_call_set_lhs (call, retval);
} }
gsi_insert_after (&gsi, call, GSI_NEW_STMT); gsi_insert_after (&gsi, call, GSI_NEW_STMT);
...@@ -1085,13 +1098,6 @@ execute_split_functions (void) ...@@ -1085,13 +1098,6 @@ execute_split_functions (void)
fprintf (dump_file, "Not splitting: nested function.\n"); fprintf (dump_file, "Not splitting: nested function.\n");
return 0; return 0;
} }
/* FIXME: Should be easy to support. */
if (DECL_BY_REFERENCE (DECL_RESULT (current_function_decl)))
{
if (dump_file)
fprintf (dump_file, "Not splitting: returns value by reference.\n");
return 0;
}
/* See if it makes sense to try to split. /* See if it makes sense to try to split.
It makes sense to split if we inline, that is if we have direct calls to It makes sense to split if we inline, that is if we have direct calls to
......
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