diff options
author | Martin Liska <mliska@suse.cz> | 2014-07-01 08:45:26 +0200 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2014-07-01 06:45:26 +0000 |
commit | e55637b71514b1f2106980ff1e8951d5d072f9c4 (patch) | |
tree | affefec9f6097f6b283af2e7be5845ea0dd4ba45 /gcc/varpool.c | |
parent | 705c7d57092b46dc4ea6bba7e60823f828250488 (diff) | |
download | gcc-e55637b71514b1f2106980ff1e8951d5d072f9c4.zip gcc-e55637b71514b1f2106980ff1e8951d5d072f9c4.tar.gz gcc-e55637b71514b1f2106980ff1e8951d5d072f9c4.tar.bz2 |
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.
From-SVN: r212191
Diffstat (limited to 'gcc/varpool.c')
-rw-r--r-- | gcc/varpool.c | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/gcc/varpool.c b/gcc/varpool.c index 04ac870..79f07bf 100644 --- a/gcc/varpool.c +++ b/gcc/varpool.c @@ -424,17 +424,15 @@ varpool_analyze_node (varpool_node *node) static void assemble_aliases (varpool_node *node) { - int i; - struct ipa_ref *ref = NULL; + struct ipa_ref *ref; - for (i = 0; node->iterate_referring (i, ref); i++) - if (ref->use == IPA_REF_ALIAS) - { - varpool_node *alias = dyn_cast <varpool_node *> (ref->referring); - do_assemble_alias (alias->decl, - DECL_ASSEMBLER_NAME (node->decl)); - assemble_aliases (alias); - } + FOR_EACH_ALIAS (node, ref) + { + varpool_node *alias = dyn_cast <varpool_node *> (ref->referring); + do_assemble_alias (alias->decl, + DECL_ASSEMBLER_NAME (node->decl)); + assemble_aliases (alias); + } } /* Output one variable, if necessary. Return whether we output it. */ @@ -694,20 +692,19 @@ varpool_for_node_and_aliases (varpool_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) - { - varpool_node *alias = dyn_cast <varpool_node *> (ref->referring); - if (include_overwritable - || cgraph_variable_initializer_availability (alias) > AVAIL_OVERWRITABLE) - if (varpool_for_node_and_aliases (alias, callback, data, - include_overwritable)) - return true; - } + + FOR_EACH_ALIAS (node, ref) + { + varpool_node *alias = dyn_cast <varpool_node *> (ref->referring); + if (include_overwritable + || cgraph_variable_initializer_availability (alias) > AVAIL_OVERWRITABLE) + if (varpool_for_node_and_aliases (alias, callback, data, + include_overwritable)) + return true; + } return false; } |