From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9011 invoked by alias); 3 Aug 2014 13:48:57 -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 9001 invoked by uid 89); 3 Aug 2014 13:48:56 -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-we0-f169.google.com Received: from mail-we0-f169.google.com (HELO mail-we0-f169.google.com) (74.125.82.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sun, 03 Aug 2014 13:48:55 +0000 Received: by mail-we0-f169.google.com with SMTP id u56so6414811wes.0 for ; Sun, 03 Aug 2014 06:48:52 -0700 (PDT) X-Received: by 10.180.11.148 with SMTP id q20mr10083086wib.56.1407073732531; Sun, 03 Aug 2014 06:48:52 -0700 (PDT) Received: from localhost ([95.145.138.172]) by mx.google.com with ESMTPSA id 10sm35972999wjx.26.2014.08.03.06.48.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 Aug 2014 06:48:52 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Subject: [PATCH 05/50] calls.c:internal_arg_pointer_based_exp References: <87y4v5d77q.fsf@googlemail.com> Date: Sun, 03 Aug 2014 13:48:00 -0000 In-Reply-To: <87y4v5d77q.fsf@googlemail.com> (Richard Sandiford's message of "Sun, 03 Aug 2014 14:38:01 +0100") Message-ID: <87d2chd6po.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/msg00138.txt.bz2 gcc/ * calls.c: Include rtl-iter.h. (internal_arg_pointer_based_exp_1): Delete. (internal_arg_pointer_based_exp): Take a const_rtx. Use FOR_EACH_SUBRTX to iterate over subrtxes. Index: gcc/calls.c =================================================================== --- gcc/calls.c 2014-08-03 11:25:10.496959956 +0100 +++ gcc/calls.c 2014-08-03 11:25:21.433068077 +0100 @@ -49,6 +49,7 @@ Software Foundation; either version 3, o #include "cgraph.h" #include "except.h" #include "dbgcnt.h" +#include "rtl-iter.h" /* Like PREFERRED_STACK_BOUNDARY but in units of bytes, not bits. */ #define STACK_BYTES (PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT) @@ -1693,7 +1694,7 @@ rtx_for_function_call (tree fndecl, tree vec cache; } internal_arg_pointer_exp_state; -static rtx internal_arg_pointer_based_exp (rtx, bool); +static rtx internal_arg_pointer_based_exp (const_rtx, bool); /* Helper function for internal_arg_pointer_based_exp. Scan insns in the tail call sequence, starting with first insn that hasn't been @@ -1741,28 +1742,13 @@ internal_arg_pointer_based_exp_scan (voi internal_arg_pointer_exp_state.scan_start = scan_start; } -/* Helper function for internal_arg_pointer_based_exp, called through - for_each_rtx. Return 1 if *LOC is a register based on - crtl->args.internal_arg_pointer. Return -1 if *LOC is not based on it - and the subexpressions need not be examined. Otherwise return 0. */ - -static int -internal_arg_pointer_based_exp_1 (rtx *loc, void *data ATTRIBUTE_UNUSED) -{ - if (REG_P (*loc) && internal_arg_pointer_based_exp (*loc, false) != NULL_RTX) - return 1; - if (MEM_P (*loc)) - return -1; - return 0; -} - /* Compute whether RTL is based on crtl->args.internal_arg_pointer. Return NULL_RTX if RTL isn't based on it, a CONST_INT offset if RTL is based on it with fixed offset, or PC if this is with variable or unknown offset. TOPLEVEL is true if the function is invoked at the topmost level. */ static rtx -internal_arg_pointer_based_exp (rtx rtl, bool toplevel) +internal_arg_pointer_based_exp (const_rtx rtl, bool toplevel) { if (CONSTANT_P (rtl)) return NULL_RTX; @@ -1796,8 +1782,15 @@ internal_arg_pointer_based_exp (rtx rtl, return NULL_RTX; } - if (for_each_rtx (&rtl, internal_arg_pointer_based_exp_1, NULL)) - return pc_rtx; + subrtx_iterator::array_type array; + FOR_EACH_SUBRTX (iter, array, rtl, NONCONST) + { + const_rtx x = *iter; + if (REG_P (x) && internal_arg_pointer_based_exp (x, false) != NULL_RTX) + return pc_rtx; + if (MEM_P (x)) + iter.skip_subrtxes (); + } return NULL_RTX; }