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?


Thomas Koenig wrote:
Actually, pointers must not escape unless i has the target attribute,
and they cannot escape if the dummy argument doesn't have it.

So, the pseudo-code should read

if (optimize && (!has_target_attribute(i) || !has_target_attribute(i_dummy)) && is_gimple_reg_type(i)) {
    int i_temp;
    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;

Sounds reasonable?

Yes, except that we could also leave out writing back if (in your syntax) intent_in(i) (only adds a restriction if intent_unspecified(i_dummy)).


I'm a bit worried that this could pessimize code with very short functions but lots of arguments, i.e. when the copying time becomes comparable to the runtime.

Cheers,
- Tobi


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