This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [autovect] [patch] and aliasing question


On Tue, May 24, 2005 at 09:36:35AM +0300, Ira Rosen wrote:

> As a followup patch I'd like to check the type memory tag directly and not
> call get_alias_set at all, as suggested by Diego. Is there an API that gets
> a type tag (or a symbol) and a declaration and determines whether a
> declaration is in may alias set of the tag, or do I have to go over the
> may-aliases of the tag myself? I also need a similar API to decide if two
> pointers alias.
> 
No, there isn't one.  But it should not be hard to implement.
Something along the lines of:

bool
is_aliased_with (tree tag, tree sym)
{
  size_t i;
  varray_type aliases;

  if (var_ann (sym)->is_alias_tag)
    {
      aliases = var_ann (tag)->may_aliases;

      if (aliases == NULL)
	return false;

      for (i = 0; i < VARRAY_ACTIVE_SIZE (aliases); i++)
	if (VARRAY_TREE (aliases, i) == sym)
	  return true;
    }
  else
    {
      aliases = var_ann (var)->may_aliases;

      if (aliases == NULL)
	return false;

      for (i = 0; i < VARRAY_ACTIVE_SIZE (aliases); i++)
	if (VARRAY_TREE (aliases, i) == tag)
	  return true;
    }

  return false
}

Coded off the top of my head, so it won't be totally correct.
Give it two symbols and it will tell you if one is in the alias
set of the other.  In general, normal symbols are in the alias
sets of tags, but when we have applied grouping heuristics, the
alias sets are turned inside-out (tags are put in the alias sets
of symbols).

Is this roughly what you're looking for?


Diego.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]