aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/decl.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@gcc.gnu.org>2020-05-08 17:01:18 +0200
committerEric Botcazou <ebotcazou@gcc.gnu.org>2020-05-08 17:24:15 +0200
commitbb1ec4773a01e5bbb7cb6e2f53ea338a74a6797f (patch)
tree64f188f766e3f5bf2ddc105a7bc2e6f241f3f838 /gcc/ada/gcc-interface/decl.c
parentc900c70049965fad7fa02aa08f0ac3a67ab99b37 (diff)
downloadgcc-bb1ec4773a01e5bbb7cb6e2f53ea338a74a6797f.zip
gcc-bb1ec4773a01e5bbb7cb6e2f53ea338a74a6797f.tar.gz
gcc-bb1ec4773a01e5bbb7cb6e2f53ea338a74a6797f.tar.bz2
Couple of tweaks to help in LTO mode
The first tweak is to remove the TREE_OVERFLOW flag on INTEGER_CSTs because it prevents them from being uniquized in LTO mode. The second, unrelated tweak is to canonicalize the packable types made by gigi so that at most one per type is present in the GENERIC IL. * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Subtype>: Deal with artificial maximally-sized types designed by access types. * gcc-interface/utils.c (packable_type_hash): New structure. (packable_type_hasher): Likewise. (packable_type_hash_table): New hash table. (init_gnat_utils): Initialize it. (destroy_gnat_utils): Destroy it. (packable_type_hasher::equal): New method. (hash_packable_type): New static function. (canonicalize_packable_type): Likewise. (make_packable_type): Make sure not to use too small a type for the size of the new fields. Canonicalize the type if it is named.
Diffstat (limited to 'gcc/ada/gcc-interface/decl.c')
-rw-r--r--gcc/ada/gcc-interface/decl.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index 3cd9d52..a4053ee 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -2685,6 +2685,22 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
set_reverse_storage_order_on_array_type (gnu_type);
if (array_type_has_nonaliased_component (gnu_type, gnat_entity))
set_nonaliased_component_on_array_type (gnu_type);
+
+ /* Kludge to remove the TREE_OVERFLOW flag for the sake of LTO
+ on maximally-sized array types designed by access types. */
+ if (integer_zerop (TYPE_SIZE (gnu_type))
+ && TREE_OVERFLOW (TYPE_SIZE (gnu_type))
+ && Is_Itype (gnat_entity)
+ && (gnat_temp = Associated_Node_For_Itype (gnat_entity))
+ && IN (Nkind (gnat_temp), N_Declaration)
+ && Is_Access_Type (Defining_Entity (gnat_temp))
+ && Is_Entity_Name (First_Index (gnat_entity))
+ && UI_To_Int (RM_Size (Entity (First_Index (gnat_entity))))
+ == BITS_PER_WORD)
+ {
+ TYPE_SIZE (gnu_type) = bitsize_zero_node;
+ TYPE_SIZE_UNIT (gnu_type) = size_zero_node;
+ }
}
/* Attach the TYPE_STUB_DECL in case we have a parallel type. */