aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraph.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2013-06-01 15:08:53 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2013-06-01 13:08:53 +0000
commit40a7fe1e382e97dda78b7cff9e05bc8e17bc9216 (patch)
tree227ede588b4d6d5d96381098725519f26a853909 /gcc/cgraph.c
parent2175988161659537ed19aed873d148ed2d04ed7f (diff)
downloadgcc-40a7fe1e382e97dda78b7cff9e05bc8e17bc9216.zip
gcc-40a7fe1e382e97dda78b7cff9e05bc8e17bc9216.tar.gz
gcc-40a7fe1e382e97dda78b7cff9e05bc8e17bc9216.tar.bz2
lto-symtab.c (lto_symtab_merge_cgraph_nodes_1): Rename to ...
* lto-symtab.c (lto_symtab_merge_cgraph_nodes_1): Rename to ... (lto_symtab_merge_symbols_1): ... this one. (lto_symtab_merge_cgraph_nodes): Rename to ... (lto_symtab_merge_symbols): ... this one; simplify. * cgraph.c (same_body_aliases_done): Rename to ... (cpp_implicit_aliases_done): ... this one. (cgraph_create_function_alias): Update. (cgraph_same_body_alias): Update. (dump_cgraph_node): Remove alias dumping; simplify thunk dumping. (verify_edge_corresponds_to_fndecl): Simplify. * cgraph.h (symtab_node_base): Add cpp_implicit_alias, alias_target. (cgraph_node): Remove same_body_alias. (varpool_node): Remove alias_of and extra_name_alias. (same_body_aliases_done): Rename to .. (cpp_implicit_aliases_done): ... this one. (symtab_alias_ultimate_target): Add default parameter. (symtab_resolve_alias): New function. (fixup_same_cpp_alias_visibility): Declare. (cgraph_function_node): Add default parameter. (cgraph_node_asm_name): Likewise. (cgraph_function_or_thunk_node): Add default parameter; do not ICE when it is NULL. (varpool_variable_node): Likewise. * tree-emutls.c (create_emultls_var): Update. (ipa_lower_emutls): Update. * cgraphunit.c (cgraph_decide_is_function_needed): Update. (cgraph_reset_node): Reset alias info. (cgraph_finalize_function): Update. (fixup_same_cpp_alias_visibility): Move to symtab.c. (analyze_function): Simplify. (cgraph_process_same_body_aliases): Simplify. (analyze_functions): Fixup same body aliases. (handle_alias_pairs): Simplify. (assemble_thunk): Update. (assemble_thunks_and_aliases): Update. (output_weakrefs): Rewrite. * lto-cgraph.c (lto_output_node): Rewrite alias handling. (lto_output_varpool_node): Likewise. (compute_ltrans_boundary): Remve assert. (get_alias_symbol): New functoin. (input_node): Rewrite alias handling. (input_varpool_node): Likewise. * ipa-pure-const.c (propagate_pure_const): Fix formating. * ipa.c (process_references): Handle weakrefs correctly. (symtab_remove_unreachable_nodes): Likewise. * trans-mem.c (get_cg_data): Update. (ipa_tm_create_version_alias): Update. (ipa_tm_execute): Update. * symtab.c (dump_symtab_base): Dump aliases. (verify_symtab_base): Verify aliases. (symtab_node_availability): New function. (symtab_alias_ultimate_target): Simplify. (fixup_same_cpp_alias_visibility): Move here from cgraphunit.c; handle all the fixup cases. (symtab_resolve_alias): New function. * passes.c (ipa_write_summaries): Handle weakrefs. * varpool.c (varpool_analyze_node): Simplify. (assemble_aliases): Update. (varpool_create_variable_alias): Simplify. (varpool_extra_name_alias): Simplify. * lto-streamer.h (lto_symtab_merge_cgraph_nodes): Rename to... (lto_symtab_merge_symbols): ... this one. * decl2.c (cp_write_global_declarations): Replace same_body_alias by symbol.cpp_implicit_alias. * lto.c (read_cgraph_and_symbols): Simplify dumping; Replace lto_symtab_merge_cgraph_nodes by lto_symtab_merge_symbols. (do_whole_program_analysis): Update dumping. From-SVN: r199577
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r--gcc/cgraph.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 735f48a..445282a 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -129,7 +129,7 @@ static GTY(()) struct cgraph_node *free_nodes;
static GTY(()) struct cgraph_edge *free_edges;
/* Did procss_same_body_aliases run? */
-bool same_body_aliases_done;
+bool cpp_implicit_aliases_done;
/* Map a cgraph_node to cgraph_function_version_info using this htab.
The cgraph_function_version_info has a THIS_NODE field that is the
@@ -556,15 +556,16 @@ cgraph_get_create_node (tree decl)
the function body is associated with (not necessarily cgraph_node (DECL). */
struct cgraph_node *
-cgraph_create_function_alias (tree alias, tree decl)
+cgraph_create_function_alias (tree alias, tree target)
{
struct cgraph_node *alias_node;
- gcc_assert (TREE_CODE (decl) == FUNCTION_DECL);
+ gcc_assert (TREE_CODE (target) == FUNCTION_DECL
+ || TREE_CODE (target) == IDENTIFIER_NODE);
gcc_assert (TREE_CODE (alias) == FUNCTION_DECL);
alias_node = cgraph_get_create_node (alias);
gcc_assert (!alias_node->symbol.definition);
- alias_node->thunk.alias = decl;
+ alias_node->symbol.alias_target = target;
alias_node->symbol.definition = true;
alias_node->symbol.alias = true;
return alias_node;
@@ -589,10 +590,10 @@ cgraph_same_body_alias (struct cgraph_node *decl_node ATTRIBUTE_UNUSED, tree ali
return NULL;
n = cgraph_create_function_alias (alias, decl);
- n->same_body_alias = true;
- if (same_body_aliases_done)
- ipa_record_reference ((symtab_node)n, (symtab_node)cgraph_get_node (decl),
- IPA_REF_ALIAS, NULL);
+ n->symbol.cpp_implicit_alias = true;
+ if (cpp_implicit_aliases_done)
+ symtab_resolve_alias ((symtab_node)n,
+ (symtab_node)cgraph_get_node (decl));
return n;
}
@@ -1545,10 +1546,13 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node)
if (node->thunk.thunk_p)
{
- fprintf (f, " Thunk of %s (asm: %s) fixed offset %i virtual value %i has "
+ fprintf (f, " Thunk");
+ if (node->thunk.alias)
+ fprintf (f, " of %s (asm: %s)",
+ lang_hooks.decl_printable_name (node->thunk.alias, 2),
+ IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->thunk.alias)));
+ fprintf (f, " fixed offset %i virtual value %i has "
"virtual offset %i)\n",
- lang_hooks.decl_printable_name (node->thunk.alias, 2),
- IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->thunk.alias)),
(int)node->thunk.fixed_offset,
(int)node->thunk.virtual_value,
(int)node->thunk.virtual_offset_p);
@@ -2288,17 +2292,11 @@ verify_edge_corresponds_to_fndecl (struct cgraph_edge *e, tree decl)
return false;
node = cgraph_function_or_thunk_node (node, NULL);
- if ((e->callee->former_clone_of != node->symbol.decl
- && (!node->same_body_alias
- || e->callee->former_clone_of != node->thunk.alias))
+ if (e->callee->former_clone_of != node->symbol.decl
/* IPA-CP sometimes redirect edge to clone and then back to the former
function. This ping-pong has to go, eventually. */
&& (node != cgraph_function_or_thunk_node (e->callee, NULL))
- && !clone_of_p (node, e->callee)
- /* If decl is a same body alias of some other decl, allow e->callee to be
- a clone of a clone of that other decl too. */
- && (!node->same_body_alias
- || !clone_of_p (cgraph_get_node (node->thunk.alias), e->callee)))
+ && !clone_of_p (cgraph_function_or_thunk_node (node, NULL), e->callee))
return true;
else
return false;