i386.c (ix86_function_regparm): Save an extra register for -fsplit-stack with DECL_ST...
authorIan Lance Taylor <iant@google.com>
Mon, 20 Mar 2017 17:43:08 +0000 (17:43 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Mon, 20 Mar 2017 17:43:08 +0000 (17:43 +0000)
* config/i386/i386.c (ix86_function_regparm): Save an extra
register for -fsplit-stack with DECL_STATIC_CHAIN.

From-SVN: r246286

gcc/ChangeLog
gcc/config/i386/i386.c

index 7164d10df6bccb749aafb412b4c6d0bffb563880..1385d92bcdf2535fd66422c13710391bf42d171a 100644 (file)
@@ -1,3 +1,8 @@
+2017-03-20  Ian Lance Taylor  <iant@google.com>
+
+       * config/i386/i386.c (ix86_function_regparm): Save an extra
+       register for -fsplit-stack with DECL_STATIC_CHAIN.
+
 2017-03-17  Palmer Dabbelt  <palmer@dabbelt.com>
 
        PR target/79912
index f58d529604c4208d936ca898f45a44eff9032ee5..259f97b5a10e4580cc4405891398051fc29e6fed 100644 (file)
@@ -7975,8 +7975,14 @@ ix86_function_regparm (const_tree type, const_tree decl)
                local_regparm = 2;
 
              /* Save a register for the split stack.  */
-             if (local_regparm == 3 && flag_split_stack)
-               local_regparm = 2;
+             if (flag_split_stack)
+               {
+                 if (local_regparm == 3)
+                   local_regparm = 2;
+                 else if (local_regparm == 2
+                          && DECL_STATIC_CHAIN (target->decl))
+                   local_regparm = 1;
+               }
 
              /* Each fixed register usage increases register pressure,
                 so less registers should be used for argument passing.