diff options
author | Ronan Desplanques <desplanques@adacore.com> | 2023-11-07 08:50:03 +0100 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2023-12-19 15:27:48 +0100 |
commit | 95a7771da2c0d9ac1f78f25fed40caef4ea3ab56 (patch) | |
tree | 21e51b735f9134596e47e1e93ad5cfd011113452 /gcc/ada/sem_util.ads | |
parent | 1acce1417b42aee9152fc42bb0247ced2acc3a4f (diff) | |
download | gcc-95a7771da2c0d9ac1f78f25fed40caef4ea3ab56.zip gcc-95a7771da2c0d9ac1f78f25fed40caef4ea3ab56.tar.gz gcc-95a7771da2c0d9ac1f78f25fed40caef4ea3ab56.tar.bz2 |
ada: Restore object constraint optimization
This patch relaxes the requirement that discriminants values should be
known at compile time for a particular optimization to be applied. That
optimization is the one that treats an unconstrained object as constrained
when the object is of a limited type, in order to reduce the size of the
object.
What makes it possible to relax this requirement is that the set of
cases where the optimization is applied was narrowed in a previous
patch.
gcc/ada/
* sem_util.adb (Build_Default_Subtype_OK): Relax
known-at-compile-time requirement.
* sem_util.ads (Build_Default_Subtype_OK): Bring documentation
comment up-to-date.
Diffstat (limited to 'gcc/ada/sem_util.ads')
-rw-r--r-- | gcc/ada/sem_util.ads | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads index 081217a..2dc75a1 100644 --- a/gcc/ada/sem_util.ads +++ b/gcc/ada/sem_util.ads @@ -282,14 +282,13 @@ package Sem_Util is -- subtype. Otherwise, simply return T. function Build_Default_Subtype_OK (T : Entity_Id) return Boolean; - -- When analyzing components or object declarations, it is possible, in - -- some cases, to build subtypes for discriminated types. This is - -- worthwhile to avoid the backend allocating the maximum possible size for - -- objects of the type. + -- When analyzing object declarations, it is possible, in some cases, to + -- build subtypes for discriminated types. This is worthwhile to avoid the + -- backend allocating the maximum possible size for objects of the type. -- In particular, when T is limited, the discriminants and therefore the -- size of an object of type T cannot change. Furthermore, if T is definite - -- with statically initialized defaulted discriminants, we are able and - -- want to build a constrained subtype of the right size. + -- with initialized defaulted discriminants, we are able and want to build + -- a constrained subtype of the right size. function Build_Discriminal_Subtype_Of_Component (T : Entity_Id) return Node_Id; |