From patchwork Tue Nov 11 15:44:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 409510 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 582FE14017E for ; Wed, 12 Nov 2014 02:44:15 +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:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=iv7LMDbsDjg4n3gF aGQ308jkN9CWzI/Re4JZGnokWVSYIc4WBIJvJVENQomS7jsiI3ZsXzBMxjjALStC nwJKcCYN0/HsdC+d5kiHFrbRIavg+xOT+yun6Bz88Ap9ru/l6G+Eb63Y2xajwCZS Zn2u+yWiidQHCXROclQGiOTagoM= 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:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=RzDRmXtXZRX9KiinRou5Tb eqb3s=; b=IsPI1uEUgIfD67/t9A1/+Z5yijlfhwvgREqT6XGgCPz8Ut6Xcdx68s wmwpUBj90asBGxWaGQ/7iJfSubKWRhuGIZhQeo134QlLEcQkJzPzbplx6ExOxBNO u5C3VB1e+kqYZCIdrc5L2mWEgPGl+UKQaffH7kiIqreFqc+BJH43w= Received: (qmail 19629 invoked by alias); 11 Nov 2014 15:44:08 -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 19620 invoked by uid 89); 11 Nov 2014 15:44:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, SPF_PASS autolearn=ham version=3.3.2 X-HELO: service87.mimecast.com Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 11 Nov 2014 15:44:06 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Tue, 11 Nov 2014 15:44:04 +0000 Received: from localhost ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 11 Nov 2014 15:44:03 +0000 From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: Remove for_each_rtx Date: Tue, 11 Nov 2014 15:44:02 +0000 Message-ID: <87vbmlivy5.fsf@e105548-lin.cambridge.arm.com> User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 X-MC-Unique: 114111115440401901 There are no more callers to for_each_rtx or for_each_rtx_in_insn, so this patch removes the functions. Tested on x86_64-linux-gnu. OK to install? Thanks, Richard gcc/ * rtl.h (rtx_function, for_each_rtx, for_each_rtx_in_insn): Delete. * rtlanal.c (non_rtx_starting_operands, for_each_rtx_1, for_each_rtx): (for_each_rtx_in_insn): Delete. (init_rtlanal): Remove initialization of non_rtx_starting_operands. * df-core.c: Remove reference to for_each_rtx in comment. diff --git a/gcc/df-core.c b/gcc/df-core.c index 691ed71..8e7a92f 100644 --- a/gcc/df-core.c +++ b/gcc/df-core.c @@ -181,7 +181,7 @@ There are four ways of doing the incremental scanning: next call to df_analyze or df_process_deferred_rescans. This mode is also used by a few passes that still rely on note_uses, - note_stores and for_each_rtx instead of using the DF data. This + note_stores and rtx iterators instead of using the DF data. This can be said to fall under case 1c. To enable this mode, call df_set_flags (DF_DEFER_INSN_RESCAN). diff --git a/gcc/rtl.h b/gcc/rtl.h index fa38abb..3bfb6bf 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -2885,10 +2885,6 @@ extern bool tablejump_p (const rtx_insn *, rtx *, rtx_jump_table_data **); extern int computed_jump_p (const_rtx); extern bool tls_referenced_p (const_rtx); -typedef int (*rtx_function) (rtx *, void *); -extern int for_each_rtx (rtx *, rtx_function, void *); -extern int for_each_rtx_in_insn (rtx_insn **, rtx_function, void *); - /* Callback for for_each_inc_dec, to process the autoinc operation OP within MEM that sets DEST to SRC + SRCOFF, or SRC if SRCOFF is NULL. The callback is passed the same opaque ARG passed to diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index c9bf69c..49c2d4e 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -65,10 +65,6 @@ static unsigned int cached_num_sign_bit_copies (const_rtx, machine_mode, const_r static unsigned int num_sign_bit_copies1 (const_rtx, machine_mode, const_rtx, machine_mode, unsigned int); -/* Offset of the first 'e', 'E' or 'V' operand for each rtx code, or - -1 if a code has no such operand. */ -static int non_rtx_starting_operands[NUM_RTX_CODE]; - rtx_subrtx_bound_info rtx_all_subrtx_bounds[NUM_RTX_CODE]; rtx_subrtx_bound_info rtx_nonconst_subrtx_bounds[NUM_RTX_CODE]; @@ -3020,137 +3016,6 @@ computed_jump_p (const_rtx insn) return 0; } -/* Optimized loop of for_each_rtx, trying to avoid useless recursive - calls. Processes the subexpressions of EXP and passes them to F. */ -static int -for_each_rtx_1 (rtx exp, int n, rtx_function f, void *data) -{ - int result, i, j; - const char *format = GET_RTX_FORMAT (GET_CODE (exp)); - rtx *x; - - for (; format[n] != '\0'; n++) - { - switch (format[n]) - { - case 'e': - /* Call F on X. */ - x = &XEXP (exp, n); - result = (*f) (x, data); - if (result == -1) - /* Do not traverse sub-expressions. */ - continue; - else if (result != 0) - /* Stop the traversal. */ - return result; - - if (*x == NULL_RTX) - /* There are no sub-expressions. */ - continue; - - i = non_rtx_starting_operands[GET_CODE (*x)]; - if (i >= 0) - { - result = for_each_rtx_1 (*x, i, f, data); - if (result != 0) - return result; - } - break; - - case 'V': - case 'E': - if (XVEC (exp, n) == 0) - continue; - for (j = 0; j < XVECLEN (exp, n); ++j) - { - /* Call F on X. */ - x = &XVECEXP (exp, n, j); - result = (*f) (x, data); - if (result == -1) - /* Do not traverse sub-expressions. */ - continue; - else if (result != 0) - /* Stop the traversal. */ - return result; - - if (*x == NULL_RTX) - /* There are no sub-expressions. */ - continue; - - i = non_rtx_starting_operands[GET_CODE (*x)]; - if (i >= 0) - { - result = for_each_rtx_1 (*x, i, f, data); - if (result != 0) - return result; - } - } - break; - - default: - /* Nothing to do. */ - break; - } - } - - return 0; -} - -/* Traverse X via depth-first search, calling F for each - sub-expression (including X itself). F is also passed the DATA. - If F returns -1, do not traverse sub-expressions, but continue - traversing the rest of the tree. If F ever returns any other - nonzero value, stop the traversal, and return the value returned - by F. Otherwise, return 0. This function does not traverse inside - tree structure that contains RTX_EXPRs, or into sub-expressions - whose format code is `0' since it is not known whether or not those - codes are actually RTL. - - This routine is very general, and could (should?) be used to - implement many of the other routines in this file. */ - -int -for_each_rtx (rtx *x, rtx_function f, void *data) -{ - int result; - int i; - - /* Call F on X. */ - result = (*f) (x, data); - if (result == -1) - /* Do not traverse sub-expressions. */ - return 0; - else if (result != 0) - /* Stop the traversal. */ - return result; - - if (*x == NULL_RTX) - /* There are no sub-expressions. */ - return 0; - - i = non_rtx_starting_operands[GET_CODE (*x)]; - if (i < 0) - return 0; - - return for_each_rtx_1 (*x, i, f, data); -} - -/* Like "for_each_rtx", but for calling on an rtx_insn **. */ - -int -for_each_rtx_in_insn (rtx_insn **insn, rtx_function f, void *data) -{ - rtx insn_as_rtx = *insn; - int result; - - result = for_each_rtx (&insn_as_rtx, f, data); - - if (insn_as_rtx != *insn) - *insn = safe_as_a (insn_as_rtx); - - return result; -} - /* MEM has a PRE/POST-INC/DEC/MODIFY address X. Extract the operands of @@ -5496,17 +5361,13 @@ setup_reg_subrtx_bounds (unsigned int code) return true; } -/* Initialize non_rtx_starting_operands, which is used to speed up - for_each_rtx, and rtx_all_subrtx_bounds. */ +/* Initialize rtx_all_subrtx_bounds. */ void init_rtlanal (void) { int i; for (i = 0; i < NUM_RTX_CODE; i++) { - const char *format = GET_RTX_FORMAT (i); - const char *first = strpbrk (format, "eEV"); - non_rtx_starting_operands[i] = first ? first - format : -1; if (!setup_reg_subrtx_bounds (i)) rtx_all_subrtx_bounds[i].count = UCHAR_MAX; if (GET_RTX_CLASS (i) != RTX_CONST_OBJ)