This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

Re: How to express the fact that arguments don't escape?


Richard Guenther wrote:
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).

This is very valuable information!


I'll attack this next.

Cheers,
- Tobi


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]