From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 96934 invoked by alias); 14 Jan 2016 16:44:16 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 96784 invoked by uid 89); 14 Jan 2016 16:44:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.4 required=5.0 tests=AWL,BAYES_20,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=krebbel@linux.vnet.ibm.com, sk:krebbel, krebbellinuxvnetibmcom, U*krebbel X-HELO: e06smtp07.uk.ibm.com Received: from e06smtp07.uk.ibm.com (HELO e06smtp07.uk.ibm.com) (195.75.94.103) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Thu, 14 Jan 2016 16:44:14 +0000 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 14 Jan 2016 16:44:11 -0000 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 14 Jan 2016 16:44:08 -0000 X-IBM-Helo: d06dlp02.portsmouth.uk.ibm.com X-IBM-MailFrom: krebbel@linux.vnet.ibm.com X-IBM-RcptTo: gcc-patches@gcc.gnu.org Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 282B32190019 for ; Thu, 14 Jan 2016 16:43:57 +0000 (GMT) Received: from d06av04.portsmouth.uk.ibm.com (d06av04.portsmouth.uk.ibm.com [9.149.37.216]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u0EGi8Ya57606258 for ; Thu, 14 Jan 2016 16:44:08 GMT Received: from d06av04.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u0EGfp33021910 for ; Thu, 14 Jan 2016 09:44:08 -0700 Received: from maggie.boeblingen.de.ibm.com (dyn-9-152-212-123.boeblingen.de.ibm.com [9.152.212.123]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u0EGYE1r015733 (version=TLSv1/SSLv3 cipher=AES256-SHA256 bits=256 verify=NO) for ; Thu, 14 Jan 2016 09:34:56 -0700 From: Andreas Krebbel To: gcc-patches@gcc.gnu.org Subject: [PATCH 1/9] gensupport: Fix define_subst operand renumbering. Date: Thu, 14 Jan 2016 16:44:00 -0000 Message-Id: <1452789254-12603-2-git-send-email-krebbel@linux.vnet.ibm.com> In-Reply-To: <1452789254-12603-1-git-send-email-krebbel@linux.vnet.ibm.com> References: <1452789254-12603-1-git-send-email-krebbel@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16011416-0029-0000-0000-00000578083D X-IsSubscribed: yes X-SW-Source: 2016-01/txt/msg00948.txt.bz2 When processing substitutions the operands are renumbered. To find a free operand number the array used_operands_numbers is used to record the operand numbers already in use. Currently this array is used to assign new numbers *before* all the RTXes in the vector have been processed. I did run into problems with this for insns where a match_dup occurred in a later (use ...) operand referring to an earlier operand (e.g. s390.md "setmem_long"). The patch splits the loop doing the processing into two in order to have all the operand numbers recorded already when assigning new numbers. Bootstrapped and regtested on s390, s390x, and x86_64. Ok for mainline? Bye, -Andreas- gcc/ChangeLog: 2016-01-14 Andreas Krebbel * gensupport.c (process_substs_on_one_elem): Split loop to complete mark_operands_used_in_match_dup on all expressions in the vector first. (adjust_operands_numbers): Inline into process_substs_on_one_elem and remove function. --- gcc/gensupport.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/gcc/gensupport.c b/gcc/gensupport.c index 596b885..8ace425 100644 --- a/gcc/gensupport.c +++ b/gcc/gensupport.c @@ -126,7 +126,10 @@ static const char * duplicate_each_alternative (const char * str, int n_dup); typedef const char * (*constraints_handler_t) (const char *, int); static rtx alter_constraints (rtx, int, constraints_handler_t); -static rtx adjust_operands_numbers (rtx); + +static void mark_operands_used_in_match_dup (rtx); +static void renumerate_operands_in_pattern (rtx); + static rtx replace_duplicating_operands_in_pattern (rtx); /* Make a version of gen_rtx_CONST_INT so that GEN_INT can be used in @@ -1843,7 +1846,15 @@ process_substs_on_one_elem (struct queue_elem *elem, subst_pattern = alter_constraints (subst_pattern, alternatives, duplicate_each_alternative); - subst_pattern = adjust_operands_numbers (subst_pattern); + mark_operands_used_in_match_dup (subst_pattern); + RTVEC_ELT (subst_pattern_vec, j) = subst_pattern; + } + + for (j = 0; j < XVECLEN (subst_elem->data, 3); j++) + { + subst_pattern = RTVEC_ELT (subst_pattern_vec, j); + + renumerate_operands_in_pattern (subst_pattern); /* Substitute match_dup and match_op_dup in the new pattern and duplicate constraints. */ @@ -1856,7 +1867,6 @@ process_substs_on_one_elem (struct queue_elem *elem, if (GET_CODE (elem->data) == DEFINE_EXPAND) remove_constraints (subst_pattern); - RTVEC_ELT (subst_pattern_vec, j) = subst_pattern; } XVEC (elem->data, 1) = subst_pattern_vec; @@ -1976,6 +1986,14 @@ find_first_unused_number_of_operand () It visits all expressions in PATTERN and assigns not-occupied operand indexes to MATCH_OPERANDs and MATCH_OPERATORs of this PATTERN. */ +/* If output pattern of define_subst contains MATCH_DUP, then this + expression would be replaced with the pattern, matched with + MATCH_OPERAND from input pattern. This pattern could contain any + number of MATCH_OPERANDs, MATCH_OPERATORs etc., so it's possible + that a MATCH_OPERAND from output_pattern (if any) would have the + same number, as MATCH_OPERAND from copied pattern. To avoid such + indexes overlapping, we assign new indexes to MATCH_OPERANDs, + laying in the output pattern outside of MATCH_DUPs. */ static void renumerate_operands_in_pattern (rtx pattern) { @@ -2010,23 +2028,6 @@ renumerate_operands_in_pattern (rtx pattern) } } -/* If output pattern of define_subst contains MATCH_DUP, then this - expression would be replaced with the pattern, matched with - MATCH_OPERAND from input pattern. This pattern could contain any - number of MATCH_OPERANDs, MATCH_OPERATORs etc., so it's possible - that a MATCH_OPERAND from output_pattern (if any) would have the - same number, as MATCH_OPERAND from copied pattern. To avoid such - indexes overlapping, we assign new indexes to MATCH_OPERANDs, - laying in the output pattern outside of MATCH_DUPs. */ -static rtx -adjust_operands_numbers (rtx pattern) -{ - mark_operands_used_in_match_dup (pattern); - - renumerate_operands_in_pattern (pattern); - - return pattern; -} /* Generate RTL expression (match_dup OPNO) -- 1.9.1