From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rock.gnat.com (rock.gnat.com [205.232.38.15]) by sourceware.org (Postfix) with ESMTPS id 2D4AC382C171 for ; Wed, 26 Oct 2022 21:30:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2D4AC382C171 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 15A9311636E; Wed, 26 Oct 2022 17:30:03 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at gnat.com Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id wNDk69j-o8s1; Wed, 26 Oct 2022 17:30:03 -0400 (EDT) Received: from free.home (tron.gnat.com [IPv6:2620:20:4000:0:46a8:42ff:fe0e:e294]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPS id AE05B11632C; Wed, 26 Oct 2022 17:30:02 -0400 (EDT) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 29QLTtmK137834 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 26 Oct 2022 18:29:56 -0300 From: Alexandre Oliva To: Qing Zhao Cc: "gcc-patches\@gcc.gnu.org" Subject: Re: [PATCH zero-call-used-regs] Add leafy mode for zero-call-used-regs Organization: Free thinker, does not speak for AdaCore References: <66ECAC37-E763-4469-B31A-7A2B031026F4@oracle.com> <0DA25420-AE6D-418B-B2F6-7A99BCC34345@oracle.com> Errors-To: aoliva@lxoliva.fsfla.org Date: Wed, 26 Oct 2022 18:29:55 -0300 In-Reply-To: <0DA25420-AE6D-418B-B2F6-7A99BCC34345@oracle.com> (Qing Zhao's message of "Tue, 25 Oct 2022 15:22:31 +0000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Oct 25, 2022, Qing Zhao wrote: >> 'all' for leaf functions is likely wasteful. If no other functions are >> called, one can determine exactly which registers might carry >> information out and thus need zeroing, and 'used' is thus likely enough, >> depending on the purpose of register scrubbing. (In some scenarios, it >> might make sense to want scrubbing of all registers, even unused ones >> that carry incoming values) > Under what kinds of situations, we should clear the un-used registers > for leaf functions? The one (admittedly contrived) scenario that comes to mind is calling an out-of-line, empty leaf function with 'all' for explicit register scrubbing at desired points in the program. I.e., this empty leaf function would be in charge of scrubbing the caller's registers. It could even be tail-called. I'm sure there are other scenarios in which keeping at least the possibility of 'all' is useful. > Now I am wondering whether we should make =E2=80=9Cleafy=E2=80=9D mode by= default then? I'm not sure what you mean by default. I think "skip" is the right default for general use, where register scrubbing is not explicitly requested. When it is, perhaps -fzero-call-used-regs without '=3D' could be 'leafy' indeed or, even better, the extended form thereof that is in search of a name and so far unimplemented. > Another thing is, do you have any information on how much this new mode c= an save the=20 > code size and run-time compared to mode =E2=80=9Call=E2=80=9D? I'm afraid I have not performed any measurements. >> I have not (yet?) implemented this variant; I haven't even found a name >> I'm happy with for it. (seal? plug? cork? another leak antonym?) > For this improvement, I am still thinking no need to add a new mode, > just add it by default? Even if it is default, it may still need a name to appear before e.g. '-gpr'. 'default-gpr' might do, but I'm not happy with it either. --=20 Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/ Free Software Activist GNU Toolchain Engineer Disinformation flourishes because many people care deeply about injustice but very few check the facts. Ask me about