From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) by sourceware.org (Postfix) with ESMTPS id F0D433857C4D for ; Mon, 21 Sep 2020 20:58:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org F0D433857C4D Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 08LKicsB061926; Mon, 21 Sep 2020 20:58:35 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 33ndnu8wyt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 21 Sep 2020 20:58:35 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 08LKkKZ0080766; Mon, 21 Sep 2020 20:58:35 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3020.oracle.com with ESMTP id 33nurrgxrc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 21 Sep 2020 20:58:35 +0000 Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 08LKwQno027595; Mon, 21 Sep 2020 20:58:27 GMT Received: from dhcp-10-154-191-206.vpn.oracle.com (/10.154.191.206) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 21 Sep 2020 13:58:26 -0700 From: Qing Zhao Message-Id: Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.15\)) Subject: Re: PING [Patch][Middle-end]Add -fzero-call-used-regs=[skip|used-gpr|all-gpr|used|all] Date: Mon, 21 Sep 2020 15:58:25 -0500 In-Reply-To: <20200921203427.GE28786@gate.crashing.org> Cc: Richard Sandiford , Kees Cook , Kees Cook via Gcc-patches , Jakub Jelinek , Uros Bizjak , "Rodriguez Bahena, Victor" To: Segher Boessenkool References: <202009101158.B6A3E1AD17@keescook> <20200911161406.GC28786@gate.crashing.org> <54F98306-1840-40F2-8085-83767B6B5F8B@ORACLE.COM> <57ECA9F8-9C79-4631-9214-12EAFA6A176E@ORACLE.COM> <8AE3E0AC-177F-40EE-90E6-FC6CE58717A5@ORACLE.COM> <20200918225151.GW28786@gate.crashing.org> <20200921203427.GE28786@gate.crashing.org> X-Mailer: Apple Mail (2.3445.104.15) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9751 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 bulkscore=0 mlxscore=0 suspectscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009210153 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9751 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 lowpriorityscore=0 phishscore=0 adultscore=0 suspectscore=0 bulkscore=0 clxscore=1015 impostorscore=0 mlxlogscore=999 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009210153 X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, HTML_MESSAGE, KAM_SHORT, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Sep 2020 20:58:42 -0000 > On Sep 21, 2020, at 3:34 PM, Segher Boessenkool = wrote: >=20 > On Mon, Sep 21, 2020 at 09:13:58AM -0500, Qing Zhao wrote: >>> On Sep 18, 2020, at 5:51 PM, Segher Boessenkool = wrote: >>>> B. Will provide a default definition in middle end to generate the = zeroing insn for selected registers. Then need to add a new target hook = =E2=80=9CZERO_CALL_USED_REGNO_P(REGNO, GPR_ONLY)=E2=80=9D, same as A, = X86 implementation will be provided in my patch.=20 >>>=20 >>> Is this just to make the xor thing work? i386 has a peephole to >>> transform the mov to a xor for this (and the backend could just = handle >>> it in its mov patterns, maybe a peephole was easier for i386, no >>> idea). >>=20 >> You mean what=E2=80=99s the purpose of the new target hook = =E2=80=9CZERO_CALL_USED_REGNO_P(REGNO, GPR_ONLY)? >>=20 >> The purpose of this new target hook is for the target to delete some = of the call_used registers that should not be zeroed, for example, the = stack registers in X86. (St0-st7).=20 >=20 > Oh, I didn't see the _P. Maybe give it a better name? Also, a better > interface altogether, a call per hard register is a bit much (and = easily > avoidable). >=20 >> For other platforms, there might be other call_used registers that = should not be zeroed.=20 >=20 > But you cannot *add* anything with this interface, and it cannot = return > different results depending on which return insn this is. It is not a > good abstraction IMO. This hook will not depend on which return insn. It just check whether = the specified register can be zeroed for this target, for example, it = will exclude stack register (st0 to st7), MMX registers (mm0 to mm7) and = mask registers (t0 to t7) for X86 target from zeroing.=20 The information depending on which return should be reflected in the = data flow information, which we can easily get from middle-end=E2=80=99s = data flow analysis.=20 I have added such target hook in the previous patch as:=20 https://gcc.gnu.org/pipermail/gcc-patches/2020-July/550018.html = However, I got several comments on too much target specific details = exposed unnecessary in the very beginning of the discussion.=20 However, If we want to add a default implementation in the middle end as = Richard suggested, this target hook might be necessary. Qing >=20 >=20 > Segher