public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Eric Botcazou <ebotcazou@adacore.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [rs6000] Do not generate sibling call to nested function
Date: Tue, 18 Sep 2018 15:26:00 -0000	[thread overview]
Message-ID: <20180918145610.GS23155@gate.crashing.org> (raw)
In-Reply-To: <2045800.G86V45WoCa@polaris>

Hi!

On Mon, Sep 17, 2018 at 11:11:53AM +0200, Eric Botcazou wrote:
> more precisely, to a nested function that requires a static chain.  The reason 
> is that the sibling call epilogue may clobber the static chain register r11.
> 
> Tested on PowerPC/Linux, OK for the mainline?
> 
> 
> 2018-09-17  Eric Botcazou  <ebotcazou@adacore.com>
> 
> 	* config/rs6000/rs6000.c (rs6000_function_ok_for_sibcall): Return false
> 	if the call takes a static chain.


> --- config/rs6000/rs6000.c	(revision 264342)
> +++ config/rs6000/rs6000.c	(working copy)
> @@ -24332,6 +24332,10 @@ rs6000_function_ok_for_sibcall (tree dec
>  {
>    tree fntype;
>  
> +  /* The sibcall epilogue may clobber the static chain register.  */
> +  if (CALL_EXPR_STATIC_CHAIN (exp))
> +    return false;
> +
>    if (decl)
>      fntype = TREE_TYPE (decl);
>    else

We could probably make sibcalls work with static chain, but that is most
likely not worth it.  Could you change the comment to say something like
that?

Approved for trunk and backports.  Thanks!


Segher

  reply	other threads:[~2018-09-18 14:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-17  9:14 Eric Botcazou
2018-09-18 15:26 ` Segher Boessenkool [this message]
2018-09-24 13:20   ` Kyrill Tkachov
2018-09-25 10:10     ` Eric Botcazou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180918145610.GS23155@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=ebotcazou@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).