diff options
author | Jan Hubicka <jh@suse.cz> | 2010-05-29 09:31:11 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2010-05-29 07:31:11 +0000 |
commit | 036546e58ac96338a9167fb1b239670fdca99ab3 (patch) | |
tree | 2bccbc03becb82b7caf9f75dcea83ae37194f46b /gcc/cgraph.c | |
parent | 6c6081113be59aa5fa6cc20c3978c7661ff43696 (diff) | |
download | gcc-036546e58ac96338a9167fb1b239670fdca99ab3.zip gcc-036546e58ac96338a9167fb1b239670fdca99ab3.tar.gz gcc-036546e58ac96338a9167fb1b239670fdca99ab3.tar.bz2 |
cgraph.c (clone_function_name): Take SUFFIX argument; export.
* cgraph.c (clone_function_name): Take SUFFIX argument; export.
(cgraph_create_virtual_clone): Take SUFFIX argument; udpate
use of clone_function_name.
* cgraph.h (cgraph_create_virtual_clone,
cgraph_function_versioning): update prototypes.
(clone_function_name): Declare.
* ipa-cp.c (ipcp_insert_stage): Update call of
cgraph_create_virtual_clone.
* omp-low.c (create_omp_child_function_name): Use
cgraph_create_virtual_clone.
* cgraphunit.c (cgraph_copy_node_for_versioning): Fix edges updating.
(cgraph_function_versioning): Take SUFFIX argument; produce new name
and make decl local.
* gcc.dg/tree-ssa/ipa-cp-1.c: Update testcase.
From-SVN: r160016
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r-- | gcc/cgraph.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 7bfb9bc..04ff9c9 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -2143,24 +2143,26 @@ cgraph_clone_node (struct cgraph_node *n, tree decl, gcov_type count, int freq, return new_node; } -/* Create a new name for omp child function. Returns an identifier. */ +/* Create a new name for clone of DECL, add SUFFIX. Returns an identifier. */ static GTY(()) unsigned int clone_fn_id_num; -static tree -clone_function_name (tree decl) +tree +clone_function_name (tree decl, const char *suffix) { tree name = DECL_ASSEMBLER_NAME (decl); size_t len = IDENTIFIER_LENGTH (name); char *tmp_name, *prefix; - prefix = XALLOCAVEC (char, len + strlen ("_clone") + 1); + prefix = XALLOCAVEC (char, len + strlen (suffix) + 2); memcpy (prefix, IDENTIFIER_POINTER (name), len); - strcpy (prefix + len, "_clone"); + strcpy (prefix + len + 1, suffix); #ifndef NO_DOT_IN_LABEL prefix[len] = '.'; #elif !defined NO_DOLLAR_IN_LABEL prefix[len] = '$'; +#else + prefix[len] = '_'; #endif ASM_FORMAT_PRIVATE_NAME (tmp_name, prefix, clone_fn_id_num++); return get_identifier (tmp_name); @@ -2176,7 +2178,8 @@ struct cgraph_node * cgraph_create_virtual_clone (struct cgraph_node *old_node, VEC(cgraph_edge_p,heap) *redirect_callers, VEC(ipa_replace_map_p,gc) *tree_map, - bitmap args_to_skip) + bitmap args_to_skip, + const char * suffix) { tree old_decl = old_node->decl; struct cgraph_node *new_node = NULL; @@ -2197,7 +2200,7 @@ cgraph_create_virtual_clone (struct cgraph_node *old_node, DECL_STRUCT_FUNCTION (new_decl) = NULL; /* Generate a new name for the new version. */ - DECL_NAME (new_decl) = clone_function_name (old_decl); + DECL_NAME (new_decl) = clone_function_name (old_decl, suffix); SET_DECL_ASSEMBLER_NAME (new_decl, DECL_NAME (new_decl)); SET_DECL_RTL (new_decl, NULL); |