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


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


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