aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUros Bizjak <ubizjak@gmail.com>2020-02-09 17:56:38 +0100
committerUros Bizjak <ubizjak@gmail.com>2020-02-09 17:56:38 +0100
commitf4777088c9fdcf92374e33c6cb5cf8038216e86f (patch)
tree85523c7252064a953b0e87b5bdf8a22885332af2
parent38660e87f01dbe15082e83cc4842d66f8d292ba0 (diff)
downloadgcc-f4777088c9fdcf92374e33c6cb5cf8038216e86f.zip
gcc-f4777088c9fdcf92374e33c6cb5cf8038216e86f.tar.gz
gcc-f4777088c9fdcf92374e33c6cb5cf8038216e86f.tar.bz2
Improve splitX passes management
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. * 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.
-rw-r--r--gcc/ChangeLog17
-rw-r--r--gcc/config/nds32/nds32.c2
-rw-r--r--gcc/config/sh/sh.c2
-rw-r--r--gcc/recog.c98
4 files changed, 65 insertions, 54 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 34c0811..feb2d06 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,20 @@
+2020-02-09 Uroš Bizjak <ubizjak@gmail.com>
+
+ * 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.
+
2020-02-09 Jakub Jelinek <jakub@redhat.com>
* gimplify.c (gimplify_adjust_omp_clauses_1): Promote
diff --git a/gcc/config/nds32/nds32.c b/gcc/config/nds32/nds32.c
index 625fa8c..acf1371 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 3439f16..a178cfd 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 5790a58..8c098cf 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 {