aboutsummaryrefslogtreecommitdiff
path: root/gcc/varasm.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2012-04-20 14:09:11 +0000
committerJan Hubicka <jh@suse.cz>2012-04-20 14:09:11 +0000
commit6d60115797a28e7b6c384e168d930342fbe2e9a2 (patch)
tree2702c3a55f5c856b2b5eb0aafbdc79ca115c0691 /gcc/varasm.c
parent607e32decbf91c56535a472c4d80955e0a1daf1d (diff)
* lto-symtab.c (lto_cgraph_replace_node): Merge needed instead of force flags.
* cgraph.c (cgraph_add_thunk): Use mark_reachable_node. (cgraph_remove_node): Update. (cgraph_mark_needed_node): Remove. (cgraph_mark_force_output_node): New. (dump_cgraph_node): Do not dump needed flag. (cgraph_node_cannot_be_local_p_1): Update. (cgraph_can_remove_if_no_direct_calls_and_refs): Update. * cgraph.h (symtab_node_base): Add force_output flag. (cgraph_node): Remove needed flag. (varpool_node): Remove force_output flag. (cgraph_mark_needed_node): Remove. (cgraph_mark_force_output_node): New. (cgraph_only_called_directly_or_aliased_p, varpool_can_remove_if_no_refs, varpool_all_refs_explicit_p): Update. * ipa-cp.c (ipcp_generate_summary): Remove out of date assert. * cgraphunit.c (cgraph_decide_is_function_needed): rewrite. (cgraph_add_new_function); Update. (cgraph_mark_if_needed); Update. (verify_cgraph_node): Update. (cgraph_analyze_function): Alias target is reachable. (process_function_and_variable_attributes): Update: externally_visible flag makes function reachable. (cgraph_analyze_functions): Update dumping. * lto-cgraph.c (lto_output_node, lto_output_varpool_node, input_overwrite_node, input_varpool_node): Update streaming. * lto-streamer-out.c (produce_symtab): Use force_output. * ipa.c (process_references): Weakrefs must be processed. (cgraph_remove_unreachable_nodes): Likewise; update for new force_output flag. (varpool_externally_visible_p); Weakrefs are externally visible even if they are not. (function_and_variable_visibility): Update; when processing alias pair force the targets to be output. (whole_program_function_and_variable_visility): Use mark_reachable_node. * trans-mem.c (ipa_tm_mark_needed_node): Remove (ipa_tm_mark_force_output_node): New function. (ipa_tm_create_version_alias, ipa_tm_create_version): Update. * gimple-fold.c (can_refer_decl_in_current_unit_p): Be lax about aliases. * varasm.c (mark_decl_referenced): Update. (find_decl_and_mark_needed): Remove. (find_decl): New function. (weak_finish, finish_aliases_1, assemble_alias): Update; do not mark alias targets as needed. (dump_tm_clone_pairs): Update. * tree-inline.c (copy_bb): Update check. * symtab.c (dump_symtab_base): Dump force_output. * tree-ssa-structalias.c (ipa_pta_execute): Use force_output. * passes.c (execute_todo): Fix dumping. * varpool.c (decide_is_variable_needed, varpool_finalize_decl): Update. (varpool_analyze_pending_decls): Alias target is reachable. (varpool_create_variable_alias): Finalize weakrefs. * class.c (make_local_function_alias): Do not mark symbol referenced. * objc-acct.c (mark_referenced_methods); Use cgraph_mark_force_output_node. * gcc-interface/utils.c (gnat_write_global_declarations): Update for new force_output placement. * lto/lto-partition.c (partition_cgraph_node_p): Use force_output. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@186624 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r--gcc/varasm.c64
1 files changed, 17 insertions, 47 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c
index dbcb1bfb56d..d506b317154 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -2249,7 +2249,7 @@ mark_decl_referenced (tree decl)
struct cgraph_node *node = cgraph_get_create_node (decl);
if (!DECL_EXTERNAL (decl)
&& !node->local.finalized)
- cgraph_mark_needed_node (node);
+ cgraph_mark_force_output_node (node);
}
else if (TREE_CODE (decl) == VAR_DECL)
{
@@ -2257,7 +2257,7 @@ mark_decl_referenced (tree decl)
varpool_mark_needed_node (node);
/* C++ frontend use mark_decl_references to force COMDAT variables
to be output that might appear dead otherwise. */
- node->force_output = true;
+ node->symbol.force_output = true;
}
/* else do nothing - we can get various sorts of CST nodes here,
which do not need to be marked. */
@@ -5271,13 +5271,20 @@ weak_finish_1 (tree decl)
#endif
}
+/* Fiven an assembly name, find the decl it is associated with. */
+static tree
+find_decl (tree target)
+{
+ symtab_node node = symtab_node_for_asm (target);
+ if (node)
+ return node->symbol.decl;
+ return NULL_TREE;
+}
+
/* This TREE_LIST contains weakref targets. */
static GTY(()) tree weakref_targets;
-/* Forward declaration. */
-static tree find_decl_and_mark_needed (tree decl, tree target);
-
/* Emit any pending weak declarations. */
void
@@ -5303,7 +5310,7 @@ weak_finish (void)
# if defined ASM_WEAKEN_LABEL && ! defined ASM_WEAKEN_DECL
ASM_WEAKEN_LABEL (asm_out_file, IDENTIFIER_POINTER (target));
# else
- tree decl = find_decl_and_mark_needed (alias_decl, target);
+ tree decl = find_decl (target);
if (! decl)
{
@@ -5406,43 +5413,6 @@ globalize_decl (tree decl)
VEC(alias_pair,gc) *alias_pairs;
-/* Given an assembly name, find the decl it is associated with. At the
- same time, mark it needed for cgraph. */
-
-static tree
-find_decl_and_mark_needed (tree decl, tree target)
-{
- struct cgraph_node *fnode = NULL;
- struct varpool_node *vnode = NULL;
-
- if (TREE_CODE (decl) == FUNCTION_DECL)
- {
- fnode = cgraph_node_for_asm (target);
- if (fnode == NULL)
- vnode = varpool_node_for_asm (target);
- }
- else
- {
- vnode = varpool_node_for_asm (target);
- if (vnode == NULL)
- fnode = cgraph_node_for_asm (target);
- }
-
- if (fnode)
- {
- cgraph_mark_needed_node (fnode);
- return fnode->symbol.decl;
- }
- else if (vnode)
- {
- varpool_mark_needed_node (vnode);
- vnode->force_output = 1;
- return vnode->symbol.decl;
- }
- else
- return NULL_TREE;
-}
-
/* Output the assembler code for a define (equate) using ASM_OUTPUT_DEF
or ASM_OUTPUT_DEF_FROM_DECLS. The function defines the symbol whose
tree node is DECL to have the value of the tree node TARGET. */
@@ -5748,7 +5718,7 @@ finish_aliases_1 (void)
{
tree target_decl;
- target_decl = find_decl_and_mark_needed (p->decl, p->target);
+ target_decl = find_decl (p->target);
if (target_decl == NULL)
{
if (symbol_alias_set_contains (defined, p->target))
@@ -5854,7 +5824,7 @@ assemble_alias (tree decl, tree target)
/* If the target has already been emitted, we don't have to queue the
alias. This saves a tad of memory. */
if (cgraph_global_info_ready)
- target_decl = find_decl_and_mark_needed (decl, target);
+ target_decl = find_decl (target);
else
target_decl= NULL;
if (target_decl && TREE_ASM_WRITTEN (target_decl))
@@ -5960,12 +5930,12 @@ dump_tm_clone_pairs (VEC(tm_alias_pair,heap) *tm_alias_pairs)
TM_GETTMCLONE. If neither of these are true, we didn't generate
a clone, and we didn't call it indirectly... no sense keeping it
in the clone table. */
- if (!dst_n || !dst_n->needed)
+ if (!dst_n || !dst_n->analyzed)
continue;
/* This covers the case where we have optimized the original
function away, and only access the transactional clone. */
- if (!src_n || !src_n->needed)
+ if (!src_n || !src_n->analyzed)
continue;
if (!switched)