From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14119 invoked by alias); 3 Aug 2014 14:10:13 -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 14092 invoked by uid 89); 3 Aug 2014 14:10:12 -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-f180.google.com Received: from mail-wi0-f180.google.com (HELO mail-wi0-f180.google.com) (209.85.212.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sun, 03 Aug 2014 14:10:11 +0000 Received: by mail-wi0-f180.google.com with SMTP id n3so3620095wiv.13 for ; Sun, 03 Aug 2014 07:10:08 -0700 (PDT) X-Received: by 10.180.39.172 with SMTP id q12mr21763865wik.55.1407075008431; Sun, 03 Aug 2014 07:10:08 -0700 (PDT) Received: from localhost ([95.145.138.172]) by mx.google.com with ESMTPSA id lq15sm30314814wic.1.2014.08.03.07.10.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 Aug 2014 07:10:08 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Subject: [PATCH 24/50] fwprop.c:varying_mem_p References: <87y4v5d77q.fsf@googlemail.com> Date: Sun, 03 Aug 2014 14:10:00 -0000 In-Reply-To: <87y4v5d77q.fsf@googlemail.com> (Richard Sandiford's message of "Sun, 03 Aug 2014 14:38:01 +0100") Message-ID: <8738ddaclc.fsf@googlemail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2014-08/txt/msg00160.txt.bz2 gcc/ * fwprop.c: Include rtl-iter.h. (varying_mem_p): Turn from being a for_each_rtx callback to being a function that examines each subrtx itself. (propagate_rtx): Update accordingly. Index: gcc/fwprop.c =================================================================== --- gcc/fwprop.c 2014-08-03 11:25:09.992954973 +0100 +++ gcc/fwprop.c 2014-08-03 11:25:26.890122028 +0100 @@ -38,6 +38,7 @@ Software Foundation; either version 3, o #include "tree-pass.h" #include "domwalk.h" #include "emit-rtl.h" +#include "rtl-iter.h" /* This pass does simple forward propagation and simplification when an @@ -623,14 +624,16 @@ propagate_rtx_1 (rtx *px, rtx old_rtx, r } -/* for_each_rtx traversal function that returns 1 if BODY points to - a non-constant mem. */ +/* Return true if X constains a non-constant mem. */ -static int -varying_mem_p (rtx *body, void *data ATTRIBUTE_UNUSED) +static bool +varying_mem_p (const_rtx x) { - rtx x = *body; - return MEM_P (x) && !MEM_READONLY_P (x); + subrtx_iterator::array_type array; + FOR_EACH_SUBRTX (iter, array, x, NONCONST) + if (MEM_P (*iter) && !MEM_READONLY_P (*iter)) + return true; + return false; } @@ -661,7 +664,7 @@ propagate_rtx (rtx x, enum machine_mode && (GET_MODE_SIZE (mode) <= GET_MODE_SIZE (GET_MODE (SUBREG_REG (new_rtx)))))) flags |= PR_CAN_APPEAR; - if (!for_each_rtx (&new_rtx, varying_mem_p, NULL)) + if (!varying_mem_p (new_rtx)) flags |= PR_HANDLE_MEM; if (speed)