Caller Saves - GNU Compiler Collection (GCC) Internals
Description: GNU Compiler Collection (GCC) Internals

Next: Function Entry, Previous: Aggregate Return, Up: Stack and Calling

#### 17.10.10 Caller-Saves Register Allocation

If you enable it, GCC can save registers around function calls. This makes it possible to use call-clobbered registers to hold variables that must live across calls.

— Macro: CALLER_SAVE_PROFITABLE (refs, calls)

> A C expression to determine whether it is worthwhile to consider placing a pseudo-register in a call-clobbered hard register and saving and restoring it around each function call. The expression should be 1 when this is worth doing, and 0 otherwise.

> If you don't define this macro, a default is used which is good on most machines: `4 *` calls`<` refs.

— Macro: HARD_REGNO_CALLER_SAVE_MODE (regno, nregs)

> A C expression specifying which mode is required for saving nregs of a pseudo-register in call-clobbered hard register regno. If regno is unsuitable for caller save, `VOIDmode` should be returned. For most machines this macro need not be defined since GCC will select the smallest suitable mode.