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]

[PATCH] Unify tree/RTL dump file handling (1/5)


This patch is the splitted version of the patch to handle RTL
dumps with the same manager used by tree dumps.

This part includes a few miscellaneous cleanups in preparation
for the next ones.

I checked that applying the five patches in order gives exactly the
same changes that were in the original submission, and
bootstrapped/regtested all languages with the five patches together on
i686-pc-linux-gnu, with no regressions. Ok to apply the set of five to mainline?


Paolo

2004-08-13  Paolo Bonzini  <bonzini@gnu.org>

	* cfgexpand.c (tree_expand_cfg): Fix incorrect comment.
	Don't print function name to the dump file, the pass manager
	would do this for us. Add code from the top of
	rest_of_compilation, up to the initial RTL dump.
	* passes.c (rest_of_handle_jump): Call fixup_tail_calls and
	close the DFI_sibling dump file.
	(rest_of_compilation): Don't do that here.  Remove code up to the
	initial RTL dump.
	(init_optimization_passes): Remove.
	(pass_rest_of_compilation): Change pass name to NULL.
	* toplev.c (lang_dependent_init): Do not use an empty dump file prefix.
	Do not call init_optimization_passes.
	* toplev.h (init_optimization_passes): Remove.

diff -rpu gcc-backup/gcc/cfgexpand.c gcc-pass/gcc/cfgexpand.c
--- gcc-backup/gcc/cfgexpand.c	2004-08-08 10:20:19.000000000 +0200
+++ gcc-pass/gcc/cfgexpand.c	2004-08-13 16:05:14.000000000 +0200
@@ -425,14 +425,6 @@
   basic_block bb, init_block;
   sbitmap blocks;
 
-  if (dump_file)
-    {
-      fprintf (dump_file, "\n;; Function %s",
-	       (*lang_hooks.decl_printable_name) (current_function_decl, 2));
-      fprintf (dump_file, " (%s)\n",
-	       IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl)));
-    }
-
   profile_status = PROFILE_ABSENT;
 
   /* Some backends want to know that we are expanding to RTL.  */
@@ -468,8 +460,7 @@
   currently_expanding_to_rtl = 0;
 
   /* Convert from NOTE_INSN_EH_REGION style notes, and do other
-     sorts of eh initialization.  Delay this until after the
-     initial rtl dump so that we can see the original nesting.  */
+     sorts of eh initialization.  */
   convert_from_eh_region_ranges ();
 
   rebuild_jump_labels (get_insns ());
@@ -485,6 +476,16 @@
 #ifdef ENABLE_CHECKING
   verify_flow_info();
 #endif
+
+  /* There's no need to defer outputting this function any more; we
+     know we want to output it.  */
+  DECL_DEFER_OUTPUT (current_function_decl) = 0;
+
+  /* Now that we're done expanding trees to RTL, we shouldn't have any
+     more CONCATs anywhere.  */
+  generating_concat_p = 0;
+
+  finalize_block_changes ();
 }
 
 struct tree_opt_pass pass_expand =
diff -rpu gcc-backup/gcc/passes.c gcc-pass/gcc/passes.c
--- gcc-backup/gcc/passes.c	2004-08-08 10:20:19.000000000 +0200
+++ gcc-pass/gcc/passes.c	2004-08-13 16:07:40.000000000 +0200
@@ -1441,6 +1312,11 @@
 #ifdef ENABLE_CHECKING
   verify_flow_info ();
 #endif
+
+  if (cfun->tail_call_emit)
+    fixup_tail_calls ();
+
+  close_dump_file (DFI_sibling, print_rtl, get_insns ());
   timevar_pop (TV_JUMP);
 }
 
@@ -1692,20 +1563,6 @@
 void
 rest_of_compilation (void)
 {
-  /* There's no need to defer outputting this function any more; we
-     know we want to output it.  */
-  DECL_DEFER_OUTPUT (current_function_decl) = 0;
-
-  /* Now that we're done expanding trees to RTL, we shouldn't have any
-     more CONCATs anywhere.  */
-  generating_concat_p = 0;
-
-  /* When processing delayed functions, prepare_function_start () won't
-     have been run to re-initialize it.  */
-  cse_not_expected = ! optimize;
-
-  finalize_block_changes ();
-
   /* Dump the rtl code if we are dumping rtl.  */
   if (open_dump_file (DFI_rtl, current_function_decl))
     close_dump_file (DFI_rtl, print_rtl, get_insns ());
@@ -1725,9 +1601,6 @@
 
   rest_of_handle_jump ();
 
-  if (cfun->tail_call_emit)
-    fixup_tail_calls ();
-
   rest_of_handle_eh ();
 
   /* Delay emitting hard_reg_initial_value sets until after EH landing pad
@@ -1983,14 +1826,6 @@
 }
 
 void
-init_optimization_passes (void)
-{
-  open_dump_file (DFI_cgraph, NULL);
-  cgraph_dump_file = dump_file;
-  dump_file = NULL;
-}
-
-void
 finish_optimization_passes (void)
 {
   timevar_push (TV_DUMP);
@@ -2007,10 +1846,6 @@
       close_dump_file (DFI_combine, NULL, NULL_RTX);
     }
 
-  dump_file = cgraph_dump_file;
-  cgraph_dump_file = NULL;
-  close_dump_file (DFI_cgraph, NULL, NULL_RTX);
-
   /* Do whatever is necessary to finish printing the graphs.  */
   if (graph_dump_format != no_graph)
     {
@@ -2055,7 +1870,7 @@
 
 struct tree_opt_pass pass_rest_of_compilation =
 {
-  "rest of compilation",                /* name */
+  NULL,			                /* name */
   NULL,		                        /* gate */
   rest_of_compilation,                  /* execute */
   NULL,                                 /* sub */
diff -rpu gcc-backup/gcc/toplev.c gcc-pass/gcc/toplev.c
--- gcc-backup/gcc/toplev.c	2004-08-08 10:20:19.000000000 +0200
+++ gcc-pass/gcc/toplev.c	2004-08-08 10:45:51.000000000 +0200
@@ -1946,7 +1947,7 @@
 {
   location_t save_loc = input_location;
   if (dump_base_name == 0)
-    dump_base_name = name ? name : "gccdump";
+    dump_base_name = name && name[0] ? name : "gccdump";
 
   /* Other front-end initialization.  */
 #ifdef USE_MAPPED_LOCATION
@@ -1965,7 +1966,6 @@
      front end is initialized.  */
   init_eh ();
   init_optabs ();
-  init_optimization_passes ();
 
   /* The following initialization functions need to generate rtl, so
      provide a dummy function context for them.  */
diff -rpu gcc-backup/gcc/toplev.h gcc-pass/gcc/toplev.h
--- gcc-backup/gcc/toplev.h	2004-08-08 10:20:19.000000000 +0200
+++ gcc-pass/gcc/toplev.h	2004-08-08 10:35:32.000000000 +0200
@@ -78,7 +78,6 @@
 extern void rest_of_compilation (void);
 extern void tree_rest_of_compilation (tree, bool);
 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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]