From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 4D7CD3858D1E for ; Wed, 8 Nov 2023 00:15:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4D7CD3858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4D7CD3858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699402519; cv=none; b=Ie0yOgbi+qL/POKXbmPVgwghV3wLyPTK1ULUnZfwosgfsU7i2Vl9a0zr4nN/JxpLkfEPS9rE9We6W66p7AEojwmqo0Yxrczfr/tlovKIiDdHJNeHXLRjplwlTOz5c1AfZfC+H6ZQTBhWD850bLUEaha2iFigVz7J2BOpWgcQfK8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699402519; c=relaxed/simple; bh=iY7xjtSVVOxluXoOllEcxKDj73GK8UTgQQXAcNOB4k0=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=evNH+REgARCG8OS+2272s8NhcKWhorf57cgTFR9tzNyis1Fa6qB1IzCVE3faMP8bBl6pkN4w7WPXdKR5yKpExWgPkOAIphoBHgo6MsoDZ2HpwYCHzLXGOS1buPbGDleG0U89d3+VFs3yipMPH1DH11c1ic5k3EZprpvhtqrWr1A= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 66BE51476; Tue, 7 Nov 2023 16:16:02 -0800 (PST) Received: from localhost (e121540-lin.manchester.arm.com [10.32.110.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 45EDF3F64C; Tue, 7 Nov 2023 16:15:17 -0800 (PST) From: Richard Sandiford To: Jeff Law Mail-Followup-To: Jeff Law ,gcc-patches@gcc.gnu.org, jlaw@ventanamicro.com, richard.sandiford@arm.com Cc: gcc-patches@gcc.gnu.org, jlaw@ventanamicro.com Subject: Re: [PATCH 07/12] mode-switching: Allow targets to set the mode for EH handlers References: Date: Wed, 08 Nov 2023 00:15:16 +0000 In-Reply-To: (Jeff Law's message of "Mon, 6 Nov 2023 18:07:53 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-17.2 required=5.0 tests=BAYES_00,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Thanks for the reviews. Jeff Law writes: > On 11/5/23 11:48, Richard Sandiford wrote: >> The mode-switching pass already had hooks to say what mode >> an entity is in on entry to a function and what mode it must >> be in on return. For SME, we also want to say what mode an >> entity is guaranteed to be in on entry to an exception handler. >> >> gcc/ >> * target.def (mode_switching.eh_handler): New hook. >> * doc/tm.texi.in (TARGET_MODE_EH_HANDLER): New @hook. >> * doc/tm.texi: Regenerate. >> * mode-switching.cc (optimize_mode_switching): Use eh_handler >> to get the mode on entry to an exception handler. > Can we ever have a path to the exception handler triggered by a normal > control flow and if so, presumably we want this to apply in that case too? Not directly AFAIK. The handler has to handle the EH_DATA_REGNOs, call __cxa_begin_catch, etc. So even if there is fall-through at the source level, I think there'd always be a block that is only reached through abnormal control flow. So... > It looks like that's the semantics of the implementation by way to using > bb_has_eh_pred. Just want to make sure that's the semantics you want in > that oddball case. > > Assuming it is the semantics you want, it's OK for the trunk, though you > might want to twiddle the docs slightly to mention that case. ...I think these EH blocks are pure re-entry points. I suppose some targets might have entities whose state is call-preserved, so that it's not changed by EH edges. But that might also apply to other abnormal control flow too, so it's probably a separate issue/feature. Thanks, Richard