From 5def232a0bf5d4c0e521f0d2e0516a14c46e6ee6 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 10 May 2016 08:42:20 +0930 Subject: [PATCH] [RS6000] Stop regrename twiddling with split-stack prologue PR target/70947 * config/rs6000/rs6000.c (rs6000_expand_split_stack_prologue): Stop regrename modifying insns saving lr before __morestack call. * config/rs6000/rs6000.md (split_stack_return): Similarly for insns restoring lr after __morestack call. From-SVN: r236052 --- gcc/ChangeLog | 8 ++++++++ gcc/config/rs6000/rs6000.c | 5 +++++ gcc/config/rs6000/rs6000.md | 4 +++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 42152ef20c4..687ab97b450 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2016-05-10 Alan Modra + + PR target/70947 + * config/rs6000/rs6000.c (rs6000_expand_split_stack_prologue): Stop + regrename modifying insns saving lr before __morestack call. + * config/rs6000/rs6000.md (split_stack_return): Similarly for + insns restoring lr after __morestack call. + 2016-05-09 Jakub Jelinek * config/i386/i386.md (set_got, set_got_labelled, lwp_llwpcb, diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 34495f3c99d..007bf5758d8 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -27993,6 +27993,11 @@ rs6000_expand_split_stack_prologue (void) const0_rtx, const0_rtx)); call_fusage = NULL_RTX; use_reg (&call_fusage, r12); + /* Say the call uses r0, even though it doesn't, to stop regrename + from twiddling with the insns saving lr, trashing args for cfun. + The insns restoring lr are similarly protected by making + split_stack_return use r0. */ + use_reg (&call_fusage, r0); add_function_usage_to (insn, call_fusage); emit_insn (gen_frame_load (r0, r1, info->lr_save_offset)); insn = emit_move_insn (lr, r0); diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index ed1989cd2a6..349bcca62e4 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -12587,8 +12587,10 @@ (set_attr "indexed" "no")]) ;; A return instruction which the middle-end doesn't see. +;; Use r0 to stop regrename twiddling with lr restore insns emitted +;; after the call to __morestack. (define_insn "split_stack_return" - [(unspec_volatile [(const_int 0)] UNSPECV_SPLIT_STACK_RETURN)] + [(unspec_volatile [(use (reg:SI 0))] UNSPECV_SPLIT_STACK_RETURN)] "" "blr" [(set_attr "type" "jmpreg")]) -- 2.30.2