aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraph.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2015-02-14 19:42:49 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2015-02-14 18:42:49 +0000
commit31de760604065cf4dae5de8828321c86b15bf3c9 (patch)
tree400f48e176f588602e37c0b5ff58c528a2855b16 /gcc/cgraph.c
parent065d214ce4129853330cb0c992b981830c950909 (diff)
downloadgcc-31de760604065cf4dae5de8828321c86b15bf3c9.zip
gcc-31de760604065cf4dae5de8828321c86b15bf3c9.tar.gz
gcc-31de760604065cf4dae5de8828321c86b15bf3c9.tar.bz2
ipa-chkp.c: Use iterate_direct_aliases.
* ipa-chkp.c: Use iterate_direct_aliases. * symtab.c (resolution_used_from_other_file_p): Move inline. (symtab_node::create_reference): Fix formating. (symtab_node::has_aliases_p): Move inline; use iterate_direct_aliases. (symtab_node::iterate_reference): Move inline. (symtab_node::iterate_referring): Move inline. (symtab_node::iterate_direct_aliases): Move inline. (symtab_node::used_from_object_file_p_worker): Inline into ... (symtab_node::used_from_object_file_p): ... this one; move inline. (symtab_node::call_for_symbol_and_aliases): Move inline; use iterate_direct_aliases. (symtab_node::call_for_symbol_and_aliases_1): New method. (cgraph_node::call_for_symbol_and_aliases): Move inline; use iterate_direct_aliases. (cgraph_node::call_for_symbol_and_aliases_1): New method. (varpool_node::call_for_node_and_aliases): Rename to ... (varpool_node::call_for_symbol_and_aliases): ... this one; Move inline; use iterate_direct_aliases. (varpool_node::call_for_symbol_and_aliases_1): New method. * ipa.c (ipa_single_use): Use iterate_direct_aliases. (ipa_discover_readonly_nonaddressable_var): Update. * ipa-devirt.c: Fix formating. * cgraph.c (cgraph_node::can_remove_if_no_direct_calls_and_refs_p): Move inline. (cgraph_node::call_for_symbol_and_aliases): Move inline. (cgraph_node::call_for_symbol_and_aliases_1): New function.. * cgraph.h (used_from_object_file_p_worker): Remove. (resolution_used_from_other_file_p): Move inline. (symtab_node::has_aliases_p): Move inline; use iterate_direct_aliases. (symtab_node::iterate_reference): Move inline. (symtab_node::iterate_referring): Move inline. (symtab_node::iterate_direct_aliases): Move inline. (symtab_node::used_from_object_file_p_worker): Inline into ... (symtab_node::used_from_object_file_p): Move inline. * tree-emutls.c (ipa_lower_emutls): Update. * varpool.c (varpool_node::call_for_symbol_and_aliases_1): New method. (varpool_node::call_for_node_and_aliases): Remove. From-SVN: r220709
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r--gcc/cgraph.c78
1 files changed, 20 insertions, 58 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index a71f68c..3548bd0 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -2215,33 +2215,6 @@ cgraph_node::call_for_symbol_thunks_and_aliases (bool (*callback)
return false;
}
-/* Call callback on function and aliases associated to the function.
- When INCLUDE_OVERWRITABLE is false, overwritable aliases and thunks are
- skipped. */
-
-bool
-cgraph_node::call_for_symbol_and_aliases (bool (*callback) (cgraph_node *,
- void *),
- void *data,
- bool include_overwritable)
-{
- ipa_ref *ref;
-
- if (callback (this, data))
- return true;
-
- FOR_EACH_ALIAS (this, ref)
- {
- cgraph_node *alias = dyn_cast <cgraph_node *> (ref->referring);
- if (include_overwritable
- || alias->get_availability () > AVAIL_INTERPOSABLE)
- if (alias->call_for_symbol_and_aliases (callback, data,
- include_overwritable))
- return true;
- }
- return false;
-}
-
/* Worker to bring NODE local. */
bool
@@ -2430,37 +2403,6 @@ cgraph_edge::maybe_hot_p (void)
return true;
}
-/* Return true when function can be removed from callgraph
- if all direct calls are eliminated. */
-
-bool
-cgraph_node::can_remove_if_no_direct_calls_and_refs_p (void)
-{
- gcc_assert (!global.inlined_to);
- /* Instrumentation clones should not be removed before
- instrumentation happens. New callers may appear after
- instrumentation. */
- if (instrumentation_clone
- && !chkp_function_instrumented_p (decl))
- return false;
- /* Extern inlines can always go, we will use the external definition. */
- if (DECL_EXTERNAL (decl))
- return true;
- /* When function is needed, we can not remove it. */
- if (force_output || used_from_other_partition)
- return false;
- if (DECL_STATIC_CONSTRUCTOR (decl)
- || DECL_STATIC_DESTRUCTOR (decl))
- return false;
- /* Only COMDAT functions can be removed if externally visible. */
- if (externally_visible
- && (!DECL_COMDAT (decl)
- || forced_by_abi
- || used_from_object_file_p ()))
- return false;
- return true;
-}
-
/* Worker for cgraph_can_remove_if_no_direct_calls_p. */
static bool
@@ -3363,4 +3305,24 @@ cgraph_c_finalize (void)
version_info_node = NULL;
}
+/* A wroker for call_for_symbol_and_aliases. */
+
+bool
+cgraph_node::call_for_symbol_and_aliases_1 (bool (*callback) (cgraph_node *,
+ void *),
+ void *data,
+ bool include_overwritable)
+{
+ ipa_ref *ref;
+ FOR_EACH_ALIAS (this, ref)
+ {
+ cgraph_node *alias = dyn_cast <cgraph_node *> (ref->referring);
+ if (include_overwritable
+ || alias->get_availability () > AVAIL_INTERPOSABLE)
+ if (alias->call_for_symbol_and_aliases (callback, data,
+ include_overwritable))
+ return true;
+ }
+ return false;
+}
#include "gt-cgraph.h"