/* 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. */
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.
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;
}
/* 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;
}
{
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);
}
list->referring.pop ();
- last = &list2->references->last ();
+ last = &list2->references.last ();
struct ipa_ref *ref = this;
*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
/* How the reference is done. */
-enum GTY(()) ipa_ref_use
+enum ipa_ref_use
{
IPA_REF_LOAD,
IPA_REF_STORE,
};
/* Record of reference in callgraph or varpool. */
-struct GTY(()) ipa_ref
+struct ipa_ref
{
public:
/* Remove reference. */
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. */
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 */
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;
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++)
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. */
{
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. */