Commit b5487346 by Eric Botcazou Committed by Eric Botcazou

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
parent 32d99e68
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.
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment