How to express the fact that arguments don't escape?
Richard Guenther
richard.guenther@gmail.com
Sat Aug 15 11:20:00 GMT 2009
On Sat, Aug 15, 2009 at 1:11 PM, Thomas Koenig<tkoenig@gcc.gnu.org> wrote:
> On Sat, 2009-08-15 at 12:11 +0200, Richard Guenther wrote:
>> > To stay within the current, C-centric framework of gcc, we'll need
>> to do
>> > even more copying.
>>
>> Yes, of course.
>
> What about the following pseudo-code: For an scalar argument integer i,
> to the subroutine foo with the corresponding dummy argument i_dummy, we
> can the do (pseudo code)
>
> if (optimize || ! is_target(i_dummy)) {
> int i_temp;
> if (intent_inout(i_dummy) || intent_in(i_dummy) || intent_unpecified(i_dummy))
for this you can include intent_in(i_dummy) as well, thus do it unconditionally.
> i_temp = i;
> call foo(&i_temp);
> if (is_no_active_do_loop_variable(i)
> && (intent_inout(i_dummy) || intent_out(i_dummy) || intent_unspecified(i_dummy)))
> i = i_temp;
just this copy is not needed for intent_in.
Note that this would be indeed profitable for all types that are cheap to copy
(is_gimple_reg_type in gimple speak).
Richard.
> }
>
>
More information about the Fortran
mailing list