Next: , Previous: , Up: Compiler Switches   [Contents][Index]


4.3.13 Subprogram Inlining Control

-gnatn[12]

The n here is intended to suggest the first syllable of the word ’inline’. GNAT recognizes and processes Inline pragmas. However, for inlining to actually occur, optimization must be enabled and, by default, inlining of subprograms across units is not performed. If you want to additionally enable inlining of subprograms specified by pragma Inline across units, you must also specify this switch.

In the absence of this switch, GNAT does not attempt inlining across units and does not access the bodies of subprograms for which pragma Inline is specified if they are not in the current unit.

You can optionally specify the inlining level: 1 for moderate inlining across units, which is a good compromise between compilation times and performances at run time, or 2 for full inlining across units, which may bring about longer compilation times. If no inlining level is specified, the compiler will pick it based on the optimization level: 1 for -O1, -O2 or -Os and 2 for -O3.

If you specify this switch the compiler will access these bodies, creating an extra source dependency for the resulting object file, and where possible, the call will be inlined. For further details on when inlining is possible see Inlining of Subprograms.

-gnatN

This switch activates front-end inlining which also generates additional dependencies.

When using a gcc-based back end (in practice this means using any version of GNAT other than the JGNAT, .NET or GNAAMP versions), then the use of -gnatN is deprecated, and the use of -gnatn is preferred. Historically front end inlining was more extensive than the gcc back end inlining, but that is no longer the case.


Next: , Previous: , Up: Compiler Switches   [Contents][Index]