Inlining?

Philippe Schaffnit P.Schaffnit@access.rwth-aachen.de
Thu Sep 7 08:35:00 GMT 2006


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.



More information about the Fortran mailing list