From: Eric Botcazou Date: Thu, 1 May 2008 20:13:56 +0000 (+0000) Subject: tree.h (TYPE_NONALIASED_COMPONENT): Expand comment. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b5487346841fcd5a5834e458c8504d1febc1a46f;p=gcc.git tree.h (TYPE_NONALIASED_COMPONENT): Expand comment. * tree.h (TYPE_NONALIASED_COMPONENT): Expand comment. (DECL_NONADDRESSABLE_P): Likewise. * alias.c (record_component_aliases): Fix comment. From-SVN: r134868 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fc9095efa6c..aa08080ea1b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2008-05-01 Eric Botcazou + + * tree.h (TYPE_NONALIASED_COMPONENT): Expand comment. + (DECL_NONADDRESSABLE_P): Likewise. + * alias.c (record_component_aliases): Fix comment. + 2008-05-01 Simon Baldwin * c-common.h (warn_array_subscript_range): New function. diff --git a/gcc/alias.c b/gcc/alias.c index 7b14f26cc13..b29abf70324 100644 --- a/gcc/alias.c +++ b/gcc/alias.c @@ -740,9 +740,8 @@ record_alias_subset (alias_set_type superset, alias_set_type subset) /* Record that component types of TYPE, if any, are part of that type for aliasing purposes. For record types, we only record component types - for fields that are marked addressable. For array types, we always - record the component types, so the front end should not call this - function if the individual component aren't addressable. */ + for fields that are not marked non-addressable. For array types, we + only record the component type if it is not marked non-aliased. */ void record_component_aliases (tree type) @@ -756,7 +755,7 @@ record_component_aliases (tree type) switch (TREE_CODE (type)) { case ARRAY_TYPE: - if (! TYPE_NONALIASED_COMPONENT (type)) + if (!TYPE_NONALIASED_COMPONENT (type)) record_alias_subset (superset, get_alias_set (TREE_TYPE (type))); break; @@ -775,7 +774,7 @@ record_component_aliases (tree type) get_alias_set (BINFO_TYPE (base_binfo))); } for (field = TYPE_FIELDS (type); field != 0; field = TREE_CHAIN (field)) - if (TREE_CODE (field) == FIELD_DECL && ! DECL_NONADDRESSABLE_P (field)) + if (TREE_CODE (field) == FIELD_DECL && !DECL_NONADDRESSABLE_P (field)) record_alias_subset (superset, get_alias_set (TREE_TYPE (field))); break; diff --git a/gcc/tree.h b/gcc/tree.h index c63ee947fab..d52c76095fb 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -2264,8 +2264,9 @@ struct tree_block GTY(()) #define TYPE_TRANSPARENT_UNION(NODE) \ (UNION_TYPE_CHECK (NODE)->type.transparent_union_flag) -/* For an ARRAY_TYPE, indicates that it is not permitted to - take the address of a component of the type. */ +/* For an ARRAY_TYPE, indicates that it is not permitted to take the + address of a component of the type. This is the counterpart of + DECL_NONADDRESSABLE_P for arrays, see the definition of this flag. */ #define TYPE_NONALIASED_COMPONENT(NODE) \ (ARRAY_TYPE_CHECK (NODE)->type.transparent_union_flag) @@ -2896,7 +2897,20 @@ struct tree_decl_with_rtl GTY(()) #define DECL_BIT_FIELD(NODE) (FIELD_DECL_CHECK (NODE)->decl_common.decl_flag_2) /* Used in a FIELD_DECL to indicate that we cannot form the address of - this component. */ + this component. This makes it possible for Type-Based Alias Analysis + to disambiguate accesses to this field with indirect accesses using + the field's type: + + struct S { int i; } s; + int *p; + + If the flag is set on 'i', TBAA computes that s.i and *p never conflict. + + From the implementation's viewpoint, the alias set of the type of the + field 'i' (int) will not be recorded as a subset of that of the type of + 's' (struct S) in record_component_aliases. The counterpart is that + accesses to s.i must not be given the alias set of the type of 'i' + (int) but instead directly that of the type of 's' (struct S). */ #define DECL_NONADDRESSABLE_P(NODE) \ (FIELD_DECL_CHECK (NODE)->decl_common.decl_flag_3)