public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, rs6000] Use new pass registration framework for analyze_swaps
@ 2016-12-08 22:54 Bill Schmidt
  2016-12-09  3:25 ` Segher Boessenkool
  0 siblings, 1 reply; 2+ messages in thread
From: Bill Schmidt @ 2016-12-08 22:54 UTC (permalink / raw)
  To: gcc-patches; +Cc: segher, jakub, dje.gcc

Hi,

Back in October
(https://gcc.gnu.org/ml/gcc-patches/2016-10/msg00256.html), Jakub
updated the target pass registration framework so that target passes act
more like regular passes:  their dumps are numbered in proper order, and
use of dump options like -details now works.  I've finally gotten around
to updating the rs6000 back end to take advantage of this.

Bootstrapped and tested on powerpc64le-unknown-linux-gnu with no
regressions.  I've verified that the "swaps" dump now appears with
proper numbering:

-rw-rw-r--  1 wschmidt wschmidt     3815 Dec  8 16:40 swaps-p8-17.c.232r.dfinit
-rw-rw-r--  1 wschmidt wschmidt     5092 Dec  8 16:40 swaps-p8-17.c.233r.swaps
-rw-rw-r--  1 wschmidt wschmidt     9751 Dec  8 16:40 swaps-p8-17.c.234r.cse1

Is this ok for trunk?

Thanks,
Bill


2016-12-08  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	* config/rs6000/rs6000-passes.def: New file.
	* config/rs6000/rs6000-protos.h: Declare make_pass_analyze_swaps.
	* config/rs6000/rs6000.c (rs6000_option_override): Remove
	registration of machine-specific passes.
	(pass_analyze_swaps::clone): New function.
	* config/rs6000/t-rs6000: Define PASSES_EXTRA.


Index: gcc/config/rs6000/rs6000-passes.def
===================================================================
--- gcc/config/rs6000/rs6000-passes.def	(revision 0)
+++ gcc/config/rs6000/rs6000-passes.def	(working copy)
@@ -0,0 +1,27 @@
+/* Description of target passes for rs6000
+   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/>.  */
+
+/*
+   Macros that can be used in this file:
+   INSERT_PASS_AFTER (PASS, INSTANCE, TGT_PASS)
+   INSERT_PASS_BEFORE (PASS, INSTANCE, TGT_PASS)
+   REPLACE_PASS (PASS, INSTANCE, TGT_PASS)
+ */
+
+  INSERT_PASS_BEFORE (pass_cse, 1, pass_analyze_swaps);
Index: gcc/config/rs6000/rs6000-protos.h
===================================================================
--- gcc/config/rs6000/rs6000-protos.h	(revision 243441)
+++ gcc/config/rs6000/rs6000-protos.h	(working copy)
@@ -258,4 +258,11 @@ extern unsigned char rs6000_class_max_nregs[][LIM_
 extern unsigned char rs6000_hard_regno_nregs[][FIRST_PSEUDO_REGISTER];
 
 extern bool rs6000_linux_float_exceptions_rounding_supported_p (void);
+
+/* Pass management.  */
+namespace gcc { class context; }
+class rtl_opt_pass;
+
+extern rtl_opt_pass *make_pass_analyze_swaps (gcc::context *);
+
 #endif  /* rs6000-protos.h */
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c	(revision 243441)
+++ gcc/config/rs6000/rs6000.c	(working copy)
@@ -5203,15 +5203,6 @@ static void
 rs6000_option_override (void)
 {
   (void) rs6000_option_override_internal (true);
-
-  /* Register machine-specific passes.  This needs to be done at start-up.
-     It's convenient to do it here (like i386 does).  */
-  opt_pass *pass_analyze_swaps = make_pass_analyze_swaps (g);
-
-  struct register_pass_info analyze_swaps_info
-    = { pass_analyze_swaps, "cse1", 1, PASS_POS_INSERT_BEFORE };
-
-  register_pass (&analyze_swaps_info);
 }
 
 \f
@@ -41865,6 +41856,11 @@ class pass_analyze_swaps : public rtl_opt_pass
       return rs6000_analyze_swaps (fun);
     }
 
+  opt_pass *clone ()
+    {
+      return new pass_analyze_swaps (m_ctxt);
+    }
+
 }; // class pass_analyze_swaps
 
 rtl_opt_pass *
Index: gcc/config/rs6000/t-rs6000
===================================================================
--- gcc/config/rs6000/t-rs6000	(revision 243441)
+++ gcc/config/rs6000/t-rs6000	(working copy)
@@ -20,6 +20,7 @@
 
 TM_H += $(srcdir)/config/rs6000/rs6000-builtin.def
 TM_H += $(srcdir)/config/rs6000/rs6000-cpus.def
+PASSES_EXTRA += $(srcdir)/config/rs6000/rs6000-passes.def
 
 rs6000-c.o: $(srcdir)/config/rs6000/rs6000-c.c
 	$(COMPILE) $<


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH, rs6000] Use new pass registration framework for analyze_swaps
  2016-12-08 22:54 [PATCH, rs6000] Use new pass registration framework for analyze_swaps Bill Schmidt
@ 2016-12-09  3:25 ` Segher Boessenkool
  0 siblings, 0 replies; 2+ messages in thread
From: Segher Boessenkool @ 2016-12-09  3:25 UTC (permalink / raw)
  To: Bill Schmidt; +Cc: gcc-patches, jakub, dje.gcc

On Thu, Dec 08, 2016 at 04:53:55PM -0600, Bill Schmidt wrote:
> Back in October
> (https://gcc.gnu.org/ml/gcc-patches/2016-10/msg00256.html), Jakub
> updated the target pass registration framework so that target passes act
> more like regular passes:  their dumps are numbered in proper order, and
> use of dump options like -details now works.  I've finally gotten around
> to updating the rs6000 back end to take advantage of this.
> 
> Bootstrapped and tested on powerpc64le-unknown-linux-gnu with no
> regressions.  I've verified that the "swaps" dump now appears with
> proper numbering:
> 
> -rw-rw-r--  1 wschmidt wschmidt     3815 Dec  8 16:40 swaps-p8-17.c.232r.dfinit
> -rw-rw-r--  1 wschmidt wschmidt     5092 Dec  8 16:40 swaps-p8-17.c.233r.swaps
> -rw-rw-r--  1 wschmidt wschmidt     9751 Dec  8 16:40 swaps-p8-17.c.234r.cse1
> 
> Is this ok for trunk?

Yes please.  Thanks,


Segher


> 2016-12-08  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
> 
> 	* config/rs6000/rs6000-passes.def: New file.
> 	* config/rs6000/rs6000-protos.h: Declare make_pass_analyze_swaps.
> 	* config/rs6000/rs6000.c (rs6000_option_override): Remove
> 	registration of machine-specific passes.
> 	(pass_analyze_swaps::clone): New function.
> 	* config/rs6000/t-rs6000: Define PASSES_EXTRA.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-12-09  3:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-08 22:54 [PATCH, rs6000] Use new pass registration framework for analyze_swaps Bill Schmidt
2016-12-09  3:25 ` Segher Boessenkool

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).