public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Regarding STATIC_CHAIN_REGNUM
@ 2019-04-04  1:29 William Tambe
  2019-04-04 12:54 ` Florian Weimer
  2019-04-04 14:26 ` Jeff Law
  0 siblings, 2 replies; 6+ messages in thread
From: William Tambe @ 2019-04-04  1:29 UTC (permalink / raw)
  To: gcc-help

Does the prologue and epilogue need to save and restore STATIC_CHAIN_REGNUM ?
or does GCC automatically takes care of it ?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Regarding STATIC_CHAIN_REGNUM
  2019-04-04  1:29 Regarding STATIC_CHAIN_REGNUM William Tambe
@ 2019-04-04 12:54 ` Florian Weimer
  2019-04-04 13:05   ` William Tambe
  2019-04-04 14:26 ` Jeff Law
  1 sibling, 1 reply; 6+ messages in thread
From: Florian Weimer @ 2019-04-04 12:54 UTC (permalink / raw)
  To: William Tambe; +Cc: gcc-help

* William Tambe:

> Does the prologue and epilogue need to save and restore STATIC_CHAIN_REGNUM ?
> or does GCC automatically takes care of it ?

I don't think GCC will save it.  It's a caller-saved register on some
architectures, after all (e.g. x86-64).

Thanks,
Florian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Regarding STATIC_CHAIN_REGNUM
  2019-04-04 12:54 ` Florian Weimer
@ 2019-04-04 13:05   ` William Tambe
  0 siblings, 0 replies; 6+ messages in thread
From: William Tambe @ 2019-04-04 13:05 UTC (permalink / raw)
  To: Florian Weimer; +Cc: gcc-help

So far I am not seeing any architectures explicitly saving/restoring
the STATIC_CHAIN_REGNUM as part of their prologue/epilogue.

Is it enough to mark the STATIC_CHAIN_REGNUM in CALL_USED_REGISTERS ?

On Thu, Apr 4, 2019 at 7:54 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> * William Tambe:
>
> > Does the prologue and epilogue need to save and restore STATIC_CHAIN_REGNUM ?
> > or does GCC automatically takes care of it ?
>
> I don't think GCC will save it.  It's a caller-saved register on some
> architectures, after all (e.g. x86-64).
>
> Thanks,
> Florian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Regarding STATIC_CHAIN_REGNUM
  2019-04-04  1:29 Regarding STATIC_CHAIN_REGNUM William Tambe
  2019-04-04 12:54 ` Florian Weimer
@ 2019-04-04 14:26 ` Jeff Law
  2019-04-04 14:32   ` William Tambe
  1 sibling, 1 reply; 6+ messages in thread
From: Jeff Law @ 2019-04-04 14:26 UTC (permalink / raw)
  To: William Tambe, gcc-help

On 4/3/19 7:29 PM, William Tambe wrote:
> Does the prologue and epilogue need to save and restore STATIC_CHAIN_REGNUM ?
> or does GCC automatically takes care of it ?
> If a callee-saved register is used, then the prologue will need to
save/restore it.  That should apply to STATIC_CHAIN_REGNUM, PIC_REGNUM
and others.

However, typically STATIC_CHAIN_REGNUM is caller-saved -- after all it's
effectively a hidden parameter.

Jeff

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Regarding STATIC_CHAIN_REGNUM
  2019-04-04 14:26 ` Jeff Law
@ 2019-04-04 14:32   ` William Tambe
  2019-04-04 14:38     ` Jeff Law
  0 siblings, 1 reply; 6+ messages in thread
From: William Tambe @ 2019-04-04 14:32 UTC (permalink / raw)
  To: Jeff Law; +Cc: gcc-help

Since STATIC_CHAIN_REGNUM is typically caller-saved, does that mean it
needs to be set 1 in CALL_USED_REGISTERS ?

On Thu, Apr 4, 2019 at 9:26 AM Jeff Law <law@redhat.com> wrote:
>
> On 4/3/19 7:29 PM, William Tambe wrote:
> > Does the prologue and epilogue need to save and restore STATIC_CHAIN_REGNUM ?
> > or does GCC automatically takes care of it ?
> > If a callee-saved register is used, then the prologue will need to
> save/restore it.  That should apply to STATIC_CHAIN_REGNUM, PIC_REGNUM
> and others.
>
> However, typically STATIC_CHAIN_REGNUM is caller-saved -- after all it's
> effectively a hidden parameter.
>
> Jeff

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Regarding STATIC_CHAIN_REGNUM
  2019-04-04 14:32   ` William Tambe
@ 2019-04-04 14:38     ` Jeff Law
  0 siblings, 0 replies; 6+ messages in thread
From: Jeff Law @ 2019-04-04 14:38 UTC (permalink / raw)
  To: William Tambe; +Cc: gcc-help

On 4/4/19 8:31 AM, William Tambe wrote:
> Since STATIC_CHAIN_REGNUM is typically caller-saved, does that mean it
> needs to be set 1 in CALL_USED_REGISTERS ?
Yes since normally you won't have a static chain and the register can be
used by the register allocator.

jeff

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-04-04 14:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-04  1:29 Regarding STATIC_CHAIN_REGNUM William Tambe
2019-04-04 12:54 ` Florian Weimer
2019-04-04 13:05   ` William Tambe
2019-04-04 14:26 ` Jeff Law
2019-04-04 14:32   ` William Tambe
2019-04-04 14:38     ` Jeff Law

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).