This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
In Ada, the result of evaluating a function call is a constant object and, therefore, can be subject to a renaming. This is fully implemented in the compiler by creating a temporary to capture the return value, either in gigi for simple cases or in the front-end for more convoluted cases. The front-end can also generate internal renamings, typically to remove the side effects of an expression before manipulating it. This is more efficient than generating a temporary when the renamed object is really a name. But generating internal renamings of function calls is to be avoided because they will inevitably be converted into a temporary at some point, so it is both conceptually simpler and more efficient to generate temporaries directly. Remove_Side_Effects already knows to avoid renaming function calls in most cases and this change deals with two more sources of these renamings. No functional changes. Tested on x86_64-pc-linux-gnu, committed on trunk 2015-05-26 Eric Botcazou <ebotcazou@adacore.com> * exp_ch6.adb (Expand_Actuals): Use a constant declaration instead of a renaming to capture the return value of a function call. (Expand_Simple_Function_Return): Call Remove_Side_Effects instead of removing side effects manually before the call to _Postconditions.
Attachment:
difs
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |