* tree.h (TYPE_NONALIASED_COMPONENT): Expand comment.
(DECL_NONADDRESSABLE_P): Likewise.
* alias.c (record_component_aliases): Fix comment.
From-SVN: r134868
+2008-05-01 Eric Botcazou <ebotcazou@adacore.com>
+
+ * tree.h (TYPE_NONALIASED_COMPONENT): Expand comment.
+ (DECL_NONADDRESSABLE_P): Likewise.
+ * alias.c (record_component_aliases): Fix comment.
+
2008-05-01 Simon Baldwin <simonb@google.com>
* c-common.h (warn_array_subscript_range): New function.
/* 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)
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;
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;
#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)
#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)