[Ada] Front-end support for Storage_Model feature
authorGary Dismukes <dismukes@adacore.com>
Mon, 13 Sep 2021 21:40:34 +0000 (17:40 -0400)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 5 Oct 2021 08:20:03 +0000 (08:20 +0000)
commitb479c0f7d7c45f9d99292ca2aa71d7845c7769bc
treec56978e4d04b0ec0668cfd6d1d7b80c798941379
parente035b4f5924b5fa5d32cb91f476221ab6edef0bb
[Ada] Front-end support for Storage_Model feature

gcc/ada/

* aspects.ads (type Aspect_Id): Add
Aspect_Designated_Storage_Model and Aspect_Storage_Model_Type.
(Aspect_Argument): Add associations for the above new aspects.
(Is_Representation_Aspect): Likewise.
(Aspect_Names, Aspect_Delay): Likewise.
* exp_ch4.adb (Expand_N_Allocator): Call Find_Storage_Op rather
than Find_Prim_Op.
* exp_intr.adb (Expand_Unc_Deallocation): Likewise.
* exp_util.ads (Find_Storage_Op): New function that locates
either a primitive operation of a storage pool or an operation
of a storage-model type specified in its Storage_Model_Type
aspect.
* exp_util.adb (Find_Storage_Op): New function that calls either
Find_Prim_Op or Get_Storage_Model_Type_Entity to locate a
storage-related operation that is associated with a type.
* sem_ch13.adb (Analyze_Aspects_At_Freeze_Point): Analyzes,
resolves, and validates the arguments of aspect
Designated_Storage_Model_Type.
(Analyze_Aspect_Specifications): Sets delay-related flags on
storage-model aspects when Delay_Required. Checks that aspect
Designated_Storage_Model is only specified for an access type
and that aspect Storage_Model_Type is only specified on an
immutably limited type. Also records such aspects for their
associated types.
(Check_Aspect_At_Freeze_Point): Resolve each of the argument
associations given for a Storage_Model_Type aspect.
(Resolve_Storage_Model_Type_Argument): New procedure that
resolves an argument given in the association for a given entity
name associated with a type with aspect Storage_Model_Type,
ensuring that it has the proper kind or profile.
(Validate_Storage_Model_Type_Aspect): New procedure that checks
the legality and completeness of the entity associations given
in a Storage_Model_Type aspect.
* sem_util.ads (package Storage_Model_Support): New nested
package that encapsulates a set of convenient utility functions
for retrieving entities, etc. associated with
storage-model-related types and objects.
(Get_Storage_Model_Type_Entity): New function to return a
specified entity associated with a type that has aspect
Storage_Model_Type.
(Has_Designated_Storage_Model_Aspect): New function that returns
whether a type has aspect Designated_Storage_Model.
(Has_Storage_Model_Type_Aspect): New function that returns
whether a type has aspect Storage_Model_Type.
(Storage_Model_Object): New function that returns the object
Entity_Id associated with a type's Designated_Storage_Model
aspect.
(Storage_Model_Type): New function that returns the type
associated with a storage-model object (when the object's type
specifies Storage_Model_Type).
(Storage_Model_Address_Type): New function that returns the
Address_Type associated with a type that has aspect
Storage_Model_Type.
(Storage_Model_Null_Address): New function that returns the
Null_Address constant associated with a type that has aspect
Storage_Model_Type.
(Storage_Model_Allocate): New function that returns the Allocate
procedure associated with a type that has aspect
Storage_Model_Type.
(Storage_Model_Deallocate): New function that returns the
Deallocate procedure associated with a type that has aspect
Storage_Model_Type.
(Storage_Model_Copy_From): New function that returns the
Copy_From procedure associated with a type that has aspect
Storage_Model_Type.
(Storage_Model_Copy_To): New function that returns the Copy_To
procedure associated with a type that has aspect
Storage_Model_Type.
(Storage_Model_Storage_Size): New function that returns the
Storage_Size function associated with a type that has aspect
Storage_Model_Type.
* sem_util.adb (package Storage_Model_Support): Body of new
nested package that contains the implementations the utility
functions declared in the spec of this package.
* snames.ads-tmpl: Add new names Name_Designated_Storage_Pool,
Name_Storage_Model, Name_Storage_Model_Type, Name_Address_Type,
Name_Copy_From, Name_Copy_To, and Name_Null_Address for the new
aspects and associated aspect arguments.
gcc/ada/aspects.ads
gcc/ada/exp_ch4.adb
gcc/ada/exp_intr.adb
gcc/ada/exp_util.adb
gcc/ada/exp_util.ads
gcc/ada/sem_ch13.adb
gcc/ada/sem_util.adb
gcc/ada/sem_util.ads
gcc/ada/snames.ads-tmpl