From patchwork Sun Aug 3 14:19:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 376044 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 ED96E140095 for ; Mon, 4 Aug 2014 00:19:33 +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=hhwahICIOQ12ECtobz0dGqqrmlbxY IA35tPg1RXxZ9p5kym4E1P5VRaZ3j9ch2jTSvc3XWZhuHHuDc4pCztlcFGnMApr8 Ym/ddFE8qlVtEKTgWgC36ZqBT9BQmQKA3uAItn0CuIi1ozQdMFcr6tjesPK41F72 9YJq+DYyC9Gcpw= 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=lfa4tSxXcNF9FbdJc1jdrpVlsGk=; b=ss0 TKIWqCpYPqnRvQAXogjG3gwi6hWJQZKIzWKskf09vr766Y+xL1142G7/2sGdhOFc o/eG5YE8AJcAD0ik/V539ZU52vEHUIknRHOYC7f1pOVT2BuECUP58JXmwXOMm3vM AXSdpjvuvKaCEYBG5E8nsg1xeHhozLP/WhsKD5hg= Received: (qmail 31086 invoked by alias); 3 Aug 2014 14:19:27 -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 31074 invoked by uid 89); 3 Aug 2014 14:19:26 -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-wg0-f52.google.com Received: from mail-wg0-f52.google.com (HELO mail-wg0-f52.google.com) (74.125.82.52) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sun, 03 Aug 2014 14:19:24 +0000 Received: by mail-wg0-f52.google.com with SMTP id a1so6462781wgh.35 for ; Sun, 03 Aug 2014 07:19:20 -0700 (PDT) X-Received: by 10.194.63.205 with SMTP id i13mr24177075wjs.74.1407075560690; Sun, 03 Aug 2014 07:19:20 -0700 (PDT) Received: from localhost ([95.145.138.172]) by mx.google.com with ESMTPSA id td10sm14974582wic.10.2014.08.03.07.19.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 Aug 2014 07:19:20 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Subject: [PATCH 34/50] regcprop.c:kill_autoinc_value References: <87y4v5d77q.fsf@googlemail.com> Date: Sun, 03 Aug 2014 15:19:19 +0100 In-Reply-To: <87y4v5d77q.fsf@googlemail.com> (Richard Sandiford's message of "Sun, 03 Aug 2014 14:38:01 +0100") Message-ID: <87vbq97j14.fsf@googlemail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 gcc/ * regcprop.c: Include rtl-iter.h. (kill_value): Take a const_rtx. (kill_autoinc_value): Turn from being a for_each_rtx callback to being a function that examines each subrtx itself. (copyprop_hardreg_forward_1): Update accordingly. Index: gcc/regcprop.c =================================================================== --- gcc/regcprop.c 2014-08-03 11:25:09.748952560 +0100 +++ gcc/regcprop.c 2014-08-03 11:25:29.603148851 +0100 @@ -36,6 +36,7 @@ #include "obstack.h" #include "tree-pass.h" #include "df.h" +#include "rtl-iter.h" /* The following code does forward propagation of hard register copies. The object is to eliminate as many dependencies as possible, so that @@ -81,12 +82,11 @@ struct value_data static void kill_value_one_regno (unsigned, struct value_data *); static void kill_value_regno (unsigned, unsigned, struct value_data *); -static void kill_value (rtx, struct value_data *); +static void kill_value (const_rtx, struct value_data *); static void set_value_regno (unsigned, enum machine_mode, struct value_data *); static void init_value_data (struct value_data *); static void kill_clobbered_value (rtx, const_rtx, void *); static void kill_set_value (rtx, const_rtx, void *); -static int kill_autoinc_value (rtx *, void *); static void copy_value (rtx, rtx, struct value_data *); static bool mode_change_ok (enum machine_mode, enum machine_mode, unsigned int); @@ -190,16 +190,13 @@ kill_value_regno (unsigned int regno, un so that we mind the mode the register is in. */ static void -kill_value (rtx x, struct value_data *vd) +kill_value (const_rtx x, struct value_data *vd) { - rtx orig_rtx = x; - if (GET_CODE (x) == SUBREG) { - x = simplify_subreg (GET_MODE (x), SUBREG_REG (x), - GET_MODE (SUBREG_REG (x)), SUBREG_BYTE (x)); - if (x == NULL_RTX) - x = SUBREG_REG (orig_rtx); + rtx tmp = simplify_subreg (GET_MODE (x), SUBREG_REG (x), + GET_MODE (SUBREG_REG (x)), SUBREG_BYTE (x)); + x = tmp ? tmp : SUBREG_REG (x); } if (REG_P (x)) { @@ -276,25 +273,24 @@ kill_set_value (rtx x, const_rtx set, vo } } -/* Called through for_each_rtx. Kill any register used as the base of an - auto-increment expression, and install that register as the root of its - own value list. */ +/* Kill any register used in X as the base of an auto-increment expression, + and install that register as the root of its own value list. */ -static int -kill_autoinc_value (rtx *px, void *data) +static void +kill_autoinc_value (rtx insn, struct value_data *vd) { - rtx x = *px; - struct value_data *const vd = (struct value_data *) data; - - if (GET_RTX_CLASS (GET_CODE (x)) == RTX_AUTOINC) + subrtx_iterator::array_type array; + FOR_EACH_SUBRTX (iter, array, PATTERN (insn), NONCONST) { - x = XEXP (x, 0); - kill_value (x, vd); - set_value_regno (REGNO (x), GET_MODE (x), vd); - return -1; + const_rtx x = *iter; + if (GET_RTX_CLASS (GET_CODE (x)) == RTX_AUTOINC) + { + x = XEXP (x, 0); + kill_value (x, vd); + set_value_regno (REGNO (x), GET_MODE (x), vd); + iter.skip_subrtxes (); + } } - - return 0; } /* Assert that SRC has been copied to DEST. Adjust the data structures @@ -807,7 +803,7 @@ copyprop_hardreg_forward_1 (basic_block /* Kill all auto-incremented values. */ /* ??? REG_INC is useless, since stack pushes aren't done that way. */ - for_each_rtx (&PATTERN (insn), kill_autoinc_value, vd); + kill_autoinc_value (insn, vd); /* Kill all early-clobbered operands. */ for (i = 0; i < n_ops; i++)