Oracle® Solaris Studio 12.4: Fortran User's Guide

Exit Print View

Updated: March 2015
 
 

3.4.46 –inline=[%auto][[,][no%]f1,…[no%]fn]

Enable or disable inlining of specified routines.

Request the optimizer to inline the user–written routines appearing in a comma-separated list of function and subroutine names. Prefixing a routine name with no% disables inlining of that routine.

Inlining is an optimization technique whereby the compiler effectively replaces a subprogram reference such as a CALL or function call with the actual subprogram code itself. Inlining often provides the optimizer more opportunities to produce efficient code.

Specify %auto to enable automatic inlining at optimization levels -O4 or -O5. Automatic inlining at these optimization levels is normally turned off when explicit inlining is specified with -inline.

Specifying -xinline= without naming any functions or %auto indicates that none of the routines in the source files are to be inlined.

Example: Inline the routines xbar, zbar, vpoint:

demo% f95 -O3 -inline=xbar,zbar,vpoint *.f

Following are the restrictions; no warnings are issued:

  • Optimization must be -O3 or greater.

  • The source for the routine must be in the file being compiled, unless -xipo or–xcrossfile are also specified.

  • The compiler determines if actual inlining is profitable and safe.

The appearance of -inline with -O4 disables the automatic inlining that the compiler would normally perform, unless %auto is also specified. With -O4, the compilers normally try to inline all appropriate user–written subroutines and functions. Adding -inline with -O4 may degrade performance by restricting the optimizer’s inlining to only those routines in the list. In this case, use the %auto suboption to enable automatic inlining at -O4 and -O5.

demo% f95 -O4 -inline=%auto,no%zpoint *.f

In the example above, the user has enabled -O4’s automatic inlining while disabling any possible inlining of the routine zpoint() that the compiler might attempt.