This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Inlining?
- From: Philippe Schaffnit <P dot Schaffnit at access dot rwth-aachen dot de>
- Cc: GFortran <fortran at gcc dot gnu dot org>
- Date: Thu, 07 Sep 2006 10:35:10 +0200
- Subject: Re: Inlining?
- Organization: Access e.V.
- References: <44F53D9C.6163F96B@access.rwth-aachen.de> <44F58818.4010607@sbcglobal.net> <44F58A43.C82AC2F9@access.rwth-aachen.de> <44F58D4D.9050900@sbcglobal.net> <44F5903A.60CBA5D9@access.rwth-aachen.de> <20060830161857.j5j8f1g7scg8gsgo@webmail.physik.uni-muenchen.de>
Hi!
First of all, I'd like to make clear that I'm obviously talking about
things which I do not really understand, so anyone feel free to dismiss
it as pure noise...
Why can't inlining be made 'before', on the sources, by creating a copy
of the source with the routine to be inlined added (as text) as a
contained subroutine? This is obviously a *bad* hack, but this is
something relatively easy (I think that even I could pull it off). There
are some potential conflicts with the variables (see example attached),
but the compilers I tested it with didn't seem to mind (GFortran, Lahey
and SGI). The next problem would be for 'further inlining' (I mean
inlining an already inlined procedure), but this copy would just need to
be kept...
Can anyone comment on that?
Thanks!
Philippe
PS: what I thought could give trouble...
!
PROGRAM Weather
!
LOGICAL :: Flag
CHARACTER ( LEN = 25 ) :: String
!
String = "Fair"
WRITE ( 6, "(/A/)" ) TRIM(String)
CALL Forecast
WRITE ( 6, "(/A/)" ) TRIM(String)
!
CONTAINS
SUBROUTINE Forecast
INTEGER :: Flag
String = "Storm"
WRITE ( 6, "(/A/)" ) TRIM(String)
Flag = 666
WRITE ( String, * ) Flag
String = "Fair to good " // TRIM(ADJUSTL(String))
END SUBROUTINE Forecast
!
END PROGRAM Weather
!
tobias.schlueter@physik.uni-muenchen.de wrote:
>
> Hi Philippe,
>
> Philippe Schaffnit <P.Schaffnit@access.rwth-aachen.de> wrote on Wed,
> 30 Aug 2006:
> > Yes, it's very general, I'm more talking about tiny routines (say some
> > 20 lines), which I'm under the impression that do not get inlined, but
> > I'll give it a go with the additional flag you mentioned, and try to
> > read the manual a bit more carefully...
>
> I'm not sure if anything has happened since, but according to the mail
> to be found at <http://gcc.gnu.org/ml/fortran/2005-07/msg00286.html>
> there's no inlining, except for contained functions into the
> containing procedure. And yes, it's a possible area of enhancement.
>
> - Tobi
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.