On some machines, a leaf function (i.e., one which makes no calls) can run more efficiently if it does not make its own register window. Often this means it is required to receive its arguments in the registers where they are passed by the caller, instead of the registers where they would normally arrive.
The special treatment for leaf functions generally applies only when other conditions are met; for example, often they may use only those registers for its own variables and temporaries. We use the term "leaf function" to mean a function that is suitable for this special handling, so that functions with no calls are not necessarily "leaf functions".
GNU CC assigns register numbers before it knows whether the function is suitable for leaf function treatment. So it needs to renumber the registers in order to output a leaf function. The following macros accomplish this.
LEAF_REGISTERS
LEAF_REG_REMAP (regno)
Normally, FUNCTION_PROLOGUE
and FUNCTION_EPILOGUE
must
treat leaf functions specially. It can test the C variable
leaf_function
which is nonzero for leaf functions. (The variable
leaf_function
is defined only if LEAF_REGISTERS
is
defined.)
Go to the first, previous, next, last section, table of contents.