From f60689fa50609683d5f6adc32d96f965d510dd6b Mon Sep 17 00:00:00 2001 From: Claudiu Zissulescu Date: Wed, 20 Nov 2019 09:39:21 +0100 Subject: [ARC] Register ARC specific passes with a .def file. New arc-passes.def to register ARC specific passes. gcc/ xxxx-xx-xx Claudiu Zissulescu * 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. From-SVN: r278485 --- gcc/config/arc/arc-passes.def | 29 ++++++++++++++++++++ gcc/config/arc/arc-protos.h | 3 ++ gcc/config/arc/arc.c | 64 ++++++++++++++++++------------------------- gcc/config/arc/t-arc | 2 ++ 4 files changed, 61 insertions(+), 37 deletions(-) create mode 100644 gcc/config/arc/arc-passes.def (limited to 'gcc/config') diff --git a/gcc/config/arc/arc-passes.def b/gcc/config/arc/arc-passes.def new file mode 100644 index 0000000..ebb69a5 --- /dev/null +++ b/gcc/config/arc/arc-passes.def @@ -0,0 +1,29 @@ +/* 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 + . */ + +/* 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); diff --git a/gcc/config/arc/arc-protos.h b/gcc/config/arc/arc-protos.h index 1220e77..da128dc 100644 --- a/gcc/config/arc/arc-protos.h +++ b/gcc/config/arc/arc-protos.h @@ -111,3 +111,6 @@ extern void arc_eh_return_address_location (rtx); extern bool arc_is_jli_call_p (rtx); extern void arc_file_end (void); extern bool arc_is_secure_call_p (rtx); + +rtl_opt_pass * make_pass_arc_ifcvt (gcc::context *ctxt); +rtl_opt_pass * make_pass_arc_predicate_delay_insns (gcc::context *ctxt); diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c index 115500e..28305f4 100644 --- a/gcc/config/arc/arc.c +++ b/gcc/config/arc/arc.c @@ -962,14 +962,24 @@ const pass_data pass_data_arc_ifcvt = 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 @@ -999,16 +1009,20 @@ const pass_data pass_data_arc_predicate_delay_insns = 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 @@ -1101,30 +1115,6 @@ arc_init (void) 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 diff --git a/gcc/config/arc/t-arc b/gcc/config/arc/t-arc index ca6e06a..604e639 100644 --- a/gcc/config/arc/t-arc +++ b/gcc/config/arc/t-arc @@ -43,6 +43,8 @@ $(srcdir)/config/arc/arc-tables.opt: $(srcdir)/config/arc/genoptions.awk \ $(srcdir)/config/arc/arc-cpus.def $(AWK) -f $< -v FORMAT=Makefile $< $(srcdir)/config/arc/arc-cpus.def > $@ +PASSES_EXTRA += $(srcdir)/config/arc/arc-passes.def + # Local Variables: # mode: Makefile # End: -- cgit v1.1