diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2022-05-27 15:28:29 +0200 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2022-07-04 07:45:58 +0000 |
commit | 2cad8a59a8060b0897d18d4075d96eb7c541e845 (patch) | |
tree | a27d06b646a7a93c8c3ec1620d04dde3cc45fdd9 /gcc/gimple-loop-jam.cc | |
parent | f3451ba8aa3a54c6f09ee049a1a406603ed2ec30 (diff) | |
download | gcc-2cad8a59a8060b0897d18d4075d96eb7c541e845.zip gcc-2cad8a59a8060b0897d18d4075d96eb7c541e845.tar.gz gcc-2cad8a59a8060b0897d18d4075d96eb7c541e845.tar.bz2 |
[Ada] Use static stack allocation for small dynamic string concatenations
This changes the expanded code generated for dynamic concatenations to
use a static array subtype for the temporary created on the stack if a
small upper bound can be computed for the length of the result. Static
stack allocation is preferred over dynamic allocation for code
generation purposes.
gcc/ada/
* exp_ch3.adb (Expand_N_Object_Declaration.Rewrite_As_Renaming):
Be prepared for slices.
* exp_ch4.adb (Get_First_Index_Bounds): New procedure.
(Expand_Array_Comparison.Length_Less_Than_4): Call it.
(Expand_Concatenate): Try to compute a maximum length for
operands with variable length and a maximum total length at the
end. If the concatenation is dynamic, but a sensible maximum
total length has been computed, use this length to create a
static array subtype for the temporary and return a slice of it.
Diffstat (limited to 'gcc/gimple-loop-jam.cc')
0 files changed, 0 insertions, 0 deletions