aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraph.c
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2013-11-13 16:34:47 +0100
committerMartin Jambor <jamborm@gcc.gnu.org>2013-11-13 16:34:47 +0100
commit6f99e449dbb48a9d7fe2f878cbc836a237acf810 (patch)
tree6edf9591cd759ae47f7a8a497c6ddf24374e6477 /gcc/cgraph.c
parent0f365c102f3ae1b5025c0893074ed4a94d3ee295 (diff)
downloadgcc-6f99e449dbb48a9d7fe2f878cbc836a237acf810.zip
gcc-6f99e449dbb48a9d7fe2f878cbc836a237acf810.tar.gz
gcc-6f99e449dbb48a9d7fe2f878cbc836a237acf810.tar.bz2
cgraph.c (cgraph_get_create_node): Do what cgraph_get_create_real_symbol_node used to do.
2013-11-13 Martin Jambor <mjambor@suse.cz> * cgraph.c (cgraph_get_create_node): Do what cgraph_get_create_real_symbol_node used to do. (cgraph_get_create_real_symbol_node): Removed. Changed all users to call cgraph_get_create_node. * cgraph.h (cgraph_get_create_real_symbol_node): Removed. * lto-streamer-in.c (input_function): Call cgraph_get_node instead of cgraph_get_create_node. Assert we get a node. From-SVN: r204748
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r--gcc/cgraph.c74
1 files changed, 22 insertions, 52 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 385b11d..b7ec166 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -540,19 +540,34 @@ cgraph_create_node (tree decl)
return node;
}
-/* Try to find a call graph node for declaration DECL and if it does not exist,
- create it. */
+/* Try to find a call graph node for declaration DECL and if it does not exist
+ or if it corresponds to an inline clone, create a new one. */
struct cgraph_node *
cgraph_get_create_node (tree decl)
{
- struct cgraph_node *node;
+ struct cgraph_node *first_clone = cgraph_get_node (decl);
- node = cgraph_get_node (decl);
- if (node)
- return node;
+ if (first_clone && !first_clone->global.inlined_to)
+ return first_clone;
- return cgraph_create_node (decl);
+ struct cgraph_node *node = cgraph_create_node (decl);
+ if (first_clone)
+ {
+ first_clone->clone_of = node;
+ node->clones = first_clone;
+ symtab_prevail_in_asm_name_hash (node);
+ symtab_insert_node_to_hashtable (node);
+ if (dump_file)
+ fprintf (dump_file, "Introduced new external node "
+ "(%s/%i) and turned into root of the clone tree.\n",
+ xstrdup (cgraph_node_name (node)), node->order);
+ }
+ else if (dump_file)
+ fprintf (dump_file, "Introduced new external node "
+ "(%s/%i).\n", xstrdup (cgraph_node_name (node)),
+ node->order);
+ return node;
}
/* Mark ALIAS as an alias to DECL. DECL_NODE is cgraph node representing
@@ -2890,51 +2905,6 @@ verify_cgraph (void)
verify_cgraph_node (node);
}
-/* Create external decl node for DECL.
- The difference i nbetween cgraph_get_create_node and
- cgraph_get_create_real_symbol_node is that cgraph_get_create_node
- may return inline clone, while cgraph_get_create_real_symbol_node
- will create a new node in this case.
- FIXME: This function should be removed once clones are put out of decl
- hash. */
-
-struct cgraph_node *
-cgraph_get_create_real_symbol_node (tree decl)
-{
- struct cgraph_node *first_clone = cgraph_get_node (decl);
- struct cgraph_node *node;
- /* create symbol table node. even if inline clone exists, we can not take
- it as a target of non-inlined call. */
- node = cgraph_get_node (decl);
- if (node && !node->global.inlined_to)
- return node;
-
- node = cgraph_create_node (decl);
-
- /* ok, we previously inlined the function, then removed the offline copy and
- now we want it back for external call. this can happen when devirtualizing
- while inlining function called once that happens after extern inlined and
- virtuals are already removed. in this case introduce the external node
- and make it available for call. */
- if (first_clone)
- {
- first_clone->clone_of = node;
- node->clones = first_clone;
- symtab_prevail_in_asm_name_hash (node);
- symtab_insert_node_to_hashtable (node);
- if (dump_file)
- fprintf (dump_file, "Introduced new external node "
- "(%s/%i) and turned into root of the clone tree.\n",
- xstrdup (cgraph_node_name (node)), node->order);
- }
- else if (dump_file)
- fprintf (dump_file, "Introduced new external node "
- "(%s/%i).\n", xstrdup (cgraph_node_name (node)),
- node->order);
- return node;
-}
-
-
/* Given NODE, walk the alias chain to return the function NODE is alias of.
Walk through thunk, too.
When AVAILABILITY is non-NULL, get minimal availability in the chain. */