aboutsummaryrefslogtreecommitdiff
path: root/gcc/lto-cgraph.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2011-06-11 13:01:53 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2011-06-11 13:01:53 +0000
commitc70f46b057cd12973d33c01c8fa0da5c14ba3944 (patch)
treec6e4afcefa6681889da1ab377bb53466f789c2ff /gcc/lto-cgraph.c
parente696a4cb377cdd9f8cf5c4066b8cf8e18891c923 (diff)
* lto-symtab.c (lto_cgraph_replace_node): Kill same body alias code.
(lto_symtab_resolve_can_prevail_p): Likewise. (lto_symtab_merge_cgraph_nodes): Update merging of aliases. * cgraph.c (same_body_aliases_done): New global var. (cgraph_same_body_alias_1): Rename to ... (cgraph_create_function_alias): ... this one; reorg to new representation. (cgraph_same_body_alias): Use cgraph_create_function_alias; record references when asked to. (cgraph_add_thunk): Fix formating. (cgraph_get_node): Kill same body alias code. (cgraph_node_for_asm): Likewise. (cgraph_remove_same_body_alias): Remove. (cgraph_remove_node): Kill same body alias code. (cgraph_mark_address_taken_node): Mark also the aliased function as having address taken. (dump_cgraph_node): Dump same body aliases. (cgraph_for_node_thunks_and_aliases): Update for new alias representation. (cgraph_for_node_and_aliases): Likewise. * cgraph.h (same_body): Kll pointer. (same_body_alias): Update comment. (same_body_aliases_done): Declare. (cgraph_remove_same_body_alias): Remove declaration. (cgraph_create_function_alias): Declare. (cgraph_process_same_body_aliases): Declare. (cgraph_function_with_gimple_body_p): Check for alias. (cgraph_can_remove_if_no_direct_calls_p): Look for aliases. (cgraph_alias_aliased_node): New function. (cgraph_function_node): Update for new aliases. (cgraph_function_or_thunk_node): Likewise. * ipa-inline-transform.c (can_remove_node_now_p): Look for aliases. (inline_call): Remove dead aliases. * cgraphunit.c (cgraph_decide_is_function_needed): Disable assembler name hack for same body aliases. (clone_of_p): Look through aliases. (verify_cgraph_node): Verify aliases. (cgraph_analyze_function): Analyze aliases; fixup C++ bugs. (cgraph_process_same_body_aliases): New function. (process_function_and_variable_attributes): Disable weakref warning on alias. (cgraph_analyze_functions): Handle aliases. (cgraph_mark_functions_to_output): Handle aliases same way as thunks. (assemble_thunks): Rename to ... (assemble_thunks_and_aliases): ... this one; handle aliases, too. (cgraph_expand_function): Remove alias output code. (cgraph_output_in_order): Skip aliases. (cgraph_preserve_function_body_p): Aliases don't need preserving. * ipa-ref.c (ipa_ref_use_name): Add alias reference. (ipa_record_reference): Do not assert on alias references. (ipa_ref_has_aliases_p): New function. * ipa-ref.h (enum ipa_ref_use): Add IPA_REF_ALIAS. (ipa_ref_has_aliases_p): Declare. * lto-cgraph.c (lto_output_node): Handle aliases. (input_node): Likewise. * lto-streamer-out.c (lto_output): Skip aliases. (produce_symtab): Kill same_body_alias code. * ipa-utils.c (ipa_reverse_postorder): Add FIXME. (ipa_reverse_postorder): Use cgraph_only_called_directly_or_aliased_p. * ipa-inline.c (update_caller_keys): Walk aliases. (inline_small_functions): Fix thinko in previous patch. * ipa.c (cgraph_externally_visible_p): Do not walk aliases. (function_and_variable_visibility): Do not walk same body aliases. * tree-ssa-structalias.c (associate_varinfo_to_alias): New function. (ipa_pta_execute): Use it. * lto.c (add_cgraph_node_to_partition_1): Break out from ... (add_cgraph_node_to_partition) ... here; walk aliases. (lto_1_to_1_map): Remove same body alias code. (promote_fn): Likewise. (lto_promote_cross_file_statics): Update comment. * decl2.c (cp_write_global_declarations): Process aliases; look trhough same body aliases. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@174952 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/lto-cgraph.c')
-rw-r--r--gcc/lto-cgraph.c57
1 files changed, 14 insertions, 43 deletions
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index 3b1115b53f6..169de382dbe 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -504,7 +504,7 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
|| referenced_from_other_partition_p (&node->ref_list, set, vset)), 1);
bp_pack_value (&bp, node->lowered, 1);
bp_pack_value (&bp, in_other_partition, 1);
- bp_pack_value (&bp, node->alias, 1);
+ bp_pack_value (&bp, node->alias && !boundary_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);
@@ -523,32 +523,15 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
node->thunk.fixed_offset);
lto_output_uleb128_stream (ob->main_stream,
node->thunk.virtual_value);
- lto_output_fn_decl_index (ob->decl_state, ob->main_stream,
- node->thunk.alias);
}
-
- if (node->same_body)
+ if ((node->alias || node->thunk.thunk_p) && !boundary_p)
{
- struct cgraph_node *alias;
- unsigned long alias_count = 1;
- for (alias = node->same_body; alias->next; alias = alias->next)
- alias_count++;
- lto_output_uleb128_stream (ob->main_stream, alias_count);
- do
- {
- lto_output_fn_decl_index (ob->decl_state, ob->main_stream,
- alias->decl);
- lto_output_fn_decl_index (ob->decl_state, ob->main_stream,
- alias->thunk.alias);
- gcc_assert (cgraph_get_node (alias->thunk.alias) == node);
- lto_output_enum (ob->main_stream, ld_plugin_symbol_resolution,
- LDPR_NUM_KNOWN, alias->resolution);
- alias = alias->previous;
- }
- while (alias);
+ lto_output_int_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);
}
- else
- lto_output_uleb128_stream (ob->main_stream, 0);
}
/* Output the varpool NODE to OB.
@@ -997,7 +980,6 @@ input_node (struct lto_file_decl_data *file_data,
struct bitpack_d bp;
unsigned decl_index;
int ref = LCC_NOT_FOUND, ref2 = LCC_NOT_FOUND;
- unsigned long same_body_count = 0;
int clone_ref;
clone_ref = lto_input_sleb128 (ib);
@@ -1043,31 +1025,20 @@ input_node (struct lto_file_decl_data *file_data,
int type = lto_input_uleb128 (ib);
HOST_WIDE_INT fixed_offset = lto_input_uleb128 (ib);
HOST_WIDE_INT virtual_value = lto_input_uleb128 (ib);
- tree real_alias;
- decl_index = lto_input_uleb128 (ib);
- real_alias = lto_file_decl_data_get_fn_decl (file_data, decl_index);
node->thunk.fixed_offset = fixed_offset;
node->thunk.this_adjusting = (type & 2);
node->thunk.virtual_value = virtual_value;
node->thunk.virtual_offset_p = (type & 4);
- node->thunk.alias = real_alias;
}
-
- same_body_count = lto_input_uleb128 (ib);
- while (same_body_count-- > 0)
+ if (node->thunk.thunk_p || node->alias)
{
- tree alias_decl, real_alias;
- struct cgraph_node *alias;
-
- decl_index = lto_input_uleb128 (ib);
- alias_decl = lto_file_decl_data_get_fn_decl (file_data, decl_index);
- decl_index = lto_input_uleb128 (ib);
- real_alias = lto_file_decl_data_get_fn_decl (file_data, decl_index);
- alias = cgraph_same_body_alias (node, alias_decl, real_alias);
- gcc_assert (alias);
- alias->resolution = lto_input_enum (ib, ld_plugin_symbol_resolution,
- LDPR_NUM_KNOWN);
+ if (lto_input_int_in_range (ib, "alias nonzero flag", 0, 1))
+ {
+ decl_index = lto_input_uleb128 (ib);
+ node->thunk.alias = lto_file_decl_data_get_fn_decl (file_data,
+ decl_index);
+ }
}
return node;
}