diff options
author | Alan Modra <amodra@gmail.com> | 2020-09-18 23:03:11 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2020-09-24 11:40:02 +0930 |
commit | 199baa71f7a6c8f255afdda03cd3b2644f8f0fcd (patch) | |
tree | 5a93a33b6d2cc716ddcc5b0ba16bb74839b93b96 /gcc | |
parent | 6b828f69519a50e6e2961b62ea552bf89d287199 (diff) | |
download | gcc-199baa71f7a6c8f255afdda03cd3b2644f8f0fcd.zip gcc-199baa71f7a6c8f255afdda03cd3b2644f8f0fcd.tar.gz gcc-199baa71f7a6c8f255afdda03cd3b2644f8f0fcd.tar.bz2 |
[RS6000] PR97107, libgo fails to build for power10
Calls from split-stack code to non-split-stack code need to expand
mapped stack memory via __morestack. Even tail calls.
__morestack is quite a surprising function on powerpc in that it calls
back to its caller, and a tail call will continue running in the
context of extra mapped stack.
PR target/97107
* config/rs6000/rs6000-internal.h (struct rs6000_stack): Improve
calls_p comment.
* config/rs6000/rs6000-logue.c (rs6000_stack_info): Likewise.
(rs6000_expand_split_stack_prologue): Emit the prologue for
functions that make a sibling call.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/config/rs6000/rs6000-internal.h | 2 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000-logue.c | 15 |
2 files changed, 14 insertions, 3 deletions
diff --git a/gcc/config/rs6000/rs6000-internal.h b/gcc/config/rs6000/rs6000-internal.h index 9caef01..32681b6 100644 --- a/gcc/config/rs6000/rs6000-internal.h +++ b/gcc/config/rs6000/rs6000-internal.h @@ -32,7 +32,7 @@ typedef struct rs6000_stack { 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 */ diff --git a/gcc/config/rs6000/rs6000-logue.c b/gcc/config/rs6000/rs6000-logue.c index 0f88ec1..d90cd57 100644 --- a/gcc/config/rs6000/rs6000-logue.c +++ b/gcc/config/rs6000/rs6000-logue.c @@ -714,7 +714,7 @@ rs6000_stack_info (void) 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. */ @@ -5479,7 +5479,18 @@ rs6000_expand_split_stack_prologue (void) 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]) { |