public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "matz at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/110899] RFE: Attributes preserve_most and preserve_all
Date: Mon, 07 Aug 2023 15:34:17 +0000	[thread overview]
Message-ID: <bug-110899-4-ZRO3ylQeTu@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110899-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110899

--- Comment #7 from Michael Matz <matz at gcc dot gnu.org> ---
(In reply to Florian Weimer from comment #5)
> > It also makes argument registers be callee-saved, which is very
> > unconventional.
> 
> Isn't this done for the this pointer in some C++ ABIs?

There are some, yes.  But those are then incompatible with the normal
definition of C++ calling conventions in terms of the ones for C (where 'this'
is simply
the first pointer argument).

The sense of that deviation lies in observing that 'this' usually isn't changed
by the callee.  For arbitrary arguments this doesn't hold, they belong to the
called function and so using a call-clobbered reg makes most sense.  It's
possible to do different of course, but it's very unusual.

> > Does the clang implementation take into account the various problematic
> > cases that arise when calling a normal function from a (say) preserve_all
> > function
> > (hint: such call can't usually be done)?
> 
> How so? We need to version the __preserve_most__ attribute with the ISA
> level, of course.

I don't see how that helps.  Imagine a preserve_all function foo that calls
printf.  How do you propose that 'foo' saves all parts of the SSE registers,
even those that aren't invented yet, or those that can't be touched by the
current ISA?  (printf might clobber all of these)

  parent reply	other threads:[~2023-08-07 15:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-04 13:57 [Bug target/110899] New: " elver at google dot com
2023-08-04 14:19 ` [Bug target/110899] " pinskia at gcc dot gnu.org
2023-08-07  8:38 ` rguenth at gcc dot gnu.org
2023-08-07 12:28 ` fw at gcc dot gnu.org
2023-08-07 12:55 ` matz at gcc dot gnu.org
2023-08-07 12:59 ` matz at gcc dot gnu.org
2023-08-07 13:42 ` fw at gcc dot gnu.org
2023-08-07 13:55 ` hubicka at gcc dot gnu.org
2023-08-07 15:34 ` matz at gcc dot gnu.org [this message]
2023-08-07 16:19 ` fw at gcc dot gnu.org
2023-08-07 16:24 ` matz at gcc dot gnu.org
2023-08-08  8:59 ` fw at gcc dot gnu.org
2023-08-08 12:47 ` matz at gcc dot gnu.org
2023-12-25 11:04 ` sjames at gcc dot gnu.org
2023-12-28 21:26 ` pinskia at gcc dot gnu.org

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=bug-110899-4-ZRO3ylQeTu@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).