summaryrefslogtreecommitdiff
path: root/gcc/cgraph.c
diff options
context:
space:
mode:
authormarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2014-07-01 06:45:26 +0000
committermarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2014-07-01 06:45:26 +0000
commite4a2b4883e06a14d340284e81ca33f3021067018 (patch)
treeaffefec9f6097f6b283af2e7be5845ea0dd4ba45 /gcc/cgraph.c
parent5d0f9ccd3b62e32edae1e1532e8d131737ac5637 (diff)
downloadgcc-e4a2b4883e06a14d340284e81ca33f3021067018.tar.gz
IPA REF alias refactoring
* cgraph.h (iterate_direct_aliases): New function. (FOR_EACH_ALIAS): New macro iterates all direct aliases for a node. * cgraph.c (cgraph_for_node_thunks_and_aliases): Usage of FOR_EACH_ALIAS added. (cgraph_for_node_and_aliases): Likewise. * cgraphunit.c (assemble_thunks_and_aliases): Likewise. * ipa-inline.c (reset_edge_caches): Likewise. (update_caller_keys): Likewise. * trans-mem.c (ipa_tm_execute): Likewise. *varpool.c (varpool_analyze_node): Likewise. (varpool_for_node_and_aliases): Likewise. * ipa-ref.h (first_alias): New function. (last_alias): Likewise. (has_aliases_p): Likewise. * ipa-ref.c (ipa_ref::remove_reference): Removal function is sensitive to IPA_REF_ALIASes. * symtab.c (symtab_node::add_reference): Node of IPA_REF_ALIAS type are put at the beginning of the list. (symtab_node::iterate_direct_aliases): New function. * lto-partition.c (add_symbol_to_partition_1): Usage of FOR_EACH_ALIAS added. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@212191 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r--gcc/cgraph.c46
1 files changed, 22 insertions, 24 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 43428be7bb4..41dcaf9e4a1 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -2198,8 +2198,7 @@ cgraph_for_node_thunks_and_aliases (struct cgraph_node *node,
bool include_overwritable)
{
struct cgraph_edge *e;
- int i;
- struct ipa_ref *ref = NULL;
+ struct ipa_ref *ref;
if (callback (node, data))
return true;
@@ -2210,16 +2209,16 @@ cgraph_for_node_thunks_and_aliases (struct cgraph_node *node,
if (cgraph_for_node_thunks_and_aliases (e->caller, callback, data,
include_overwritable))
return true;
- for (i = 0; node->iterate_referring (i, ref); i++)
- if (ref->use == IPA_REF_ALIAS)
- {
- struct cgraph_node *alias = dyn_cast <cgraph_node *> (ref->referring);
- if (include_overwritable
- || cgraph_function_body_availability (alias) > AVAIL_OVERWRITABLE)
- if (cgraph_for_node_thunks_and_aliases (alias, callback, data,
- include_overwritable))
- return true;
- }
+
+ FOR_EACH_ALIAS (node, ref)
+ {
+ struct cgraph_node *alias = dyn_cast <cgraph_node *> (ref->referring);
+ if (include_overwritable
+ || cgraph_function_body_availability (alias) > AVAIL_OVERWRITABLE)
+ if (cgraph_for_node_thunks_and_aliases (alias, callback, data,
+ include_overwritable))
+ return true;
+ }
return false;
}
@@ -2233,21 +2232,20 @@ cgraph_for_node_and_aliases (struct cgraph_node *node,
void *data,
bool include_overwritable)
{
- int i;
- struct ipa_ref *ref = NULL;
+ struct ipa_ref *ref;
if (callback (node, data))
return true;
- for (i = 0; node->iterate_referring (i, ref); i++)
- if (ref->use == IPA_REF_ALIAS)
- {
- struct cgraph_node *alias = dyn_cast <cgraph_node *> (ref->referring);
- if (include_overwritable
- || cgraph_function_body_availability (alias) > AVAIL_OVERWRITABLE)
- if (cgraph_for_node_and_aliases (alias, callback, data,
- include_overwritable))
- return true;
- }
+
+ FOR_EACH_ALIAS (node, ref)
+ {
+ struct cgraph_node *alias = dyn_cast <cgraph_node *> (ref->referring);
+ if (include_overwritable
+ || cgraph_function_body_availability (alias) > AVAIL_OVERWRITABLE)
+ if (cgraph_for_node_and_aliases (alias, callback, data,
+ include_overwritable))
+ return true;
+ }
return false;
}