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?