From patchwork Mon Mar 21 01:40:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 599937 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3qSz721P50z9s5w for ; Mon, 21 Mar 2016 12:40:46 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=tOz8FQtD; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:references:mime-version:content-type :in-reply-to; q=dns; s=default; b=mISKhb8znsFK3KTm4tfw0bHLmzeAQf XxpxFIH6ne0sjuWUJssrD1bNcZ4yc5N6RnC0r5dSf46h9y96io4qC069WAKCn7DV 7QlfS1tKUEPWIUwLWhK98Tdv7Q/9LDP/+QdLkd/CjQpwsc5WudsOUfPosVEsytPc xasJ9CI3IUYZw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:references:mime-version:content-type :in-reply-to; s=default; bh=EPAMATcCobcrkOuV4xds3CrW0io=; b=tOz8 FQtDpCGRTrvQiHENqR5SUuzOy3n3iZyFGwR8X2eqXxf61k2YBm7TB5H+vbdiefU/ iriE1u/zQotIAte7BCa8NVFhwudFXccAjDHV86CuDaAgsF+3FGuY1MEN78HhuxXr FAKiTfXtphSN0H4i6VrwAPLqosw6c7hTNmv69co= Received: (qmail 67011 invoked by alias); 21 Mar 2016 01:40:36 -0000 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 Received: (qmail 66193 invoked by uid 89); 21 Mar 2016 01:40:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=death, communication, wish X-HELO: mail-pf0-f195.google.com Received: from mail-pf0-f195.google.com (HELO mail-pf0-f195.google.com) (209.85.192.195) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 21 Mar 2016 01:40:34 +0000 Received: by mail-pf0-f195.google.com with SMTP id u190so27553661pfb.2 for ; Sun, 20 Mar 2016 18:40:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=7BK967dY3uYbHUHyCv1s39cT8zkkd6SMleIAoVSfdgA=; b=Yjio5iWQczOAETUDYBp752zL+MbmQBNmweQLbIsnoUZMMVe2tzy/RlF8WNH1+Sz0YH 5ZU5qjolo4QWUsjnWVx2xdQsvBBxudW3b8kfuPXG0YgnVMXqOxGnLctfODkzTtmcLXdN aJIrm1EIjLki9d7qjCQbYeRl2kJbKYU5dRh7+NKyFlH0AJ08U1dnPEUNyHWyHZ1jrh8k BkYo/VSp68njZfBEdfTnaqZaCf/ciLDDtxsjCQ7mDCFCQEsxeK4CAUpfkUUdQ1oBolos vSORVZLuex2kmHirycY4ehfeS58+TqwsMU4JUsKzy+rle3wRuq946Xzgp3SAGHdkvvgm VypA== X-Gm-Message-State: AD7BkJIrSYoqNu99qRKfWiF+n2TVum75cFdenvKqR0dMkWW+KB0v5JGk3aB42SsyTwS4Ow== X-Received: by 10.98.12.153 with SMTP id 25mr41221536pfm.27.1458524432595; Sun, 20 Mar 2016 18:40:32 -0700 (PDT) Received: from bubble.grove.modra.org (CPE-58-160-146-233.sa.bigpond.net.au. [58.160.146.233]) by smtp.gmail.com with ESMTPSA id g74sm35963799pfj.1.2016.03.20.18.40.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Mar 2016 18:40:32 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 4CFF5EA0153; Mon, 21 Mar 2016 12:10:28 +1030 (ACDT) Date: Mon, 21 Mar 2016 12:10:28 +1030 From: Alan Modra To: gcc-patches@gcc.gnu.org Subject: [PATCH 3/7] ira.c tidies: validate_equiv_mem_from_store Message-ID: <20160321014028.GF22605@bubble.grove.modra.org> References: <20160321013723.GC22605@bubble.grove.modra.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160321013723.GC22605@bubble.grove.modra.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes Lose a couple of static vars. * ira.c (struct equiv_mem_data): New. (equiv_mem, equiv_mem_modified): Delete static vars. (validate_equiv_mem_from_store): Use "data" param to communicate.. (validate_equiv_mem): ..from here. diff --git a/gcc/ira.c b/gcc/ira.c index abd78ff..75abe6e 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -2926,24 +2926,29 @@ struct equivalence structure for that register. */ static struct equivalence *reg_equiv; -/* Used for communication between the following two functions: contains - a MEM that we wish to ensure remains unchanged. */ -static rtx equiv_mem; +/* Used for communication between the following two functions. */ +struct equiv_mem_data +{ + /* A MEM that we wish to ensure remains unchanged. */ + rtx equiv_mem; -/* Set nonzero if EQUIV_MEM is modified. */ -static int equiv_mem_modified; + /* Set true if EQUIV_MEM is modified. */ + bool equiv_mem_modified; +}; /* If EQUIV_MEM is modified by modifying DEST, indicate that it is modified. Called via note_stores. */ static void validate_equiv_mem_from_store (rtx dest, const_rtx set ATTRIBUTE_UNUSED, - void *data ATTRIBUTE_UNUSED) + void *data) { + struct equiv_mem_data *info = (struct equiv_mem_data *) data; + if ((REG_P (dest) - && reg_overlap_mentioned_p (dest, equiv_mem)) + && reg_overlap_mentioned_p (dest, info->equiv_mem)) || (MEM_P (dest) - && anti_dependence (equiv_mem, dest))) - equiv_mem_modified = 1; + && anti_dependence (info->equiv_mem, dest))) + info->equiv_mem_modified = true; } /* Verify that no store between START and the death of REG invalidates @@ -2957,16 +2962,14 @@ validate_equiv_mem (rtx_insn *start, rtx reg, rtx memref) { rtx_insn *insn; rtx note; - - equiv_mem = memref; - equiv_mem_modified = 0; + struct equiv_mem_data info = { memref, false }; /* If the memory reference has side effects or is volatile, it isn't a valid equivalence. */ if (side_effects_p (memref)) return 0; - for (insn = start; insn && ! equiv_mem_modified; insn = NEXT_INSN (insn)) + for (insn = start; insn; insn = NEXT_INSN (insn)) { if (! INSN_P (insn)) continue; @@ -2982,7 +2985,9 @@ validate_equiv_mem (rtx_insn *start, rtx reg, rtx memref) if (CALL_P (insn)) return 0; - note_stores (PATTERN (insn), validate_equiv_mem_from_store, NULL); + note_stores (PATTERN (insn), validate_equiv_mem_from_store, &info); + if (info.equiv_mem_modified) + return 0; /* If a register mentioned in MEMREF is modified via an auto-increment, we lose the equivalence. Do the same if one