From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ln01.mxout.alfaservers.com (ln01.mxout.alfaservers.com [85.17.185.57]) by sourceware.org (Postfix) with ESMTPS id E1DAE3858034 for ; Fri, 23 Oct 2020 07:27:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E1DAE3858034 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=blueice.be Authentication-Results: sourceware.org; spf=none smtp.mailfrom=henri.cloetens@blueice.be Received: from [91.176.63.30] (port=45890 helo=[192.168.250.29]) by ln01.alfaservers.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1kVrUD-0002Gb-MX; Fri, 23 Oct 2020 09:27:41 +0200 Subject: Re: How to recognize registers after reload ?. To: Jeff Law , Segher Boessenkool Cc: gcc-help References: <20201022222438.GX2672@gate.crashing.org> <82fed76c-e343-a155-4b3d-ef8ab07d2baf@redhat.com> From: Henri Cloetens Message-ID: <734be852-33ed-ee19-88a9-99a5905db5cf@blueice.be> Date: Fri, 23 Oct 2020 09:28:49 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <82fed76c-e343-a155-4b3d-ef8ab07d2baf@redhat.com> Content-Language: en-MW X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - ln01.alfaservers.com X-AntiAbuse: Original Domain - gcc.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - blueice.be X-Get-Message-Sender-Via: ln01.alfaservers.com: authenticated_id: henri.cloetens@blueice.be X-Authenticated-Sender: ln01.alfaservers.com: henri.cloetens@blueice.be X-Source: X-Source-Args: X-Source-Dir: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00, HTML_MESSAGE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no 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; format=flowed Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gcc-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Oct 2020 07:27:46 -0000 Hello Segher, Jeff, - The machine is indeed such that for each operation there is only one   non-register operand possible. - Take a first example, to describe the problem with the combine: void set_to_one(int *a) { *a = 1 ; } In the machine, this becomes: R30 = 1  // move immediate to register [R20] = R30 // move to *a return Now, to get this, there is not one movsi - pattern, because if there is only one, combine will combine both moves into something like [R20] = 1 and this does not exist, and combine crashes. So, there are 2 moves: /movesi_internal_fromreg/ (moving from a register to memory or register) /movesi_internal_toreg/ (moving from immediate, memory, register to register). This is all nice and fine, until the reload step. In case the number of internal registers is exceeded, stuff needs to go on the stack. Now, suppose I have the operation R30 = 1 and the compiler wants to put R30 on the stack, it sees this is not possible, and will make a helper move : R30 = 1 (old one) R100 = R30 and then, it will try to put R100 on the stack. Now, to do the move, R100 = R30, it calls the /movsi/ pattern in the machine description. Only, it declares in the RTX R100 as a register operand, which it is not, or not entirely. It is a stack operand, but my /define_expand movsi/ recognizes it as a register operand, end emits /movesi_internal_toreg/, while it should emit /movesi_internal_fromreg/, and the whole system ends in an endless loop. To solve this decently, I need to find in the /define_expand movsi/ if R100 is a stack operand or not. There is one way, that is to implement TARGET_SECONDARY_RELOAD, have that parse all the arguments, put it in an operand database, and have /define_expand movsi/ interrogate this database. Now, I will only do that if there is no other option. Best Regards, Henri. >