On 12/12/13 13:49, Tom de Vries wrote:
Honza,
in calls.c:expand_call, I see the following code:
...
#ifdef REG_PARM_STACK_SPACE
/* If outgoing reg parm stack space changes, we can not do
sibcall. */
|| (OUTGOING_REG_PARM_STACK_SPACE (funtype)
!= OUTGOING_REG_PARM_STACK_SPACE (TREE_TYPE
(current_function_decl)))
|| (reg_parm_stack_space != REG_PARM_STACK_SPACE (fndecl))
#endif
...
I don't understand the last line. reg_parm_stack_space is initialized
like this:
...
reg_parm_stack_space = REG_PARM_STACK_SPACE (!fndecl ? fntype : fndecl);
...
Was this meant perhaps?
...
|| (reg_parm_stack_space != REG_PARM_STACK_SPACE
(current_function_decl))
I think you're probably right.
sibcall/tailcall basically re-use the current function's stack so if
there's a difference between REG_PARM_STACK_SPACE (fndecl) and
REG_PARM_STACK_SPACE (current_function_decl), then we can't perform a
sibcall/tailcall optimization.
So the pattern that we want to check a property of fndecl and
current_function_decl and if they don't match, then don't do a sibcall
is repeated in a few places.
Assuming you bootstrap & test successfully, consider a patch which fixes
this pre-approved.
jeff