From patchwork Fri Nov 19 20:44:28 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 72305 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 034831007D2 for ; Sat, 20 Nov 2010 07:44:39 +1100 (EST) Received: (qmail 32296 invoked by alias); 19 Nov 2010 20:44:38 -0000 Received: (qmail 32288 invoked by uid 22791); 19 Nov 2010 20:44:37 -0000 X-SWARE-Spam-Status: No, hits=-5.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, TW_CR, TW_DR, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 19 Nov 2010 20:44:31 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oAJKiTqW000813 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 19 Nov 2010 15:44:30 -0500 Received: from anchor.twiddle.home (ovpn-113-44.phx2.redhat.com [10.3.113.44]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id oAJKiTpM029958; Fri, 19 Nov 2010 15:44:29 -0500 Message-ID: <4CE6E1AC.4070309@redhat.com> Date: Fri, 19 Nov 2010 12:44:28 -0800 From: Richard Henderson User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101103 Fedora/1.0-0.33.b2pre.fc14 Thunderbird/3.1.6 MIME-Version: 1.0 To: Joern Rennecke CC: gcc-patches@gcc.gnu.org, Pompapathi V Gadad Subject: Re: RFA: Fix crx --enable-werror-always build References: <20101112112249.uy2nt7wlk404w4g4-nzlynne@webmail.spamcop.net> <4CE6C325.8080306@redhat.com> <20101119142121.f2byb6jfok0s0g0w-nzlynne@webmail.spamcop.net> In-Reply-To: <20101119142121.f2byb6jfok0s0g0w-nzlynne@webmail.spamcop.net> X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On 11/19/2010 11:21 AM, Joern Rennecke wrote: > Quoting Richard Henderson : > >> On 11/12/2010 08:22 AM, Joern Rennecke wrote: >>> + gcc_assert (REGNO (reg) != CC_REGNUM); >> >> This is the only change I'm unsure about. I wonder if instead >> the previous IF was supposed to check REG instead of ADDR_REG. > > That seems unlikely, because then the > > && GET_MODE_SIZE (GET_MODE (SUBREG_REG (addr_reg))) > <= UNITS_PER_WORD)) > > check would be redundant. True. Comparing this to the i386 legitimate address predicate I see if ((strict && ! REG_OK_FOR_BASE_STRICT_P (reg)) || (! strict && ! REG_OK_FOR_BASE_NONSTRICT_P (reg))) /* Base is not valid. */ return false; In the crx case, the un-wrapping of the subreg isn't saved back into the crx_address structure, and so the subreg will make it to if (address.base && !REGNO_OK_FOR_BASE_P (REGNO (address.base))) which ought to ICE due to REGNO applied to SUBREG. Which probably will never happen, since this only happens for strict, and I expect that subregs of hard regs are resolved by now. That said, a more correct patch seems like it would be like this: r~ diff --git a/gcc/config/crx/crx.c b/gcc/config/crx/crx.c index 5fc963a..35177a8 100644 --- a/gcc/config/crx/crx.c +++ b/gcc/config/crx/crx.c @@ -590,30 +590,21 @@ crx_function_arg_regno_p (int n) * Scaled index --> reg + reg | 22-bit disp. + reg + reg | * 22-disp. + reg + reg + (2 | 4 | 8) */ -static int crx_addr_reg_p (rtx addr_reg) +static rtx +crx_addr_reg_p (rtx addr_reg) { - rtx reg; + if (GET_MODE (addr_reg) != Pmode) + return NULL_RTX; if (REG_P (addr_reg)) - { - reg = addr_reg; - } - else if ((GET_CODE (addr_reg) == SUBREG + return addr_reg; + else if (GET_CODE (addr_reg) == SUBREG && REG_P (SUBREG_REG (addr_reg)) - && GET_MODE_SIZE (GET_MODE (SUBREG_REG (addr_reg))) - <= UNITS_PER_WORD)) - { - reg = SUBREG_REG (addr_reg); - } + && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (addr_reg))) + <= UNITS_PER_WORD)) + return SUBREG_REG (addr_reg); else - return FALSE; - - if (GET_MODE (addr_reg) != Pmode) - { - return FALSE; - } - - return TRUE; + return NULL_RTX; } enum crx_addrtype @@ -752,8 +743,18 @@ crx_decompose_address (rtx addr, struct crx_address *out) return CRX_INVALID; } - if (base && !crx_addr_reg_p (base)) return CRX_INVALID; - if (index && !crx_addr_reg_p (index)) return CRX_INVALID; + if (base) + { + base = crx_addr_reg_p (base); + if (!base) + return CRX_INVALID; + } + if (index) + { + index = crx_addr_reg_p (index); + if (!index) + return CRX_INVALID; + } out->base = base; out->index = index;