===================================================================
@@ -0,0 +1,28 @@
+/* Description of target passes for AVR.
+ Copyright (C) 2016 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/>. */
+
+/* This avr-specific pass (re)computes insn notes, in particular REG_DEAD
+ notes which are used by `avr.c::reg_unused_after' and branch offset
+ computations. These notes must be correct, i.e. there must be no
+ dangling REG_DEAD notes; otherwise wrong code might result, cf. PR64331.
+
+ DF needs (correct) CFG, hence right before free_cfg is the last
+ opportunity to rectify notes. */
+
+INSERT_PASS_BEFORE (pass_free_cfg, 1, avr_pass_recompute_notes);
===================================================================
@@ -154,6 +154,11 @@ extern void asm_output_float (FILE *file
extern bool avr_have_dimode;
+namespace gcc { class context; }
+class rtl_opt_pass;
+
+extern rtl_opt_pass *make_avr_pass_recompute_notes (gcc::context *);
+
/* From avr-log.c */
#define avr_dump(...) avr_vdump (NULL, __FUNCTION__, __VA_ARGS__)
===================================================================
@@ -295,6 +295,7 @@ avr_to_int_mode (rtx x)
: simplify_gen_subreg (int_mode_for_mode (mode), x, mode, 0);
}
+namespace {
static const pass_data avr_pass_data_recompute_notes =
{
@@ -328,20 +329,12 @@ public:
}
}; // avr_pass_recompute_notes
+} // anon namespace
-static void
-avr_register_passes (void)
+rtl_opt_pass*
+make_avr_pass_recompute_notes (gcc::context *ctxt)
{
- /* This avr-specific pass (re)computes insn notes, in particular REG_DEAD
- notes which are used by `avr.c::reg_unused_after' and branch offset
- computations. These notes must be correct, i.e. there must be no
- dangling REG_DEAD notes; otherwise wrong code might result, cf. PR64331.
-
- DF needs (correct) CFG, hence right before free_cfg is the last
- opportunity to rectify notes. */
-
- register_pass (new avr_pass_recompute_notes (g, "avr-notes-free-cfg"),
- PASS_POS_INSERT_BEFORE, "*free_cfg", 1);
+ return new avr_pass_recompute_notes (ctxt, "avr-notes-free-cfg");
}
@@ -464,11 +457,6 @@ avr_option_override (void)
init_machine_status = avr_init_machine_status;
avr_log_set_avr_log();
-
- /* Register some avr-specific pass(es). There is no canonical place for
- pass registration. This function is convenient. */
-
- avr_register_passes ();
}
/* Function to set up the backend function structure. */
===================================================================
@@ -16,6 +16,8 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
+PASSES_EXTRA += $(srcdir)/config/avr/avr-passes.def
+
driver-avr.o: $(srcdir)/config/avr/driver-avr.c \
$(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(srcdir)/config/avr/avr-arch.h $(TM_H)