4.4.3. Managing inlining

You can force the compiler to attempt to inline a function using the __forceinline keyword. The compiler places the function inline, unless doing so causes problems. For example, a recursive function is inlined into itself only once. To force the compiler to attempt to inline all functions, compile your code with the --forceinline command-line option.

At the highest levels of optimization (-O2 and -O3), the compiler is able to automatically inline functions if it is sensible to do so, even if the user does not explicitly give a hint. See Marking functions as static for more information.

You can control the automatic inlining of functions at the highest optimization levels using the --[no_]autoinline command-line option. In general, when automatic inlining is enabled, the compiler inlines anything that it is sensible to inline. When automatic inlining is disabled, only functions marked as __inline are candidates for inlining.

You can control whether inlining is performed at all using the --[no_]inline keyword. By default, inlining of functions is enabled. If you disable inlining of functions using the --no_inline command-line option, then the compiler attempts to inline only those functions that are explicitly qualified with __forceinline.

For more information see:

Copyright © 2002-2007 ARM Limited. All rights reserved.ARM DUI 0205H