From patchwork Sat Sep 30 09:08:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 820188 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-463260-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="pj2Ejpus"; dkim-atps=neutral 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 3y42gf2xPCz9t2h for ; Sat, 30 Sep 2017 19:09:49 +1000 (AEST) 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:cc:subject:date:message-id:in-reply-to:references; q=dns; s= default; b=h/YoCt3HOtO9+a3094m6PgAex2b6USsRXlZDExaH5GHmlojt54MP2 4Kfxdoz1Kiam2LKmBe2VdyZFCUw+nPmcBcDj6KAlqDiDNZx83yq+K//vQVV5U3mD q2jfErIlC1IeknIrgaVGdJRntVNW9ujExRcV/YO2ubSIyDCRsNYvyI= 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:cc:subject:date:message-id:in-reply-to:references; s= default; bh=js0BjIMvw9r9POgthM9r540OL3Q=; b=pj2EjpusjP6fUT91keAH ssRHr1OZ1dU4MR4dUjcRgnhjPBxbakAjljDRKcftLccoziV0KfOSq0vj3WBZ54AZ prfPvqjlpESNOy+Xv/ugLwTF5oRdqGX3hNYpyeIwmQxyAH8Fx0KlocT6dp85gQTx VSFTNaXtO+/J3+icmhvceO8= Received: (qmail 63167 invoked by alias); 30 Sep 2017 09:09:40 -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 63158 invoked by uid 89); 30 Sep 2017 09:09:39 -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, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*Ad:U*aoliva, barriers 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; Sat, 30 Sep 2017 09:09:38 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0884637E88; Sat, 30 Sep 2017 09:09:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0884637E88 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=aoliva@redhat.com Received: from freie.home (ovpn04.gateway.prod.ext.phx2.redhat.com [10.5.9.4]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BDF145C881; Sat, 30 Sep 2017 09:09:36 +0000 (UTC) Received: from frit.home (frit.home [172.31.160.7]) by freie.home (8.15.2/8.15.2) with ESMTP id v8U98pIS022010; Sat, 30 Sep 2017 06:08:51 -0300 From: Alexandre Oliva To: Richard Biener Cc: GCC Patches , Alexandre Oliva Subject: [PATCH 1/9] [SFN] adjust RTL insn-walking API Date: Sat, 30 Sep 2017 06:08:19 -0300 Message-Id: <20170930090827.6604-1-aoliva@redhat.com> In-Reply-To: References: 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. --- gcc/cfgbuild.c | 2 +- gcc/cfgrtl.c | 4 ++-- gcc/emit-rtl.c | 69 ++++++++++++++++++++++++++++++++-------------------------- gcc/lra.c | 2 +- gcc/rtl.h | 4 ++-- 5 files changed, 44 insertions(+), 37 deletions(-) diff --git a/gcc/cfgbuild.c b/gcc/cfgbuild.c index 62956b2..76c21d7 100644 --- a/gcc/cfgbuild.c +++ b/gcc/cfgbuild.c @@ -512,7 +512,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 6ef47b7..bce56b4 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -2274,11 +2274,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 e790cbc..68c1f11 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -3355,20 +3355,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; @@ -3390,67 +3387,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; } @@ -3458,17 +3458,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 a473777..9037495 100644 --- a/gcc/lra.c +++ b/gcc/lra.c @@ -1810,7 +1810,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 a63f33e..3bda77c 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -2980,13 +2980,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 *);