-/* Add the actual variables FULL_REF can access, given a member of
- full_ref's points-to set VAR, where FULL_REF is an access of SIZE at
- OFFSET from var. IS_CALL_SITE is true if this is a call, and IS_DEF
- is true if this is supposed to be a vdef, and false if this should
- be a VUSE.
-
- The real purpose of this function is to take a points-to set for a
- pointer to a structure, say
-
- struct s {
- int a;
- int b;
- } foo, *foop = &foo;
-
- and discover which variables an access, such as foop->b, can alias.
-
- This is necessary because foop only actually points to foo's first
- member, so that is all the points-to set contains. However, an access
- to foop->a may be touching some single SFT if we have created some
- SFT's for a structure. */
-
-static bool
-add_vars_for_offset (tree full_ref, tree var, HOST_WIDE_INT offset,
- HOST_WIDE_INT size, bool is_call_site, bool is_def)
-{
- /* Call-clobbered tags may have non-call-clobbered
- symbols in their alias sets. Ignore them if we are
- adding VOPs for a call site. */
- if (is_call_site && !is_call_clobbered (var))
- return false;
-
- /* For offset 0, we already have the right variable. If there is no
- full_ref, this is not a place we care about (All component
- related accesses that go through pointers will have full_ref not
- NULL).
- Any var for which we didn't create SFT's can't be
- distinguished. */
- if (!full_ref || (offset == 0 && size != -1)
- || (TREE_CODE (var) != STRUCT_FIELD_TAG
- && (!var_can_have_subvars (var) || !get_subvars_for_var (var))))
- {
- if (!access_can_touch_variable (full_ref, var, offset, size))
- return false;
-
- if (is_def)
- append_vdef (var);
- else
- append_vuse (var);
- return true;
- }
- else if (TREE_CODE (var) == STRUCT_FIELD_TAG)
- {
- bool added = false;
- subvar_t sv = get_subvars_for_var (SFT_PARENT_VAR (var));
- for (; sv; sv = sv->next)
- {
- /* Once we hit the end of the parts that could touch,
- stop looking. */
- if (size != -1
- && SFT_OFFSET (var) + offset + size <= SFT_OFFSET (sv->var))
- break;
- if (overlap_subvar (SFT_OFFSET (var) + offset, size, sv->var, NULL))
- {
- added = true;
- if (is_def)
- append_vdef (sv->var);
- else
- append_vuse (sv->var);
- }
- }
- return added;
- }
-
- return false;
-}
-
-/* Add all aliases from ALIASES as virtual operands for the access
- FULL_REF at OFFSET and size SIZE. IS_CALL_SITE is true if the
- stmt of the reference is a call. IS_DEF is true if we should add
- VDEF virtual operands, otherwise we'll add VUSEs. *NONE_ADDED
- is set to false once the first virtual operand was added. */
-
-static void
-add_vars_for_bitmap (bitmap aliases, tree full_ref,
- HOST_WIDE_INT offset, HOST_WIDE_INT size,
- bool is_call_site, bool is_def, bool *none_added)
-{
- bitmap_iterator bi;
- unsigned int i;
-
- EXECUTE_IF_SET_IN_BITMAP (aliases, 0, i, bi)
- {
- tree al = referenced_var (i);
-
- if (TREE_CODE (al) == MEMORY_PARTITION_TAG)
- add_vars_for_bitmap (MPT_SYMBOLS (al), full_ref,
- offset, size, is_call_site, is_def, none_added);
- else
- *none_added &= !add_vars_for_offset (full_ref, al, offset, size,
- is_call_site, is_def);
- }
-}
-
-/* Add VAR to the virtual operands array. FLAGS is as in