aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraphclones.c
diff options
context:
space:
mode:
authorMichael Ploujnikov <michael.ploujnikov@oracle.com>2018-11-30 22:20:43 +0000
committerMichael Ploujnikov <plouj@gcc.gnu.org>2018-11-30 22:20:43 +0000
commitb75255a9b11ae672e569966860090d70ff10ffca (patch)
tree55a027d11ff28e72cff913ce39f05def9cd7cd11 /gcc/cgraphclones.c
parentd5b5f5ad904650d992b4acc967c6dd94d1dc4f12 (diff)
downloadgcc-b75255a9b11ae672e569966860090d70ff10ffca.zip
gcc-b75255a9b11ae672e569966860090d70ff10ffca.tar.gz
gcc-b75255a9b11ae672e569966860090d70ff10ffca.tar.bz2
Make function assembly more independent.
This is achieved by having clone_function_name assign unique clone numbers for each function independently. gcc: * cgraphclones.c: Replaced clone_fn_id_num with clone_fn_ids; hash map. (clone_function_name_numbered): Use clone_fn_ids. gcc/testsuite: * gcc.dg/independent-cloneids-1.c: New test. From-SVN: r266691
Diffstat (limited to 'gcc/cgraphclones.c')
-rw-r--r--gcc/cgraphclones.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/cgraphclones.c b/gcc/cgraphclones.c
index 0fbc7a9..a45722f 100644
--- a/gcc/cgraphclones.c
+++ b/gcc/cgraphclones.c
@@ -517,7 +517,7 @@ cgraph_node::create_clone (tree new_decl, profile_count prof_count,
return new_node;
}
-static GTY(()) unsigned int clone_fn_id_num;
+static GTY(()) hash_map<const char *, unsigned> *clone_fn_ids;
/* Return a new assembler name for a clone of decl named NAME. Apart
from the string SUFFIX, the new name will end with a unique (for
@@ -529,7 +529,13 @@ static GTY(()) unsigned int clone_fn_id_num;
tree
clone_function_name_numbered (const char *name, const char *suffix)
{
- return clone_function_name (name, suffix, clone_fn_id_num++);
+ /* Initialize the function->counter mapping the first time it's
+ needed. */
+ if (!clone_fn_ids)
+ clone_fn_ids = hash_map<const char *, unsigned int>::create_ggc (64);
+ unsigned int &suffix_counter = clone_fn_ids->get_or_insert (
+ IDENTIFIER_POINTER (get_identifier (name)));
+ return clone_function_name (name, suffix, suffix_counter++);
}
/* Return a new assembler name for a clone of DECL. Apart from string