aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2014-05-25 00:00:14 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2014-05-24 22:00:14 +0000
commitaede2c10ca855d3b00020caf846aae6d9d378ebe (patch)
tree12ca2f5d9d68edce3aad0e13eb2c2fb693d94c86 /gcc/ipa.c
parentf3de79d43a924e3984ab3299ac7a38f5a4aabdf5 (diff)
downloadgcc-aede2c10ca855d3b00020caf846aae6d9d378ebe.zip
gcc-aede2c10ca855d3b00020caf846aae6d9d378ebe.tar.gz
gcc-aede2c10ca855d3b00020caf846aae6d9d378ebe.tar.bz2
tree-core.h (tree_decl_with_vis): Replace comdat_group by symtab_node pointer.
* tree-core.h (tree_decl_with_vis): Replace comdat_group by symtab_node pointer. * tree.c (copy_node_stat): Be sure tonot copy symtab_node pointer. (find_decls_types_r): Do not walk COMDAT_GROUP. * tree.h (DECL_COMDAT_GROUP): Revamp to use decl_comdat_group. * varasm.c (make_decl_one_only): Use set_comdat_group; create node if needed. * ipa-inline-transform.c (save_inline_function_body): Update way we decl->symtab mapping. * symtab.c (symtab_hash, hash_node, eq_node symtab_insert_node_to_hashtable): Remove. (symtab_register_node): Update. (symtab_unregister_node): Update. (symtab_get_node): Reimplement as inline function. (symtab_add_to_same_comdat_group): Update. (symtab_dissolve_same_comdat_group_list): Update. (dump_symtab_base): Update. (verify_symtab_base): Update. (symtab_make_decl_local): Update. (fixup_same_cpp_alias_visibility): Update. (symtab_nonoverwritable_alias): Update. * cgraphclones.c (set_new_clone_decl_and_node_flags): Update. * ipa.c (update_visibility_by_resolution_info): UPdate. * bb-reorder.c: Include cgraph.h * lto-streamer-out.c (DFS_write_tree_body, hash_tree): Do not deal with comdat groups. * ipa-comdats.c (set_comdat_group, ipa_comdats): Update. * cgraph.c (cgraph_get_create_node): Update. * cgraph.h (struct symtab_node): Add get_comdat_group, set_comdat_group and comdat_group_. (symtab_get_node): Make inline. (symtab_insert_node_to_hashtable): Remove. (symtab_can_be_discarded): Update. (decl_comdat_group): New function. * tree-streamer-in.c (lto_input_ts_decl_with_vis_tree_pointers): Update. * lto-cgraph.c (lto_output_node, lto_output_varpool_node): Stream out comdat group name. (read_comdat_group): New function. (input_node, input_varpool_node): Use it. * trans-mem.c (ipa_tm_create_version_alias): Update code creating comdat groups. * mips.c (mips_start_unique_function): Likewise. (ix86_code_end): Likewise. (rs6000_code_end): Likweise. * tree-streamer-out.c (DECL_COMDAT_GROUP): Do not stream comdat group. * lto-symtab.c (lto_symtab_merge_symbols): Update code setting symtab pointer. * lto.c (compare_tree_sccs_1): Do not compare comdat groups. * optmize.c (maybe_thunk_body): Use set_comdat_group. (maybe_clone_body): Likewise. * decl.c (duplicate_decls): Update code duplicating comdat group; do not copy symtab pointer; before freeing newdecl remove it from symtab. * decl2.c (constrain_visibility): Use set_comdat_group. * c-decl.c (merge_decls): Preserve symtab node pointers. (duplicate_decls): Free new decl. From-SVN: r210901
Diffstat (limited to 'gcc/ipa.c')
-rw-r--r--gcc/ipa.c35
1 files changed, 28 insertions, 7 deletions
diff --git a/gcc/ipa.c b/gcc/ipa.c
index d0beefe..b0cc6d5 100644
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -1021,13 +1021,13 @@ update_visibility_by_resolution_info (symtab_node * node)
for (symtab_node *next = node->same_comdat_group;
next != node; next = next->same_comdat_group)
{
- DECL_COMDAT_GROUP (next->decl) = NULL;
+ next->set_comdat_group (NULL);
DECL_WEAK (next->decl) = false;
if (next->externally_visible
&& !define)
DECL_EXTERNAL (next->decl) = true;
}
- DECL_COMDAT_GROUP (node->decl) = NULL;
+ node->set_comdat_group (NULL);
DECL_WEAK (node->decl) = false;
if (!define)
DECL_EXTERNAL (node->decl) = true;
@@ -1135,11 +1135,12 @@ function_and_variable_visibility (bool whole_program)
next != node;
next = next->same_comdat_group)
{
+ next->set_comdat_group (NULL);
symtab_make_decl_local (next->decl);
next->unique_name = ((next->resolution == LDPR_PREVAILING_DEF_IRONLY
|| next->unique_name
|| next->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP)
- && TREE_PUBLIC (next->decl));
+ && TREE_PUBLIC (next->decl));
}
/* cgraph_externally_visible_p has already checked all other nodes
in the group and they will all be made local. We need to
@@ -1147,6 +1148,8 @@ function_and_variable_visibility (bool whole_program)
segfault though. */
symtab_dissolve_same_comdat_group_list (node);
}
+ if (TREE_PUBLIC (node->decl))
+ node->set_comdat_group (NULL);
symtab_make_decl_local (node->decl);
}
@@ -1163,8 +1166,7 @@ function_and_variable_visibility (bool whole_program)
{
gcc_checking_assert (DECL_COMDAT (node->decl)
== DECL_COMDAT (decl_node->decl));
- gcc_checking_assert (DECL_COMDAT_GROUP (node->decl)
- == DECL_COMDAT_GROUP (decl_node->decl));
+ gcc_checking_assert (symtab_in_same_comdat_p (node, decl_node));
gcc_checking_assert (node->same_comdat_group);
}
node->forced_by_abi = decl_node->forced_by_abi;
@@ -1254,9 +1256,28 @@ function_and_variable_visibility (bool whole_program)
vnode->unique_name = ((vnode->resolution == LDPR_PREVAILING_DEF_IRONLY
|| vnode->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP)
&& TREE_PUBLIC (vnode->decl));
+ if (vnode->same_comdat_group && TREE_PUBLIC (vnode->decl))
+ {
+ symtab_node *next = vnode;
+
+ /* Set all members of comdat group local. */
+ if (vnode->same_comdat_group)
+ for (next = vnode->same_comdat_group;
+ next != vnode;
+ next = next->same_comdat_group)
+ {
+ next->set_comdat_group (NULL);
+ symtab_make_decl_local (next->decl);
+ next->unique_name = ((next->resolution == LDPR_PREVAILING_DEF_IRONLY
+ || next->unique_name
+ || next->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP)
+ && TREE_PUBLIC (next->decl));
+ }
+ symtab_dissolve_same_comdat_group_list (vnode);
+ }
+ if (TREE_PUBLIC (vnode->decl))
+ vnode->set_comdat_group (NULL);
symtab_make_decl_local (vnode->decl);
- if (vnode->same_comdat_group)
- symtab_dissolve_same_comdat_group_list (vnode);
vnode->resolution = LDPR_PREVAILING_DEF_IRONLY;
}
update_visibility_by_resolution_info (vnode);