int cr_save_p; /* true if the CR reg needs to be saved */
unsigned int vrsave_mask; /* mask of vec registers to save */
int push_p; /* true if we need to allocate stack space */
- int calls_p; /* true if the function makes any calls */
+ int calls_p; /* true if there are non-sibling calls */
int world_save_p; /* true if we're saving *everything*:
r13-r31, cr, f14-f31, vrsave, v20-v31 */
enum rs6000_abi abi; /* which ABI to use */
info->altivec_size = 16 * (LAST_ALTIVEC_REGNO + 1
- info->first_altivec_reg_save);
- /* Does this function call anything? */
+ /* Does this function call anything (apart from sibling calls)? */
info->calls_p = (!crtl->is_leaf || cfun->machine->ra_needs_full_frame);
/* Determine if we need to save the condition code registers. */
gcc_assert (flag_split_stack && reload_completed);
if (!info->push_p)
- return;
+ {
+ /* We need the -fsplit-stack prologue for functions that make
+ tail calls. Tail calls don't count against crtl->is_leaf.
+ Note that we are called inside a sequence. get_insns will
+ just return that (as yet empty) sequence, so instead we
+ access the function rtl with get_topmost_sequence. */
+ for (insn = get_topmost_sequence ()->first; insn; insn = NEXT_INSN (insn))
+ if (CALL_P (insn))
+ break;
+ if (!insn)
+ return;
+ }
if (global_regs[29])
{