This is the mail archive of the
mailing list for the GCC project.
Re: Problems with sibling calls
- From: Georg-Johann Lay <avr at gjlay dot de>
- To: Dave Korn <dave dot korn dot cygwin at googlemail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 29 May 2009 19:13:04 +0200
- Subject: Re: Problems with sibling calls
- References: <4A1FB71D.email@example.com> <4A1FF28D.firstname.lastname@example.org>
Dave Korn schrieb:
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
How can that be fixed? Most probably, I am missing something, and the
information is hidden somewhere is the trees passed to
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.
Yep, thanks much! That's the right place to store the information and
will solve the local function problem.
But this will only (or is intended to) track information for the caller,
not information needed for the callee that was gathered in the mentioned
hooks. It can be used, of course, to exchange data between hooks
provided with CUMULATIVE_ARGS and hooks that aren't, but it would still
make implications on how the hooks get called in calls.c:expand_call().