diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2007-09-11 19:43:02 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2007-09-11 19:43:02 +0000 |
commit | fa89b6ecba4ce9448b82a21f91b360eacf57bc72 (patch) | |
tree | 6794bfdde0fa3a761d0a915bf86007b0ca87d7e2 /gcc/ada/decl.c | |
parent | 868eaa1f422576b092cc1bdcf576d4cfa3d18fb3 (diff) | |
download | gcc-fa89b6ecba4ce9448b82a21f91b360eacf57bc72.zip gcc-fa89b6ecba4ce9448b82a21f91b360eacf57bc72.tar.gz gcc-fa89b6ecba4ce9448b82a21f91b360eacf57bc72.tar.bz2 |
tree-ssa-structalias.c (push_fields_onto_fieldstack): Deal with TYPE_NONALIASED_COMPONENT like with DECL_NONADDRESSABLE_P.
* tree-ssa-structalias.c (push_fields_onto_fieldstack): Deal with
TYPE_NONALIASED_COMPONENT like with DECL_NONADDRESSABLE_P.
ada/
* decl.c (array_type_has_nonaliased_component): New predicate.
(gnat_to_gnu_field) <E_Array_Type>: Invoke the above predicate to
set the TYPE_NONALIASED_COMPONENT flag on the type.
<E_Array_Subtype>: Likewise.
* gigi.h (type_for_nonaliased_component_p): Declare.
* utils.c (type_for_nonaliased_component_p): New predicate.
(create_field_decl): Invoke the above predicate to set the
DECL_NONADDRESSABLE_P flag on the field.
From-SVN: r128391
Diffstat (limited to 'gcc/ada/decl.c')
-rw-r--r-- | gcc/ada/decl.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/gcc/ada/decl.c b/gcc/ada/decl.c index 5aa4bc8..3d7c849 100644 --- a/gcc/ada/decl.c +++ b/gcc/ada/decl.c @@ -103,6 +103,7 @@ static tree gnat_to_gnu_field (Entity_Id, tree, int, bool); static tree gnat_to_gnu_param (Entity_Id, Mechanism_Type, Entity_Id, bool, bool *); static bool same_discriminant_p (Entity_Id, Entity_Id); +static bool array_type_has_nonaliased_component (Entity_Id, tree); static void components_to_record (tree, Node_Id, tree, int, bool, tree *, bool, bool, bool, bool); static Uint annotate_value (tree); @@ -1788,16 +1789,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) { tem = build_array_type (tem, gnu_index_types[index]); TYPE_MULTI_ARRAY_P (tem) = (index > 0); - - /* If the type below this is a multi-array type, then this - does not have aliased components. But we have to make - them addressable if it must be passed by reference or - if that is the default. */ - if ((TREE_CODE (TREE_TYPE (tem)) == ARRAY_TYPE - && TYPE_MULTI_ARRAY_P (TREE_TYPE (tem))) - || (!Has_Aliased_Components (gnat_entity) - && !must_pass_by_ref (TREE_TYPE (tem)) - && !default_pass_by_ref (TREE_TYPE (tem)))) + if (array_type_has_nonaliased_component (gnat_entity, tem)) TYPE_NONALIASED_COMPONENT (tem) = 1; } @@ -2123,16 +2115,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) { gnu_type = build_array_type (gnu_type, gnu_index_type[index]); TYPE_MULTI_ARRAY_P (gnu_type) = (index > 0); - - /* If the type below this is a multi-array type, then this - does not have aliased components. But we have to make - them addressable if it must be passed by reference or - if that is the default. */ - if ((TREE_CODE (TREE_TYPE (gnu_type)) == ARRAY_TYPE - && TYPE_MULTI_ARRAY_P (TREE_TYPE (gnu_type))) - || (!Has_Aliased_Components (gnat_entity) - && !must_pass_by_ref (TREE_TYPE (gnu_type)) - && !default_pass_by_ref (TREE_TYPE (gnu_type)))) + if (array_type_has_nonaliased_component (gnat_entity, gnu_type)) TYPE_NONALIASED_COMPONENT (gnu_type) = 1; } @@ -4625,6 +4608,24 @@ same_discriminant_p (Entity_Id discr1, Entity_Id discr2) return Original_Record_Component (discr1) == Original_Record_Component (discr2); } + +/* Return true if the array type specified by GNAT_TYPE and GNU_TYPE has + a non-aliased component in the back-end sense. */ + +static bool +array_type_has_nonaliased_component (Entity_Id gnat_type, tree gnu_type) +{ + /* If the type below this is a multi-array type, then + this does not have aliased components. */ + if (TREE_CODE (TREE_TYPE (gnu_type)) == ARRAY_TYPE + && TYPE_MULTI_ARRAY_P (TREE_TYPE (gnu_type))) + return true; + + if (Has_Aliased_Components (gnat_type)) + return false; + + return type_for_nonaliased_component_p (TREE_TYPE (gnu_type)); +} /* Given GNAT_ENTITY, elaborate all expressions that are required to be elaborated at the point of its definition, but do nothing else. */ |