@@ -221,7 +221,7 @@ public:
/* Get number of references for this node. */
inline unsigned num_references (void)
{
- return ref_list.references ? ref_list.references->length () : 0;
+ return ref_list.references.length ();
}
/* Iterates I-th reference in the list, REF is also set. */
@@ -604,7 +604,7 @@ public:
symtab_node *same_comdat_group;
/* Vectors of referring and referenced entities. */
- ipa_ref_list ref_list;
+ ipa_ref_list GTY((skip)) ref_list;
/* Alias target. May be either DECL pointer or ASSEMBLER_NAME pointer
depending to what was known to frontend on the creation time.
@@ -2676,7 +2676,7 @@ symtab_node::next_defined_symbol (void)
inline ipa_ref *
symtab_node::iterate_reference (unsigned i, ipa_ref *&ref)
{
- vec_safe_iterate (ref_list.references, i, &ref);
+ ref_list.references.iterate (i, &ref);
return ref;
}
@@ -5719,8 +5719,7 @@ cp_fix_function_decl_p (tree decl)
/* Don't fix same_body aliases. Although they don't have their own
CFG, they share it with what they alias to. */
- if (!node || !node->alias
- || !vec_safe_length (node->ref_list.references))
+ if (!node || !node->alias || !node->num_references ())
return true;
}
@@ -32,7 +32,6 @@ ipa_ref::remove_reference ()
{
struct ipa_ref_list *list = referred_ref_list ();
struct ipa_ref_list *list2 = referring_ref_list ();
- vec<ipa_ref_t, va_gc> *old_references = list2->references;
struct ipa_ref *last;
gcc_assert (list->referring[referred_index] == this);
@@ -66,7 +65,7 @@ ipa_ref::remove_reference ()
}
list->referring.pop ();
- last = &list2->references->last ();
+ last = &list2->references.last ();
struct ipa_ref *ref = this;
@@ -75,8 +74,7 @@ ipa_ref::remove_reference ()
*ref = *last;
ref->referred_ref_list ()->referring[referred_index] = ref;
}
- list2->references->pop ();
- gcc_assert (list2->references == old_references);
+ list2->references.pop ();
}
/* Return true when execution of reference can lead to return from
@@ -27,7 +27,7 @@ struct symtab_node;
/* How the reference is done. */
-enum GTY(()) ipa_ref_use
+enum ipa_ref_use
{
IPA_REF_LOAD,
IPA_REF_STORE,
@@ -36,7 +36,7 @@ enum GTY(()) ipa_ref_use
};
/* Record of reference in callgraph or varpool. */
-struct GTY(()) ipa_ref
+struct ipa_ref
{
public:
/* Remove reference. */
@@ -59,28 +59,27 @@ public:
symtab_node *referred;
gimple *stmt;
unsigned int lto_stmt_uid;
+ unsigned int referred_index;
/* speculative id is used to link direct calls with their corresponding
IPA_REF_ADDR references when representing speculative calls. */
unsigned int speculative_id : 16;
- unsigned int referred_index;
ENUM_BITFIELD (ipa_ref_use) use:3;
unsigned int speculative:1;
};
typedef struct ipa_ref ipa_ref_t;
-typedef struct ipa_ref *ipa_ref_ptr;
/* List of references. This is stored in both callgraph and varpool nodes. */
-struct GTY(()) ipa_ref_list
+struct ipa_ref_list
{
public:
/* Return first reference in list or NULL if empty. */
struct ipa_ref *first_reference (void)
{
- if (!vec_safe_length (references))
+ if (!references.length ())
return NULL;
- return &(*references)[0];
+ return &references[0];
}
/* Return first referring ref in list or NULL if empty. */
@@ -121,20 +120,20 @@ public:
void clear (void)
{
referring.create (0);
- references = NULL;
+ references.create (0);
}
/* Return number of references. */
unsigned int nreferences (void)
{
- return vec_safe_length (references);
+ return references.length ();
}
/* Store actual references in references vector. */
- vec<ipa_ref_t, va_gc> *references;
+ vec<ipa_ref_t, va_heap, vl_ptr> references;
/* Referring is vector of pointers to references. It must not live in GGC space
or GGC will try to mark middle of references vectors. */
- vec<ipa_ref_ptr> GTY((skip)) referring;
+ vec<ipa_ref_t *, va_heap, vl_ptr> referring;
};
#endif /* GCC_IPA_REF_H */
@@ -592,10 +592,9 @@ symtab_node::create_reference (symtab_node *referred_node,
gcc_checking_assert (use_type != IPA_REF_ALIAS || !stmt);
list = &ref_list;
- old_references = vec_safe_address (list->references);
- vec_safe_grow (list->references, vec_safe_length (list->references) + 1,
- true);
- ref = &list->references->last ();
+ old_references = list->references.address ();
+ list->references.safe_grow (list->references.length () + 1, false);
+ ref = &list->references.last ();
list2 = &referred_node->ref_list;
@@ -623,7 +622,7 @@ symtab_node::create_reference (symtab_node *referred_node,
ref->speculative = 0;
/* If vector was moved in memory, update pointers. */
- if (old_references != list->references->address ())
+ if (old_references != list->references.address ())
{
int i;
for (i = 0; iterate_reference(i, ref2); i++)
@@ -786,9 +785,9 @@ symtab_node::clear_stmts_in_references (void)
void
symtab_node::remove_all_references (void)
{
- while (vec_safe_length (ref_list.references))
- ref_list.references->last ().remove_reference ();
- vec_free (ref_list.references);
+ while (ref_list.references.length ())
+ ref_list.references.last ().remove_reference ();
+ ref_list.references.release ();
}
/* Remove all referring items in ref list. */
@@ -1774,7 +1773,7 @@ symtab_node::resolve_alias (symtab_node *target, bool transparent)
{
symtab_node *n;
- gcc_assert (!analyzed && !vec_safe_length (ref_list.references));
+ gcc_assert (!analyzed && !ref_list.references.length ());
/* Never let cycles to creep into the symbol table alias references;
those will make alias walkers to be infinite. */