ada: Adjust semantics and implementation of storage models
This makes the following adjustments to the semantics and implementation of
storage models in the compiler:
1. By-copy semantics in subprogram calls: when an object accessed with a
nonnative storage model is passed as an actual parameter in a call to
a subprogram, an intermediate copy made on the host is passed instead.
2. More generally, any additional temporary required on the host by the
semantics of nonnative storage models is now created by the front-end
instead of the code generator.
3. All the temporaries created on the host for nonnative storage models
are allocated on the secondary stack instead of the primary stack.
As a result, this should simplify the implementation in code generators.
gcc/ada/
* exp_aggr.adb (Build_Assignment_With_Temporary): Adjust comment
and fix type of second parameter. Create the temporary on the
secondary stack by calling Build_Temporary_On_Secondary_Stack.
(Convert_Array_Aggr_In_Allocator): Adjust formatting.
(Expand_Array_Aggregate): Likewise.
* exp_ch4.adb (Expand_N_Allocator): Set Actual_Designated_Subtype
on the dereference in the initialization for all composite types.
* exp_ch5.adb (Expand_N_Assignment_Statement): Create a temporary
on the host for an assignment between nonnative storage models.
Suppress more checks when Suppress_Assignment_Checks is set.
* exp_ch6.adb (Add_Simple_Call_By_Copy_Code): Deal with actuals
that are dereferences with an Actual_Designated_Subtype. Add
support for nonnative storage models.
(Expand_Actuals): Create a copy if the actual is a dereference
with a nonnative storage model.
* exp_util.ads (Build_Temporary_On_Secondary_Stack): Declare.
* exp_util.adb (Build_Temporary_On_Secondary_Stack): New function.
* sem_ch5.adb (Analyze_Assignment.Set_Assignment_Type): Do not
build an actual subtype for dereferences with an
Actual_Designated_Subtype
* sinfo.ads (Actual_Designated_Subtype): Adjust documentation.
(Suppress_Assignment_Checks): Likewise.