From patchwork Thu Feb 6 11:13:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 1234264 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-519027-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha1 header.s=default header.b=fR8FRb4P; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=J+PF8rVx; 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 48CwmS35FKz9sRG for ; Thu, 6 Feb 2020 22:13:58 +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 :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=own1IhoaNJMN7lmts5U7TyB/xIfkpyxXnrHzZ68v0Sd98H ES2LXgx5V09J8VAV5Ux/qoou+MQa+lpOnLl9ipDFhbbMfIzlWlum+eIT1R8MowOT ZOOxqLzdLapzoqMDvXwmX5WAIcDYXdbUfuu9co8HyFnue9+wUvEFlsN5egbTg= 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 :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=43nlWkw5IRo7lzzeJkLvdZLcR3Y=; b=fR8FRb4PXf99mNOYhIi9 kIbtT6yg5PspseBQKL8JUTd0Lri1xAjl32tNcsLNa4SfgbQAcvFXao1wGb8gAsGo DmJwLTRd0thZQYs/UwvzPk4WrXe59jEAdMQyUh9UgEB3d384O31h2bdmTTH64wlM QeA4b0UuAKDp5cu2qLmoGnc= Received: (qmail 45330 invoked by alias); 6 Feb 2020 11:13:51 -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 45318 invoked by uid 89); 6 Feb 2020 11:13:50 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.6 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-il1-f171.google.com Received: from mail-il1-f171.google.com (HELO mail-il1-f171.google.com) (209.85.166.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 06 Feb 2020 11:13:48 +0000 Received: by mail-il1-f171.google.com with SMTP id s85so4712243ill.11 for ; Thu, 06 Feb 2020 03:13:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=gLWObchoFbwofNrlIwje7T0FWBxgZbs6PKjBq7Vk6os=; b=J+PF8rVxLx+N+bkwFCwSQHMFd15Zr8R6AKScqnSJ9/a5xMNm/mPkXBgKSvC9Mu0sCL H7AU/MnIQNe5CU6yK2KnOKqYDk/GEe04SH1tMMKjzpuDAXm4NYVWyYJqcv+9tCh1E48f IfnqkaO75WZgP5GtTCXPt9Rnvv0zhs8Yj0I32VjkD/LhauZQXI12Bt4CBprE/odZm5Q6 FryVCvVjffPMUA3kfgNOFZkDMxczISA654c9tWj//mAGp91VL3kzJp1JpRpfame0+zG8 vlbOBoOMLJCB0iruuHJeWFP6baAWpfa/gwp2SSUaGCOIomWH1U95xQo1LBQyrZfA9JwS Dsxw== MIME-Version: 1.0 From: Uros Bizjak Date: Thu, 6 Feb 2020 12:13:35 +0100 Message-ID: Subject: [PATCH] Improve splitX passes management To: "gcc-patches@gcc.gnu.org" The names of split_before_sched2 ("split4") and split_before_regstack ("split3") do not reflect their insertion point in the sequence of passes, where split_before_regstack follows split_before_sched2. Reorder the code and rename the passes to reflect the reality. split_before_regstack pass does not need to run if split_before_sched2 pass was already performed. Introduce enable_split_before_sched2 function to simplify gating functions of these two passes. There is no need for a separate rest_of_handle_split_before_sched2. split_all_insns can be called unconditionally from pass_split_before_sched2::execute, since the corresponding gating function determines if the pass is executed or not. Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}. 2020-02-06 Uroš Bizjak * recog.c: Move pass_split_before_sched2 code in front of pass_split_before_regstack. (pass_data_split_before_sched2): Rename pass to split3 from split4. (pass_data_split_before_regstack): Rename pass to split4 from split3. (rest_of_handle_split_before_sched2): Remove. (pass_split_before_sched2::execute): Unconditionally call split_all_insns. (enable_split_before_sched2): New function. (pass_split_before_sched2::gate): Use enable_split_before_sched2. (pass_split_before_regstack::gate): Ditto. * config/nds32/nds32.c (nds32_split_double_word_load_store_p): Update name check for renamed split4 pass. * config/sh/sh.c (register_sh_passes): Update pass insertion point for renamed split4 pass. Uros. diff --git a/gcc/config/nds32/nds32.c b/gcc/config/nds32/nds32.c index 625fa8ce7db8..acf13715d830 100644 --- a/gcc/config/nds32/nds32.c +++ b/gcc/config/nds32/nds32.c @@ -5496,7 +5496,7 @@ nds32_split_double_word_load_store_p(rtx *operands, bool load_p) return false; const char *pass_name = current_pass->name; - if (pass_name && ((strcmp (pass_name, "split4") == 0) + if (pass_name && ((strcmp (pass_name, "split3") == 0) || (strcmp (pass_name, "split5") == 0))) return !satisfies_constraint_Da (mem) || MEM_VOLATILE_P (mem); diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index 3439f1663830..a178cfd3b9c9 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -800,7 +800,7 @@ register_sh_passes (void) /* Run sh_treg_combine pass after register allocation and basic block reordering as this sometimes creates new opportunities. */ register_pass (make_pass_sh_treg_combine (g, true, "sh_treg_combine3"), - PASS_POS_INSERT_AFTER, "split4", 1); + PASS_POS_INSERT_AFTER, "split3", 1); /* Optimize sett and clrt insns, by e.g. removing them if the T bit value is known after a conditional branch. diff --git a/gcc/recog.c b/gcc/recog.c index 5790a58a9114..8c098cf5b0fe 100644 --- a/gcc/recog.c +++ b/gcc/recog.c @@ -3943,9 +3943,19 @@ make_pass_split_after_reload (gcc::context *ctxt) return new pass_split_after_reload (ctxt); } +static bool +enable_split_before_sched2 (void) +{ +#ifdef INSN_SCHEDULING + return optimize > 0 && flag_schedule_insns_after_reload; +#else + return false; +#endif +} + namespace { -const pass_data pass_data_split_before_regstack = +const pass_data pass_data_split_before_sched2 = { RTL_PASS, /* type */ "split3", /* name */ @@ -3958,61 +3968,38 @@ const pass_data pass_data_split_before_regstack = 0, /* todo_flags_finish */ }; -class pass_split_before_regstack : public rtl_opt_pass +class pass_split_before_sched2 : public rtl_opt_pass { public: - pass_split_before_regstack (gcc::context *ctxt) - : rtl_opt_pass (pass_data_split_before_regstack, ctxt) + pass_split_before_sched2 (gcc::context *ctxt) + : rtl_opt_pass (pass_data_split_before_sched2, ctxt) {} /* opt_pass methods: */ - virtual bool gate (function *); + virtual bool gate (function *) + { + return enable_split_before_sched2 (); + } + virtual unsigned int execute (function *) { split_all_insns (); return 0; } -}; // class pass_split_before_regstack - -bool -pass_split_before_regstack::gate (function *) -{ -#if HAVE_ATTR_length && defined (STACK_REGS) - /* If flow2 creates new instructions which need splitting - and scheduling after reload is not done, they might not be - split until final which doesn't allow splitting - if HAVE_ATTR_length. */ -# ifdef INSN_SCHEDULING - return !optimize || !flag_schedule_insns_after_reload; -# else - return true; -# endif -#else - return false; -#endif -} +}; // class pass_split_before_sched2 } // anon namespace rtl_opt_pass * -make_pass_split_before_regstack (gcc::context *ctxt) -{ - return new pass_split_before_regstack (ctxt); -} - -static unsigned int -rest_of_handle_split_before_sched2 (void) +make_pass_split_before_sched2 (gcc::context *ctxt) { -#ifdef INSN_SCHEDULING - split_all_insns (); -#endif - return 0; + return new pass_split_before_sched2 (ctxt); } namespace { -const pass_data pass_data_split_before_sched2 = +const pass_data pass_data_split_before_regstack = { RTL_PASS, /* type */ "split4", /* name */ @@ -4025,36 +4012,43 @@ const pass_data pass_data_split_before_sched2 = 0, /* todo_flags_finish */ }; -class pass_split_before_sched2 : public rtl_opt_pass +class pass_split_before_regstack : public rtl_opt_pass { public: - pass_split_before_sched2 (gcc::context *ctxt) - : rtl_opt_pass (pass_data_split_before_sched2, ctxt) + pass_split_before_regstack (gcc::context *ctxt) + : rtl_opt_pass (pass_data_split_before_regstack, ctxt) {} /* opt_pass methods: */ - virtual bool gate (function *) - { -#ifdef INSN_SCHEDULING - return optimize > 0 && flag_schedule_insns_after_reload; -#else - return false; -#endif - } - + virtual bool gate (function *); virtual unsigned int execute (function *) { - return rest_of_handle_split_before_sched2 (); + split_all_insns (); + return 0; } -}; // class pass_split_before_sched2 +}; // class pass_split_before_regstack + +bool +pass_split_before_regstack::gate (function *) +{ +#if HAVE_ATTR_length && defined (STACK_REGS) + /* If flow2 creates new instructions which need splitting + and scheduling after reload is not done, they might not be + split until final which doesn't allow splitting + if HAVE_ATTR_length. */ + return !enable_split_before_sched2 (); +#else + return false; +#endif +} } // anon namespace rtl_opt_pass * -make_pass_split_before_sched2 (gcc::context *ctxt) +make_pass_split_before_regstack (gcc::context *ctxt) { - return new pass_split_before_sched2 (ctxt); + return new pass_split_before_regstack (ctxt); } namespace {