This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Problems with sibling calls
- From: Dave Korn <dave dot korn dot cygwin at googlemail dot com>
- To: Georg-Johann Lay <avr at gjlay dot de>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 29 May 2009 15:34:53 +0100
- Subject: Re: Problems with sibling calls
- References: <4A1FB71D.6070605@gjlay.de>
Georg-Johann Lay wrote:
> The trouble is this: If a callee gets some arguments passed on the stack
> or in call-saved regs, the callee is not ok for a sibling call. That's
> because sibcall_epilogue executes before sibcall insns.
>
> All this information is pretty easy available in FUNCTION_ARGS resp.
> FUNCTION_ARG_ADVANCE and can be stored in CUMULATIVE_ARGS.
>
> However, the place where the information is needed is in
> targetm.function_ok_for_sibcall (aka. TARGET_FUNCTION_OK_FOR_SIBCALL),
> and that hook only gets the function decl and call expression trees, but
> these trees do not contain information about where the calle's arguments
> get passed.
>
> How can that be fixed? Most probably, I am missing something, and the
> information is hidden somewhere is the trees passed to
> targetm.function_ok_for_sibcall?
> So what am I missing here? Is there some other approach to solve this?
The standard answer is that frame layout and other per-function info is
stored in the "struct function" machine-dependent part of the global 'cfun'
current function struct. See:
http://gcc.gnu.org/onlinedocs/gccint/Per_002dFunction-Data.html
cheers,
DaveK