@@ -44,10 +44,10 @@ namespace {
/* Scan the tree to ensure that the compiled code by GCC
conforms to the TI ABI specification. If GCC cannot
output a conforming code, raise an error. */
-const pass_data pass_data_tiabi_check =
+const pass_data pass_data_pru_tiabi_check =
{
GIMPLE_PASS, /* type */
- "*tiabi_check", /* name */
+ "*pru_tiabi_check", /* name */
OPTGROUP_NONE, /* optinfo_flags */
TV_NONE, /* tv_id */
PROP_gimple_any, /* properties_required */
@@ -58,11 +58,11 @@ const pass_data pass_data_tiabi_check =
};
/* Implementation class for the TI ABI compliance-check pass. */
-class pass_tiabi_check : public gimple_opt_pass
+class pass_pru_tiabi_check : public gimple_opt_pass
{
public:
- pass_tiabi_check (gcc::context *ctxt)
- : gimple_opt_pass (pass_data_tiabi_check, ctxt)
+ pass_pru_tiabi_check (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_pru_tiabi_check, ctxt)
{}
/* opt_pass methods: */
@@ -73,7 +73,7 @@ public:
return pru_current_abi == PRU_ABI_TI;
}
-}; // class pass_tiabi_check
+}; // class pass_pru_tiabi_check
/* Return 1 if type TYPE is a pointer to function type or a
structure having a pointer to function type as one of its fields.
@@ -187,7 +187,7 @@ check_op_callback (tree *tp, int *walk_subtrees, void *data)
/* Pass implementation. */
unsigned
-pass_tiabi_check::execute (function *fun)
+pass_pru_tiabi_check::execute (function *fun)
{
struct walk_stmt_info wi;
const_tree fntype = TREE_TYPE (fun->decl);
@@ -210,19 +210,7 @@ pass_tiabi_check::execute (function *fun)
} // anon namespace
gimple_opt_pass *
-make_pass_tiabi_check (gcc::context *ctxt)
+make_pru_tiabi_check (gcc::context *ctxt)
{
- return new pass_tiabi_check (ctxt);
-}
-
-/* Register as early as possible. */
-void
-pru_register_abicheck_pass (void)
-{
- opt_pass *tiabi_check = make_pass_tiabi_check (g);
- struct register_pass_info tiabi_check_info
- = { tiabi_check, "*warn_unused_result",
- 1, PASS_POS_INSERT_AFTER
- };
- register_pass (&tiabi_check_info);
+ return new pass_pru_tiabi_check (ctxt);
}
new file mode 100644
@@ -0,0 +1,24 @@
+/* Description of target passes for PRU.
+ Copyright (C) 2024 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/>. */
+
+/* If strict TI ABI conformance is requested, then this pass would validate
+ that the compiled code by GCC conforms to the TI ABI specification.
+ If GCC cannot output a conforming code, then an error is raised. */
+
+INSERT_PASS_AFTER (pass_warn_unused_result, 1, pru_tiabi_check);
@@ -72,7 +72,7 @@ extern int pru_get_ctable_base_offset (unsigned HOST_WIDE_INT caddr);
extern int pru_symref2ioregno (rtx op);
-extern void pru_register_abicheck_pass (void);
+extern rtl_opt_pass *make_pru_tiabi_check (gcc::context *);
#endif /* RTX_CODE */
@@ -626,11 +626,6 @@ pru_option_override (void)
options. */
target_option_default_node = target_option_current_node
= build_target_option_node (&global_options, &global_options_set);
-
- /* Due to difficulties in implementing the TI ABI with GCC,
- at least check and error-out if GCC cannot compile a
- compliant output. */
- pru_register_abicheck_pass ();
}
/* Compute a (partial) cost for rtx X. Return true if the complete
@@ -19,6 +19,8 @@
# License along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
+PASSES_EXTRA += $(srcdir)/config/pru/pru-passes.def
+
# Unfortunately mabi=ti is not feature-complete enough to build newlib.
# Hence we cannot present mabi=gnu/ti as a multilib option.
Switch to using a passes definition file instead of explicitly registering the PRU-specific passes in pru.cc. This would make it cleaner to add new PRU-specific passes. There are no functional changes. gcc/ChangeLog: * config/pru/pru-passes.cc (class pass_tiabi_check): Rename to add "pru_" prefix. (class pass_pru_tiabi_check): Ditto. (pass_tiabi_check::execute): Ditto. (pass_pru_tiabi_check::execute): Ditto. (make_pru_tiabi_check): Ditto. (pru_register_abicheck_pass): Remove. * config/pru/pru-protos.h (pru_register_abicheck_pass): Remove. (make_pru_tiabi_check): Add declaration. * config/pru/pru.cc (pru_option_override): Remove explicit pass registration. * config/pru/t-pru: Register PRU passes definition file. * config/pru/pru-passes.def: New file. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu> --- gcc/config/pru/pru-passes.cc | 30 +++++++++--------------------- gcc/config/pru/pru-passes.def | 24 ++++++++++++++++++++++++ gcc/config/pru/pru-protos.h | 2 +- gcc/config/pru/pru.cc | 5 ----- gcc/config/pru/t-pru | 2 ++ 5 files changed, 36 insertions(+), 27 deletions(-) create mode 100644 gcc/config/pru/pru-passes.def