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 C70193854815 for ; Mon, 14 Dec 2020 16:37:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C70193854815 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 7A6EB30E; Mon, 14 Dec 2020 08:37:39 -0800 (PST) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.126]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EDE1A3F66B; Mon, 14 Dec 2020 08:37:38 -0800 (PST) From: Richard Sandiford To: Jeff Law Mail-Followup-To: Jeff Law , gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Cc: gcc-patches@gcc.gnu.org Subject: Re: [19/23] rtlanal: Add some new helper classes References: Date: Mon, 14 Dec 2020 16:37:37 +0000 In-Reply-To: (Jeff Law's message of "Sun, 13 Dec 2020 10:30:47 -0700") 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-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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, 14 Dec 2020 16:37:41 -0000 Jeff Law writes: > On 11/13/20 1:20 AM, Richard Sandiford via Gcc-patches wrote: >> This patch adds some classes for gathering the list of registers >> and memory that are read and written by an instruction, along >> with various properties about the accesses. In some ways it's >> similar to the information that DF collects for registers, >> but extended to memory. The main reason for using it instead >> of DF is that it can analyse tentative changes to instructions >> before they've been committed. >> >> The classes also collect general information about the instruction, >> since it's cheap to do and helps to avoid multiple walks of the same >> RTL pattern. >> >> I've tried to optimise the code quite a bit, since with later patches >> it becomes relatively performance-sensitive. See the discussion in >> the comments for the trade-offs involved. >> >> I put the declarations in a new rtlanal.h header file since it >> seemed a bit excessive to put so much new inline stuff in rtl.h. >> >> gcc/ >> * rtlanal.h: New file. >> (MEM_REGNO): New constant. >> (rtx_obj_flags): New namespace. >> (rtx_obj_reference, rtx_properties): New classes. >> (growing_rtx_properties, vec_rtx_properties_base): Likewise. >> (vec_rtx_properties): New alias. >> * rtlanal.c: Include it. >> (rtx_properties::try_to_add_reg): New function. >> (rtx_properties::try_to_add_dest): Likewise. >> (rtx_properties::try_to_add_src): Likewise. >> (rtx_properties::try_to_add_pattern): Likewise. >> (rtx_properties::try_to_add_insn): Likewise. >> (vec_rtx_properties_base::grow): Likewise. > One might argue at least some of these should become first class > properties of insns but then we have the joy of keeping them up-to-date > as transformations are made.=C2=A0 It also reminds me a bit of the old > var_ann stuff we had in the tree SSA implementation.=C2=A0 Yeah. The RTL SSA insn info does store these properties, but that has the advantage of being new code and so can require all updates to go through new interfaces. I agree that ideally we'd store the information directly in RTL insns instead. I guess one question is where we would store the new flags. In some ways it might be easier to do that after any future split of rtx_insn and rtx, since we could then use a smaller code field and potentially replace the mode field. (Things like :TI markers for VLIW bundles could use a separate flag instead.) It might even be possible to do the update fairly cheaply, if we made the generators record static flags for the fixed part of the pattern and only computed the operand information dynamically. Thanks, Richard