From dd629845b0931912853a26bf8f8e05adf9f048a2 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 20 Mar 2017 17:43:08 +0000 Subject: [PATCH] i386.c (ix86_function_regparm): Save an extra register for -fsplit-stack with DECL_STATIC_CHAIN. * config/i386/i386.c (ix86_function_regparm): Save an extra register for -fsplit-stack with DECL_STATIC_CHAIN. From-SVN: r246286 --- gcc/ChangeLog | 5 +++++ gcc/config/i386/i386.c | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7164d10df6b..1385d92bcdf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-03-20 Ian Lance Taylor + + * config/i386/i386.c (ix86_function_regparm): Save an extra + register for -fsplit-stack with DECL_STATIC_CHAIN. + 2017-03-17 Palmer Dabbelt PR target/79912 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index f58d529604c..259f97b5a10 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -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. -- 2.30.2