5.4.4. Automatic inlining

At -O2 and -O3 levels of optimization, the compiler considers inlining calls to functions that are defined, but are not inline functions. This works best for static functions, because if all uses of a static function can be inlined, no out-of-line copy is required. It is best to mark all non-inline functions as static if they are not used outside the translation unit where they are defined. A translation unit is the preprocessed output of a source file together with all of the headers and source files included as a result of the #include directive. Typically, you do not want to place definitions of non-inline functions in header files.

If you are compiling with the --multifile option, enabled by default at -O3 level, or --ltcg, it is possible for the compiler to perform automatic inlining for calls to functions that are defined in other translation units.

For --multifile, both translation units must be compiled in the same invocation of the compiler. For --ltcg, they are required only to be linked together.

--no_inline disables automatic inlining.

Copyright © 2002-2010 ARM. All rights reserved.ARM DUI 0205J
Non-ConfidentialID101213