diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2008-05-01 20:13:56 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2008-05-01 20:13:56 +0000 |
commit | b5487346841fcd5a5834e458c8504d1febc1a46f (patch) | |
tree | 9828a8380bd06a56ecc335ce3c88debf94b1c748 | |
parent | 32d99e6869ec4eb0d8f801893d2ea499f9951f71 (diff) | |
download | gcc-b5487346841fcd5a5834e458c8504d1febc1a46f.zip gcc-b5487346841fcd5a5834e458c8504d1febc1a46f.tar.gz gcc-b5487346841fcd5a5834e458c8504d1febc1a46f.tar.bz2 |
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
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/alias.c | 9 | ||||
-rw-r--r-- | gcc/tree.h | 20 |
3 files changed, 27 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fc9095e..aa08080 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +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. diff --git a/gcc/alias.c b/gcc/alias.c index 7b14f26..b29abf7 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; @@ -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) |