From patchwork Sun Aug 3 13:53:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 376016 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 175901400A3 for ; Sun, 3 Aug 2014 23:53:34 +1000 (EST) 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:subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=default; b=dDzVDekLlLXyqBahcU/vLn+wOXJqp L3P0eF73wxl6IIkuyFdVQcc1GWJdiUWqms1oMRpy3v60AQGDa/plEEx+y+2tSpVh i5SaibbPB+Rcns4SnMMCzFEpKPbkbAzXoezUwNDwz990aW116IZjDRlSlAmzuziN 5mYQIpCUVvb5pY= 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:subject:references:date:in-reply-to:message-id:mime-version :content-type; s=default; bh=FeF84SEvp077OwI22Hnz5bWjjzo=; b=Jpr koCNbOrwlrnaHOZV2fexC1qxxoXBHBmEm+8ANLAn3trbwanV0Tu32/2pgCL90u9m QirXiH0rg+pv9yfsOtfvJs7UwhaS5ysLBAF3GAtGbwTcjopizBeMR2YGuFNiuK7m gqf1NKonw0jBO/may0P3BohtKBaHT6UhOcjpE7DU= Received: (qmail 15260 invoked by alias); 3 Aug 2014 13:53:29 -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 15251 invoked by uid 89); 3 Aug 2014 13:53:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 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-f174.google.com Received: from mail-wi0-f174.google.com (HELO mail-wi0-f174.google.com) (209.85.212.174) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sun, 03 Aug 2014 13:53:27 +0000 Received: by mail-wi0-f174.google.com with SMTP id d1so3691020wiv.1 for ; Sun, 03 Aug 2014 06:53:24 -0700 (PDT) X-Received: by 10.180.212.12 with SMTP id ng12mr22628297wic.9.1407074004417; Sun, 03 Aug 2014 06:53:24 -0700 (PDT) Received: from localhost ([95.145.138.172]) by mx.google.com with ESMTPSA id ch5sm36009146wjb.18.2014.08.03.06.53.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 Aug 2014 06:53:24 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Subject: [PATCH 09/50] cfgcleanup.c:mentions_nonequal_regs References: <87y4v5d77q.fsf@googlemail.com> Date: Sun, 03 Aug 2014 14:53:23 +0100 In-Reply-To: <87y4v5d77q.fsf@googlemail.com> (Richard Sandiford's message of "Sun, 03 Aug 2014 14:38:01 +0100") Message-ID: <87vbq9brxo.fsf@googlemail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 gcc/ * cfgcleanup.c: Include rtl-iter.h. (mentions_nonequal_regs): Turn from being a for_each_rtx callback to being a function that examines each subrtx itself. (thread_jump): Update accordingly. Index: gcc/cfgcleanup.c =================================================================== --- gcc/cfgcleanup.c 2014-08-03 11:25:10.407959076 +0100 +++ gcc/cfgcleanup.c 2014-08-03 11:25:22.602079634 +0100 @@ -53,6 +53,7 @@ Software Foundation; either version 3, o #include "df.h" #include "dce.h" #include "dbgcnt.h" +#include "rtl-iter.h" #define FORWARDER_BLOCK_P(BB) ((BB)->flags & BB_FORWARDER_BLOCK) @@ -80,7 +81,6 @@ static edge thread_jump (edge, basic_blo static bool mark_effect (rtx, bitmap); static void notice_new_block (basic_block); static void update_forwarder_flag (basic_block); -static int mentions_nonequal_regs (rtx *, void *); static void merge_memattrs (rtx, rtx); /* Set flags for newly created block. */ @@ -234,29 +234,31 @@ mark_effect (rtx exp, regset nonequal) } } -/* Return nonzero if X is a register set in regset DATA. - Called via for_each_rtx. */ -static int -mentions_nonequal_regs (rtx *x, void *data) +/* Return true if X contains a register in NONEQUAL. */ +static bool +mentions_nonequal_regs (const_rtx x, regset nonequal) { - regset nonequal = (regset) data; - if (REG_P (*x)) + subrtx_iterator::array_type array; + FOR_EACH_SUBRTX (iter, array, x, NONCONST) { - int regno; - - regno = REGNO (*x); - if (REGNO_REG_SET_P (nonequal, regno)) - return 1; - if (regno < FIRST_PSEUDO_REGISTER) + const_rtx x = *iter; + if (REG_P (x)) { - int n = hard_regno_nregs[regno][GET_MODE (*x)]; - while (--n > 0) - if (REGNO_REG_SET_P (nonequal, regno + n)) - return 1; + unsigned int regno = REGNO (x); + if (REGNO_REG_SET_P (nonequal, regno)) + return true; + if (regno < FIRST_PSEUDO_REGISTER) + { + int n = hard_regno_nregs[regno][GET_MODE (x)]; + while (--n > 0) + if (REGNO_REG_SET_P (nonequal, regno + n)) + return true; + } } } - return 0; + return false; } + /* Attempt to prove that the basic block B will have no side effects and always continues in the same edge if reached via E. Return the edge if exist, NULL otherwise. */ @@ -379,7 +381,7 @@ thread_jump (edge e, basic_block b) /* cond2 must not mention any register that is not equal to the former block. */ - if (for_each_rtx (&cond2, mentions_nonequal_regs, nonequal)) + if (mentions_nonequal_regs (cond2, nonequal)) goto failed_exit; EXECUTE_IF_SET_IN_REG_SET (nonequal, 0, i, rsi)