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]

Use pass manager for RTL passes 4/4: other changes


This part includes other small adjustments that are not in the previous functions.
The four patches were bootstrapped and regtested on powerpc-apple-darwin, and I checked that the assembly was the same for the .i files in a powerpc-apple-darwin compiler. Before the mainline slush finishes, I'll have it bootstrapped and rested on i686-pc-linux-gnu, too.


Ok to apply the four to mainline?

I would also like to rename tree-pass.h to passes.h, but this would not be particularly nice to branch maintainers. Suggestion on when to do it (including "never") are welcome.

Paolo

2005-05-19  Paolo Bonzini  <bonzini@gnu.org>

	* passes.c (finish_optimization_passes): Use dump_begin
	and dump_end, TDI_end.
	(gate_rest_of_compilation): New.
	(pass_rest_of_compilation): Use it.
	(gate_postreload, pass_postreload): New.
	* toplev.c (general_init): Rename init_tree_optimization_passes.
	* toplev.h (init_tree_optimization_passes): Rename to
	init_optimizations_passes.
	* tree-dump.c (dump_flag): Make static.
	(dump_files): Remove RTL dumps.
	* tree-optimize.c (pass_all_optimizations,
	pass_cleanup_cfg_post_optimizing, pass_free_datastructures,
	pass_init_datastructures, pass_fixup_cfg): Make non-static.
	* tree-pretty-print.c: Include tree-pass.h.
	* cgraph.c: Include tree-dump.h.
	
Index: passes.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/passes.c,v
retrieving revision 2.90
diff -p -u -r2.90 passes.c
--- passes.c	27 Apr 2005 21:35:20 -0000	2.90
+++ passes.c	18 May 2005 10:29:55 -0000
@@ -209,20 +213,25 @@
   timevar_push (TV_DUMP);
   if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
     {
-      open_dump_file (DFI_bp, NULL);
+      dump_file = dump_begin (pass_branch_prob.static_pass_number, NULL);
       end_branch_prob ();
-      close_dump_file (DFI_bp, NULL, NULL_RTX);
+      if (dump_file)
+	dump_end (pass_branch_prob.static_pass_number, dump_file);
     }
 
-  if (optimize > 0 && open_dump_file (DFI_combine, NULL))
+  if (optimize > 0)
     {
-      dump_combine_total_stats (dump_file);
-      close_dump_file (DFI_combine, NULL, NULL_RTX);
+      dump_file = dump_begin (pass_combine.static_pass_number, NULL);
+      if (dump_file)
+	{
+	  dump_combine_total_stats (dump_file);
+          dump_end (pass_combine.static_pass_number, dump_file);
+	}
     }
 
   /* Do whatever is necessary to finish printing the graphs.  */
   if (graph_dump_format != no_graph)
-    for (i = DFI_MIN; (dfi = get_dump_file_info (i)) != NULL; ++i)
+    for (i = TDI_end; (dfi = get_dump_file_info (i)) != NULL; ++i)
       if (dump_initialized_p (i)
 	  && (dfi->flags & TDF_RTL) != 0
 	  && (name = get_dump_file_name (i)) != NULL)
@@ -234,23 +243,53 @@
   timevar_pop (TV_DUMP);
 }
 
+static bool
+gate_rest_of_compilation (void)
+{
+  /* Early return if there were errors.  We can run afoul of our
+     consistency checks, and there's not really much point in fixing them.  */
+  return !(rtl_dump_and_exit || flag_syntax_only || errorcount || sorrycount);
+}
+
 struct tree_opt_pass pass_rest_of_compilation =
 {
-  NULL,			                /* name */
-  NULL,		                        /* gate */
-  rest_of_compilation,                  /* execute */
+  NULL,                                 /* name */
+  gate_rest_of_compilation,             /* gate */
+  NULL,                                 /* execute */
   NULL,                                 /* sub */
   NULL,                                 /* next */
   0,                                    /* static_pass_number */
   TV_REST_OF_COMPILATION,               /* tv_id */
-  PROP_rtl,		                /* properties_required */
+  PROP_rtl,                             /* properties_required */
   0,                                    /* properties_provided */
-  PROP_rtl,                             /* properties_destroyed */
+  0,                                    /* properties_destroyed */
   0,                                    /* todo_flags_start */
-  TODO_ggc_collect,			/* todo_flags_finish */
-  0					/* letter */
+  TODO_ggc_collect,                     /* todo_flags_finish */
+  0                                     /* letter */
 };
 
+static bool
+gate_postreload (void)
+{
+  return reload_completed;
+}
+
+struct tree_opt_pass pass_postreload =
+{
+  NULL,                                 /* name */
+  gate_postreload,                      /* gate */
+  NULL,                                 /* execute */
+  NULL,                                 /* sub */
+  NULL,                                 /* next */
+  0,                                    /* static_pass_number */
+  0,                                    /* tv_id */
+  PROP_rtl,                             /* properties_required */
+  0,                                    /* properties_provided */
+  0,                                    /* properties_destroyed */
+  0,                                    /* todo_flags_start */
+  TODO_ggc_collect,                     /* todo_flags_finish */
+  0                                     /* letter */
+};
 
 
 /* The root of the compilation pass tree, once constructed.  */
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.954
diff -p -u -r1.954 toplev.c
--- toplev.c	3 May 2005 17:55:38 -0000	1.954
+++ toplev.c	18 May 2005 10:30:36 -0000
@@ -1668,7 +1668,7 @@ general_init (const char *argv0)
 
   /* This must be done after add_params but before argument processing.  */
   init_ggc_heuristics();
-  init_tree_optimization_passes ();
+  init_optimization_passes ();
 }
 
 /* Process the options that have been parsed.  */
Index: toplev.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.h,v
retrieving revision 1.134
diff -p -u -r1.134 toplev.h
--- toplev.h	23 Apr 2005 21:27:56 -0000	1.134
+++ toplev.h	18 May 2005 10:30:36 -0000
@@ -77,7 +77,7 @@ extern void inform (const char *, ...) A
 extern void rest_of_decl_compilation (tree, int, int);
 extern void rest_of_type_compilation (tree, int);
 extern void tree_rest_of_compilation (tree);
-extern void init_tree_optimization_passes (void);
+extern void init_optimization_passes (void);
 extern void finish_optimization_passes (void);
 extern bool enable_rtl_dump_file (int);
 
Index: tree-dump.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-dump.c,v
retrieving revision 1.42
diff -p -u -r1.42 tree-dump.c
--- tree-dump.c	13 May 2005 13:56:53 -0000	1.42
+++ tree-dump.c	18 May 2005 10:30:38 -0000
@@ -34,6 +34,7 @@ Software Foundation, 59 Temple Place - S
 #include "tree-iterator.h"
 
 static unsigned int queue (dump_info_p, tree, int);
+static int dump_flag (dump_info_p, int, tree);
 static void dump_index (dump_info_p, unsigned int);
 static void dequeue_and_dump (dump_info_p);
 static void dump_new_line (dump_info_p);
@@ -621,7 +622,8 @@ dequeue_and_dump (dump_info_p di)
 /* Return nonzero if FLAG has been specified for the dump, and NODE
    is not the root node of the dump.  */
 
-int dump_flag (dump_info_p di, int flag, tree node)
+static int
+dump_flag (dump_info_p di, int flag, tree node)
 {
   return (di->flags & flag) && (node != di->node);
 }
@@ -681,43 +683,6 @@ static struct dump_file_info dump_files[
   {NULL, "ipa-all", NULL, TDF_IPA, 0, 0, 0},
 
   { ".cgraph", "ipa-cgraph", NULL,	TDF_IPA, 0,  1, 0},
-
-  { ".sibling", "rtl-sibling", NULL,	TDF_RTL, 0,  1, 'i'},
-  { ".eh", "rtl-eh", NULL,		TDF_RTL, 0,  2, 'h'},
-  { ".jump", "rtl-jump", NULL,		TDF_RTL, 0,  3, 'j'},
-  { ".cse", "rtl-cse", NULL,    	 TDF_RTL, 0,  4, 's'},
-  { ".gcse", "rtl-gcse", NULL,		TDF_RTL, 0,  5, 'G'},
-  { ".loop", "rtl-loop", NULL,		TDF_RTL, 0,  6, 'L'},
-  { ".bypass", "rtl-bypass", NULL,		TDF_RTL, 0,  7, 'G'},
-  { ".cfg", "rtl-cfg", NULL,			TDF_RTL, 0,  8, 'f'},
-  { ".bp", "rtl-bp", NULL,			TDF_RTL, 0,  9, 'b'},
-  { ".vpt", "rtl-vpt", NULL,			TDF_RTL, 0, 10, 'V'},
-  { ".ce1", "rtl-ce1", NULL,			TDF_RTL, 0, 11, 'C'},
-  { ".tracer", "rtl-tracer", NULL,		TDF_RTL, 0, 12, 'T'},
-  { ".loop2", "rtl-loop2", NULL,		TDF_RTL, 0, 13, 'L'},
-  { ".web", "rtl-web", NULL,			TDF_RTL, 0, 14, 'Z'},
-  { ".cse2", "rtl-cse2", NULL,		TDF_RTL, 0, 15, 't'},
-  { ".life", "rtl-life", NULL,		TDF_RTL, 0, 16, 'f'},
-  { ".combine", "rtl-combine", NULL,		TDF_RTL, 0, 17, 'c'},
-  { ".ce2", "rtl-ce2", NULL,			TDF_RTL, 0, 18, 'C'},
-  { ".regmove", "rtl-regmove", NULL,		TDF_RTL, 0, 19, 'N'},
-  { ".sms", "rtl-sms", NULL,			TDF_RTL, 0, 20, 'm'},
-  { ".sched", "rtl-sched", NULL,		TDF_RTL, 0, 21, 'S'},
-  { ".lreg", "rtl-lreg", NULL,		TDF_RTL, 0, 22, 'l'},
-  { ".greg", "rtl-greg", NULL,		TDF_RTL, 0, 23, 'g'},
-  { ".postreload", "rtl-postreload", NULL,	TDF_RTL, 0, 24, 'o'},
-  { ".gcse2", "rtl-gcse2", NULL,		TDF_RTL, 0, 25, 'J'},
-  { ".flow2", "rtl-flow2", NULL,		TDF_RTL, 0, 26, 'w'},
-  { ".peephole2", "rtl-peephole2", NULL,	TDF_RTL, 0, 27, 'z'},
-  { ".ce3", "rtl-ce3", NULL,			TDF_RTL, 0, 28, 'E'},
-  { ".rnreg", "rtl-rnreg", NULL,		TDF_RTL, 0, 29, 'n'},
-  { ".bbro", "rtl-bbro", NULL,		TDF_RTL, 0, 30, 'B'},
-  { ".btl", "rtl-btl", NULL,			TDF_RTL, 0, 31, 'd'},
-  { ".sched2", "rtl-sched2", NULL,		TDF_RTL, 0, 32, 'R'},
-  { ".stack", "rtl-stack", NULL,		TDF_RTL, 0, 33, 'k'},
-  { ".vartrack", "rtl-vartrack", NULL,	TDF_RTL, 0, 34, 'V'},
-  { ".mach", "rtl-mach", NULL,		TDF_RTL, 0, 35, 'M'},
-  { ".dbr", "rtl-dbr", NULL,			TDF_RTL, 0, 36, 'd'}
 };
 
 /* Dynamically registered tree dump files and switches.  */
Index: tree-optimize.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-optimize.c,v
retrieving revision 2.98
diff -p -u -r2.98 tree-optimize.c
--- tree-optimize.c	17 May 2005 20:28:22 -0000	2.98
+++ tree-optimize.c	18 May 2005 10:30:39 -0000
@@ -68,7 +68,7 @@ gate_all_optimizations (void)
 	  && !(errorcount || sorrycount));
 }
 
-static struct tree_opt_pass pass_all_optimizations =
+struct tree_opt_pass pass_all_optimizations =
 {
   NULL,					/* name */
   gate_all_optimizations,		/* gate */
@@ -98,7 +98,7 @@ execute_cleanup_cfg_post_optimizing (voi
   group_case_labels ();
 }
 
-static struct tree_opt_pass pass_cleanup_cfg_post_optimizing =
+struct tree_opt_pass pass_cleanup_cfg_post_optimizing =
 {
   "final_cleanup",			/* name */
   NULL,					/* gate */
@@ -142,7 +142,7 @@ execute_free_datastructures (void)
   delete_tree_cfg_annotations ();
 }
 
-static struct tree_opt_pass pass_free_datastructures =
+struct tree_opt_pass pass_free_datastructures =
 {
   NULL,					/* name */
   NULL,					/* gate */
@@ -181,7 +181,7 @@ execute_fixup_cfg (void)
   cleanup_tree_cfg ();
 }
 
-static struct tree_opt_pass pass_fixup_cfg =
+struct tree_opt_pass pass_fixup_cfg =
 {
   NULL,					/* name */
   NULL,					/* gate */
@@ -215,7 +215,7 @@ execute_init_datastructures (void)
   init_tree_ssa ();
 }
 
-static struct tree_opt_pass pass_init_datastructures =
+struct tree_opt_pass pass_init_datastructures =
 {
   NULL,					/* name */
   NULL,					/* gate */
Index: cgraph.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cgraph.c,v
retrieving revision 1.71
--- cgraph.c	27 Apr 2005 08:35:49 -0000	1.71
+++ cgraph.c	19 May 2005 18:46:47 -0000
@@ -97,6 +97,7 @@
 #include "varray.h"
 #include "output.h"
 #include "intl.h"
+#include "tree-dump.h"
 
 static void cgraph_node_remove_callers (struct cgraph_node *node);
 static inline void cgraph_edge_remove_caller (struct cgraph_edge *e);
Index: tree-pretty-print.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-pretty-print.c,v
retrieving revision 2.58
diff -p -u -r2.58 tree-pretty-print.c
--- tree-pretty-print.c	04 May 2005 17:35:19 -0000	2.58
+++ tree-pretty-print.c	19 May 2005 18:29:11 -0000
@@ -32,6 +32,7 @@
 #include "langhooks.h"
 #include "tree-iterator.h"
 #include "tree-chrec.h"
+#include "tree-pass.h"
 
 /* Local functions, macros and variables.  */
 static int op_prio (tree);
Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.1486
diff -p -u -u -r1.1486 Makefile.in
--- Makefile.in	17 May 2005 09:55:08 -0000	1.1486
+++ Makefile.in	18 May 2005 12:37:43 -0000
@@ -1882,7 +1882,7 @@ tree-nomudflap.o : $(CONFIG_H) errors.h 
    $(GGC_H) gt-tree-mudflap.h tree-pass.h
 tree-pretty-print.o : tree-pretty-print.c $(CONFIG_H) $(SYSTEM_H) \
    errors.h $(TREE_H) $(DIAGNOSTIC_H) real.h $(HASHTAB_H) $(TREE_FLOW_H) \
-   $(TM_H) coretypes.h tree-iterator.h tree-chrec.h langhooks.h
+   $(TM_H) coretypes.h tree-iterator.h tree-chrec.h langhooks.h tree-pass.h
 fold-const.o : fold-const.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
    $(TREE_H) $(FLAGS_H) real.h toplev.h $(HASHTAB_H) $(EXPR_H) $(RTL_H) \
    $(GGC_H) $(TM_P_H) langhooks.h $(MD5_H)
@@ -2036,7 +2036,7 @@ simplify-rtx.o : simplify-rtx.c $(CONFIG
 cgraph.o : cgraph.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
    langhooks.h toplev.h $(FLAGS_H) $(GGC_H) $(TARGET_H) $(CGRAPH_H) \
    gt-cgraph.h output.h intl.h $(BASIC_BLOCK_H) debug.h $(HASHTAB_H) \
-   tree-inline.h $(VARRAY_H)
+   tree-inline.h $(VARRAY_H) tree-dump.h
 cgraphunit.o : cgraphunit.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
    $(TREE_H) langhooks.h tree-inline.h toplev.h $(FLAGS_H) $(GGC_H) \
    $(TARGET_H) $(CGRAPH_H) intl.h pointer-set.h function.h $(TREE_GIMPLE_H) \

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