diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2022-12-19 11:47:38 +0100 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2023-01-05 15:30:01 +0100 |
commit | 133a8e6339ff5d4c695cd1c4ee0f4958386d46bd (patch) | |
tree | 2d3d80f89a22715e3d7df4ee8034d4d74bef326a /gcc/function-tests.cc | |
parent | 229f5150ad6e233a0b2e0cd9f8b09072a566aa96 (diff) | |
download | gcc-133a8e6339ff5d4c695cd1c4ee0f4958386d46bd.zip gcc-133a8e6339ff5d4c695cd1c4ee0f4958386d46bd.tar.gz gcc-133a8e6339ff5d4c695cd1c4ee0f4958386d46bd.tar.bz2 |
ada: Optimize class-wide objects initialized with function calls
This optimizes the implementation of class-wide objects initialized with
function calls in the non-interface case, by avoiding an unnecessary copy
operation and/or a dispatching call to the _Size primitive when possible.
gcc/ada/
* exp_ch3.adb (Expand_N_Object_Declaration): New local variable
Func_Id holding the function for a special return object.
Use a direct renaming in the class-wide case when the initializing
expression is a captured function call, except for a special return
object when the two functions do not return on the same stack.
Apply the accessibility check for class-wide special return objects.
* exp_util.adb (Make_CW_Equivalent_Type) <Has_Tag_Of_Type>: New.
Do not force a dispatching call to the primitive operation _Size if
the expression is known to statically have the tag of its type.
Diffstat (limited to 'gcc/function-tests.cc')
0 files changed, 0 insertions, 0 deletions