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
This commit is contained in:
Georg-Johann Lay 2016-10-11 08:02:48 +00:00 committed by Georg-Johann Lay
parent 7c50766489
commit 76beabf41a
5 changed files with 53 additions and 17 deletions

View file

@ -1,3 +1,16 @@
2016-10-11 Georg-Johann Lay <avr@gjlay.de>
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 <robert.suchanek@imgtec.com>
* config/mips/mips-cpus.def: Replace PTF_AVOID_BRANCHLIKELY with

View file

@ -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);

View file

@ -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__)

View file

@ -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. */

View file

@ -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)