aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/decl.cc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2022-09-05 17:51:34 +0200
committerMarc Poulhiès <poulhies@adacore.com>2022-09-12 10:16:52 +0200
commitca4b9801e2b83cf22ba87ba2b30e450cbb0b6150 (patch)
tree6decf5098283a05f09706e02a3519b1f32b9d58d /gcc/ada/gcc-interface/decl.cc
parent9ccd61dfee0f21cf049653cfdaf2c28750ebe3cd (diff)
downloadgcc-ca4b9801e2b83cf22ba87ba2b30e450cbb0b6150.zip
gcc-ca4b9801e2b83cf22ba87ba2b30e450cbb0b6150.tar.gz
gcc-ca4b9801e2b83cf22ba87ba2b30e450cbb0b6150.tar.bz2
[Ada] Temporary tweak new expansion of contracts
In the case of a function, the new expansion of contracts makes use of an extended return statement to store the result of the function in the return object while the post-conditions are evaluated. Unfortunately GNAT does not elide the copy of the return object for extended return statements for the time being, so this scheme incurs an extra copy of the return value on the primary or secondary stack, as well as an additional pair of calls to Adjust/Finalize when the return type needs finalization. This temporarily changes the expansion to use a block statement containing a renaming, which does not incur the extra copy provided that it is manually adjusted to be recognized by the existing "tail call" optimization present in the Expand_Simple_Function_Return routine. gcc/ada/ * contracts.adb (uild_Subprogram_Contract_Wrapper): Remove useless local variable. In the case of a function, replace the extended return statement by a block statement declaring a renaming of the call to the local subprogram after removing side effects manually. (Expand_Subprogram_Contract): Adjust description accordingly. * exp_ch6.adb (Expand_Ctrl_Function_Call): Rewrite obsolete comment and do not apply the transformation twice. * sem_attr.adb (Analyze_Attribute_Old_Result): Now expect a block statement instead of an extended return statement.
Diffstat (limited to 'gcc/ada/gcc-interface/decl.cc')
0 files changed, 0 insertions, 0 deletions