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.
This commit is contained in:
parent
38660e87f0
commit
f4777088c9
@ -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
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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.
|
||||
|
118
gcc/recog.c
118
gcc/recog.c
@ -3943,12 +3943,66 @@ 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_sched2 =
|
||||
{
|
||||
RTL_PASS, /* type */
|
||||
"split3", /* name */
|
||||
OPTGROUP_NONE, /* optinfo_flags */
|
||||
TV_NONE, /* tv_id */
|
||||
0, /* properties_required */
|
||||
0, /* properties_provided */
|
||||
0, /* properties_destroyed */
|
||||
0, /* todo_flags_start */
|
||||
0, /* todo_flags_finish */
|
||||
};
|
||||
|
||||
class pass_split_before_sched2 : public rtl_opt_pass
|
||||
{
|
||||
public:
|
||||
pass_split_before_sched2 (gcc::context *ctxt)
|
||||
: rtl_opt_pass (pass_data_split_before_sched2, ctxt)
|
||||
{}
|
||||
|
||||
/* opt_pass methods: */
|
||||
virtual bool gate (function *)
|
||||
{
|
||||
return enable_split_before_sched2 ();
|
||||
}
|
||||
|
||||
virtual unsigned int execute (function *)
|
||||
{
|
||||
split_all_insns ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
}; // class pass_split_before_sched2
|
||||
|
||||
} // anon namespace
|
||||
|
||||
rtl_opt_pass *
|
||||
make_pass_split_before_sched2 (gcc::context *ctxt)
|
||||
{
|
||||
return new pass_split_before_sched2 (ctxt);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
const pass_data pass_data_split_before_regstack =
|
||||
{
|
||||
RTL_PASS, /* type */
|
||||
"split3", /* name */
|
||||
"split4", /* name */
|
||||
OPTGROUP_NONE, /* optinfo_flags */
|
||||
TV_NONE, /* tv_id */
|
||||
0, /* properties_required */
|
||||
@ -3983,11 +4037,7 @@ pass_split_before_regstack::gate (function *)
|
||||
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
|
||||
return !enable_split_before_sched2 ();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
@ -4001,62 +4051,6 @@ 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)
|
||||
{
|
||||
#ifdef INSN_SCHEDULING
|
||||
split_all_insns ();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
const pass_data pass_data_split_before_sched2 =
|
||||
{
|
||||
RTL_PASS, /* type */
|
||||
"split4", /* name */
|
||||
OPTGROUP_NONE, /* optinfo_flags */
|
||||
TV_NONE, /* tv_id */
|
||||
0, /* properties_required */
|
||||
0, /* properties_provided */
|
||||
0, /* properties_destroyed */
|
||||
0, /* todo_flags_start */
|
||||
0, /* todo_flags_finish */
|
||||
};
|
||||
|
||||
class pass_split_before_sched2 : public rtl_opt_pass
|
||||
{
|
||||
public:
|
||||
pass_split_before_sched2 (gcc::context *ctxt)
|
||||
: rtl_opt_pass (pass_data_split_before_sched2, ctxt)
|
||||
{}
|
||||
|
||||
/* opt_pass methods: */
|
||||
virtual bool gate (function *)
|
||||
{
|
||||
#ifdef INSN_SCHEDULING
|
||||
return optimize > 0 && flag_schedule_insns_after_reload;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual unsigned int execute (function *)
|
||||
{
|
||||
return rest_of_handle_split_before_sched2 ();
|
||||
}
|
||||
|
||||
}; // class pass_split_before_sched2
|
||||
|
||||
} // anon namespace
|
||||
|
||||
rtl_opt_pass *
|
||||
make_pass_split_before_sched2 (gcc::context *ctxt)
|
||||
{
|
||||
return new pass_split_before_sched2 (ctxt);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
const pass_data pass_data_split_for_shorten_branches =
|
||||
|
Loading…
Reference in New Issue
Block a user