Previous: Profiling, Up: Stack and Calling

13.9.13 Permitting tail calls

— Target Hook: bool TARGET_FUNCTION_OK_FOR_SIBCALL (tree decl, tree exp)

True if it is ok to do sibling call optimization for the specified call expression exp. decl will be the called function, or NULL if this is an indirect call.

It is not uncommon for limitations of calling conventions to prevent tail calls to functions outside the current unit of translation, or during PIC compilation. The hook is used to enforce these restrictions, as the sibcall md pattern can not fail, or fall over to a “normal” call. The criteria for successful sibling call optimization may vary greatly between different architectures.