This patch adds a new '-fdump-front-end' flag and associated dump machinery. I use it on the modules branch, as that's sufficiently complex to need a dumper. The dump file is unnumbered with a '.fe' suffix. Perhaps it will be useful for other front ends too.

I'm also prepared to remove the -fdump-translation-unit dumper, which is a completely inscrutable c++ only dump, that I think is well past its best-before date. (Jason?)

If there's a preference to hold this off until merging modules, that's fine. Just thought I'd float it now.

nathan
--
Nathan Sidwell
2017-05-09  Nathan Sidwell  <nat...@acm.org>

	Front end dump file.
	gcc/
	* dumpfile.h (tree_dump_index): Add TDI_lang.
	(TDF_LANG): New.
	* dumpfile.c (dump_files): Add front-end.
	(dump_option_value_info): Add lang.  Adjust all.
	gcc/doc/
	* invoke.texi (-fdump-front-end): Document.

Index: doc/invoke.texi
===================================================================
--- doc/invoke.texi	(revision 247784)
+++ doc/invoke.texi	(working copy)
@@ -542,6 +542,7 @@ Objective-C and Objective-C++ Dialects}.
 -fdump-noaddr  -fdump-unnumbered  -fdump-unnumbered-links @gol
 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
 -fdump-final-insns@r{[}=@var{file}@r{]}
+-fdump-front-end @gol
 -fdump-ipa-all  -fdump-ipa-cgraph  -fdump-ipa-inline @gol
 -fdump-passes @gol
 -fdump-rtl-@var{pass}  -fdump-rtl-@var{pass}=@var{filename} @gol
@@ -12948,6 +12953,11 @@ same directory as the output file.  If t
 is used, @var{options} controls the details of the dump as described
 for the @option{-fdump-tree} options.
 
+@item -fdump-front-end
+@opindex fdump-front-end
+Dump front-end-specific information.  The file name is made by appending
+@file{.fe} to the source file name.
+
 @item -fdump-ipa-@var{switch}
 @opindex fdump-ipa
 Control the dumping at various stages of inter-procedural analysis
Index: dumpfile.c
===================================================================
--- dumpfile.c	(revision 247784)
+++ dumpfile.c	(working copy)
@@ -51,6 +51,8 @@ int dump_flags;
 static struct dump_file_info dump_files[TDI_end] =
 {
   {NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, false, false},
+  {".fe", "front-end", NULL, NULL, NULL, NULL, NULL, TDF_LANG,
+   OPTGROUP_OTHER, 0, 0, 0, -1, false, false},
   {".cgraph", "ipa-cgraph", NULL, NULL, NULL, NULL, NULL, TDF_IPA,
    0, 0, 0, 0, 0, false, false},
   {".type-inheritance", "ipa-type-inheritance", NULL, NULL, NULL, NULL, NULL, TDF_IPA,
@@ -115,10 +117,11 @@ static const struct dump_option_value_in
   {"missed", MSG_MISSED_OPTIMIZATION},
   {"note", MSG_NOTE},
   {"optall", MSG_ALL},
+  {"lang", TDF_LANG},
   {"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_GIMPLE)},
+	    | TDF_GIMPLE | TDF_LANG)},
   {NULL, 0}
 };
 
Index: dumpfile.h
===================================================================
--- dumpfile.h	(revision 247784)
+++ dumpfile.h	(working copy)
@@ -27,6 +27,7 @@ along with GCC; see the file COPYING3.
 enum tree_dump_index
 {
   TDI_none,			/* No dump */
+  TDI_lang,			/* Lang-specific.  */
   TDI_cgraph,                   /* dump function call graph.  */
   TDI_inheritance,              /* dump type inheritance graph.  */
   TDI_clones,			/* dump IPA cloning decisions.  */
@@ -89,7 +90,7 @@ enum tree_dump_index
 #define MSG_NOTE                 (1 << 29)  /* general optimization info */
 #define MSG_ALL         (MSG_OPTIMIZED_LOCATIONS | MSG_MISSED_OPTIMIZATION \
                          | MSG_NOTE)
-
+#define TDF_LANG	(1 << 30)	/* Lang-specific dumper.  */
 
 /* Flags to control high-level -fopt-info dumps.  Usually these flags
    define a group of passes.  An optimization pass can be part of

Reply via email to