From 76beabf41a6e89bc773ede6c7709d41b3be14821 Mon Sep 17 00:00:00 2001 From: Georg-Johann Lay Date: Tue, 11 Oct 2016 08:02:48 +0000 Subject: [PATCH] New avr-passes.def to register AVR specific passes. * config/avr/avr-passes.def: New file. * config/avr/t-avr (PASSES_EXTRA): Add avr-passes.def. * config/avr/avr-protos.h (gcc::context, rtl_opt_pass): Declare. (make_avr_pass_recompute_note): New proto. * config/avr/avr.c (make_avr_pass_recompute_notes): New function. (avr_pass_recompute_notes): Use anonymous namespace. (avr_register_passes): Remove function... (avr_option_override): ...and its call. From-SVN: r240966 --- gcc/ChangeLog | 13 +++++++++++++ gcc/config/avr/avr-passes.def | 28 ++++++++++++++++++++++++++++ gcc/config/avr/avr-protos.h | 5 +++++ gcc/config/avr/avr.c | 22 +++++----------------- gcc/config/avr/t-avr | 2 ++ 5 files changed, 53 insertions(+), 17 deletions(-) create mode 100644 gcc/config/avr/avr-passes.def diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a8860a5fc25..8dbf87c884c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2016-10-11 Georg-Johann Lay + + New avr-passes.def to register AVR specific passes. + + * config/avr/avr-passes.def: New file. + * config/avr/t-avr (PASSES_EXTRA): Add avr-passes.def. + * config/avr/avr-protos.h (gcc::context, rtl_opt_pass): Declare. + (make_avr_pass_recompute_note): New proto. + * config/avr/avr.c (make_avr_pass_recompute_notes): New function. + (avr_pass_recompute_notes): Use anonymous namespace. + (avr_register_passes): Remove function... + (avr_option_override): ...and its call. + 2016-10-11 Robert Suchanek * config/mips/mips-cpus.def: Replace PTF_AVOID_BRANCHLIKELY with diff --git a/gcc/config/avr/avr-passes.def b/gcc/config/avr/avr-passes.def new file mode 100644 index 00000000000..64d9ce4f183 --- /dev/null +++ b/gcc/config/avr/avr-passes.def @@ -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 + . */ + +/* 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); diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h index ddc3047b32b..1a5efa8fb31 100644 --- a/gcc/config/avr/avr-protos.h +++ b/gcc/config/avr/avr-protos.h @@ -154,6 +154,11 @@ extern void asm_output_float (FILE *file, REAL_VALUE_TYPE n); 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__) diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index 9cb81061dc0..7310b54f9ed 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -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. */ diff --git a/gcc/config/avr/t-avr b/gcc/config/avr/t-avr index 48b77013dde..ffa5b5010a1 100644 --- a/gcc/config/avr/t-avr +++ b/gcc/config/avr/t-avr @@ -16,6 +16,8 @@ # along with GCC; see the file COPYING3. If not see # . +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) -- 2.30.2