From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 121267 invoked by alias); 12 Dec 2017 03:10: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 121245 invoked by uid 89); 12 Dec 2017 03:10:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 12 Dec 2017 03:10:54 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CE43C7E42C; Tue, 12 Dec 2017 03:10:52 +0000 (UTC) Received: from freie.home (ovpn04.gateway.prod.ext.phx2.redhat.com [10.5.9.4]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6439B4F6C6; Tue, 12 Dec 2017 03:10:50 +0000 (UTC) Received: from livre (livre.home [172.31.160.2]) by freie.home (8.15.2/8.15.2) with ESMTP id vBC2QGos027049; Tue, 12 Dec 2017 00:26:23 -0200 From: Alexandre Oliva To: Jeff Law Cc: Richard Biener , Jason Merrill , GCC Patches Subject: Re: [SFN+LVU+IEPM v4 1/9] [SFN] adjust RTL insn-walking API References: <20171110023448.28164-1-aoliva@redhat.com> <748cdfaf-491d-b1bf-ab38-9799cada7de6@redhat.com> Date: Tue, 12 Dec 2017 03:10:00 -0000 In-Reply-To: <748cdfaf-491d-b1bf-ab38-9799cada7de6@redhat.com> (Jeff Law's message of "Thu, 7 Dec 2017 15:25:31 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2017-12/txt/msg00696.txt.bz2 On Dec 7, 2017, Jeff Law wrote: > On 11/09/2017 07:34 PM, Alexandre Oliva wrote: >> This patch removes unused RTL functions, introduces alternate ones for >> use in a later SFN patch, and regroups other related functions so that >> they appear in a more consistent order. >> >> for gcc/ChangeLog >> >> * emit-rtl.c (next_nondebug_insn, prev_nondebug_insn): Reorder. >> (next_nonnote_nondebug_insn, prev_nonnote_nondebug_insn): Reorder. >> (next_nonnote_nondebug_insn_bb): New. >> (prev_nonnote_nondebug_insn_bb): New. >> (prev_nonnote_insn_bb, next_nonnote_insn_bb): Remove. >> * rtl.h (prev_nonnote_insn_bb, next_nonnote_insn_bb): Remove decls. >> (prev_nonnote_nondebug_insn_bb): Declare. >> (next_nonnote_nondebug_insn_bb): Declare. >> * cfgbuild.c (find_bb_boundaries): Adjust to skip debug insns. >> * cfgrtl.c (get_last_bb_insn): Likewise. >> * lra.c (push_insns): Likewise. > OK. Seems like this ought to go in immediately rather than waiting on > the full kit to be ack'd. Thanks, FTR, here it is, as installed: >From 18fc635703209d1a4ab2d9544c0f7b946e3c4c04 Mon Sep 17 00:00:00 2001 From: aoliva Date: Tue, 12 Dec 2017 02:14:39 +0000 Subject: [PATCH 1/7] [SFN] adjust RTL insn-walking API This patch removes unused RTL functions, introduces alternate ones for use in a later SFN patch, and regroups other related functions so that they appear in a more consistent order. for gcc/ChangeLog * emit-rtl.c (next_nondebug_insn, prev_nondebug_insn): Reorder. (next_nonnote_nondebug_insn, prev_nonnote_nondebug_insn): Reorder. (next_nonnote_nondebug_insn_bb): New. (prev_nonnote_nondebug_insn_bb): New. (prev_nonnote_insn_bb, next_nonnote_insn_bb): Remove. * rtl.h (prev_nonnote_insn_bb, next_nonnote_insn_bb): Remove decls. (prev_nonnote_nondebug_insn_bb): Declare. (next_nonnote_nondebug_insn_bb): Declare. * cfgbuild.c (find_bb_boundaries): Adjust to skip debug insns. * cfgrtl.c (get_last_bb_insn): Likewise. * lra.c (push_insns): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@255564 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 14 ++++++++++++ gcc/cfgbuild.c | 2 +- gcc/cfgrtl.c | 4 ++-- gcc/emit-rtl.c | 69 ++++++++++++++++++++++++++++++++-------------------------- gcc/lra.c | 2 +- gcc/rtl.h | 4 ++-- 6 files changed, 58 insertions(+), 37 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 54df8c0ee727..6d0a64e6adcc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2017-12-12 Alexandre Oliva + + * emit-rtl.c (next_nondebug_insn, prev_nondebug_insn): Reorder. + (next_nonnote_nondebug_insn, prev_nonnote_nondebug_insn): Reorder. + (next_nonnote_nondebug_insn_bb): New. + (prev_nonnote_nondebug_insn_bb): New. + (prev_nonnote_insn_bb, next_nonnote_insn_bb): Remove. + * rtl.h (prev_nonnote_insn_bb, next_nonnote_insn_bb): Remove decls. + (prev_nonnote_nondebug_insn_bb): Declare. + (next_nonnote_nondebug_insn_bb): Declare. + * cfgbuild.c (find_bb_boundaries): Adjust to skip debug insns. + * cfgrtl.c (get_last_bb_insn): Likewise. + * lra.c (push_insns): Likewise. + 2017-12-11 David Malcolm PR c/82050 diff --git a/gcc/cfgbuild.c b/gcc/cfgbuild.c index a0926752143d..77a221de2119 100644 --- a/gcc/cfgbuild.c +++ b/gcc/cfgbuild.c @@ -511,7 +511,7 @@ find_bb_boundaries (basic_block bb) the middle of a BB. We need to split it in the same manner as if the barrier were preceded by a control_flow_insn_p insn. */ if (!flow_transfer_insn) - flow_transfer_insn = prev_nonnote_insn_bb (insn); + flow_transfer_insn = prev_nonnote_nondebug_insn_bb (insn); } if (control_flow_insn_p (insn)) diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index a2ad075db85f..eb673a1e0799 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -2285,11 +2285,11 @@ get_last_bb_insn (basic_block bb) end = table; /* Include any barriers that may follow the basic block. */ - tmp = next_nonnote_insn_bb (end); + tmp = next_nonnote_nondebug_insn_bb (end); while (tmp && BARRIER_P (tmp)) { end = tmp; - tmp = next_nonnote_insn_bb (end); + tmp = next_nonnote_nondebug_insn_bb (end); } return end; diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 428e4743454f..42de598067f4 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -3370,20 +3370,17 @@ next_nonnote_insn (rtx_insn *insn) return insn; } -/* Return the next insn after INSN that is not a NOTE, but stop the - search before we enter another basic block. This routine does not - look inside SEQUENCEs. */ +/* Return the next insn after INSN that is not a DEBUG_INSN. This + routine does not look inside SEQUENCEs. */ rtx_insn * -next_nonnote_insn_bb (rtx_insn *insn) +next_nondebug_insn (rtx_insn *insn) { while (insn) { insn = NEXT_INSN (insn); - if (insn == 0 || !NOTE_P (insn)) + if (insn == 0 || !DEBUG_INSN_P (insn)) break; - if (NOTE_INSN_BASIC_BLOCK_P (insn)) - return NULL; } return insn; @@ -3405,67 +3402,70 @@ prev_nonnote_insn (rtx_insn *insn) return insn; } -/* Return the previous insn before INSN that is not a NOTE, but stop - the search before we enter another basic block. This routine does - not look inside SEQUENCEs. */ +/* Return the previous insn before INSN that is not a DEBUG_INSN. + This routine does not look inside SEQUENCEs. */ rtx_insn * -prev_nonnote_insn_bb (rtx_insn *insn) +prev_nondebug_insn (rtx_insn *insn) { - while (insn) { insn = PREV_INSN (insn); - if (insn == 0 || !NOTE_P (insn)) + if (insn == 0 || !DEBUG_INSN_P (insn)) break; - if (NOTE_INSN_BASIC_BLOCK_P (insn)) - return NULL; } return insn; } -/* Return the next insn after INSN that is not a DEBUG_INSN. This - routine does not look inside SEQUENCEs. */ +/* Return the next insn after INSN that is not a NOTE nor DEBUG_INSN. + This routine does not look inside SEQUENCEs. */ rtx_insn * -next_nondebug_insn (rtx_insn *insn) +next_nonnote_nondebug_insn (rtx_insn *insn) { while (insn) { insn = NEXT_INSN (insn); - if (insn == 0 || !DEBUG_INSN_P (insn)) + if (insn == 0 || (!NOTE_P (insn) && !DEBUG_INSN_P (insn))) break; } return insn; } -/* Return the previous insn before INSN that is not a DEBUG_INSN. - This routine does not look inside SEQUENCEs. */ +/* Return the next insn after INSN that is not a NOTE nor DEBUG_INSN, + but stop the search before we enter another basic block. This + routine does not look inside SEQUENCEs. */ rtx_insn * -prev_nondebug_insn (rtx_insn *insn) +next_nonnote_nondebug_insn_bb (rtx_insn *insn) { while (insn) { - insn = PREV_INSN (insn); - if (insn == 0 || !DEBUG_INSN_P (insn)) + insn = NEXT_INSN (insn); + if (insn == 0) + break; + if (DEBUG_INSN_P (insn)) + continue; + if (!NOTE_P (insn)) break; + if (NOTE_INSN_BASIC_BLOCK_P (insn)) + return NULL; } return insn; } -/* Return the next insn after INSN that is not a NOTE nor DEBUG_INSN. +/* Return the previous insn before INSN that is not a NOTE nor DEBUG_INSN. This routine does not look inside SEQUENCEs. */ rtx_insn * -next_nonnote_nondebug_insn (rtx_insn *insn) +prev_nonnote_nondebug_insn (rtx_insn *insn) { while (insn) { - insn = NEXT_INSN (insn); + insn = PREV_INSN (insn); if (insn == 0 || (!NOTE_P (insn) && !DEBUG_INSN_P (insn))) break; } @@ -3473,17 +3473,24 @@ next_nonnote_nondebug_insn (rtx_insn *insn) return insn; } -/* Return the previous insn before INSN that is not a NOTE nor DEBUG_INSN. - This routine does not look inside SEQUENCEs. */ +/* Return the previous insn before INSN that is not a NOTE nor + DEBUG_INSN, but stop the search before we enter another basic + block. This routine does not look inside SEQUENCEs. */ rtx_insn * -prev_nonnote_nondebug_insn (rtx_insn *insn) +prev_nonnote_nondebug_insn_bb (rtx_insn *insn) { while (insn) { insn = PREV_INSN (insn); - if (insn == 0 || (!NOTE_P (insn) && !DEBUG_INSN_P (insn))) + if (insn == 0) break; + if (DEBUG_INSN_P (insn)) + continue; + if (!NOTE_P (insn)) + break; + if (NOTE_INSN_BASIC_BLOCK_P (insn)) + return NULL; } return insn; diff --git a/gcc/lra.c b/gcc/lra.c index 3fd15ee57943..f790904ec57f 100644 --- a/gcc/lra.c +++ b/gcc/lra.c @@ -1806,7 +1806,7 @@ push_insns (rtx_insn *from, rtx_insn *to) static void setup_sp_offset (rtx_insn *from, rtx_insn *last) { - rtx_insn *before = next_nonnote_insn_bb (last); + rtx_insn *before = next_nonnote_nondebug_insn_bb (last); HOST_WIDE_INT offset = (before == NULL_RTX || ! INSN_P (before) ? 0 : lra_get_insn_recog_data (before)->sp_offset); diff --git a/gcc/rtl.h b/gcc/rtl.h index 8de5a1cada5a..9cc982172f53 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -3085,13 +3085,13 @@ extern rtx_call_insn *last_call_insn (void); extern rtx_insn *previous_insn (rtx_insn *); extern rtx_insn *next_insn (rtx_insn *); extern rtx_insn *prev_nonnote_insn (rtx_insn *); -extern rtx_insn *prev_nonnote_insn_bb (rtx_insn *); extern rtx_insn *next_nonnote_insn (rtx_insn *); -extern rtx_insn *next_nonnote_insn_bb (rtx_insn *); extern rtx_insn *prev_nondebug_insn (rtx_insn *); extern rtx_insn *next_nondebug_insn (rtx_insn *); extern rtx_insn *prev_nonnote_nondebug_insn (rtx_insn *); +extern rtx_insn *prev_nonnote_nondebug_insn_bb (rtx_insn *); extern rtx_insn *next_nonnote_nondebug_insn (rtx_insn *); +extern rtx_insn *next_nonnote_nondebug_insn_bb (rtx_insn *); extern rtx_insn *prev_real_insn (rtx_insn *); extern rtx_insn *next_real_insn (rtx); extern rtx_insn *prev_active_insn (rtx_insn *); -- 2.13.6 -- Alexandre Oliva, freedom fighter http://FSFLA.org/~lxoliva/ You must be the change you wish to see in the world. -- Gandhi Be Free! -- http://FSFLA.org/ FSF Latin America board member Free Software Evangelist|Red Hat Brasil GNU Toolchain Engineer