aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraph.h
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2011-06-18 10:31:03 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2011-06-18 08:31:03 +0000
commitcd35bcf7e8fa8fb1f11e8a45fd1012ca6461e278 (patch)
treed841d5d2b4ed36e1175fc28ca05d5529968c1c38 /gcc/cgraph.h
parentd3ff9ee4686ea27a0df76224c790c67284889f57 (diff)
downloadgcc-cd35bcf7e8fa8fb1f11e8a45fd1012ca6461e278.zip
gcc-cd35bcf7e8fa8fb1f11e8a45fd1012ca6461e278.tar.gz
gcc-cd35bcf7e8fa8fb1f11e8a45fd1012ca6461e278.tar.bz2
lto-symtab.c (lto_varpool_replace_node): Remove code handling extra name aliases.
* lto-symtab.c (lto_varpool_replace_node): Remove code handling extra name aliases. (lto_symtab_resolve_can_prevail_p): Likewise. (lto_symtab_merge_cgraph_nodes): Update alias_of pointers. * cgraphbuild.c (record_reference): Remove extra body alias code. (mark_load): Likewise. (mark_store): Likewise. * cgraph.h (varpool_node): Remove extra_name filed; add alias_of and extraname_alias. (varpool_create_variable_alias, varpool_for_node_and_aliases): Declare. (varpool_alias_aliased_node): New inline function. (varpool_variable_node): New function. * cgraphunit.c (handle_alias_pairs): Handle also variable aliases. * ipa-ref.c (ipa_record_reference): Allow aliases on variables. * lto-cgraph.c (lto_output_varpool_node): Update streaming. (input_varpool_node): Likewise. * lto-streamer-out.c (produce_symtab): Remove extra name aliases. (varpool_externally_visible_p): Remove extra body alias code. (function_and_variable_visibility): Likewise. * tree-ssa-structalias.c (associate_varinfo_to_alias_1): New function. (ipa_pta_execute): Use it. * varpool.c (varpool_remove_node): Remove extra name alias code. (varpool_mark_needed_node): Likewise. (varpool_analyze_pending_decls): Analyze aliases. (assemble_aliases): New functoin. (varpool_assemble_decl): Use it. (varpool_create_variable_alias): New function. (varpool_extra_name_alias): Rewrite. (varpool_for_node_and_aliases): New function. From-SVN: r175167
Diffstat (limited to 'gcc/cgraph.h')
-rw-r--r--gcc/cgraph.h52
1 files changed, 49 insertions, 3 deletions
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index feb742d..dd08feb 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -380,13 +380,12 @@ DEF_VEC_ALLOC_P(cgraph_edge_p,heap);
struct GTY((chain_next ("%h.next"), chain_prev ("%h.prev"))) varpool_node {
tree decl;
+ /* For aliases points to declaration DECL is alias of. */
+ tree alias_of;
/* Pointer to the next function in varpool_nodes. */
struct varpool_node *next, *prev;
/* Pointer to the next function in varpool_nodes_queue. */
struct varpool_node *next_needed, *prev_needed;
- /* For normal nodes a pointer to the first extra name alias. For alias
- nodes a pointer to the normal node. */
- struct varpool_node *extra_name;
/* Circular list of nodes in the same comdat group if non-NULL. */
struct varpool_node *same_comdat_group;
struct ipa_ref_list ref_list;
@@ -415,6 +414,7 @@ struct GTY((chain_next ("%h.next"), chain_prev ("%h.prev"))) varpool_node {
/* Set for aliases once they got through assemble_alias. Also set for
extra name aliases in varpool_extra_name_alias. */
unsigned alias : 1;
+ unsigned extra_name_alias : 1;
/* Set when variable is used from other LTRANS partition. */
unsigned used_from_other_partition : 1;
/* Set when variable is available in the other LTRANS partition.
@@ -665,9 +665,13 @@ bool varpool_analyze_pending_decls (void);
void varpool_remove_unreferenced_decls (void);
void varpool_empty_needed_queue (void);
struct varpool_node * varpool_extra_name_alias (tree, tree);
+struct varpool_node * varpool_create_variable_alias (tree, tree);
const char * varpool_node_name (struct varpool_node *node);
void varpool_reset_queue (void);
bool const_value_known_p (tree);
+bool varpool_for_node_and_aliases (struct varpool_node *,
+ bool (*) (struct varpool_node *, void *),
+ void *, bool);
/* Walk all reachable static variables. */
#define FOR_EACH_STATIC_VARIABLE(node) \
@@ -968,6 +972,20 @@ cgraph_alias_aliased_node (struct cgraph_node *n)
return NULL;
}
+/* Return node that alias N is aliasing. */
+
+static inline struct varpool_node *
+varpool_alias_aliased_node (struct varpool_node *n)
+{
+ struct ipa_ref *ref;
+
+ ipa_ref_list_reference_iterate (&n->ref_list, 0, ref);
+ gcc_checking_assert (ref->use == IPA_REF_ALIAS);
+ if (ref->refered_type == IPA_REF_CGRAPH)
+ return ipa_ref_varpool_node (ref);
+ return NULL;
+}
+
/* Given NODE, walk the alias chain to return the function NODE is alias of.
Walk through thunk, too.
When AVAILABILITY is non-NULL, get minimal availablity in the chain. */
@@ -1026,6 +1044,34 @@ cgraph_function_or_thunk_node (struct cgraph_node *node, enum availability *avai
return NULL;
}
+/* Given NODE, walk the alias chain to return the function NODE is alias of.
+ Do not walk through thunks.
+ When AVAILABILITY is non-NULL, get minimal availablity in the chain. */
+
+static inline struct varpool_node *
+varpool_variable_node (struct varpool_node *node, enum availability *availability)
+{
+ if (availability)
+ *availability = cgraph_variable_initializer_availability (node);
+ while (node)
+ {
+ if (node->alias && node->analyzed)
+ node = varpool_alias_aliased_node (node);
+ else
+ return node;
+ if (node && availability)
+ {
+ enum availability a;
+ a = cgraph_variable_initializer_availability (node);
+ if (a < *availability)
+ *availability = a;
+ }
+ }
+ if (*availability)
+ *availability = AVAIL_NOT_AVAILABLE;
+ return NULL;
+}
+
/* Return true when the edge E represents a direct recursion. */
static inline bool
cgraph_edge_recursive_p (struct cgraph_edge *e)