diff mbox

Fix PR66870 ppc64le, ppc64 split stack

Message ID 55BA8954.6070101@linux.vnet.ibm.com
State New
Headers show

Commit Message

Lynn A. Boger July 30, 2015, 8:30 p.m. UTC
The attached patch fixes a problem identified in PR66870 with
split stack on ppc64 and ppc64le.  If flag_split_stack is true, but
the function being processed has the no_split_stack attribute, then
the split stack prologue should not be generated.

Bootstrapped on ppc64le-linux and ppc64-linux, passed the
go and libgo testsuites (where split stack is enabled by default).


gcc/ChangeLog

2015-07-30    Lynn Boger <laboger@linux.vnet.ibm.com>

                 PR66870
                 * gcc/config/rs6000/rs6000.c:  Add check for no_split_stack
                 function attribute along with flag_split_stack check to
                 determine when to generate split stack prologue for
                 ppc64 and ppc64le.
diff mbox

Patch

Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c	(revision 226401)
+++ gcc/config/rs6000/rs6000.c	(working copy)
@@ -23736,6 +23736,10 @@  rs6000_emit_prologue (void)
   int using_static_chain_p = (cfun->static_chain_decl != NULL_TREE
 			      && df_regs_ever_live_p (STATIC_CHAIN_REGNUM)
 			      && call_used_regs[STATIC_CHAIN_REGNUM]);
+  int using_split_stack = flag_split_stack &&
+   (lookup_attribute ("no_split_stack", DECL_ATTRIBUTES (cfun->decl))
+         == NULL);
+ 
   /* Offset to top of frame for frame_reg and sp respectively.  */
   HOST_WIDE_INT frame_off = 0;
   HOST_WIDE_INT sp_off = 0;
@@ -24006,7 +24010,7 @@  rs6000_emit_prologue (void)
       && info->cr_save_p
       && REGNO (frame_reg_rtx) != cr_save_regno
       && !(using_static_chain_p && cr_save_regno == 11)
-      && !(flag_split_stack && cr_save_regno == 12 && sp_adjust))
+      && !(using_split_stack && cr_save_regno == 12 && sp_adjust))
     {
       cr_save_rtx = gen_rtx_REG (SImode, cr_save_regno);
       START_USE (cr_save_regno);
@@ -24584,7 +24588,7 @@  rs6000_emit_prologue (void)
       if ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
 	  && !using_static_chain_p)
 	save_regno = 11;
-      else if (flag_split_stack || REGNO (frame_reg_rtx) == 12)
+      else if (using_split_stack || REGNO (frame_reg_rtx) == 12)
 	{
 	  save_regno = 11;
 	  if (using_static_chain_p)
@@ -24687,7 +24691,7 @@  rs6000_emit_prologue (void)
       emit_insn (gen_frame_store (reg, sp_reg_rtx, RS6000_TOC_SAVE_SLOT));
     }
 
-  if (flag_split_stack && split_stack_arg_pointer_used_p ())
+  if (using_split_stack && split_stack_arg_pointer_used_p ())
     {
       /* Set up the arg pointer (r12) for -fsplit-stack code.  If
 	 __morestack was called, it left the arg pointer to the old
@@ -26274,7 +26278,10 @@  rs6000_expand_split_stack_prologue (void)
 static rtx
 rs6000_internal_arg_pointer (void)
 {
-  if (flag_split_stack)
+  if (flag_split_stack
+     && (lookup_attribute ("no_split_stack", DECL_ATTRIBUTES (cfun->decl))
+         == NULL))
+
     {
       if (cfun->machine->split_stack_arg_pointer == NULL_RTX)
 	{