diff options
author | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2020-05-09 23:04:38 +0200 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2020-05-09 23:06:26 +0200 |
commit | 1e3cabd45d499652abc3bfe28f82a363ed70390d (patch) | |
tree | be260f6939c2fd83660d66e17a0ebcd621d80654 /gcc/ada/gcc-interface/utils.c | |
parent | 2448ee85a89f313e48ee40eaed0d645c4c027944 (diff) | |
download | gcc-1e3cabd45d499652abc3bfe28f82a363ed70390d.zip gcc-1e3cabd45d499652abc3bfe28f82a363ed70390d.tar.gz gcc-1e3cabd45d499652abc3bfe28f82a363ed70390d.tar.bz2 |
Fix small issues with -fgnat-encodings=minimal
This is the mode where the GNAT compiler does not use special encodings
in the debug info to describe some Ada constructs, for example packed
array types.
* gcc-interface/ada-tree.h (TYPE_PACKED_ARRAY_TYPE_P): Rename into...
(TYPE_BIT_PACKED_ARRAY_TYPE_P): ...this.
(TYPE_IS_PACKED_ARRAY_TYPE_P): Rename into...
(BIT_PACKED_ARRAY_TYPE_P): ...this.
(TYPE_IMPL_PACKED_ARRAY_P): Adjust to above renaming.
* gcc-interface/gigi.h (maybe_pad_type): Remove IS_USER_TYPE..
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Adjust
call to maybe_pad_type.
<E_Ordinary_Fixed_Point_Type>: Remove const qualifiers for tree.
<E_Signed_Integer_Subtype>: Remove redundant test and redundant call
to associate_original_type_to_packed_array. Turn into assertion.
Call associate_original_type_to_packed_array and modify
gnu_entity_name accordingly. Explicitly set the parallel type
for GNAT encodings.
Call create_type_decl in the misaligned case before maybe_pad_type.
<E_Array_Type>: Do not use the name of the implementation type for
a packed array when not using GNAT encodings.
<E_Array_Subtype>: Move around setting flags. Use the result of the
call to associate_original_type_to_packed_array for gnu_entity_name.
<E_Record_Subtype>: Create XVS type and XVZ variable only if debug
info is requested for the type.
Call create_type_decl if a padded type was created for a type entity
(gnat_to_gnu_component_type): Use local variable and adjust calls to
maybe_pad_type.
(gnat_to_gnu_subprog_type): Adjust call to maybe_pad_type.
(gnat_to_gnu_field): Likewise.
(validate_size): Adjust to renaming of macro.
(set_rm_size): Likewise.
(associate_original_type_to_packed_array): Adjust return type and
return the name of the original type if GNAT encodings are not used
* gcc-interface/misc.c (gnat_get_debug_typ): Remove obsolete stuff.
(gnat_get_fixed_point_type_info): Remove const qualifiers for tree.
(gnat_get_array_descr_info): Likewise and set variables lazily.
Remove call to maybe_debug_type. Simplify a few computations.
(enumerate_modes): Remove const qualifier for tree.
* gcc-interface/utils.c (make_type_from_size): Adjust to renaming.
(maybe_pad_type): Remove IS_USER_TYPE parameter and adjust. Remove
specific code for implementation types for packed arrays.
(compute_deferred_decl_context): Remove const qualifier for tree.
(convert): Adjust call to maybe_pad_type.
(unchecked_convert): Likewise.
* gcc-interface/utils2.c (is_simple_additive_expressio): Likewise.
Diffstat (limited to 'gcc/ada/gcc-interface/utils.c')
-rw-r--r-- | gcc/ada/gcc-interface/utils.c | 52 |
1 files changed, 17 insertions, 35 deletions
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index 9dd08e2..1b320f5 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -1332,9 +1332,9 @@ make_type_from_size (tree type, tree size_tree, bool for_biased) if (size == 0) size = 1; - /* Only do something if the type isn't a packed array type and doesn't - already have the proper size and the size isn't too large. */ - if (TYPE_IS_PACKED_ARRAY_TYPE_P (type) + /* Only do something if the type is not a bit-packed array type and does + not already have the proper size and the size is not too large. */ + if (BIT_PACKED_ARRAY_TYPE_P (type) || (TYPE_PRECISION (type) == size && biased_p == for_biased) || size > LONG_LONG_TYPE_SIZE) break; @@ -1457,15 +1457,14 @@ canonicalize_pad_type (tree type) if needed. We have already verified that SIZE and ALIGN are large enough. GNAT_ENTITY is used to name the resulting record and to issue a warning. IS_COMPONENT_TYPE is true if this is being done for the component type of - an array. IS_USER_TYPE is true if the original type needs to be completed. - DEFINITION is true if this type is being defined. SET_RM_SIZE is true if - the RM size of the resulting type is to be set to SIZE too; in this case, - the padded type is canonicalized before being returned. */ + an array. DEFINITION is true if this type is being defined. SET_RM_SIZE + is true if the RM size of the resulting type is to be set to SIZE too; in + this case, the padded type is canonicalized before being returned. */ tree maybe_pad_type (tree type, tree size, unsigned int align, Entity_Id gnat_entity, bool is_component_type, - bool is_user_type, bool definition, bool set_rm_size) + bool definition, bool set_rm_size) { tree orig_size = TYPE_SIZE (type); unsigned int orig_align = TYPE_ALIGN (type); @@ -1509,31 +1508,13 @@ maybe_pad_type (tree type, tree size, unsigned int align, if (align == 0 && !size) return type; - /* If requested, complete the original type and give it a name. */ - if (is_user_type) - create_type_decl (get_entity_name (gnat_entity), type, - !Comes_From_Source (gnat_entity), - !(TYPE_NAME (type) - && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL - && DECL_IGNORED_P (TYPE_NAME (type))), - gnat_entity); - /* We used to modify the record in place in some cases, but that could generate incorrect debugging information. So make a new record type and name. */ record = make_node (RECORD_TYPE); TYPE_PADDING_P (record) = 1; - /* ??? Padding types around packed array implementation types will be - considered as root types in the array descriptor language hook (see - gnat_get_array_descr_info). Give them the original packed array type - name so that the one coming from sources appears in the debugging - information. */ - if (TYPE_IMPL_PACKED_ARRAY_P (type) - && TYPE_ORIGINAL_PACKED_ARRAY (type) - && gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL) - TYPE_NAME (record) = TYPE_NAME (TYPE_ORIGINAL_PACKED_ARRAY (type)); - else if (Present (gnat_entity)) + if (Present (gnat_entity)) TYPE_NAME (record) = create_concat_name (gnat_entity, "PAD"); SET_TYPE_ALIGN (record, align ? align : orig_align); @@ -1601,6 +1582,7 @@ maybe_pad_type (tree type, tree size, unsigned int align, } } + /* Make the inner type the debug type of the padded type. */ if (gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL) SET_TYPE_DEBUG_TYPE (record, maybe_debug_type (type)); @@ -3229,7 +3211,7 @@ compute_deferred_decl_context (Entity_Id gnat_scope) if (TREE_CODE (context) == TYPE_DECL) { - const tree context_type = TREE_TYPE (context); + tree context_type = TREE_TYPE (context); /* Skip dummy types: only the final ones can appear in the context chain. */ @@ -4875,7 +4857,7 @@ convert (tree type, tree expr) && smaller_form_type_p (etype, type)) { expr = convert (maybe_pad_type (etype, TYPE_SIZE (type), 0, Empty, - false, false, false, true), + false, false, true), expr); return build1 (VIEW_CONVERT_EXPR, type, expr); } @@ -5495,14 +5477,14 @@ unchecked_convert (tree type, tree expr, bool notrunc_p) if (c < 0) { expr = convert (maybe_pad_type (etype, TYPE_SIZE (type), 0, Empty, - false, false, false, true), + false, false, true), expr); expr = unchecked_convert (type, expr, notrunc_p); } else { tree rec_type = maybe_pad_type (type, TYPE_SIZE (etype), 0, Empty, - false, false, false, true); + false, false, true); expr = unchecked_convert (rec_type, expr, notrunc_p); expr = build_component_ref (expr, TYPE_FIELDS (rec_type), false); } @@ -5520,14 +5502,14 @@ unchecked_convert (tree type, tree expr, bool notrunc_p) if (c < 0) { expr = convert (maybe_pad_type (etype, new_size, 0, Empty, - false, false, false, true), + false, false, true), expr); expr = unchecked_convert (type, expr, notrunc_p); } else { tree rec_type = maybe_pad_type (type, TYPE_SIZE (etype), 0, Empty, - false, false, false, true); + false, false, true); expr = unchecked_convert (rec_type, expr, notrunc_p); expr = build_component_ref (expr, TYPE_FIELDS (rec_type), false); } @@ -5572,7 +5554,7 @@ unchecked_convert (tree type, tree expr, bool notrunc_p) && TYPE_ALIGN (etype) < TYPE_ALIGN (type)) { expr = convert (maybe_pad_type (etype, NULL_TREE, TYPE_ALIGN (type), - Empty, false, false, false, true), + Empty, false, false, true), expr); return unchecked_convert (type, expr, notrunc_p); } @@ -5589,7 +5571,7 @@ unchecked_convert (tree type, tree expr, bool notrunc_p) || tree_int_cst_lt (TYPE_SIZE (etype), TYPE_SIZE (type)))) { expr = convert (maybe_pad_type (etype, TYPE_SIZE (type), 0, - Empty, false, false, false, true), + Empty, false, false, true), expr); return unchecked_convert (type, expr, notrunc_p); } |