Next:Registers That Form a Stack, Previous:How Values Fit in Registers, Up:Register Usage [Contents][Index]
On some machines, a leaf function (i.e., one which makes no calls) can runmore efficiently if it does not make its own register window. Often thismeans it is required to receive its arguments in the registers where theyare passed by the caller, instead of the registers where they wouldnormally arrive.
The special treatment for leaf functions generally applies only whenother conditions are met; for example, often they may use only thoseregisters for its own variables and temporaries. We use the term “leaffunction” to mean a function that is suitable for this specialhandling, so that functions with no calls are not necessarily “leaffunctions”.
GCC assigns register numbers before it knows whether the function issuitable for leaf function treatment. So it needs to renumber theregisters in order to output a leaf function. The following macrosaccomplish this.
Name of a char vector, indexed by hard register number, whichcontains 1 for a register that is allowable in a candidate for leaffunction treatment.
If leaf function treatment involves renumbering the registers, then theregisters marked here should be the ones before renumbering—those thatGCC would ordinarily allocate. The registers which will actually beused in the assembler code, after renumbering, should not be marked with 1in this vector.
Define this macro only if the target machine offers a way to optimizethe treatment of leaf functions.
A C expression whose value is the register number to whichregnoshould be renumbered, when a function is treated as a leaf function.
Ifregno is a register number which should not appear in a leaffunction before renumbering, then the expression should yield −1, whichwill cause the compiler to abort.
Define this macro only if the target machine offers a way to optimize thetreatment of leaf functions, and registers need to be renumbered to dothis.
TARGET_ASM_FUNCTION_PROLOGUE andTARGET_ASM_FUNCTION_EPILOGUE must usually treat leaf functionsspecially. They can test the C variablecurrent_function_is_leafwhich is nonzero for leaf functions.current_function_is_leaf isset prior to local register allocation and is valid for the remainingcompiler passes. They can also test the C variablecurrent_function_uses_only_leaf_regs which is nonzero for leaffunctions which only use leaf registers.current_function_uses_only_leaf_regs is valid after all passesthat modify the instructions have been run and is only useful ifLEAF_REGISTERS is defined.
Next:Registers That Form a Stack, Previous:How Values Fit in Registers, Up:Register Usage [Contents][Index]