This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [ColdFire 42/63] Add support for sibling calls
On Wed, 2007-01-10 at 11:56 +0000, Richard Sandiford wrote:
> This patch adds support for sibcalls. It's a useful optimisation in its
> own right, but it's also needed by the upcoming thunks patch.
>
> Indirect sibcalls must use a register that isn't clobbered by the
> epilogue, and that isn't live on entry to the callee. The patch uses
> the static chain register for this purpose and forbids sibcalls to
> functions that need a static chain register.
>
> The sibcall_operand predicate only allows valid constants and the
> static chain register. The operand therefore doesn't need to be
> (and shouldn't be) reloaded, so the patch uses empty constraints.
> This seems better than adding a special register class.
>
> Richard
>
>
> gcc/
> * config/m68k/m68k-protos.h (output_sibcall): Declare.
> (mips_expand_epilogue): Add a bool parameter.
> (m68k_legitimize_sibcall_address): Declare.
> * config/m68k/m68k.c (TARGET_FUNCTION_OK_FOR_SIBCALL): Define.
> (m68k_expand_epilogue): Add a parameter to select between sibling
> and normal epilogues. Only generate a return for the latter.
> (m68k_ok_for_sibcall_p): New function.
> (m68k_legitimize_sibcall_address, output_sibcall): New functions.
> * config/m68k/m68k.md (sibcall, *sibcall): New patterns.
> (sibcall_value, *sibcall_value): Likewise.
> (*call, *call_value): Require !SIBLING_CALL_P.
> (epilogue): Update call to m68k_expand_epilogue.
> (sibcall_epilogue): New pattern.
> * config/m68k/predicates.md (const_call_operand): Say that this
> predicate applies to sibling calls too.
> (sibcall_operand): New predicate.
OK.
jeff