From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 668C43858423; Mon, 7 Aug 2023 15:34:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 668C43858423 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1691422458; bh=mF6+1y5SK/vzSpLum3Iw/DQfyPFYXPh+LIYRSriVdM8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=R7qGP+2UpN6+mti2leDNzcceizbQ4w9FgGzJitEutG6j4ZNIDPwb6ih9wBo0EMO5d qAAvWAdvH2OkoBMKt2Acj52vBBz8EvVitQFNZp10MUprMON0tei5nurC6uE5OnZzCy qAOA9K0qaK/miFJ6JIPy+jzVRazP8Uk2gQFoCi3I= From: "matz at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: matz at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110899 --- Comment #7 from Michael Matz --- (In reply to Florian Weimer from comment #5) > > It also makes argument registers be callee-saved, which is very > > unconventional. >=20 > 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 'th= is' is simply the first pointer argument). The sense of that deviation lies in observing that 'this' usually isn't cha= nged by the callee. For arbitrary arguments this doesn't hold, they belong to t= he 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_a= ll > > function > > (hint: such call can't usually be done)? >=20 > 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)=