This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problems with sibling calls


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
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.

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().

Georg-Johann


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]