gnu /
gcc /
a521dc37999bed5ec1f529b4c6ba7ded09dca464 [Ada] Use static stack allocation for small string if-expressions
This changes the expanded code generated for if-expressions of 1-dimensional
arrays to create a static temporary on the stack if a small upper bound can
be computed for the length of a subtype covering the result. Static stack
allocation is preferred over dynamic allocation for code generation purpose.
This also contains a couple of enhancements to the support code for checks,
so as to avoid generating useless checks during the modified expansion.
gcc/ada/
* checks.adb (Apply_Length_Check_On_Assignment): Return early if
the Suppress_Assignment_Checks flag is set.
(Selected_Range_Checks): Deal with conditional expressions.
* exp_ch4.adb (Too_Large_Length_For_Array): New constant.
(Expand_Concatenate): Use it in lieu of Too_Large_Max_Length.
(Expand_N_If_Expression): If the result has a unidimensional array
type but the dependent expressions have constrained subtypes with
known bounds, create a static temporary on the stack with a subtype
covering the result.
(Get_First_Index_Bounds): Deal with string literals.
* uintp.ads (Uint_256): New deferred constant.
* sinfo.ads (Suppress_Assignment_Checks): Document new usage.
4 files changed