diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-05-24 22:00:14 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-05-24 22:00:14 +0000 |
commit | 8c0163928b8ac73298dc1ef3aca43e8921780832 (patch) | |
tree | 12ca2f5d9d68edce3aad0e13eb2c2fb693d94c86 /gcc/lto-cgraph.c | |
parent | 5f70fed563a6de012a39846859192ba2e40ba5c8 (diff) | |
download | gcc-8c0163928b8ac73298dc1ef3aca43e8921780832.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@210901 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/lto-cgraph.c')
-rw-r--r-- | gcc/lto-cgraph.c | 99 |
1 files changed, 79 insertions, 20 deletions
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c index 2329d1a6be5..4f8d5b701ff 100644 --- a/gcc/lto-cgraph.c +++ b/gcc/lto-cgraph.c @@ -395,6 +395,8 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node, ipa_opt_pass_d *pass; int i; bool alias_p; + const char *comdat; + tree group; boundary_p = !lto_symtab_encoder_in_partition_p (encoder, node); @@ -478,15 +480,24 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node, streamer_write_hwi_stream (ob->main_stream, ref); } - if (node->same_comdat_group && !boundary_p) + group = node->get_comdat_group (); + if (group) + comdat = IDENTIFIER_POINTER (group); + else + comdat = ""; + lto_output_data_stream (ob->main_stream, comdat, strlen (comdat) + 1); + if (group) { - ref = lto_symtab_encoder_lookup (encoder, - node->same_comdat_group); - gcc_assert (ref != LCC_NOT_FOUND); + if (node->same_comdat_group && !boundary_p) + { + ref = lto_symtab_encoder_lookup (encoder, + node->same_comdat_group); + gcc_assert (ref != LCC_NOT_FOUND); + } + else + ref = LCC_NOT_FOUND; + streamer_write_hwi_stream (ob->main_stream, ref); } - else - ref = LCC_NOT_FOUND; - streamer_write_hwi_stream (ob->main_stream, ref); streamer_write_hwi_stream (ob->main_stream, node->tp_first_run); @@ -551,6 +562,8 @@ lto_output_varpool_node (struct lto_simple_output_block *ob, varpool_node *node, struct bitpack_d bp; int ref; bool alias_p; + const char *comdat; + tree group; streamer_write_enum (ob->main_stream, LTO_symtab_tags, LTO_symtab_last_tag, LTO_symtab_variable); @@ -587,15 +600,24 @@ lto_output_varpool_node (struct lto_simple_output_block *ob, varpool_node *node, /* in_other_partition. */ } streamer_write_bitpack (&bp); - if (node->same_comdat_group && !boundary_p) + group = node->get_comdat_group (); + if (group) + comdat = IDENTIFIER_POINTER (group); + else + comdat = ""; + lto_output_data_stream (ob->main_stream, comdat, strlen (comdat) + 1); + if (group) { - ref = lto_symtab_encoder_lookup (encoder, - node->same_comdat_group); - gcc_assert (ref != LCC_NOT_FOUND); + if (node->same_comdat_group && !boundary_p) + { + ref = lto_symtab_encoder_lookup (encoder, + node->same_comdat_group); + gcc_assert (ref != LCC_NOT_FOUND); + } + else + ref = LCC_NOT_FOUND; + streamer_write_hwi_stream (ob->main_stream, ref); } - else - ref = LCC_NOT_FOUND; - streamer_write_hwi_stream (ob->main_stream, ref); streamer_write_enum (ob->main_stream, ld_plugin_symbol_resolution, LDPR_NUM_KNOWN, node->resolution); } @@ -946,6 +968,26 @@ output_symtab (void) output_refs (encoder); } +/* Return COMDAT_GROUP encoded in IB as a plain string. */ + +static tree +read_comdat_group (struct lto_input_block *ib) +{ + unsigned int len = strnlen (ib->data + ib->p, ib->len - ib->p - 1); + tree group; + + if (ib->data[ib->p + len]) + lto_section_overrun (ib); + if (!len) + { + ib->p++; + return NULL; + } + group = get_identifier (ib->data + ib->p); + ib->p += len + 1; + return group; +} + /* Overwrite the information in NODE based on FILE_DATA, TAG, FLAGS, STACK_SIZE, SELF_TIME and SELF_SIZE. This is called either to initialize NODE or to replace the values in it, for instance because the first @@ -1034,6 +1076,7 @@ input_node (struct lto_file_decl_data *file_data, int clone_ref; int order; int i, count; + tree group; order = streamer_read_hwi (ib) + order_base; clone_ref = streamer_read_hwi (ib); @@ -1079,7 +1122,9 @@ input_node (struct lto_file_decl_data *file_data, if (tag == LTO_symtab_analyzed_node) ref = streamer_read_hwi (ib); - ref2 = streamer_read_hwi (ib); + group = read_comdat_group (ib); + if (group) + ref2 = streamer_read_hwi (ib); /* Make sure that we have not read this node before. Nodes that have already been read will have their tag stored in the 'aux' @@ -1098,8 +1143,14 @@ input_node (struct lto_file_decl_data *file_data, /* Store a reference for now, and fix up later to be a pointer. */ node->global.inlined_to = (cgraph_node_ptr) (intptr_t) ref; - /* Store a reference for now, and fix up later to be a pointer. */ - node->same_comdat_group = (symtab_node *) (intptr_t) ref2; + if (group) + { + node->set_comdat_group (group); + /* Store a reference for now, and fix up later to be a pointer. */ + node->same_comdat_group = (symtab_node *) (intptr_t) ref2; + } + else + node->same_comdat_group = (symtab_node *) (intptr_t) LCC_NOT_FOUND; if (node->thunk.thunk_p) { @@ -1131,6 +1182,7 @@ input_varpool_node (struct lto_file_decl_data *file_data, struct bitpack_d bp; int ref = LCC_NOT_FOUND; int order; + tree group; order = streamer_read_hwi (ib) + order_base; decl_index = streamer_read_uhwi (ib); @@ -1168,9 +1220,16 @@ input_varpool_node (struct lto_file_decl_data *file_data, } if (node->alias && !node->analyzed && node->weakref) node->alias_target = get_alias_symbol (node->decl); - ref = streamer_read_hwi (ib); - /* Store a reference for now, and fix up later to be a pointer. */ - node->same_comdat_group = (symtab_node *) (intptr_t) ref; + group = read_comdat_group (ib); + if (group) + { + node->set_comdat_group (group); + ref = streamer_read_hwi (ib); + /* Store a reference for now, and fix up later to be a pointer. */ + node->same_comdat_group = (symtab_node *) (intptr_t) ref; + } + else + node->same_comdat_group = (symtab_node *) (intptr_t) LCC_NOT_FOUND; node->resolution = streamer_read_enum (ib, ld_plugin_symbol_resolution, LDPR_NUM_KNOWN); gcc_assert (flag_ltrans |