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] Add -fdump-rtl-<pass>-quiet


This patch scratches an itch I've had for a while.

Basically it just reduces all tree and RTL dumps to just the function dump. This means that the files are easier to diff.

This can still be combined with the other options of course:
  e.g. -fdump-rtl-all-quiet-slim is quite nice.

Obviously, most of the passes do dumps by calling fprintf directly, and I don't want to edit each and every case, so I've implemented this by setting dump_file=NULL in execute_one_pass.

OK to commit?

Andrew
2012-04-18  Andrew Stubbs  <ams@codesourcery.com>

	gcc/
	* tree-pass.h (TDF_QUIET): New define.
	* tree-dump.c (dump_options): Add "quiet".
	* passes.c (execute_one_pass): Handle TDF_QUIET.
	* doc/invoke.texi: Document -fdump-tree-quiet.
	Mention -fdump-rtl-pass-options form.

diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index a13ddfa..1082b13 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -5229,6 +5229,7 @@ of option arguments.
 
 @item -d@var{letters}
 @itemx -fdump-rtl-@var{pass}
+@itemx -fdump-rtl-@var{pass}-@var{options}
 @opindex d
 Says to make debugging dumps during compilation at times specified by
 @var{letters}.  This is used for debugging the RTL-based passes of the
@@ -5244,6 +5245,9 @@ explicitly specified and it is not an executable, otherwise it is the
 basename of the source file. These switches may have different effects
 when @option{-E} is used for preprocessing.
 
+The @option{-fdump-rtl-@var{pass}-@var{options}} form uses the same
+@var{options} as @option{-fdump-tree-@var{pass}-@var{options}}.
+
 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
 @option{-d} option @var{letters}.  Here are the possible
 letters for use in @var{pass} and @var{letters}, and their meanings:
@@ -5672,9 +5676,11 @@ Enable showing the tree dump for each statement.
 Enable showing the EH region number holding each statement.
 @item scev
 Enable showing scalar evolution analysis details.
+@item quiet
+Disable all but the function dump.
 @item all
-Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
-and @option{lineno}.
+Turn on all options, except @option{raw}, @option{slim}, @option{verbose},
+@option{lineno} and @option{quiet}.
 @end table
 
 The following tree dumps are possible:
diff --git a/gcc/passes.c b/gcc/passes.c
index a786881..e946c63 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -2078,8 +2078,16 @@ execute_one_pass (struct opt_pass *pass)
   /* Do it!  */
   if (pass->execute)
     {
+      FILE *tmp = dump_file;
+
+      if (dump_flags & TDF_QUIET)
+	dump_file = NULL;
+
       todo_after = pass->execute ();
       do_per_function (clear_last_verified, NULL);
+
+      if (dump_flags & TDF_QUIET)
+	dump_file = tmp;
     }
 
   /* Stop timevar.  */
diff --git a/gcc/tree-dump.c b/gcc/tree-dump.c
index 3e89cdf..81f3262 100644
--- a/gcc/tree-dump.c
+++ b/gcc/tree-dump.c
@@ -824,9 +824,11 @@ static const struct dump_option_value_info dump_options[] =
   {"nouid", TDF_NOUID},
   {"enumerate_locals", TDF_ENUMERATE_LOCALS},
   {"scev", TDF_SCEV},
+  {"quiet", TDF_QUIET},
   {"all", ~(TDF_RAW | TDF_SLIM | TDF_LINENO | TDF_TREE | TDF_RTL | TDF_IPA
 	    | TDF_STMTADDR | TDF_GRAPH | TDF_DIAGNOSTIC | TDF_VERBOSE
-	    | TDF_RHS_ONLY | TDF_NOUID | TDF_ENUMERATE_LOCALS | TDF_SCEV)},
+	    | TDF_RHS_ONLY | TDF_NOUID | TDF_ENUMERATE_LOCALS | TDF_SCEV
+	    | TDF_QUIET)},
   {NULL, 0}
 };
 
diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h
index 6f1fd6a..ed47dd1 100644
--- a/gcc/tree-pass.h
+++ b/gcc/tree-pass.h
@@ -84,6 +84,7 @@ enum tree_dump_index
 #define TDF_ENUMERATE_LOCALS (1 << 22)	/* Enumerate locals by uid.  */
 #define TDF_CSELIB	(1 << 23)	/* Dump cselib details.  */
 #define TDF_SCEV	(1 << 24)	/* Dump SCEV details.  */
+#define TDF_QUIET	(1 << 25)	/* Dump only function content.  */
 
 
 /* In tree-dump.c */

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