summaryrefslogtreecommitdiff
path: root/gcc/lto-cgraph.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2013-06-01 13:08:53 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2013-06-01 13:08:53 +0000
commit48669653091db6b1a1e1ff6fa5c2acf65fdad761 (patch)
tree227ede588b4d6d5d96381098725519f26a853909 /gcc/lto-cgraph.c
parenta47321b78ae92ae535fb3f3de0c05250c1c03068 (diff)
downloadgcc-48669653091db6b1a1e1ff6fa5c2acf65fdad761.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@199577 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/lto-cgraph.c')
-rw-r--r--gcc/lto-cgraph.c62
1 files changed, 27 insertions, 35 deletions
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index 2268f240804..6699b8aa2ff 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -377,6 +377,7 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
struct cgraph_node *clone_of;
struct ipa_opt_pass_d *pass;
int i;
+ bool alias_p;
boundary_p = !lto_symtab_encoder_in_partition_p (encoder, (symtab_node)node);
@@ -485,7 +486,8 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
defined in other unit, we may use the info on aliases to resolve
symbol1 != symbol2 type tests that we can do only for locally defined objects
otherwise. */
- bp_pack_value (&bp, node->symbol.alias && (!boundary_p || DECL_EXTERNAL (node->symbol.decl)), 1);
+ alias_p = node->symbol.alias && (!boundary_p || DECL_EXTERNAL (node->symbol.decl));
+ bp_pack_value (&bp, alias_p, 1);
bp_pack_value (&bp, node->frequency, 2);
bp_pack_value (&bp, node->only_called_at_startup, 1);
bp_pack_value (&bp, node->only_called_at_exit, 1);
@@ -504,15 +506,6 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
streamer_write_uhwi_stream (ob->main_stream, node->thunk.fixed_offset);
streamer_write_uhwi_stream (ob->main_stream, node->thunk.virtual_value);
}
- if ((node->symbol.alias || node->thunk.thunk_p)
- && (!boundary_p || (node->symbol.alias && DECL_EXTERNAL (node->symbol.decl))))
- {
- streamer_write_hwi_in_range (ob->main_stream, 0, 1,
- node->thunk.alias != NULL);
- if (node->thunk.alias != NULL)
- lto_output_fn_decl_index (ob->decl_state, ob->main_stream,
- node->thunk.alias);
- }
}
/* Output the varpool NODE to OB.
@@ -522,10 +515,10 @@ static void
lto_output_varpool_node (struct lto_simple_output_block *ob, struct varpool_node *node,
lto_symtab_encoder_t encoder)
{
- bool boundary_p = (node->symbol.definition
- && !lto_symtab_encoder_in_partition_p (encoder, (symtab_node)node));
+ bool boundary_p = !lto_symtab_encoder_in_partition_p (encoder, (symtab_node)node);
struct bitpack_d bp;
int ref;
+ bool alias_p;
streamer_write_enum (ob->main_stream, LTO_symtab_tags, LTO_symtab_last_tag,
LTO_symtab_variable);
@@ -536,8 +529,9 @@ lto_output_varpool_node (struct lto_simple_output_block *ob, struct varpool_node
bp_pack_value (&bp, node->symbol.force_output, 1);
bp_pack_value (&bp, node->symbol.unique_name, 1);
bp_pack_value (&bp, node->symbol.definition, 1);
- bp_pack_value (&bp, node->symbol.alias, 1);
- bp_pack_value (&bp, node->alias_of != NULL, 1);
+ alias_p = node->symbol.alias && (!boundary_p || DECL_EXTERNAL (node->symbol.decl));
+ bp_pack_value (&bp, alias_p, 1);
+ bp_pack_value (&bp, node->symbol.analyzed && !boundary_p, 1);
gcc_assert (node->symbol.definition || !node->symbol.analyzed);
/* Constant pool initializers can be de-unified into individual ltrans units.
FIXME: Alternatively at -Os we may want to avoid generating for them the local
@@ -554,12 +548,11 @@ lto_output_varpool_node (struct lto_simple_output_block *ob, struct varpool_node
bp_pack_value (&bp, node->symbol.definition
&& referenced_from_other_partition_p (&node->symbol.ref_list,
encoder), 1);
- bp_pack_value (&bp, boundary_p && !DECL_EXTERNAL (node->symbol.decl), 1);
+ bp_pack_value (&bp, node->symbol.analyzed
+ && boundary_p && !DECL_EXTERNAL (node->symbol.decl), 1);
/* in_other_partition. */
}
streamer_write_bitpack (&bp);
- if (node->alias_of)
- lto_output_var_decl_index (ob->decl_state, ob->main_stream, node->alias_of);
if (node->symbol.same_comdat_group && !boundary_p)
{
ref = lto_symtab_encoder_lookup (encoder,
@@ -756,7 +749,7 @@ compute_ltrans_boundary (lto_symtab_encoder_t in_encoder)
!lsei_end_p (lsei); lsei_next_variable_in_partition (&lsei))
{
struct varpool_node *vnode = lsei_varpool_node (lsei);
- gcc_assert (!vnode->symbol.alias || vnode->alias_of);
+
lto_set_symtab_encoder_in_partition (encoder, (symtab_node)vnode);
lto_set_symtab_encoder_encode_initializer (encoder, vnode);
add_references (encoder, &vnode->symbol.ref_list);
@@ -919,6 +912,17 @@ input_overwrite_node (struct lto_file_decl_data *file_data,
LDPR_NUM_KNOWN);
}
+/* Return string alias is alias of. */
+
+static tree
+get_alias_symbol (tree decl)
+{
+ tree alias = lookup_attribute ("alias", DECL_ATTRIBUTES (decl));
+ gcc_assert (lookup_attribute ("weakref", DECL_ATTRIBUTES (decl)));
+ return get_identifier (TREE_STRING_POINTER
+ (TREE_VALUE (TREE_VALUE (alias))));
+}
+
/* Read a node from input_block IB. TAG is the node's tag just read.
Return the node read or overwriten. */
@@ -1004,15 +1008,8 @@ input_node (struct lto_file_decl_data *file_data,
node->thunk.virtual_value = virtual_value;
node->thunk.virtual_offset_p = (type & 4);
}
- if (node->thunk.thunk_p || node->symbol.alias)
- {
- if (streamer_read_hwi_in_range (ib, "alias nonzero flag", 0, 1))
- {
- decl_index = streamer_read_uhwi (ib);
- node->thunk.alias = lto_file_decl_data_get_fn_decl (file_data,
- decl_index);
- }
- }
+ if (node->symbol.alias && !node->symbol.analyzed)
+ node->symbol.alias_target = get_alias_symbol (node->symbol.decl);
return node;
}
@@ -1028,7 +1025,6 @@ input_varpool_node (struct lto_file_decl_data *file_data,
struct varpool_node *node;
struct bitpack_d bp;
int ref = LCC_NOT_FOUND;
- bool non_null_aliasof;
int order;
order = streamer_read_hwi (ib) + order_base;
@@ -1046,20 +1042,16 @@ input_varpool_node (struct lto_file_decl_data *file_data,
node->symbol.unique_name = bp_unpack_value (&bp, 1);
node->symbol.definition = bp_unpack_value (&bp, 1);
node->symbol.alias = bp_unpack_value (&bp, 1);
- non_null_aliasof = bp_unpack_value (&bp, 1);
+ node->symbol.analyzed = bp_unpack_value (&bp, 1);
node->symbol.used_from_other_partition = bp_unpack_value (&bp, 1);
node->symbol.in_other_partition = bp_unpack_value (&bp, 1);
- node->symbol.analyzed = (node->symbol.definition && (!node->symbol.alias || !node->symbol.in_other_partition));
if (node->symbol.in_other_partition)
{
DECL_EXTERNAL (node->symbol.decl) = 1;
TREE_STATIC (node->symbol.decl) = 0;
}
- if (non_null_aliasof)
- {
- decl_index = streamer_read_uhwi (ib);
- node->alias_of = lto_file_decl_data_get_var_decl (file_data, decl_index);
- }
+ if (node->symbol.alias && !node->symbol.analyzed)
+ node->symbol.alias_target = get_alias_symbol (node->symbol.decl);
ref = streamer_read_hwi (ib);
/* Store a reference for now, and fix up later to be a pointer. */
node->symbol.same_comdat_group = (symtab_node) (intptr_t) ref;