From d7252499463a4fe2c073d8a28c6c0c966e20755f Mon Sep 17 00:00:00 2001 From: Ilya Leoshkevich Date: Thu, 6 Sep 2018 07:35:35 +0000 Subject: [PATCH] S/390: Register pass_s390_early_mach statically The dump file used to come at the end of the sorted dump file list, because the pass was registered dynamically. This did not reflect the order in which passes are executed. Static registration fixes this: * foo4.c.277r.split2 * foo4.c.281r.early_mach * foo4.c.282r.pro_and_epilogue gcc/ChangeLog: 2018-09-06 Ilya Leoshkevich PR target/80080 * config/s390/s390-passes.def: New file. * config/s390/s390-protos.h (class rtl_opt_pass): Add forward declaration. (make_pass_s390_early_mach): Add declaration. * config/s390/s390.c (make_pass_s390_early_mach): (s390_option_override): Remove dynamic registration. * config/s390/t-s390: Add s390-passes.def. From-SVN: r264142 --- gcc/ChangeLog | 11 +++++++++++ gcc/config/s390/s390-passes.def | 20 ++++++++++++++++++++ gcc/config/s390/s390-protos.h | 6 ++++++ gcc/config/s390/s390.c | 21 ++++++--------------- gcc/config/s390/t-s390 | 1 + 5 files changed, 44 insertions(+), 15 deletions(-) create mode 100644 gcc/config/s390/s390-passes.def diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f24c52ed8ba..31f7778d63d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2018-09-06 Ilya Leoshkevich + + PR target/80080 + * config/s390/s390-passes.def: New file. + * config/s390/s390-protos.h (class rtl_opt_pass): Add forward + declaration. + (make_pass_s390_early_mach): Add declaration. + * config/s390/s390.c (make_pass_s390_early_mach): + (s390_option_override): Remove dynamic registration. + * config/s390/t-s390: Add s390-passes.def. + 2018-09-06 Ilya Leoshkevich * config/s390/s390.c (s390_decompose_constant_pool_ref): diff --git a/gcc/config/s390/s390-passes.def b/gcc/config/s390/s390-passes.def new file mode 100644 index 00000000000..035c6e8bc0a --- /dev/null +++ b/gcc/config/s390/s390-passes.def @@ -0,0 +1,20 @@ +/* Description of target passes for S/390. + Copyright (C) 2018 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 +. */ + +INSERT_PASS_BEFORE (pass_thread_prologue_and_epilogue, 1, pass_s390_early_mach); diff --git a/gcc/config/s390/s390-protos.h b/gcc/config/s390/s390-protos.h index 46f0743461d..45fce6ce865 100644 --- a/gcc/config/s390/s390-protos.h +++ b/gcc/config/s390/s390-protos.h @@ -165,3 +165,9 @@ extern void s390_register_target_pragmas (void); /* Routines for s390-c.c */ extern bool s390_const_operand_ok (tree, int, int, tree); + +/* Pass management. */ +namespace gcc { class context; } +class rtl_opt_pass; + +extern rtl_opt_pass *make_pass_s390_early_mach (gcc::context *ctxt); diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 3e183ddb55c..30bf0292d89 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -10556,6 +10556,12 @@ pass_s390_early_mach::execute (function *fun) } // anon namespace +rtl_opt_pass * +make_pass_s390_early_mach (gcc::context *ctxt) +{ + return new pass_s390_early_mach (ctxt); +} + /* Calculate TARGET = REG + OFFSET as s390_emit_prologue would do it. - push too big immediates to the literal pool and annotate the refs - emit frame related notes for stack pointer changes. */ @@ -14964,21 +14970,6 @@ s390_option_override (void) if (!global_options_set.x_dwarf_version) dwarf_version = 2; } - - /* Register a target-specific optimization-and-lowering pass - to run immediately before prologue and epilogue generation. - - Registering the pass must be done at start up. It's - convenient to do it here. */ - opt_pass *new_pass = new pass_s390_early_mach (g); - struct register_pass_info insert_pass_s390_early_mach = - { - new_pass, /* pass */ - "pro_and_epilogue", /* reference_pass_name */ - 1, /* ref_pass_instance_number */ - PASS_POS_INSERT_BEFORE /* po_op */ - }; - register_pass (&insert_pass_s390_early_mach); } #if S390_USE_TARGET_ATTRIBUTE diff --git a/gcc/config/s390/t-s390 b/gcc/config/s390/t-s390 index cdea373040a..8ca0c7879c9 100644 --- a/gcc/config/s390/t-s390 +++ b/gcc/config/s390/t-s390 @@ -18,6 +18,7 @@ TM_H += $(srcdir)/config/s390/s390-builtins.def TM_H += $(srcdir)/config/s390/s390-builtin-types.def +PASSES_EXTRA += $(srcdir)/config/s390/s390-passes.def s390-c.o: $(srcdir)/config/s390/s390-c.c \ $(srcdir)/config/s390/s390-protos.h $(CONFIG_H) $(SYSTEM_H) coretypes.h \ -- 2.30.2