aboutsummaryrefslogtreecommitdiff
path: root/gcc/symtab.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2014-07-01 08:45:26 +0200
committerMartin Liska <marxin@gcc.gnu.org>2014-07-01 06:45:26 +0000
commite55637b71514b1f2106980ff1e8951d5d072f9c4 (patch)
treeaffefec9f6097f6b283af2e7be5845ea0dd4ba45 /gcc/symtab.c
parent705c7d57092b46dc4ea6bba7e60823f828250488 (diff)
downloadgcc-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/symtab.c')
-rw-r--r--gcc/symtab.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/gcc/symtab.c b/gcc/symtab.c
index 89591ee..80ea94a 100644
--- a/gcc/symtab.c
+++ b/gcc/symtab.c
@@ -558,8 +558,22 @@ symtab_node::add_reference (symtab_node *referred_node,
ref = &list->references->last ();
list2 = &referred_node->ref_list;
- list2->referring.safe_push (ref);
- ref->referred_index = list2->referring.length () - 1;
+
+ /* IPA_REF_ALIAS is always inserted at the beginning of the list. */
+ if(use_type == IPA_REF_ALIAS)
+ {
+ list2->referring.safe_insert (0, ref);
+ ref->referred_index = 0;
+
+ for (unsigned int i = 1; i < list2->referring.length (); i++)
+ list2->referring[i]->referred_index = i;
+ }
+ else
+ {
+ list2->referring.safe_push (ref);
+ ref->referred_index = list2->referring.length () - 1;
+ }
+
ref->referring = this;
ref->referred = referred_node;
ref->stmt = stmt;
@@ -796,6 +810,20 @@ symtab_node::iterate_referring (unsigned i, struct ipa_ref *&ref)
return ref;
}
+/* Iterates I-th referring alias item in the list, REF is also set. */
+
+struct ipa_ref *
+symtab_node::iterate_direct_aliases (unsigned i, struct ipa_ref *&ref)
+{
+ ref_list.referring.iterate (i, &ref);
+
+ if (ref && ref->use != IPA_REF_ALIAS)
+ return NULL;
+
+ return ref;
+}
+
+
static const char * const symtab_type_names[] = {"symbol", "function", "variable"};
/* Dump base fields of symtab nodes. Not to be used directly. */