diff options
author | Jan Hubicka <jh@suse.cz> | 2008-08-29 13:31:40 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2008-08-29 11:31:40 +0000 |
commit | c6f7cfc15e7480f86aa3e4d407932f38fd635c89 (patch) | |
tree | d057c22936747f4672fd349b48d59df2628ab832 /gcc/tree-inline.c | |
parent | efd8f7507b3ce6e4cc00c7eac4f011736ca4f14d (diff) | |
download | gcc-c6f7cfc15e7480f86aa3e4d407932f38fd635c89.tar.gz |
tree.c (build_function_type_skip_args, [...]): New functions.
* tree.c (build_function_type_skip_args, build_function_decl_skip_args):
New functions.
* tree.h (build_function_type_skip_args, build_function_decl_skip_args):
Declare.
* gimple.c (giple_copy_call_skip_args): New function.
(giple_copy_call_skip_args): Declare.
* cgraph.h (cgraph_function_versioning): Add skip_args arugmnet
* ipa-cp.c (ipcp_node_not_modifiable_p): Rename to ...
(ipcp_node_modifiable_p): ... this one; use tree_versionable_function_p.
(ipcp_create_replace_map): Improve debug output.
(ipcp_need_redirect_p): Return false when not clonning.
(ipcp_update_callgraph): Skip args.
(ipcp_insert_stage): UPdate call of !ipcp_node_modifiable_p;
skip args.
* cgraphunit.c (cgraph_function_versioning): Add skip_args argument.
(save_inline_function_body): Update call of tree_function_versioning.
* ipa-prop.c (ipa_edge_removal_hook): Do not ICE on unanalyzed nodes.
* tree-inline.c (copy_arguments_for_versioning): Add skip_args argument.
(tree_function_versioning): Likewise.
* tree-inline.h (tree_function_versioning): Update prototype.
From-SVN: r139761
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r-- | gcc/tree-inline.c | 45 |
1 files changed, 32 insertions, 13 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 4fb28fef7e6..eb95cc6624a 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -4089,19 +4089,37 @@ copy_decl_maybe_to_var (tree decl, copy_body_data *id) /* Return a copy of the function's argument tree. */ static tree -copy_arguments_for_versioning (tree orig_parm, copy_body_data * id) +copy_arguments_for_versioning (tree orig_parm, copy_body_data * id, + bitmap args_to_skip, tree *vars) { - tree *arg_copy, *parg; + tree arg, *parg; + tree new_parm = NULL; + int i = 0; - arg_copy = &orig_parm; - for (parg = arg_copy; *parg; parg = &TREE_CHAIN (*parg)) - { - tree new_tree = remap_decl (*parg, id); - lang_hooks.dup_lang_specific_decl (new_tree); - TREE_CHAIN (new_tree) = TREE_CHAIN (*parg); - *parg = new_tree; - } - return orig_parm; + parg = &new_parm; + + for (arg = orig_parm; arg; arg = TREE_CHAIN (arg), i++) + if (!args_to_skip || !bitmap_bit_p (args_to_skip, i)) + { + tree new_tree = remap_decl (arg, id); + lang_hooks.dup_lang_specific_decl (new_tree); + *parg = new_tree; + parg = &TREE_CHAIN (new_tree); + } + else + { + /* Make an equivalent VAR_DECL. If the argument was used + as temporary variable later in function, the uses will be + replaced by local variable. */ + tree var = copy_decl_to_var (arg, id); + get_var_ann (var); + add_referenced_var (var); + insert_decl_map (id, arg, var); + /* Declare this new variable. */ + TREE_CHAIN (var) = *vars; + *vars = var; + } + return new_parm; } /* Return a copy of the function's static chain. */ @@ -4146,7 +4164,7 @@ tree_versionable_function_p (tree fndecl) of edges of clones of the function will be updated. */ void tree_function_versioning (tree old_decl, tree new_decl, varray_type tree_map, - bool update_clones) + bool update_clones, bitmap args_to_skip) { struct cgraph_node *old_version_node; struct cgraph_node *new_version_node; @@ -4214,7 +4232,8 @@ tree_function_versioning (tree old_decl, tree new_decl, varray_type tree_map, /* Copy the function's arguments. */ if (DECL_ARGUMENTS (old_decl) != NULL_TREE) DECL_ARGUMENTS (new_decl) = - copy_arguments_for_versioning (DECL_ARGUMENTS (old_decl), &id); + copy_arguments_for_versioning (DECL_ARGUMENTS (old_decl), &id, + args_to_skip, &vars); DECL_INITIAL (new_decl) = remap_blocks (DECL_INITIAL (id.src_fn), &id); |