diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2023-11-28 20:46:00 +0100 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2023-12-19 15:27:49 +0100 |
commit | 80a63cc744e9f16ace1e007f8973e97448742335 (patch) | |
tree | ceeea92d3707049a5bccbc69213209b8dcae5253 /gcc/ada/gcc-interface/decl.cc | |
parent | 35ef3e08ec5bc03fe2cb80efc3271168bc6d419e (diff) | |
download | gcc-80a63cc744e9f16ace1e007f8973e97448742335.zip gcc-80a63cc744e9f16ace1e007f8973e97448742335.tar.gz gcc-80a63cc744e9f16ace1e007f8973e97448742335.tar.bz2 |
ada: Rename Is_Constr_Subt_For_UN_Aliased flag
The flag is set on the constructed subtype of an object with unconstrained
nominal subtype that is aliased and is used by the code generator to adjust
the layout of the object.
But it is actually only used for array subtypes, where it determines whether
the object is allocated with its bounds, and this usage could be extended to
other cases than the original case.
gcc/ada/
* einfo.ads (Is_Constr_Subt_For_UN_Aliased): Rename into...
(Is_Constr_Array_Subt_With_Bounds): ...this.
* exp_ch3.adb (Expand_N_Object_Declaration): Adjust to above
renaming and remove now redundant test.
* sem_ch3.adb (Analyze_Object_Declaration): Likewise, but set
Is_Constr_Array_Subt_With_Bounds only on arrays.
* gen_il-fields.ads (Opt_Field_Enum): Apply same renaming.
* gen_il-gen-gen_entities.adb (Entity_Kind): Likewise.
* gen_il-internals.adb (Image): Remove specific processing for
Is_Constr_Subt_For_UN_Aliased.
* treepr.adb (Image): Likewise.
* gcc-interface/decl.cc (gnat_to_gnu_entity): Adjust to renaming
and remove now redundant tests.
* gcc-interface/trans.cc (Identifier_to_gnu): Likewise.
(Call_to_gnu): Likewise.
Diffstat (limited to 'gcc/ada/gcc-interface/decl.cc')
-rw-r--r-- | gcc/ada/gcc-interface/decl.cc | 44 |
1 files changed, 20 insertions, 24 deletions
diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc index d2456bf..c3d2de2 100644 --- a/gcc/ada/gcc-interface/decl.cc +++ b/gcc/ada/gcc-interface/decl.cc @@ -889,7 +889,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) || (TYPE_SIZE (gnu_type) && integer_zerop (TYPE_SIZE (gnu_type)) && !TREE_OVERFLOW (TYPE_SIZE (gnu_type)))) - && !Is_Constr_Subt_For_UN_Aliased (gnat_type) + && !Is_Constr_Array_Subt_With_Bounds (gnat_type) && No (gnat_renamed_obj) && No (Address_Clause (gnat_entity))) gnu_size = bitsize_unit_node; @@ -907,7 +907,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) && kind != E_Exception && kind != E_Out_Parameter && Is_Composite_Type (gnat_type) - && !Is_Constr_Subt_For_UN_Aliased (gnat_type) + && !Is_Constr_Array_Subt_With_Bounds (gnat_type) && !Is_Exported (gnat_entity) && !imported_p && No (gnat_renamed_obj) @@ -932,11 +932,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) check_ok_for_atomic_type (gnu_inner, gnat_entity, true); } - /* If this is an aliased object with an unconstrained array nominal - subtype, make a type that includes the template. We will either - allocate or create a variable of that type, see below. */ - if (Is_Constr_Subt_For_UN_Aliased (gnat_type) - && Is_Array_Type (gnat_und_type) + /* If this is an array allocated with its bounds, make a type that + includes the template. We will either allocate it or create a + variable of that type, see below. */ + if (Is_Constr_Array_Subt_With_Bounds (gnat_type) && !type_annotate_only) { tree gnu_array = gnat_to_gnu_type (Base_Type (gnat_type)); @@ -986,7 +985,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) size might be zero at run time, we force at least the unit size. */ if (Is_Aliased (gnat_entity) && Is_Constrained (gnat_type) - && !Is_Constr_Subt_For_UN_Aliased (gnat_type) + && !Is_Constr_Array_Subt_With_Bounds (gnat_type) && Is_Array_Type (gnat_und_type) && !TREE_CONSTANT (gnu_object_size)) gnu_size = size_binop (MAX_EXPR, gnu_object_size, bitsize_unit_node); @@ -1145,12 +1144,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) the entity as indirect reference to the renamed object. */ if (Materialize_Entity (gnat_entity)) { - /* If this is an aliased object with an unconstrained array - nominal subtype, we make its type a thin reference, i.e. - the reference counterpart of a thin pointer, exactly as - we would have done in the non-renaming case below. */ - if (Is_Constr_Subt_For_UN_Aliased (gnat_type) - && Is_Array_Type (gnat_und_type) + /* If this is an array allocated with its bounds, we make + its type a thin reference, the reference counterpart of + a thin pointer, exactly as we would have done in the + non-renaming case below. */ + if (Is_Constr_Array_Subt_With_Bounds (gnat_type) && !type_annotate_only) { tree gnu_array @@ -1253,8 +1251,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) /* If this is an aliased object with an unconstrained array nominal subtype, then it can overlay only another aliased object with an unconstrained array nominal subtype and compatible template. */ - if (Is_Constr_Subt_For_UN_Aliased (gnat_type) - && Is_Array_Type (gnat_und_type) + if (Is_Constr_Array_Subt_With_Bounds (gnat_type) && !type_annotate_only) { tree rec_type = TREE_TYPE (gnu_type); @@ -1488,14 +1485,13 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) (TREE_TYPE (TYPE_FIELDS (gnu_type)))))) static_flag = true; - /* If this is an aliased object with an unconstrained array nominal - subtype, we make its type a thin reference, i.e. the reference - counterpart of a thin pointer, so it points to the array part. - This is aimed to make it easier for the debugger to decode the - object. Note that we have to do it this late because of the - couple of allocation adjustments that might be made above. */ - if (Is_Constr_Subt_For_UN_Aliased (gnat_type) - && Is_Array_Type (gnat_und_type) + /* If this is an array allocated with its bounds, we make its type a + thin reference, i.e. the reference counterpart of a thin pointer, + so that it points to the array part. This is aimed at making it + easier for the debugger to decode the object. Note that we have + to do it this late because of the couple of allocation adjustments + that might be made above. */ + if (Is_Constr_Array_Subt_With_Bounds (gnat_type) && !type_annotate_only) { /* In case the object with the template has already been allocated |