This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [buildbot] r201508: Build failures after pass C++ conversion


On Tue, 2013-08-06 at 13:12 +0200, Jan-Benedict Glaw wrote:
> On Mon, 2013-08-05 20:16:05 -0000, dmalcolm@gcc.gnu.org <dmalcolm@gcc.gnu.org> wrote:
> > New Revision: 201508
> > 
> > URL: http://gcc.gnu.org/viewcvs?rev=201508&root=gcc&view=rev
> > Log:
> > Automated conversion of passes to C++ classes
> > 
> > gcc/
> > 
> > 	Patch autogenerated by refactor_passes.py from
> > 	https://github.com/davidmalcolm/gcc-refactoring-scripts
> > 	revision 03fe39476a4c4ea450b49e087cfa817b5f92021e
> 
> I see quite some fall-out from this on epiphany-elf:
> 
> g++ -c   -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -Ibuild -I../../../../gcc/gcc -I../../../../gcc/gcc/build -I../../../../gcc/gcc/../include -I../../../../gcc/gcc/../libcpp/include  -I../../../../gcc/gcc/../libdecnumber -I../../../../gcc/gcc/../libdecnumber/dpd -I../libdecnumber -I../../../../gcc/gcc/../libbacktrace    \
>                 -o build/genflags.o ../../../../gcc/gcc/genflags.c
> In file included from ./tm.h:21:0,
>                  from ../../../../gcc/gcc/genflags.c:26:
> ../../../../gcc/gcc/config/epiphany/epiphany.h:932:8: error: ârtl_opt_passâ does not name a type
>  extern rtl_opt_pass *make_pass_mode_switch_use (gcc::context *ctxt);
>         ^
> ../../../../gcc/gcc/config/epiphany/epiphany.h:933:8: error: ârtl_opt_passâ does not name a type
>  extern rtl_opt_pass *make_pass_resolve_sw_modes (gcc::context *ctxt);
>         ^
Sorry about this, clearly I failed to test the target-specific passes.

epiphany_init does some interesting manipulation of passes.  I don't
have epiphany hardware, but I've reproduced the build failure on my
x86_64 box using --configure target=epiphany-elf, and the attached patch
ports it to the new API.  With this patch, stage 1 was able to build,
and cc1 seems to generate assembler on a trivial test. I was able to
step through epiphany_init's pass manipulation, and it appears to be
doing the right thing.

This does add two new headers to epiphany.c; I'm not seeing where to add
the deps (gcc/config/epiphany/t-epiphany doesn't list epiphany.o).

I'm kicking off a bootstrap of this (on x86_64) to further verify that
the non-epiphany changes are good.  What other testing can I do to
verify this?

gcc/

	* config/epiphany/epiphany.c (pass_mode_switch_use): New.
	(epiphany_init): Port to new C++ pass API.
	(epiphany_optimize_mode_switching): Likewise.
	* config/epiphany/epiphany.h: Likewise.
	* pass_manager.h (pass_manager::get_pass_split_all_insns): New.
	(pass_manager::get_pass_mode_switching): New.
	(pass_manager::get_pass_peephole2): New.
	* mode-switching.c (pass_mode_switching): Add clone method.
	* recog.c (pass_peephole2): Add clone method.
	(pass_split_all_insns): Add clone method.

Sorry again about this.
Index: gcc/mode-switching.c
===================================================================
--- gcc/mode-switching.c	(revision 201526)
+++ gcc/mode-switching.c	(working copy)
@@ -809,6 +809,9 @@
   {}
 
   /* opt_pass methods: */
+  /* The epiphany backend creates a second instance of this pass, so we need
+     a clone method.  */
+  opt_pass * clone () { return new pass_mode_switching (ctxt_); }
   bool gate () { return gate_mode_switching (); }
   unsigned int execute () { return rest_of_handle_mode_switching (); }
 
Index: gcc/config/epiphany/epiphany.c
===================================================================
--- gcc/config/epiphany/epiphany.c	(revision 201526)
+++ gcc/config/epiphany/epiphany.c	(working copy)
@@ -45,6 +45,8 @@
 #include "ggc.h"
 #include "tm-constrs.h"
 #include "tree-pass.h"	/* for current_pass */
+#include "context.h"
+#include "pass_manager.h"
 
 /* Which cpu we're compiling for.  */
 int epiphany_cpu_type;
@@ -59,6 +61,9 @@
 /* The rounding mode that we generally use for floating point.  */
 int epiphany_normal_fp_rounding;
 
+/* The pass instance, for use in epiphany_optimize_mode_switching. */
+static opt_pass *pass_mode_switch_use;
+
 static void epiphany_init_reg_tables (void);
 static int get_epiphany_condition_code (rtx);
 static tree epiphany_handle_interrupt_attribute (tree *, tree, tree, int, bool *);
@@ -165,20 +170,24 @@
      pass because of the side offect of epiphany_mode_needed on
      MACHINE_FUNCTION(cfun)->unknown_mode_uses.  But it must run before
      pass_resolve_sw_modes.  */
-  static struct register_pass_info insert_use_info
-    = { &pass_mode_switch_use.pass, "mode_sw",
+  pass_mode_switch_use = make_pass_mode_switch_use (g);
+  struct register_pass_info insert_use_info
+    = { pass_mode_switch_use, "mode_sw",
 	1, PASS_POS_INSERT_AFTER
       };
-  static struct register_pass_info mode_sw2_info
-    = { &pass_mode_switching.pass, "mode_sw",
+  opt_pass *mode_sw2 = g->get_passes()->get_pass_mode_switching()->clone ();
+  struct register_pass_info mode_sw2_info
+    = { mode_sw2, "mode_sw",
 	1, PASS_POS_INSERT_AFTER
       };
-  static struct register_pass_info mode_sw3_info
-    = { &pass_resolve_sw_modes.pass, "mode_sw",
+  opt_pass *mode_sw3 = make_pass_resolve_sw_modes (g);
+  struct register_pass_info mode_sw3_info
+    = { mode_sw3, "mode_sw",
 	1, PASS_POS_INSERT_AFTER
       };
-  static struct register_pass_info mode_sw4_info
-    = { &pass_split_all_insns.pass, "mode_sw",
+  opt_pass *mode_sw4 = g->get_passes()->get_pass_split_all_insns()->clone ();
+  struct register_pass_info mode_sw4_info
+    = { mode_sw4, "mode_sw",
 	1, PASS_POS_INSERT_AFTER
       };
   static const int num_modes[] = NUM_MODES_FOR_MODE_SWITCHING;
@@ -205,8 +214,10 @@
          (see http://gcc.gnu.org/ml/gcc-patches/2011-10/msg02819.html,)
          we need a second peephole2 pass to get reasonable code.  */
   {
-    static struct register_pass_info peep2_2_info
-      = { &pass_peephole2.pass, "peephole2",
+    opt_pass *extra_peephole2
+      = g->get_passes ()->get_pass_peephole2()->clone ();
+    struct register_pass_info peep2_2_info
+      = { extra_peephole2, "peephole2",
 	  1, PASS_POS_INSERT_AFTER
 	};
 
@@ -2256,7 +2267,7 @@
       return (MACHINE_FUNCTION (cfun)->sw_entities_processed
 	      & (1 << EPIPHANY_MSW_ENTITY_ROUND_UNKNOWN)) != 0;
     case EPIPHANY_MSW_ENTITY_FPU_OMNIBUS:
-      return optimize == 0 || current_pass == &pass_mode_switch_use.pass;
+      return optimize == 0 || current_pass == pass_mode_switch_use;
     }
   gcc_unreachable ();
 }
Index: gcc/config/epiphany/epiphany.h
===================================================================
--- gcc/config/epiphany/epiphany.h	(revision 201526)
+++ gcc/config/epiphany/epiphany.h	(working copy)
@@ -929,6 +929,9 @@
 };
 
 extern int epiphany_normal_fp_rounding;
+
+class rtl_opt_pass;
+namespace gcc { class context; }
 extern rtl_opt_pass *make_pass_mode_switch_use (gcc::context *ctxt);
 extern rtl_opt_pass *make_pass_resolve_sw_modes (gcc::context *ctxt);
 
Index: gcc/pass_manager.h
===================================================================
--- gcc/pass_manager.h	(revision 201526)
+++ gcc/pass_manager.h	(working copy)
@@ -66,6 +66,15 @@
   void execute_early_local_passes ();
   unsigned int execute_pass_mode_switching ();
 
+  /* Various passes are manually cloned by epiphany. */
+  opt_pass *get_pass_split_all_insns () const {
+    return pass_split_all_insns_1;
+  }
+  opt_pass *get_pass_mode_switching () const {
+    return pass_mode_switching_1;
+  }
+  opt_pass *get_pass_peephole2 () const { return pass_peephole2_1; }
+
 public:
   /* The root of the compilation pass tree, once constructed.  */
   opt_pass *all_passes;
Index: gcc/recog.c
===================================================================
--- gcc/recog.c	(revision 201526)
+++ gcc/recog.c	(working copy)
@@ -3803,6 +3803,9 @@
   {}
 
   /* opt_pass methods: */
+  /* The epiphany backend creates a second instance of this pass, so we need
+     a clone method.  */
+  opt_pass * clone () { return new pass_peephole2 (ctxt_); }
   bool gate () { return gate_handle_peephole2 (); }
   unsigned int execute () { return rest_of_handle_peephole2 (); }
 
@@ -3848,6 +3851,9 @@
   {}
 
   /* opt_pass methods: */
+  /* The epiphany backend creates a second instance of this pass, so
+     we need a clone method.  */
+  opt_pass * clone () { return new pass_split_all_insns (ctxt_); }
   unsigned int execute () { return rest_of_handle_split_all_insns (); }
 
 }; // class pass_split_all_insns

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]