From patchwork Sat Oct 25 09:24:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 402998 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 B5556140096 for ; Sat, 25 Oct 2014 20:24:41 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version:content-type; q=dns; s=default; b=pu3Lpvd1dZqD+oId7um/fR2KV4I3sAVkz40aKEg3TP6/IAY7Wb XVWZwaZQXV3Cpq79ayfqMzSM3Pex7Ft6JPN7/RImqjSA7w5uHlimRrU2NkvHuXZQ dExrz+0WCwAi6E7aNuXJzkTjYuOZfJruswIty9UMAKSTRkyGFrijaH1Ko= 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:from :to:cc:subject:date:message-id:mime-version:content-type; s= default; bh=EuXKXzwizMs8hG73IuE1Doz+fIc=; b=RgD0pROqQ4GEr8qteShI LaIhnDblLQLeRpcooKDJklxpUrwHCx1Z95TZIpLmkohnYbZjN5xuAYLrp5PX04tf tUK4q1Kg0Jo3KDbrBh+TkIgW4Lf08flb9ZUfzHNESYIXmxqON02RmHanPdP8XTqN dEvFRe72hlWLzj4FRdobkZ8= Received: (qmail 8070 invoked by alias); 25 Oct 2014 09:24:35 -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 8059 invoked by uid 89); 25 Oct 2014 09:24:34 -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 X-HELO: mail-wi0-f182.google.com Received: from mail-wi0-f182.google.com (HELO mail-wi0-f182.google.com) (209.85.212.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 25 Oct 2014 09:24:33 +0000 Received: by mail-wi0-f182.google.com with SMTP id bs8so2951731wib.3 for ; Sat, 25 Oct 2014 02:24:30 -0700 (PDT) X-Received: by 10.180.95.41 with SMTP id dh9mr9595635wib.0.1414229070475; Sat, 25 Oct 2014 02:24:30 -0700 (PDT) Received: from localhost ([95.144.14.167]) by mx.google.com with ESMTPSA id l5sm4595153wif.3.2014.10.25.02.24.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Oct 2014 02:24:30 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, dj@redhat.com, rdsandiford@googlemail.com Cc: dj@redhat.com Subject: [mep] RFA: Use new rtl iterators in mep_store_find_set Date: Sat, 25 Oct 2014 10:24:29 +0100 Message-ID: <87ioj8zelu.fsf@googlemail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 This is part of a series to remove uses of for_each_rtx from the ports. Tested by making sure there were no code changes for gcc.dg, gcc.c-torture and g++.dg for mep-elf. OK to install? Thanks, Richard gcc/ * config/mep/mep.c (mep_store_find_set): Take a const_rtx and return a bool. Replace "void *" with specific type. Iterate over all subrtxes. (mep_store_data_bypass_1): Update calls accordingly. Index: gcc/config/mep/mep.c =================================================================== --- gcc/config/mep/mep.c 2014-10-25 09:51:18.001817191 +0100 +++ gcc/config/mep/mep.c 2014-10-25 09:51:18.384820605 +0100 @@ -6644,13 +6644,16 @@ mep_sched_reorder (FILE *dump ATTRIBUTE_ return 2; } -/* A for_each_rtx callback. Return true if *X is a register that is - set by insn PREV. */ +/* Return true if X contains a register that is set by insn PREV. */ -static int -mep_store_find_set (rtx *x, void *prev) +static bool +mep_store_find_set (const_rtx x, const rtx_insn *prev) { - return REG_P (*x) && reg_set_p (*x, (const_rtx) prev); + subrtx_iterator::array_type array; + FOR_EACH_SUBRTX (iter, array, x, NONCONST) + if (REG_P (x) && reg_set_p (x, prev)) + return true; + return false; } /* Like mep_store_bypass_p, but takes a pattern as the second argument, @@ -6687,7 +6690,7 @@ mep_store_data_bypass_1 (rtx_insn *prev, src = SET_SRC (pat); for (i = 1; i < XVECLEN (src, 0); i++) - if (for_each_rtx (&XVECEXP (src, 0, i), mep_store_find_set, prev)) + if (mep_store_find_set (XVECEXP (src, 0, i), prev)) return false; return true; @@ -6695,7 +6698,7 @@ mep_store_data_bypass_1 (rtx_insn *prev, /* Otherwise just check that PREV doesn't modify any register mentioned in the memory destination. */ - return !for_each_rtx (&SET_DEST (pat), mep_store_find_set, prev); + return !mep_store_find_set (SET_DEST (pat), prev); } /* Return true if INSN is a store instruction and if the store address