The following qualifiers set a minimum for
-loop
nest level for function call expansion. The /inline_
looplevel
and /ipa_looplevel
qualifiers enable
you to limit inlining and IPA to just functions that are referenced
in nested loops, where the reduced function call overhead or
enhanced optimization will be multiplied:
/inline_looplevel=<n> [/inll] /ipa_looplevel=<n> [/ipall]
The argument is defined from the most deeply nested leaf of the call tree. A small value restricts inlining (IPA) to the best candidate functions, for example:
main { .. a(); ------> a() {...} } .. for (..) { for (..) { b(); ---------> b() { } for (..) { } for (..) { c(); -------> c() {...} } } }
The call to b
is inside a doubly nested loop, and
would be more profitable to expand than the call to a
. The call to c
is quadruply nested, so inlining
c
would yield the biggest gain of the three.
The argument is defined from the most deeply nested function reference:
/Inline_looplevel=1
means only the functions
referenced in the most deeply nested call sites may be inlined,
for example, function c
in the previous example. If
more than one function call is at the same loop nest level, all
of them are selected when that level is included.
/Inline_looplevel=2
means only function
calls at the most deeply nested level and one loop less deeply
nested may be expanded. /Inline_looplevel=3
would
be required to inline function b
, since its call is
two loops less nested than the call to function c
.
A value of 3 or greater will cause c
to be inlined
into b
, and then the new b
to be
inlined into the main program.
/Inline_looplevel (or /ipa_looplevel)=
permits inlining at any nesting level.
The calling tree and loop tables written to the listing file
with /listoptions=cl
include the nesting depth
level of each call in each program unit and the aggregate nesting
depth, that is the sum of the nesting depths for each call site,
starting from the main program. This information can be used to
identify the best functions for inlining.
A function that passes the inline_looplevel
test
will be inlined everywhere it is used, even in places that are
not in deeply nested loops. If some, but not all, invocations
of a function are to be expanded, use the inline and IPA pragmas
Just before each function call that is to be expanded. (See Section 6.2.6.)
Because inlining increases the size of the code, the extra
paging and cache contention can actually slow down a program.
Restricting inlining to functions used in for
loops
multiplies the benefits of eliminating function call overhead for
a given amount of code space expansion. If inlining appears to
have slowed an application code, investigate using IPA, which
has little effect on code space and the number of temporary
variables.