Gcc's man page says:

       -finline-functions-called-once
           Consider all "static" functions called once for inlining into
           their caller even if they are not marked "inline".  If a call
           to a given function is integrated, then the function is not
           output as assembler code in its own right.

           Enabled at levels -O1, -O2, -O3 and -Os.

Now, when using -flto -fwhole-program, *all* functions (that the user provided) will be "static inline", no ? - so *all* functions only called once in that program will be inlined ?

I am asking because our most important programs often consist of a chain of "routines-that-do-all-the-work" which are all only called once. However, in general they are (certainly when viewed from the perspective of a C programmer) *huge*.

E.g., our forecast program:

     HLPROG (small "main" program)
        |
        | calls
        V
     GEMINI (read input files, write output files, and:)
        |
        V
     SL2TIM (time stepping, and:)
        |
        V
     PHCALL (subgrid scale computations)
        |
        V
     PHTASK (split them into tasks over model domain)
        |
        V
     PHYS   (actually hand out the work to:)
        |
     ----------------------
     |    |    |     |    |
     LSP  CVP  RADIA TURB SOIL

     (large scale precipitation, convective precipitation,
      radiation, turbulence, soil processes)

The last five are each around 2,000 lines of Fortran, the P routines are each several hundreds of lines, as is SL2TIM. GEMINI is more than 2,000 lines.

My question is: How can I be sure that all of them are integrated (note that the man page says they are "considered") ? Does -Winline help here ? Perhaps I should scan the assembler output (HAH!).

Kind regards,

--
Toon Moene - e-mail: t...@moene.org - phone: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
At home: http://moene.org/~toon/
Progress of GNU Fortran: http://gcc.gnu.org/gcc-4.5/changes.html

Reply via email to