]> gcc.gnu.org Git - gcc.git/commit
ada: Optimize class-wide objects initialized with function calls
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 19 Dec 2022 10:47:38 +0000 (11:47 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Thu, 5 Jan 2023 14:30:01 +0000 (15:30 +0100)
commit133a8e6339ff5d4c695cd1c4ee0f4958386d46bd
tree2d3d80f89a22715e3d7df4ee8034d4d74bef326a
parent229f5150ad6e233a0b2e0cd9f8b09072a566aa96
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.
gcc/ada/exp_ch3.adb
gcc/ada/exp_util.adb
This page took 0.069641 seconds and 6 git commands to generate.