We currently call rs6000_emit_epilogue with a boolean parameter saying if this is for a sibcall. We also need to create epilogues for eh_return. This isn't yet indicated directly: instead, we get an eh_return epilogue if crtl->calls_eh_return and this is not a sibcall.
This patch changes things so there is a three-way enum argument. What is called "normal" now can still actually be "eh_return". The rs6000_emit_epilogue function still uses an "int sibcall" variable internally. Tested on powerpc*-linux; committing to trunk. Segher 2019-05-14 Segher Boessenkool <seg...@kernel.crashing.org> * config/rs6000/rs6000-protos.h (rs6000_emit_epilogue): Change arguments. * config/rs6000/rs6000.c (rs6000_emit_epilogue): Change arguments. * config/rs6000/rs6000.md (epilogue_type): New define_enum. (sibcall_epilogue): Adjust. (epilogue): Adjust. --- gcc/config/rs6000/rs6000-protos.h | 2 +- gcc/config/rs6000/rs6000.c | 3 ++- gcc/config/rs6000/rs6000.md | 6 ++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h index 8466368..9718ada 100644 --- a/gcc/config/rs6000/rs6000-protos.h +++ b/gcc/config/rs6000/rs6000-protos.h @@ -190,7 +190,7 @@ extern alias_set_type get_TOC_alias_set (void); extern void rs6000_emit_prologue (void); extern void rs6000_emit_load_toc_table (int); extern unsigned int rs6000_dbx_register_number (unsigned int, unsigned int); -extern void rs6000_emit_epilogue (int); +extern void rs6000_emit_epilogue (enum epilogue_type); extern void rs6000_expand_split_stack_prologue (void); extern void rs6000_split_stack_space_check (rtx, rtx); extern void rs6000_emit_eh_reg_restore (rtx, rtx); diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index b886f58..2992ba5 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -27874,8 +27874,9 @@ emit_cfa_restores (rtx cfa_restores) /* Emit function epilogue as insns. */ void -rs6000_emit_epilogue (int sibcall) +rs6000_emit_epilogue (enum epilogue_type epilogue_type) { + int sibcall = (epilogue_type == EPILOGUE_TYPE_SIBCALL); rs6000_stack_t *info; int restoring_GPRs_inline; int restoring_FPRs_inline; diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 8da7aba..c3181e7 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -174,6 +174,8 @@ (define_c_enum "unspecv" UNSPECV_SPEC_BARRIER ; Speculation barrier ]) +; The three different kinds of epilogue. +(define_enum "epilogue_type" [normal sibcall eh_return]) ;; Define an insn type attribute. This is used in function unit delay ;; computations. @@ -10941,7 +10943,7 @@ (define_expand "sibcall_epilogue" { if (!TARGET_SCHED_PROLOG) emit_insn (gen_blockage ()); - rs6000_emit_epilogue (TRUE); + rs6000_emit_epilogue (EPILOGUE_TYPE_SIBCALL); DONE; }) @@ -12881,7 +12883,7 @@ (define_expand "epilogue" { if (!TARGET_SCHED_PROLOG) emit_insn (gen_blockage ()); - rs6000_emit_epilogue (FALSE); + rs6000_emit_epilogue (EPILOGUE_TYPE_NORMAL); DONE; }) -- 1.8.3.1