+2019-11-20 Claudiu Zissulescu <claziss@synopsys.com>
+
+ * config/arc/arc-protos.h (make_pass_arc_ifcvt): Declare.
+ (make_pass_arc_predicate_delay_insns): Likewise.
+ * config/arc/arc.c (class pass_arc_ifcvt): Reformat text, add gate
+ method, remove clone.
+ (class pass_arc_predicate_delay_insns): Likewise.
+ (arc_init): Remove registering of ARC specific passes.
+ * config/arc/t-arc (PASSES_EXTRA): Add arc-passes.def.
+ * config/arc/arc-passes.def: New file.
+
2019-11-20 Jakub Jelinek <jakub@redhat.com>
PR middle-end/90840
--- /dev/null
+/* Description of target passes for ARC.
+ Copyright (C) 2019 Free Software Foundation, Inc. */
+
+/* This file is part of GCC.
+
+ GCC is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 3, or (at your option) any later
+ version.
+
+ GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+
+/* First target dependent ARC if-conversion pass. */
+INSERT_PASS_AFTER (pass_delay_slots, 1, pass_arc_ifcvt);
+
+/* Second target dependent ARC if-conversion pass. */
+INSERT_PASS_BEFORE (pass_shorten_branches, 1, pass_arc_ifcvt);
+
+/* Find annulled delay insns and convert them to use the appropriate
+ predicate. This allows branch shortening to size up these
+ instructions properly. */
+INSERT_PASS_AFTER (pass_delay_slots, 1, pass_arc_predicate_delay_insns);
class pass_arc_ifcvt : public rtl_opt_pass
{
-public:
- pass_arc_ifcvt(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_arc_ifcvt, ctxt)
- {}
+ public:
+ pass_arc_ifcvt (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_arc_ifcvt, ctxt)
+ {}
/* opt_pass methods: */
- opt_pass * clone () { return new pass_arc_ifcvt (m_ctxt); }
- virtual unsigned int execute (function *) { return arc_ifcvt (); }
+ opt_pass * clone ()
+ {
+ return new pass_arc_ifcvt (m_ctxt);
+ }
+ virtual unsigned int execute (function *)
+ {
+ return arc_ifcvt ();
+ }
+ virtual bool gate (function *)
+ {
+ return (optimize > 1 && !TARGET_NO_COND_EXEC);
+ }
};
} // anon namespace
class pass_arc_predicate_delay_insns : public rtl_opt_pass
{
-public:
- pass_arc_predicate_delay_insns(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_arc_predicate_delay_insns, ctxt)
- {}
+ public:
+ pass_arc_predicate_delay_insns(gcc::context *ctxt)
+ : rtl_opt_pass(pass_data_arc_predicate_delay_insns, ctxt)
+ {}
/* opt_pass methods: */
virtual unsigned int execute (function *)
- {
- return arc_predicate_delay_insns ();
- }
+ {
+ return arc_predicate_delay_insns ();
+ }
+ virtual bool gate (function *)
+ {
+ return flag_delayed_branch;
+ }
};
} // anon namespace
arc_punct_chars['&'] = 1;
arc_punct_chars['+'] = 1;
arc_punct_chars['_'] = 1;
-
- if (optimize > 1 && !TARGET_NO_COND_EXEC)
- {
- /* There are two target-independent ifcvt passes, and arc_reorg may do
- one or more arc_ifcvt calls. */
- opt_pass *pass_arc_ifcvt_4 = make_pass_arc_ifcvt (g);
- struct register_pass_info arc_ifcvt4_info
- = { pass_arc_ifcvt_4, "dbr", 1, PASS_POS_INSERT_AFTER };
- struct register_pass_info arc_ifcvt5_info
- = { pass_arc_ifcvt_4->clone (), "shorten", 1, PASS_POS_INSERT_BEFORE };
-
- register_pass (&arc_ifcvt4_info);
- register_pass (&arc_ifcvt5_info);
- }
-
- if (flag_delayed_branch)
- {
- opt_pass *pass_arc_predicate_delay_insns
- = make_pass_arc_predicate_delay_insns (g);
- struct register_pass_info arc_predicate_delay_info
- = { pass_arc_predicate_delay_insns, "dbr", 1, PASS_POS_INSERT_AFTER };
-
- register_pass (&arc_predicate_delay_info);
- }
}
/* Parse -mirq-ctrl-saved=RegisterRange, blink, lp_copunt. The