[PATCH] Remove special-casing of PTR_IS_REF_ALL pointers from alias analysis

Richard Guenther rguenther@suse.de
Thu May 1 13:08:00 GMT 2008


On Thu, 1 May 2008, Richard Kenner wrote:

> > There's the other abominations SFT_NONADDRESSABLE_P and 
> > DECL_NONADDRESSABLE_P and its implications to aliasing which
> > are completely non-understood by anyone else than Kenner
> > (and you maybe) ;)
> 
> I have no idea what SFT_NONADDRESSABLE_P means, but DECL_NONADDRESSABLE_P
> is simple enough: it's set on a field if there's no way of there being an
> address directly to that field.  For C, this is true for bitfields (though
> I don't think we set it for them) and for Ada it's true if there's no
> "aliased" on the field.  What it means from an aliasing point of view is
> that the alias set to be used for that field is that of the underlying
> record, not the field itself.

But if there cannot be an address to such field, name it a.b, then
you never will need an alias set for the field, as for example

 T *p = &a.b;
 *p = x;

cannot happen.  So if you instead have

 T *p = &a;
 p->b = x;

which is valid, the used alias set is _always_ that of the base object
*p, which is the structures alias set, for the purpose of conflict
decision.

So what I (and others) do not understand is how

 1) DECL_NONADDRESSABLE_P is a concept that the middle-end needs to
    know about (the middle-end doesn't build up new addresses), but
    why this is not handled and enforced in the FEs only

 2) Why we need to record the parents alias set at all.  To cite
    tree.h:

struct tree_struct_field_tag GTY(())
{
...
  /* Alias set for a DECL_NONADDRESSABLE_P field.  Otherwise -1.  */
  alias_set_type alias_set;
};

As of the C frontend and bitfiels I think either DECL_BIT_FIELD or
TREE_ADDRESSABLE is used to denote addressability of a FIELD_DECL.

But as said, it is up to the frontends to avoid addressing non-addressable
things.

Thanks for any clarification,
Richard.



More information about the Gcc-patches mailing list