summaryrefslogtreecommitdiff
path: root/gcc/ipa-inline.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/ipa-inline.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/ipa-inline.c')
-rw-r--r--gcc/ipa-inline.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index 81030f3a01a..c4095ec9b4f 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -1119,8 +1119,7 @@ reset_edge_caches (struct cgraph_node *node)
struct cgraph_edge *edge;
struct cgraph_edge *e = node->callees;
struct cgraph_node *where = node;
- int i;
- struct ipa_ref *ref = NULL;
+ struct ipa_ref *ref;
if (where->global.inlined_to)
where = where->global.inlined_to;
@@ -1131,9 +1130,9 @@ reset_edge_caches (struct cgraph_node *node)
for (edge = where->callers; edge; edge = edge->next_caller)
if (edge->inline_failed)
reset_edge_growth_cache (edge);
- for (i = 0; where->iterate_referring (i, ref); i++)
- if (ref->use == IPA_REF_ALIAS)
- reset_edge_caches (dyn_cast <cgraph_node *> (ref->referring));
+
+ FOR_EACH_ALIAS (where, ref)
+ reset_edge_caches (dyn_cast <cgraph_node *> (ref->referring));
if (!e)
return;
@@ -1172,8 +1171,7 @@ update_caller_keys (fibheap_t heap, struct cgraph_node *node,
struct cgraph_edge *check_inlinablity_for)
{
struct cgraph_edge *edge;
- int i;
- struct ipa_ref *ref = NULL;
+ struct ipa_ref *ref;
if ((!node->alias && !inline_summary (node)->inlinable)
|| node->global.inlined_to)
@@ -1181,12 +1179,11 @@ update_caller_keys (fibheap_t heap, struct cgraph_node *node,
if (!bitmap_set_bit (updated_nodes, node->uid))
return;
- 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);
- update_caller_keys (heap, alias, updated_nodes, check_inlinablity_for);
- }
+ FOR_EACH_ALIAS (node, ref)
+ {
+ struct cgraph_node *alias = dyn_cast <cgraph_node *> (ref->referring);
+ update_caller_keys (heap, alias, updated_nodes, check_inlinablity_for);
+ }
for (edge = node->callers; edge; edge = edge->next_caller)
if (edge->inline_failed)