diff mbox series

[1/2] S/390: Register pass_s390_early_mach statically

Message ID 20180905084245.2014-1-iii@linux.ibm.com
State New
Headers show
Series [1/2] S/390: Register pass_s390_early_mach statically | expand

Commit Message

Ilya Leoshkevich Sept. 5, 2018, 8:42 a.m. UTC
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-08-27  Ilya Leoshkevich  <iii@linux.ibm.com>

	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.
---
 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 +
 4 files changed, 33 insertions(+), 15 deletions(-)
 create mode 100644 gcc/config/s390/s390-passes.def

Comments

Andreas Krebbel Sept. 6, 2018, 7:36 a.m. UTC | #1
gcc/ChangeLog:

2018-08-27  Ilya Leoshkevich  <iii@linux.ibm.com>

	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.


Committed. Thanks!

Andreas
diff mbox series

Patch

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
+<http://www.gnu.org/licenses/>.  */
+
+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 5c2a8cb2c6c..e869e2eb506 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -10677,6 +10677,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.  */
@@ -15085,21 +15091,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 \