SPRUI04F july 2015 – april 2023
The compiler makes decisions about which functions to inline based on the factors mentioned in Section 3.11. In addition, there are several restrictions that can disqualify a function from being inlined by automatic inlining or inline keyword-based inlining.
The compiler will leave calls as they are if the function:
The compiler will also not inline a call if the function has features that create difficult situations for the compiler:
A call in a statement that is annotated with a NOINLINE pragma will not be inlined, regardless of other indications (including a FUNC_ALWAYS_INLINE pragma or always_inline attribute on the called function).
A call in a statement that is annotated with a FORCEINLINE pragma will always be inlined, if it is not disqualified for one of the reasons above, even if the called function has a FUNC_CANNOT_INLINE pragma or cannot_inline attribute.
In other words, a statement-level pragma overrides a function-level pragma or attribute. If both NOINLINE and FORCEINLINE apply to the same statement, the one that appears first is used and the rest are ignored.