-fdump-translation-unit is an inscrutably opaque dump. It turned out that most of the uses of the tree-dump header file was to indirectly get at dumpfile.h, and the dump_function entry point it had forwarded to a dumper in tree-cfg.c. The gimple dumper would use its node dumper when asked for a raw dump, but that was about it.

We have prettier printers now.  This patch nukes the tu dumper.  ok?

nathan

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

	Remove -fdump-translation-unit.
	gcc/
	* Makefile.in (TREE_DUMP_H): Delete.
	(C_COMMON_OBJS): Remove c-family/c-dump.o.
	(OBJS): Remove tree-dump.o.
	(PLUGIN_HEADERS): Remove $(TREE_DUMP_H).
	* cgraphclones.c: Include dumpfile.h not tree-dump.h.
	* doc/invoke.texi: Remove -fdump-translation-unit.
	* dumpfile.h (TDI_tu): Delete.
	(dump_function): Declare.
	(dump_node): Delete.
	* dumpfile.c: Include tree-cfg.h.
	(dump_files): Remove ".tu" line.
	(FIRST_AUTO_NUMBERED_DUMP): Decrement.
	(dump_function): New, from tree-dump.c.
	* tree-dump.h: Delete.
	* tree-dump.c: Delete.
	* gimplify.h: Include splay-tree.h not tree-dump.h.
	* graphite-poly.c: Don't include tree-dump.h
	* langhooks-def.h (lhd_tree_dump_dump_tree,
	lhd_tree_dump_type_quals): Don't declare.
	(LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN,
	LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN,
	LANG_HOOKS_TREE_DUMP_INITIALIZER): Delete.
	* langhooks.c (lhd_tree_dump_dump_tree,
	lhd_tree_dump_type_quals): Delete.
	* langhooks.h (lang_hooks_for_tree_dump): Delete.
	(lang_hooks): Remove tree_dump field.
	* print-tree.c: Include dumpfile.h not tree-dump.h.
	* stor-layout.c: Likewise.
	* tree-nested.c: Likewise.
	* tree-cfg.c (dump_function_to_file): Don't dump raw node.
	gcc/c/
	* c-decl.c (c_parse_final_cleanups): Don't dump cleanup nodes.
	* gimple-parser.c: Don't #include tree-dump.h
	gcc/c-family/
	* c-dump.c: Delete.
	* c-gimplify.c (c_genericize): Don't raw dump the saved tree.
	gcc/cp/
	* Make-lang.in (CXX_AND_OBJCXX_OBJS): Remove cp/dump.o.
	* decl2.c (dump_tu): Delete.
	(c_parse_final_cleanups): Don't dump_tu.
	* dump.c: Delete.
	gcc/fortran/
	* trans-decl.c: Include dumpfile.h, not tree-dump.h.

Index: Makefile.in
===================================================================
--- Makefile.in	(revision 247784)
+++ Makefile.in	(working copy)
@@ -970,7 +970,6 @@ OPTS_H = $(INPUT_H) $(VEC_H) opts.h $(OB
 SYMTAB_H = $(srcdir)/../libcpp/include/symtab.h $(OBSTACK_H)
 CPP_ID_DATA_H = $(CPPLIB_H) $(srcdir)/../libcpp/include/cpp-id-data.h
 CPP_INTERNAL_H = $(srcdir)/../libcpp/internal.h $(CPP_ID_DATA_H)
-TREE_DUMP_H = tree-dump.h $(SPLAY_TREE_H) $(DUMPFILE_H)
 TREE_PASS_H = tree-pass.h $(TIMEVAR_H) $(DUMPFILE_H)
 TREE_SSA_H = tree-ssa.h tree-ssa-operands.h \
 		$(BITMAP_H) sbitmap.h $(BASIC_BLOCK_H) $(GIMPLE_H) \
@@ -1181,7 +1180,7 @@ GCC_OBJS = gcc.o gcc-main.o ggc-none.o
 c-family-warn = $(STRICT_WARN)
 
 # Language-specific object files shared by all C-family front ends.
-C_COMMON_OBJS = c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o \
+C_COMMON_OBJS = c-family/c-common.o c-family/c-cppbuiltin.o \
   c-family/c-format.o c-family/c-gimplify.o c-family/c-indentation.o \
   c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o \
   c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o \
@@ -1483,7 +1482,6 @@ OBJS = \
 	tree-data-ref.o \
 	tree-dfa.o \
 	tree-diagnostic.o \
-	tree-dump.o \
 	tree-eh.o \
 	tree-emutls.o \
 	tree-if-conv.o \
@@ -3409,7 +3407,7 @@ PLUGIN_HEADERS = $(TREE_H) $(CONFIG_H) $
   toplev.h $(DIAGNOSTIC_CORE_H) $(BASIC_BLOCK_H) $(HASH_TABLE_H) \
   tree-ssa-alias.h $(INTERNAL_FN_H) gimple-fold.h tree-eh.h gimple-expr.h \
   gimple.h is-a.h memmodel.h $(TREE_PASS_H) $(GCC_PLUGIN_H) \
-  $(GGC_H) $(TREE_DUMP_H) $(PRETTY_PRINT_H) $(OPTS_H) $(PARAMS_H) \
+  $(GGC_H) $(PRETTY_PRINT_H) $(OPTS_H) $(PARAMS_H) \
   $(tm_file_list) $(tm_include_list) $(tm_p_file_list) $(tm_p_include_list) \
   $(host_xm_file_list) $(host_xm_include_list) $(xm_include_list) \
   intl.h $(PLUGIN_VERSION_H) $(DIAGNOSTIC_H) ${C_TREE_H} \
Index: c/c-decl.c
===================================================================
--- c/c-decl.c	(revision 247784)
+++ c/c-decl.c	(working copy)
@@ -11240,18 +11240,6 @@ c_parse_final_cleanups (void)
       dump_ada_specs (collect_all_refs, NULL);
     }
 
-  if (ext_block)
-    {
-      tree tmp = BLOCK_VARS (ext_block);
-      int flags;
-      FILE * stream = dump_begin (TDI_tu, &flags);
-      if (stream && tmp)
-	{
-	  dump_node (tmp, flags & ~TDF_SLIM, stream);
-	  dump_end (TDI_tu, stream);
-	}
-    }
-
   /* Process all file scopes in this compilation, and the external_scope,
      through wrapup_global_declarations.  */
   FOR_EACH_VEC_ELT (*all_translation_units, i, t)
Index: c/gimple-parser.c
===================================================================
--- c/gimple-parser.c	(revision 247784)
+++ c/gimple-parser.c	(working copy)
@@ -53,7 +53,6 @@ along with GCC; see the file COPYING3.
 #include "tree-ssanames.h"
 #include "gimple-ssa.h"
 #include "tree-dfa.h"
-#include "tree-dump.h"
 
 
 /* Gimple parsing functions.  */
Index: c-family/c-dump.c
===================================================================
--- c-family/c-dump.c	(revision 247784)
+++ c-family/c-dump.c	(working copy)
@@ -1,50 +0,0 @@
-/* Tree-dumping functionality for C-family languages.
-   Copyright (C) 2002-2017 Free Software Foundation, Inc.
-   Written by Mark Mitchell <m...@codesourcery.com>
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 3, or (at your option) any later
-version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING3.  If not see
-<http://www.gnu.org/licenses/>.  */
-
-#include "config.h"
-#include "system.h"
-#include "coretypes.h"
-#include "c-common.h"
-#include "tree-dump.h"
-
-/* Dump any C-specific tree codes and attributes of common codes.  */
-
-bool
-c_dump_tree (void *dump_info, tree t)
-{
-  enum tree_code code;
-  dump_info_p di = (dump_info_p) dump_info;
-
-  /* Figure out what kind of node this is.  */
-  code = TREE_CODE (t);
-
-  switch (code)
-    {
-    case FIELD_DECL:
-      if (DECL_C_BIT_FIELD (t))
-	dump_string (di, "bitfield");
-      break;
-
-    default:
-      break;
-    }
-
-  return false;
-}
Index: c-family/c-gimplify.c
===================================================================
--- c-family/c-gimplify.c	(revision 247784)
+++ c-family/c-gimplify.c	(working copy)
@@ -141,11 +141,7 @@ c_genericize (tree fndecl)
       fprintf (dump_orig, ";; enabled by -%s\n", dump_flag_name (TDI_original));
       fprintf (dump_orig, "\n");
 
-      if (local_dump_flags & TDF_RAW)
-	dump_node (DECL_SAVED_TREE (fndecl),
-		   TDF_SLIM | local_dump_flags, dump_orig);
-      else
-	print_c_tree (dump_orig, DECL_SAVED_TREE (fndecl));
+      print_c_tree (dump_orig, DECL_SAVED_TREE (fndecl));
       fprintf (dump_orig, "\n");
     }
 
Index: cgraphclones.c
===================================================================
--- cgraphclones.c	(revision 247784)
+++ cgraphclones.c	(working copy)
@@ -78,7 +78,7 @@ along with GCC; see the file COPYING3.
 #include "tree-eh.h"
 #include "tree-cfg.h"
 #include "tree-inline.h"
-#include "tree-dump.h"
+#include "dumpfile.h"
 #include "gimple-pretty-print.h"
 
 /* Create clone of edge in the node N represented by CALL_EXPR
Index: cp/Make-lang.in
===================================================================
--- cp/Make-lang.in	(revision 247784)
+++ cp/Make-lang.in	(working copy)
@@ -74,7 +74,7 @@ CXX_C_OBJS = attribs.o incpath.o \
 CXX_AND_OBJCXX_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \
  cp/class.o cp/decl2.o cp/error.o cp/lex.o cp/parser.o cp/ptree.o cp/rtti.o \
  cp/typeck.o cp/cvt.o cp/except.o cp/friend.o cp/init.o cp/method.o \
- cp/search.o cp/semantics.o cp/tree.o cp/repo.o cp/dump.o cp/optimize.o \
+ cp/search.o cp/semantics.o cp/tree.o cp/repo.o cp/optimize.o \
  cp/mangle.o cp/cp-objcp-common.o cp/name-lookup.o cp/cxx-pretty-print.o \
  cp/cp-cilkplus.o \
  cp/cp-gimplify.o cp/cp-array-notation.o cp/lambda.o \
Index: cp/decl2.c
===================================================================
--- cp/decl2.c	(revision 247784)
+++ cp/decl2.c	(working copy)
@@ -4363,22 +4363,6 @@ generate_mangling_aliases ()
   defer_mangling_aliases = false;
 }
 
-/* The entire file is now complete.  If requested, dump everything
-   to a file.  */
-
-static void
-dump_tu (void)
-{
-  int flags;
-  FILE *stream = dump_begin (TDI_tu, &flags);
-
-  if (stream)
-    {
-      dump_node (global_namespace, flags & ~TDF_SLIM, stream);
-      dump_end (TDI_tu, stream);
-    }
-}
-
 static location_t locus_at_end_of_parsing;
 
 /* Check the deallocation functions for CODE to see if we want to warn that
@@ -4472,7 +4456,6 @@ c_parse_final_cleanups (void)
 	    || ! DECL_HARD_REGISTER (node->decl))
 	  DECL_ASSEMBLER_NAME (node->decl);
       c_common_write_pch ();
-      dump_tu ();
       /* Ensure even the callers don't try to finalize the CU.  */
       flag_syntax_only = 1;
       return;
@@ -4830,10 +4813,6 @@ c_parse_final_cleanups (void)
 
   fini_constexpr ();
 
-  /* The entire file is now complete.  If requested, dump everything
-     to a file.  */
-  dump_tu ();
-
   if (flag_detailed_statistics)
     {
       dump_tree_statistics ();
Index: cp/dump.c
===================================================================
--- cp/dump.c	(revision 247784)
+++ cp/dump.c	(working copy)
@@ -1,496 +0,0 @@
-/* Tree-dumping functionality for intermediate representation.
-   Copyright (C) 1999-2017 Free Software Foundation, Inc.
-   Written by Mark Mitchell <m...@codesourcery.com>
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3, or (at your option)
-any later version.
-
-GCC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING3.  If not see
-<http://www.gnu.org/licenses/>.  */
-
-#include "config.h"
-#include "system.h"
-#include "coretypes.h"
-#include "cp-tree.h"
-#include "tree-dump.h"
-
-static void dump_access (dump_info_p, tree);
-
-static void dump_op (dump_info_p, tree);
-
-/* Dump a representation of the accessibility information associated
-   with T.  */
-
-static void
-dump_access (dump_info_p di, tree t)
-{
-  if (TREE_PROTECTED(t))
-    dump_string_field (di, "accs", "prot");
-  else if (TREE_PRIVATE(t))
-    dump_string_field (di, "accs", "priv");
-  else
-    dump_string_field (di, "accs", "pub");
-}
-
-/* Dump a representation of the specific operator for an overloaded
-   operator associated with node t.  */
-
-static void
-dump_op (dump_info_p di, tree t)
-{
-  switch (DECL_OVERLOADED_OPERATOR_P (t)) {
-    case NEW_EXPR:
-      dump_string (di, "new");
-      break;
-    case VEC_NEW_EXPR:
-      dump_string (di, "vecnew");
-      break;
-    case DELETE_EXPR:
-      dump_string (di, "delete");
-      break;
-    case VEC_DELETE_EXPR:
-      dump_string (di, "vecdelete");
-      break;
-    case UNARY_PLUS_EXPR:
-      dump_string (di, "pos");
-      break;
-    case NEGATE_EXPR:
-      dump_string (di, "neg");
-      break;
-    case ADDR_EXPR:
-      dump_string (di, "addr");
-      break;
-    case INDIRECT_REF:
-      dump_string(di, "deref");
-      break;
-    case BIT_NOT_EXPR:
-      dump_string(di, "not");
-      break;
-    case TRUTH_NOT_EXPR:
-      dump_string(di, "lnot");
-      break;
-    case PREINCREMENT_EXPR:
-      dump_string(di, "preinc");
-      break;
-    case PREDECREMENT_EXPR:
-      dump_string(di, "predec");
-      break;
-    case PLUS_EXPR:
-      if (DECL_ASSIGNMENT_OPERATOR_P (t))
-	dump_string (di, "plusassign");
-      else
-	dump_string(di, "plus");
-      break;
-    case MINUS_EXPR:
-      if (DECL_ASSIGNMENT_OPERATOR_P (t))
-	dump_string (di, "minusassign");
-      else
-	dump_string(di, "minus");
-      break;
-    case MULT_EXPR:
-      if (DECL_ASSIGNMENT_OPERATOR_P (t))
-	dump_string (di, "multassign");
-      else
-	dump_string (di, "mult");
-      break;
-    case TRUNC_DIV_EXPR:
-      if (DECL_ASSIGNMENT_OPERATOR_P (t))
-	dump_string (di, "divassign");
-      else
-	dump_string (di, "div");
-      break;
-    case TRUNC_MOD_EXPR:
-      if (DECL_ASSIGNMENT_OPERATOR_P (t))
-	 dump_string (di, "modassign");
-      else
-	dump_string (di, "mod");
-      break;
-    case BIT_AND_EXPR:
-      if (DECL_ASSIGNMENT_OPERATOR_P (t))
-	dump_string (di, "andassign");
-      else
-	dump_string (di, "and");
-      break;
-    case BIT_IOR_EXPR:
-      if (DECL_ASSIGNMENT_OPERATOR_P (t))
-	dump_string (di, "orassign");
-      else
-	dump_string (di, "or");
-      break;
-    case BIT_XOR_EXPR:
-      if (DECL_ASSIGNMENT_OPERATOR_P (t))
-	dump_string (di, "xorassign");
-      else
-	dump_string (di, "xor");
-      break;
-    case LSHIFT_EXPR:
-      if (DECL_ASSIGNMENT_OPERATOR_P (t))
-	dump_string (di, "lshiftassign");
-      else
-	dump_string (di, "lshift");
-      break;
-    case RSHIFT_EXPR:
-      if (DECL_ASSIGNMENT_OPERATOR_P (t))
-	dump_string (di, "rshiftassign");
-      else
-	dump_string (di, "rshift");
-      break;
-    case EQ_EXPR:
-      dump_string (di, "eq");
-      break;
-    case NE_EXPR:
-      dump_string (di, "ne");
-      break;
-    case LT_EXPR:
-      dump_string (di, "lt");
-      break;
-    case GT_EXPR:
-      dump_string (di, "gt");
-      break;
-    case LE_EXPR:
-      dump_string (di, "le");
-      break;
-    case GE_EXPR:
-      dump_string (di, "ge");
-      break;
-    case TRUTH_ANDIF_EXPR:
-      dump_string (di, "land");
-      break;
-    case TRUTH_ORIF_EXPR:
-      dump_string (di, "lor");
-      break;
-    case COMPOUND_EXPR:
-      dump_string (di, "compound");
-      break;
-    case MEMBER_REF:
-      dump_string (di, "memref");
-      break;
-    case COMPONENT_REF:
-      dump_string (di, "ref");
-      break;
-    case ARRAY_REF:
-      dump_string (di, "subs");
-      break;
-    case POSTINCREMENT_EXPR:
-      dump_string (di, "postinc");
-      break;
-    case POSTDECREMENT_EXPR:
-      dump_string (di, "postdec");
-      break;
-    case CALL_EXPR:
-      dump_string (di, "call");
-      break;
-    case NOP_EXPR:
-      if (DECL_ASSIGNMENT_OPERATOR_P (t))
-	dump_string (di, "assign");
-      break;
-    default:
-      break;
-  }
-}
-
-/* Dump information common to statements from STMT.  */
-
-static void
-dump_stmt (dump_info_p di, const_tree t)
-{
-  if (EXPR_HAS_LOCATION (t))
-    dump_int (di, "line", EXPR_LINENO (t));
-}
-
-bool
-cp_dump_tree (void* dump_info, tree t)
-{
-  enum tree_code code;
-  dump_info_p di = (dump_info_p) dump_info;
-
-  /* Figure out what kind of node this is.  */
-  code = TREE_CODE (t);
-
-  if (DECL_P (t))
-    {
-      if (DECL_LANG_SPECIFIC (t) && DECL_LANGUAGE (t) != lang_cplusplus)
-	dump_string_field (di, "lang", language_to_string (DECL_LANGUAGE (t)));
-    }
-
-  switch (code)
-    {
-    case IDENTIFIER_NODE:
-      if (IDENTIFIER_OPNAME_P (t))
-	{
-	  dump_string_field (di, "note", "operator");
-	  return true;
-	}
-      else if (IDENTIFIER_TYPENAME_P (t))
-	{
-	  dump_child ("tynm", TREE_TYPE (t));
-	  return true;
-	}
-      break;
-
-    case OFFSET_TYPE:
-      dump_string_field (di, "note", "ptrmem");
-      dump_child ("ptd", TYPE_PTRMEM_POINTED_TO_TYPE (t));
-      dump_child ("cls", TYPE_PTRMEM_CLASS_TYPE (t));
-      return true;
-
-    case RECORD_TYPE:
-      if (TYPE_PTRMEMFUNC_P (t))
-	{
-	  dump_string_field (di, "note", "ptrmem");
-	  dump_child ("ptd", TYPE_PTRMEM_POINTED_TO_TYPE (t));
-	  dump_child ("cls", TYPE_PTRMEM_CLASS_TYPE (t));
-	  return true;
-	}
-      /* Fall through.  */
-
-    case UNION_TYPE:
-      /* Is it a type used as a base? */
-      if (TYPE_CONTEXT (t) && TREE_CODE (TYPE_CONTEXT (t)) == TREE_CODE (t)
-	  && CLASSTYPE_AS_BASE (TYPE_CONTEXT (t)) == t)
-	{
-	  dump_child ("bfld", TYPE_CONTEXT (t));
-	  return true;
-	}
-
-      if (! MAYBE_CLASS_TYPE_P (t))
-	break;
-
-      dump_child ("vfld", TYPE_VFIELD (t));
-      if (CLASSTYPE_TEMPLATE_SPECIALIZATION(t))
-	dump_string(di, "spec");
-
-      if (!dump_flag (di, TDF_SLIM, t) && TYPE_BINFO (t))
-	{
-	  int i;
-	  tree binfo;
-	  tree base_binfo;
-
-	  for (binfo = TYPE_BINFO (t), i = 0;
-	       BINFO_BASE_ITERATE (binfo, i, base_binfo); ++i)
-	    {
-	      dump_child ("base", BINFO_TYPE (base_binfo));
-	      if (BINFO_VIRTUAL_P (base_binfo))
-		dump_string_field (di, "spec", "virt");
-	      dump_access (di, base_binfo);
-	    }
-	}
-      break;
-
-    case FIELD_DECL:
-      dump_access (di, t);
-      if (DECL_MUTABLE_P (t))
-	dump_string_field (di, "spec", "mutable");
-      break;
-
-    case VAR_DECL:
-      if (TREE_CODE (CP_DECL_CONTEXT (t)) == RECORD_TYPE)
-	dump_access (di, t);
-      if (TREE_STATIC (t) && !TREE_PUBLIC (t))
-	dump_string_field (di, "link", "static");
-      break;
-
-    case FUNCTION_DECL:
-      if (!DECL_THUNK_P (t))
-	{
-	  if (DECL_OVERLOADED_OPERATOR_P (t)) {
-	    dump_string_field (di, "note", "operator");
-	    dump_op (di, t);
-	  }
-	  if (DECL_FUNCTION_MEMBER_P (t))
-	    {
-	      dump_string_field (di, "note", "member");
-	      dump_access (di, t);
-	    }
-	  if (DECL_PURE_VIRTUAL_P (t))
-	    dump_string_field (di, "spec", "pure");
-	  if (DECL_VIRTUAL_P (t))
-	    dump_string_field (di, "spec", "virt");
-	  if (DECL_CONSTRUCTOR_P (t))
-	    dump_string_field (di, "note", "constructor");
-	  if (DECL_DESTRUCTOR_P (t))
-	    dump_string_field (di, "note", "destructor");
-	  if (DECL_CONV_FN_P (t))
-	    dump_string_field (di, "note", "conversion");
-	  if (DECL_GLOBAL_CTOR_P (t))
-	    dump_string_field (di, "note", "global init");
-	  if (DECL_GLOBAL_DTOR_P (t))
-	    dump_string_field (di, "note", "global fini");
-	  if (DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (t))
-	    dump_string_field (di, "note", "pseudo tmpl");
-	}
-      else
-	{
-	  tree virt = THUNK_VIRTUAL_OFFSET (t);
-
-	  dump_string_field (di, "note", "thunk");
-	  if (DECL_THIS_THUNK_P (t))
-	    dump_string_field (di, "note", "this adjusting");
-	  else
-	    {
-	      dump_string_field (di, "note", "result adjusting");
-	      if (virt)
-		virt = BINFO_VPTR_FIELD (virt);
-	    }
-	  dump_int (di, "fixd", THUNK_FIXED_OFFSET (t));
-	  if (virt)
-	    dump_int (di, "virt", tree_to_shwi (virt));
-	  dump_child ("fn", DECL_INITIAL (t));
-	}
-      break;
-
-    case NAMESPACE_DECL:
-      if (DECL_NAMESPACE_ALIAS (t))
-	dump_child ("alis", DECL_NAMESPACE_ALIAS (t));
-      else if (!dump_flag (di, TDF_SLIM, t))
-	dump_child ("dcls", cp_namespace_decls (t));
-      break;
-
-    case TEMPLATE_DECL:
-      dump_child ("rslt", DECL_TEMPLATE_RESULT (t));
-      dump_child ("inst", DECL_TEMPLATE_INSTANTIATIONS (t));
-      dump_child ("spcs", DECL_TEMPLATE_SPECIALIZATIONS (t));
-      dump_child ("prms", DECL_TEMPLATE_PARMS (t));
-      break;
-
-    case OVERLOAD:
-      dump_child ("crnt", OVL_CURRENT (t));
-      dump_child ("chan", OVL_CHAIN (t));
-      break;
-
-    case TRY_BLOCK:
-      dump_stmt (di, t);
-      if (CLEANUP_P (t))
-	dump_string_field (di, "note", "cleanup");
-      dump_child ("body", TRY_STMTS (t));
-      dump_child ("hdlr", TRY_HANDLERS (t));
-      break;
-
-    case EH_SPEC_BLOCK:
-      dump_stmt (di, t);
-      dump_child ("body", EH_SPEC_STMTS (t));
-      dump_child ("raises", EH_SPEC_RAISES (t));
-      break;
-
-    case PTRMEM_CST:
-      dump_child ("clas", PTRMEM_CST_CLASS (t));
-      dump_child ("mbr", PTRMEM_CST_MEMBER (t));
-      break;
-
-    case THROW_EXPR:
-      /* These nodes are unary, but do not have code class `1'.  */
-      dump_child ("op 0", TREE_OPERAND (t, 0));
-      break;
-
-    case AGGR_INIT_EXPR:
-      {
-	int i = 0;
-	tree arg;
-	aggr_init_expr_arg_iterator iter;
-	dump_int (di, "ctor", AGGR_INIT_VIA_CTOR_P (t));
-	dump_child ("fn", AGGR_INIT_EXPR_FN (t));
-	FOR_EACH_AGGR_INIT_EXPR_ARG (arg, iter, t)
-	  {
-	    char buffer[32];
-	    sprintf (buffer, "%u", i);
-	    dump_child (buffer, arg);
-	    i++;
-	  }
-	dump_child ("decl", AGGR_INIT_EXPR_SLOT (t));
-      }
-      break;
-
-    case HANDLER:
-      dump_stmt (di, t);
-      dump_child ("parm", HANDLER_PARMS (t));
-      dump_child ("body", HANDLER_BODY (t));
-      break;
-
-    case MUST_NOT_THROW_EXPR:
-      dump_stmt (di, t);
-      dump_child ("body", TREE_OPERAND (t, 0));
-      dump_child ("cond", MUST_NOT_THROW_COND (t));
-      break;
-
-    case USING_STMT:
-      dump_stmt (di, t);
-      dump_child ("nmsp", USING_STMT_NAMESPACE (t));
-      break;
-
-    case CLEANUP_STMT:
-      dump_stmt (di, t);
-      dump_child ("decl", CLEANUP_DECL (t));
-      dump_child ("expr", CLEANUP_EXPR (t));
-      dump_child ("body", CLEANUP_BODY (t));
-      break;
-
-    case IF_STMT:
-      dump_stmt (di, t);
-      dump_child ("cond", IF_COND (t));
-      dump_child ("then", THEN_CLAUSE (t));
-      dump_child ("else", ELSE_CLAUSE (t));
-      break;
-
-    case BREAK_STMT:
-    case CONTINUE_STMT:
-      dump_stmt (di, t);
-      break;
-
-    case DO_STMT:
-      dump_stmt (di, t);
-      dump_child ("body", DO_BODY (t));
-      dump_child ("cond", DO_COND (t));
-      break;
-
-    case FOR_STMT:
-      dump_stmt (di, t);
-      dump_child ("init", FOR_INIT_STMT (t));
-      dump_child ("cond", FOR_COND (t));
-      dump_child ("expr", FOR_EXPR (t));
-      dump_child ("body", FOR_BODY (t));
-      break;
-
-    case RANGE_FOR_STMT:
-      dump_stmt (di, t);
-      dump_child ("decl", RANGE_FOR_DECL (t));
-      dump_child ("expr", RANGE_FOR_EXPR (t));
-      dump_child ("body", RANGE_FOR_BODY (t));
-      break;
-
-    case SWITCH_STMT:
-      dump_stmt (di, t);
-      dump_child ("cond", SWITCH_STMT_COND (t));
-      dump_child ("body", SWITCH_STMT_BODY (t));
-      break;
-
-    case WHILE_STMT:
-      dump_stmt (di, t);
-      dump_child ("cond", WHILE_COND (t));
-      dump_child ("body", WHILE_BODY (t));
-      break;
-
-    case STMT_EXPR:
-      dump_child ("stmt", STMT_EXPR_STMT (t));
-      break;
-
-    case EXPR_STMT:
-      dump_stmt (di, t);
-      dump_child ("expr", EXPR_STMT_EXPR (t));
-      break;
-
-    default:
-      break;
-    }
-
-  return c_dump_tree (di, t);
-}
Index: doc/invoke.texi
===================================================================
--- doc/invoke.texi	(revision 247784)
+++ doc/invoke.texi	(working copy)
@@ -546,7 +546,6 @@ Objective-C and Objective-C++ Dialects}.
 -fdump-passes @gol
 -fdump-rtl-@var{pass}  -fdump-rtl-@var{pass}=@var{filename} @gol
 -fdump-statistics @gol
--fdump-translation-unit@r{[}-@var{n}@r{]} @gol
 -fdump-tree-all @gol
 -fdump-tree-@var{switch} @gol
 -fdump-tree-@var{switch}-@var{options} @gol
@@ -12985,16 +12984,6 @@ whole compilation unit while @samp{-deta
 the passes generate them.  The default with no option is to sum
 counters for each function compiled.
 
-@item -fdump-translation-unit @r{(C++ only)}
-@itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
-@opindex fdump-translation-unit
-Dump a representation of the tree structure for the entire translation
-unit to a file.  The file name is made by appending @file{.tu} to the
-source file name, and the file is created in the same directory as the
-output file.  If the @samp{-@var{options}} form is used, @var{options}
-controls the details of the dump as described for the
-@option{-fdump-tree} options.
-
 @item -fdump-tree-all
 @itemx -fdump-tree-@var{switch}
 @itemx -fdump-tree-@var{switch}-@var{options}
Index: dumpfile.c
===================================================================
--- dumpfile.c	(revision 247784)
+++ dumpfile.c	(working copy)
@@ -26,6 +26,7 @@ along with GCC; see the file COPYING3.
 #include "diagnostic-core.h"
 #include "dumpfile.h"
 #include "context.h"
+#include "tree-cfg.h"
 
 /* If non-NULL, return one past-the-end of the matching SUBPART of
    the WHOLE string.  */
@@ -57,8 +58,6 @@ static struct dump_file_info dump_files[
    0, 0, 0, 0, 0, false, false},
   {".ipa-clones", "ipa-clones", NULL, NULL, NULL, NULL, NULL, TDF_IPA,
    0, 0, 0, 0, 0, false, false},
-  {".tu", "translation-unit", NULL, NULL, NULL, NULL, NULL, TDF_TREE,
-   0, 0, 0, 0, 1, false, false},
   {".class", "class-hierarchy", NULL, NULL, NULL, NULL, NULL, TDF_TREE,
    0, 0, 0, 0, 2, false, false},
   {".original", "tree-original", NULL, NULL, NULL, NULL, NULL, TDF_TREE,
@@ -67,7 +66,7 @@ static struct dump_file_info dump_files[
    0, 0, 0, 0, 4, false, false},
   {".nested", "tree-nested", NULL, NULL, NULL, NULL, NULL, TDF_TREE,
    0, 0, 0, 0, 5, false, false},
-#define FIRST_AUTO_NUMBERED_DUMP 6
+#define FIRST_AUTO_NUMBERED_DUMP 5
 
   {NULL, "tree-all", NULL, NULL, NULL, NULL, NULL, TDF_TREE,
    0, 0, 0, 0, 0, false, false},
@@ -982,6 +981,22 @@ dump_basic_block (int dump_kind, basic_b
     dump_bb (alt_dump_file, bb, indent, TDF_DETAILS);
 }
 
+/* Dump FUNCTION_DECL FN as tree dump PHASE.  */
+
+void
+dump_function (int phase, tree fn)
+{
+  FILE *stream;
+  int flags;
+
+  stream = dump_begin (phase, &flags);
+  if (stream)
+    {
+      dump_function_to_file (fn, stream, flags);
+      dump_end (phase, stream);
+    }
+}
+
 /* Print information from the combine pass on dump_file.  */
 
 void
Index: dumpfile.h
===================================================================
--- dumpfile.h	(revision 247784)
+++ dumpfile.h	(working copy)
@@ -30,7 +30,6 @@ enum tree_dump_index
   TDI_cgraph,                   /* dump function call graph.  */
   TDI_inheritance,              /* dump type inheritance graph.  */
   TDI_clones,			/* dump IPA cloning decisions.  */
-  TDI_tu,			/* dump the whole translation unit.  */
   TDI_class,			/* dump class hierarchy.  */
   TDI_original,			/* dump each function before optimizing it */
   TDI_generic,			/* dump each function after genericizing it */
@@ -138,6 +137,7 @@ extern const char *dump_flag_name (int);
 extern void dump_printf (int, const char *, ...) ATTRIBUTE_PRINTF_2;
 extern void dump_printf_loc (int, source_location,
                              const char *, ...) ATTRIBUTE_PRINTF_3;
+extern void dump_function (int phase, tree fn);
 extern void dump_basic_block (int, basic_block, int);
 extern void dump_generic_expr_loc (int, source_location, int, tree);
 extern void dump_generic_expr (int, int, tree);
@@ -146,9 +146,6 @@ extern void dump_gimple_stmt (int, int,
 extern void print_combine_total_stats (void);
 extern bool enable_rtl_dump_file (void);
 
-/* In tree-dump.c  */
-extern void dump_node (const_tree, int, FILE *);
-
 /* In combine.c  */
 extern void dump_combine_total_stats (FILE *);
 /* In cfghooks.c  */
Index: fortran/trans-decl.c
===================================================================
--- fortran/trans-decl.c	(revision 247784)
+++ fortran/trans-decl.c	(working copy)
@@ -35,7 +35,7 @@ along with GCC; see the file COPYING3.
 #include "stor-layout.h"
 #include "varasm.h"
 #include "attribs.h"
-#include "tree-dump.h"
+#include "dumpfile.h"
 #include "toplev.h"	/* For announce_function.  */
 #include "debug.h"
 #include "constructor.h"
Index: gimplify.c
===================================================================
--- gimplify.c	(revision 247784)
+++ gimplify.c	(working copy)
@@ -56,7 +56,7 @@ along with GCC; see the file COPYING3.
 #include "gimple-low.h"
 #include "cilk.h"
 #include "gomp-constants.h"
-#include "tree-dump.h"
+#include "splay-tree.h"
 #include "gimple-walk.h"
 #include "langhooks-def.h"	/* FIXME: for lhd_set_decl_assembler_name */
 #include "builtins.h"
Index: graphite-poly.c
===================================================================
--- graphite-poly.c	(revision 247784)
+++ graphite-poly.c	(working copy)
@@ -39,7 +39,6 @@ along with GCC; see the file COPYING3.
 #include "tree-data-ref.h"
 #include "pretty-print.h"
 #include "gimple-pretty-print.h"
-#include "tree-dump.h"
 #include "graphite.h"
 
 /* Print to STDERR the GMP value VAL.  */
Index: langhooks-def.h
===================================================================
--- langhooks-def.h	(revision 247784)
+++ langhooks-def.h	(working copy)
@@ -147,19 +147,8 @@ extern int lhd_type_dwarf_attribute (con
 /* Hooks for tree gimplification.  */
 #define LANG_HOOKS_GIMPLIFY_EXPR lhd_gimplify_expr
 
-/* Tree dump hooks.  */
-extern bool lhd_tree_dump_dump_tree (void *, tree);
-extern int lhd_tree_dump_type_quals (const_tree);
 extern tree lhd_make_node (enum tree_code);
 
-#define LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN lhd_tree_dump_dump_tree
-#define LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN lhd_tree_dump_type_quals
-
-#define LANG_HOOKS_TREE_DUMP_INITIALIZER { \
-  LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN, \
-  LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN \
-}
-
 /* Types hooks.  There are no reasonable defaults for most of them,
    so we create a compile-time error instead.  */
 extern tree lhd_unit_size_without_reusable_padding (tree);
@@ -319,7 +308,6 @@ extern void lhd_end_section (void);
   LANG_HOOKS_COMMON_ATTRIBUTE_TABLE, \
   LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE, \
   LANG_HOOKS_TREE_INLINING_INITIALIZER, \
-  LANG_HOOKS_TREE_DUMP_INITIALIZER, \
   LANG_HOOKS_DECLS, \
   LANG_HOOKS_FOR_TYPES_INITIALIZER, \
   LANG_HOOKS_LTO, \
Index: langhooks.c
===================================================================
--- langhooks.c	(revision 247784)
+++ langhooks.c	(working copy)
@@ -236,25 +236,6 @@ lhd_types_compatible_p (tree x, tree y)
   return TYPE_MAIN_VARIANT (x) == TYPE_MAIN_VARIANT (y);
 }
 
-/* lang_hooks.tree_dump.dump_tree:  Dump language-specific parts of tree
-   nodes.  Returns nonzero if it does not want the usual dumping of the
-   second argument.  */
-
-bool
-lhd_tree_dump_dump_tree (void *di ATTRIBUTE_UNUSED, tree t ATTRIBUTE_UNUSED)
-{
-  return false;
-}
-
-/* lang_hooks.tree_dump.type_qual:  Determine type qualifiers in a
-   language-specific way.  */
-
-int
-lhd_tree_dump_type_quals (const_tree t)
-{
-  return TYPE_QUALS (t);
-}
-
 /* lang_hooks.gimplify_expr re-writes *EXPR_P into GIMPLE form.  */
 
 int
Index: langhooks.h
===================================================================
--- langhooks.h	(revision 247784)
+++ langhooks.h	(working copy)
@@ -44,18 +44,6 @@ struct lang_hooks_for_tree_inlining
   bool (*var_mod_type_p) (tree, tree);
 };
 
-/* The following hooks are used by tree-dump.c.  */
-
-struct lang_hooks_for_tree_dump
-{
-  /* Dump language-specific parts of tree nodes.  Returns nonzero if it
-     does not want the usual dumping of the second argument.  */
-  bool (*dump_tree) (void *, tree);
-
-  /* Determine type qualifiers in a language-specific way.  */
-  int (*type_quals) (const_tree);
-};
-
 /* Hooks related to types.  */
 
 struct lang_hooks_for_types
@@ -447,8 +435,6 @@ struct lang_hooks
 
   struct lang_hooks_for_tree_inlining tree_inlining;
 
-  struct lang_hooks_for_tree_dump tree_dump;
-
   struct lang_hooks_for_decls decls;
 
   struct lang_hooks_for_types types;
Index: print-tree.c
===================================================================
--- print-tree.c	(revision 247784)
+++ print-tree.c	(working copy)
@@ -32,7 +32,7 @@ along with GCC; see the file COPYING3.
 #include "tree-iterator.h"
 #include "gimple-pretty-print.h" /* FIXME */
 #include "tree-cfg.h"
-#include "tree-dump.h"
+#include "dumpfile.h"
 #include "print-tree.h"
 
 /* Define the hash table of nodes already seen.
Index: stor-layout.c
===================================================================
--- stor-layout.c	(revision 247784)
+++ stor-layout.c	(working copy)
@@ -38,7 +38,7 @@ along with GCC; see the file COPYING3.
 #include "print-tree.h"
 #include "langhooks.h"
 #include "tree-inline.h"
-#include "tree-dump.h"
+#include "dumpfile.h"
 #include "gimplify.h"
 #include "debug.h"
 
Index: tree-cfg.c
===================================================================
--- tree-cfg.c	(revision 247784)
+++ tree-cfg.c	(working copy)
@@ -7588,7 +7588,6 @@ dump_function_to_file (tree fndecl, FILE
 
   if (flags & TDF_RAW && !gimple_has_body_p (fndecl))
     {
-      dump_node (fndecl, TDF_SLIM | flags, file);
       current_function_decl = old_current_fndecl;
       return;
     }
Index: tree-dump.c
===================================================================
--- tree-dump.c	(revision 247784)
+++ tree-dump.c	(working copy)
@@ -1,772 +0,0 @@
-/* Tree-dumping functionality for intermediate representation.
-   Copyright (C) 1999-2017 Free Software Foundation, Inc.
-   Written by Mark Mitchell <m...@codesourcery.com>
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 3, or (at your option) any later
-version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING3.  If not see
-<http://www.gnu.org/licenses/>.  */
-
-#include "config.h"
-#include "system.h"
-#include "coretypes.h"
-#include "tree.h"
-#include "tree-pretty-print.h"
-#include "tree-dump.h"
-#include "langhooks.h"
-#include "tree-iterator.h"
-#include "tree-cfg.h"
-
-static unsigned int queue (dump_info_p, const_tree, int);
-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);
-static void dump_maybe_newline (dump_info_p);
-
-/* Add T to the end of the queue of nodes to dump.  Returns the index
-   assigned to T.  */
-
-static unsigned int
-queue (dump_info_p di, const_tree t, int flags)
-{
-  dump_queue_p dq;
-  dump_node_info_p dni;
-  unsigned int index;
-
-  /* Assign the next available index to T.  */
-  index = ++di->index;
-
-  /* Obtain a new queue node.  */
-  if (di->free_list)
-    {
-      dq = di->free_list;
-      di->free_list = dq->next;
-    }
-  else
-    dq = XNEW (struct dump_queue);
-
-  /* Create a new entry in the splay-tree.  */
-  dni = XNEW (struct dump_node_info);
-  dni->index = index;
-  dni->binfo_p = ((flags & DUMP_BINFO) != 0);
-  dq->node = splay_tree_insert (di->nodes, (splay_tree_key) t,
-				(splay_tree_value) dni);
-
-  /* Add it to the end of the queue.  */
-  dq->next = 0;
-  if (!di->queue_end)
-    di->queue = dq;
-  else
-    di->queue_end->next = dq;
-  di->queue_end = dq;
-
-  /* Return the index.  */
-  return index;
-}
-
-static void
-dump_index (dump_info_p di, unsigned int index)
-{
-  fprintf (di->stream, "@%-6u ", index);
-  di->column += 8;
-}
-
-/* If T has not already been output, queue it for subsequent output.
-   FIELD is a string to print before printing the index.  Then, the
-   index of T is printed.  */
-
-void
-queue_and_dump_index (dump_info_p di, const char *field, const_tree t, int flags)
-{
-  unsigned int index;
-  splay_tree_node n;
-
-  /* If there's no node, just return.  This makes for fewer checks in
-     our callers.  */
-  if (!t)
-    return;
-
-  /* See if we've already queued or dumped this node.  */
-  n = splay_tree_lookup (di->nodes, (splay_tree_key) t);
-  if (n)
-    index = ((dump_node_info_p) n->value)->index;
-  else
-    /* If we haven't, add it to the queue.  */
-    index = queue (di, t, flags);
-
-  /* Print the index of the node.  */
-  dump_maybe_newline (di);
-  fprintf (di->stream, "%-4s: ", field);
-  di->column += 6;
-  dump_index (di, index);
-}
-
-/* Dump the type of T.  */
-
-void
-queue_and_dump_type (dump_info_p di, const_tree t)
-{
-  queue_and_dump_index (di, "type", TREE_TYPE (t), DUMP_NONE);
-}
-
-/* Dump column control */
-#define SOL_COLUMN 25		/* Start of line column.  */
-#define EOL_COLUMN 55		/* End of line column.  */
-#define COLUMN_ALIGNMENT 15	/* Alignment.  */
-
-/* Insert a new line in the dump output, and indent to an appropriate
-   place to start printing more fields.  */
-
-static void
-dump_new_line (dump_info_p di)
-{
-  fprintf (di->stream, "\n%*s", SOL_COLUMN, "");
-  di->column = SOL_COLUMN;
-}
-
-/* If necessary, insert a new line.  */
-
-static void
-dump_maybe_newline (dump_info_p di)
-{
-  int extra;
-
-  /* See if we need a new line.  */
-  if (di->column > EOL_COLUMN)
-    dump_new_line (di);
-  /* See if we need any padding.  */
-  else if ((extra = (di->column - SOL_COLUMN) % COLUMN_ALIGNMENT) != 0)
-    {
-      fprintf (di->stream, "%*s", COLUMN_ALIGNMENT - extra, "");
-      di->column += COLUMN_ALIGNMENT - extra;
-    }
-}
-
-/* Dump FUNCTION_DECL FN as tree dump PHASE.  */
-
-void
-dump_function (int phase, tree fn)
-{
-  FILE *stream;
-  int flags;
-
-  stream = dump_begin (phase, &flags);
-  if (stream)
-    {
-      dump_function_to_file (fn, stream, flags);
-      dump_end (phase, stream);
-    }
-}
-
-/* Dump pointer PTR using FIELD to identify it.  */
-
-void
-dump_pointer (dump_info_p di, const char *field, void *ptr)
-{
-  dump_maybe_newline (di);
-  fprintf (di->stream, "%-4s: %-8" HOST_WIDE_INT_PRINT "x ", field,
-	   (unsigned HOST_WIDE_INT) (uintptr_t) ptr);
-  di->column += 15;
-}
-
-/* Dump integer I using FIELD to identify it.  */
-
-void
-dump_int (dump_info_p di, const char *field, int i)
-{
-  dump_maybe_newline (di);
-  fprintf (di->stream, "%-4s: %-7d ", field, i);
-  di->column += 14;
-}
-
-/* Dump the floating point value R, using FIELD to identify it.  */
-
-static void
-dump_real (dump_info_p di, const char *field, const REAL_VALUE_TYPE *r)
-{
-  char buf[32];
-  real_to_decimal (buf, r, sizeof (buf), 0, true);
-  dump_maybe_newline (di);
-  fprintf (di->stream, "%-4s: %s ", field, buf);
-  di->column += strlen (buf) + 7;
-}
-
-/* Dump the fixed-point value F, using FIELD to identify it.  */
-
-static void
-dump_fixed (dump_info_p di, const char *field, const FIXED_VALUE_TYPE *f)
-{
-  char buf[32];
-  fixed_to_decimal (buf, f, sizeof (buf));
-  dump_maybe_newline (di);
-  fprintf (di->stream, "%-4s: %s ", field, buf);
-  di->column += strlen (buf) + 7;
-}
-
-
-/* Dump the string S.  */
-
-void
-dump_string (dump_info_p di, const char *string)
-{
-  dump_maybe_newline (di);
-  fprintf (di->stream, "%-13s ", string);
-  if (strlen (string) > 13)
-    di->column += strlen (string) + 1;
-  else
-    di->column += 14;
-}
-
-/* Dump the string field S.  */
-
-void
-dump_string_field (dump_info_p di, const char *field, const char *string)
-{
-  dump_maybe_newline (di);
-  fprintf (di->stream, "%-4s: %-7s ", field, string);
-  if (strlen (string) > 7)
-    di->column += 6 + strlen (string) + 1;
-  else
-    di->column += 14;
-}
-
-/* Dump the next node in the queue.  */
-
-static void
-dequeue_and_dump (dump_info_p di)
-{
-  dump_queue_p dq;
-  splay_tree_node stn;
-  dump_node_info_p dni;
-  tree t;
-  unsigned int index;
-  enum tree_code code;
-  enum tree_code_class code_class;
-  const char* code_name;
-
-  /* Get the next node from the queue.  */
-  dq = di->queue;
-  stn = dq->node;
-  t = (tree) stn->key;
-  dni = (dump_node_info_p) stn->value;
-  index = dni->index;
-
-  /* Remove the node from the queue, and put it on the free list.  */
-  di->queue = dq->next;
-  if (!di->queue)
-    di->queue_end = 0;
-  dq->next = di->free_list;
-  di->free_list = dq;
-
-  /* Print the node index.  */
-  dump_index (di, index);
-  /* And the type of node this is.  */
-  if (dni->binfo_p)
-    code_name = "binfo";
-  else
-    code_name = get_tree_code_name (TREE_CODE (t));
-  fprintf (di->stream, "%-16s ", code_name);
-  di->column = 25;
-
-  /* Figure out what kind of node this is.  */
-  code = TREE_CODE (t);
-  code_class = TREE_CODE_CLASS (code);
-
-  /* Although BINFOs are TREE_VECs, we dump them specially so as to be
-     more informative.  */
-  if (dni->binfo_p)
-    {
-      unsigned ix;
-      tree base;
-      vec<tree, va_gc> *accesses = BINFO_BASE_ACCESSES (t);
-
-      dump_child ("type", BINFO_TYPE (t));
-
-      if (BINFO_VIRTUAL_P (t))
-	dump_string_field (di, "spec", "virt");
-
-      dump_int (di, "bases", BINFO_N_BASE_BINFOS (t));
-      for (ix = 0; BINFO_BASE_ITERATE (t, ix, base); ix++)
-	{
-	  tree access = (accesses ? (*accesses)[ix] : access_public_node);
-	  const char *string = NULL;
-
-	  if (access == access_public_node)
-	    string = "pub";
-	  else if (access == access_protected_node)
-	    string = "prot";
-	  else if (access == access_private_node)
-	    string = "priv";
-	  else
-	    gcc_unreachable ();
-
-	  dump_string_field (di, "accs", string);
-	  queue_and_dump_index (di, "binf", base, DUMP_BINFO);
-	}
-
-      goto done;
-    }
-
-  /* We can knock off a bunch of expression nodes in exactly the same
-     way.  */
-  if (IS_EXPR_CODE_CLASS (code_class))
-    {
-      /* If we're dumping children, dump them now.  */
-      queue_and_dump_type (di, t);
-
-      switch (code_class)
-	{
-	case tcc_unary:
-	  dump_child ("op 0", TREE_OPERAND (t, 0));
-	  break;
-
-	case tcc_binary:
-	case tcc_comparison:
-	  dump_child ("op 0", TREE_OPERAND (t, 0));
-	  dump_child ("op 1", TREE_OPERAND (t, 1));
-	  break;
-
-	case tcc_expression:
-	case tcc_reference:
-	case tcc_statement:
-	case tcc_vl_exp:
-	  /* These nodes are handled explicitly below.  */
-	  break;
-
-	default:
-	  gcc_unreachable ();
-	}
-    }
-  else if (DECL_P (t))
-    {
-      expanded_location xloc;
-      /* All declarations have names.  */
-      if (DECL_NAME (t))
-	dump_child ("name", DECL_NAME (t));
-      if (DECL_ASSEMBLER_NAME_SET_P (t)
-	  && DECL_ASSEMBLER_NAME (t) != DECL_NAME (t))
-	dump_child ("mngl", DECL_ASSEMBLER_NAME (t));
-      if (DECL_ABSTRACT_ORIGIN (t))
-        dump_child ("orig", DECL_ABSTRACT_ORIGIN (t));
-      /* And types.  */
-      queue_and_dump_type (di, t);
-      dump_child ("scpe", DECL_CONTEXT (t));
-      /* And a source position.  */
-      xloc = expand_location (DECL_SOURCE_LOCATION (t));
-      if (xloc.file)
-	{
-	  const char *filename = lbasename (xloc.file);
-
-	  dump_maybe_newline (di);
-	  fprintf (di->stream, "srcp: %s:%-6d ", filename,
-		   xloc.line);
-	  di->column += 6 + strlen (filename) + 8;
-	}
-      /* And any declaration can be compiler-generated.  */
-      if (CODE_CONTAINS_STRUCT (TREE_CODE (t), TS_DECL_COMMON)
-	  && DECL_ARTIFICIAL (t))
-	dump_string_field (di, "note", "artificial");
-      if (DECL_CHAIN (t) && !dump_flag (di, TDF_SLIM, NULL))
-	dump_child ("chain", DECL_CHAIN (t));
-    }
-  else if (code_class == tcc_type)
-    {
-      /* All types have qualifiers.  */
-      int quals = lang_hooks.tree_dump.type_quals (t);
-
-      if (quals != TYPE_UNQUALIFIED)
-	{
-	  fprintf (di->stream, "qual: %c%c%c     ",
-		   (quals & TYPE_QUAL_CONST) ? 'c' : ' ',
-		   (quals & TYPE_QUAL_VOLATILE) ? 'v' : ' ',
-		   (quals & TYPE_QUAL_RESTRICT) ? 'r' : ' ');
-	  di->column += 14;
-	}
-
-      /* All types have associated declarations.  */
-      dump_child ("name", TYPE_NAME (t));
-
-      /* All types have a main variant.  */
-      if (TYPE_MAIN_VARIANT (t) != t)
-	dump_child ("unql", TYPE_MAIN_VARIANT (t));
-
-      /* And sizes.  */
-      dump_child ("size", TYPE_SIZE (t));
-
-      /* All types have alignments.  */
-      dump_int (di, "algn", TYPE_ALIGN (t));
-    }
-  else if (code_class == tcc_constant)
-    /* All constants can have types.  */
-    queue_and_dump_type (di, t);
-
-  /* Give the language-specific code a chance to print something.  If
-     it's completely taken care of things, don't bother printing
-     anything more ourselves.  */
-  if (lang_hooks.tree_dump.dump_tree (di, t))
-    goto done;
-
-  /* Now handle the various kinds of nodes.  */
-  switch (code)
-    {
-      int i;
-
-    case IDENTIFIER_NODE:
-      dump_string_field (di, "strg", IDENTIFIER_POINTER (t));
-      dump_int (di, "lngt", IDENTIFIER_LENGTH (t));
-      break;
-
-    case TREE_LIST:
-      dump_child ("purp", TREE_PURPOSE (t));
-      dump_child ("valu", TREE_VALUE (t));
-      dump_child ("chan", TREE_CHAIN (t));
-      break;
-
-    case STATEMENT_LIST:
-      {
-	tree_stmt_iterator it;
-	for (i = 0, it = tsi_start (t); !tsi_end_p (it); tsi_next (&it), i++)
-	  {
-	    char buffer[32];
-	    sprintf (buffer, "%u", i);
-	    dump_child (buffer, tsi_stmt (it));
-	  }
-      }
-      break;
-
-    case TREE_VEC:
-      dump_int (di, "lngt", TREE_VEC_LENGTH (t));
-      for (i = 0; i < TREE_VEC_LENGTH (t); ++i)
-	{
-	  char buffer[32];
-	  sprintf (buffer, "%u", i);
-	  dump_child (buffer, TREE_VEC_ELT (t, i));
-	}
-      break;
-
-    case INTEGER_TYPE:
-    case ENUMERAL_TYPE:
-      dump_int (di, "prec", TYPE_PRECISION (t));
-      dump_string_field (di, "sign", TYPE_UNSIGNED (t) ? "unsigned": "signed");
-      dump_child ("min", TYPE_MIN_VALUE (t));
-      dump_child ("max", TYPE_MAX_VALUE (t));
-
-      if (code == ENUMERAL_TYPE)
-	dump_child ("csts", TYPE_VALUES (t));
-      break;
-
-    case REAL_TYPE:
-      dump_int (di, "prec", TYPE_PRECISION (t));
-      break;
-
-    case FIXED_POINT_TYPE:
-      dump_int (di, "prec", TYPE_PRECISION (t));
-      dump_string_field (di, "sign", TYPE_UNSIGNED (t) ? "unsigned": "signed");
-      dump_string_field (di, "saturating",
-			 TYPE_SATURATING (t) ? "saturating": "non-saturating");
-      break;
-
-    case POINTER_TYPE:
-      dump_child ("ptd", TREE_TYPE (t));
-      break;
-
-    case REFERENCE_TYPE:
-      dump_child ("refd", TREE_TYPE (t));
-      break;
-
-    case METHOD_TYPE:
-      dump_child ("clas", TYPE_METHOD_BASETYPE (t));
-      /* Fall through.  */
-
-    case FUNCTION_TYPE:
-      dump_child ("retn", TREE_TYPE (t));
-      dump_child ("prms", TYPE_ARG_TYPES (t));
-      break;
-
-    case ARRAY_TYPE:
-      dump_child ("elts", TREE_TYPE (t));
-      dump_child ("domn", TYPE_DOMAIN (t));
-      break;
-
-    case RECORD_TYPE:
-    case UNION_TYPE:
-      if (TREE_CODE (t) == RECORD_TYPE)
-	dump_string_field (di, "tag", "struct");
-      else
-	dump_string_field (di, "tag", "union");
-
-      dump_child ("flds", TYPE_FIELDS (t));
-      dump_child ("fncs", TYPE_METHODS (t));
-      queue_and_dump_index (di, "binf", TYPE_BINFO (t),
-			    DUMP_BINFO);
-      break;
-
-    case CONST_DECL:
-      dump_child ("cnst", DECL_INITIAL (t));
-      break;
-
-    case DEBUG_EXPR_DECL:
-      dump_int (di, "-uid", DEBUG_TEMP_UID (t));
-      /* Fall through.  */
-
-    case VAR_DECL:
-    case PARM_DECL:
-    case FIELD_DECL:
-    case RESULT_DECL:
-      if (TREE_CODE (t) == PARM_DECL)
-	dump_child ("argt", DECL_ARG_TYPE (t));
-      else
-	dump_child ("init", DECL_INITIAL (t));
-      dump_child ("size", DECL_SIZE (t));
-      dump_int (di, "algn", DECL_ALIGN (t));
-
-      if (TREE_CODE (t) == FIELD_DECL)
-	{
-	  if (DECL_FIELD_OFFSET (t))
-	    dump_child ("bpos", bit_position (t));
-	}
-      else if (VAR_P (t) || TREE_CODE (t) == PARM_DECL)
-	{
-	  dump_int (di, "used", TREE_USED (t));
-	  if (DECL_REGISTER (t))
-	    dump_string_field (di, "spec", "register");
-	}
-      break;
-
-    case FUNCTION_DECL:
-      dump_child ("args", DECL_ARGUMENTS (t));
-      if (DECL_EXTERNAL (t))
-	dump_string_field (di, "body", "undefined");
-      if (TREE_PUBLIC (t))
-	dump_string_field (di, "link", "extern");
-      else
-	dump_string_field (di, "link", "static");
-      if (DECL_SAVED_TREE (t) && !dump_flag (di, TDF_SLIM, t))
-	dump_child ("body", DECL_SAVED_TREE (t));
-      break;
-
-    case INTEGER_CST:
-      fprintf (di->stream, "int: ");
-      print_decs (t, di->stream);
-      break;
-
-    case STRING_CST:
-      fprintf (di->stream, "strg: %-7s ", TREE_STRING_POINTER (t));
-      dump_int (di, "lngt", TREE_STRING_LENGTH (t));
-      break;
-
-    case REAL_CST:
-      dump_real (di, "valu", TREE_REAL_CST_PTR (t));
-      break;
-
-    case FIXED_CST:
-      dump_fixed (di, "valu", TREE_FIXED_CST_PTR (t));
-      break;
-
-    case TRUTH_NOT_EXPR:
-    case ADDR_EXPR:
-    case INDIRECT_REF:
-    case CLEANUP_POINT_EXPR:
-    case SAVE_EXPR:
-    case REALPART_EXPR:
-    case IMAGPART_EXPR:
-      /* These nodes are unary, but do not have code class `1'.  */
-      dump_child ("op 0", TREE_OPERAND (t, 0));
-      break;
-
-    case TRUTH_ANDIF_EXPR:
-    case TRUTH_ORIF_EXPR:
-    case INIT_EXPR:
-    case MODIFY_EXPR:
-    case COMPOUND_EXPR:
-    case PREDECREMENT_EXPR:
-    case PREINCREMENT_EXPR:
-    case POSTDECREMENT_EXPR:
-    case POSTINCREMENT_EXPR:
-      /* These nodes are binary, but do not have code class `2'.  */
-      dump_child ("op 0", TREE_OPERAND (t, 0));
-      dump_child ("op 1", TREE_OPERAND (t, 1));
-      break;
-
-    case COMPONENT_REF:
-    case BIT_FIELD_REF:
-      dump_child ("op 0", TREE_OPERAND (t, 0));
-      dump_child ("op 1", TREE_OPERAND (t, 1));
-      dump_child ("op 2", TREE_OPERAND (t, 2));
-      break;
-
-    case ARRAY_REF:
-    case ARRAY_RANGE_REF:
-      dump_child ("op 0", TREE_OPERAND (t, 0));
-      dump_child ("op 1", TREE_OPERAND (t, 1));
-      dump_child ("op 2", TREE_OPERAND (t, 2));
-      dump_child ("op 3", TREE_OPERAND (t, 3));
-      break;
-
-    case COND_EXPR:
-      dump_child ("op 0", TREE_OPERAND (t, 0));
-      dump_child ("op 1", TREE_OPERAND (t, 1));
-      dump_child ("op 2", TREE_OPERAND (t, 2));
-      break;
-
-    case TRY_FINALLY_EXPR:
-      dump_child ("op 0", TREE_OPERAND (t, 0));
-      dump_child ("op 1", TREE_OPERAND (t, 1));
-      break;
-
-    case CALL_EXPR:
-      {
-	int i = 0;
-	tree arg;
-	call_expr_arg_iterator iter;
-	dump_child ("fn", CALL_EXPR_FN (t));
-	FOR_EACH_CALL_EXPR_ARG (arg, iter, t)
-	  {
-	    char buffer[32];
-	    sprintf (buffer, "%u", i);
-	    dump_child (buffer, arg);
-	    i++;
-	  }
-      }
-      break;
-
-    case CONSTRUCTOR:
-      {
-	unsigned HOST_WIDE_INT cnt;
-	tree index, value;
-	dump_int (di, "lngt", CONSTRUCTOR_NELTS (t));
-	FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (t), cnt, index, value)
-	  {
-	    dump_child ("idx", index);
-	    dump_child ("val", value);
-	  }
-      }
-      break;
-
-    case BIND_EXPR:
-      dump_child ("vars", TREE_OPERAND (t, 0));
-      dump_child ("body", TREE_OPERAND (t, 1));
-      break;
-
-    case LOOP_EXPR:
-      dump_child ("body", TREE_OPERAND (t, 0));
-      break;
-
-    case EXIT_EXPR:
-      dump_child ("cond", TREE_OPERAND (t, 0));
-      break;
-
-    case RETURN_EXPR:
-      dump_child ("expr", TREE_OPERAND (t, 0));
-      break;
-
-    case TARGET_EXPR:
-      dump_child ("decl", TREE_OPERAND (t, 0));
-      dump_child ("init", TREE_OPERAND (t, 1));
-      dump_child ("clnp", TREE_OPERAND (t, 2));
-      /* There really are two possible places the initializer can be.
-	 After RTL expansion, the second operand is moved to the
-	 position of the fourth operand, and the second operand
-	 becomes NULL.  */
-      dump_child ("init", TREE_OPERAND (t, 3));
-      break;
-
-    case CASE_LABEL_EXPR:
-      dump_child ("name", CASE_LABEL (t));
-      if (CASE_LOW (t))
-	{
-	  dump_child ("low ", CASE_LOW (t));
-	  if (CASE_HIGH (t))
-	    dump_child ("high", CASE_HIGH (t));
-	}
-      break;
-    case LABEL_EXPR:
-      dump_child ("name", TREE_OPERAND (t,0));
-      break;
-    case GOTO_EXPR:
-      dump_child ("labl", TREE_OPERAND (t, 0));
-      break;
-    case SWITCH_EXPR:
-      dump_child ("cond", TREE_OPERAND (t, 0));
-      dump_child ("body", TREE_OPERAND (t, 1));
-      if (TREE_OPERAND (t, 2))
-        {
-      	  dump_child ("labl", TREE_OPERAND (t,2));
-        }
-      break;
-    case OMP_CLAUSE:
-      {
-	int i;
-	fprintf (di->stream, "%s\n", omp_clause_code_name[OMP_CLAUSE_CODE (t)]);
-	for (i = 0; i < omp_clause_num_ops[OMP_CLAUSE_CODE (t)]; i++)
-	  dump_child ("op: ", OMP_CLAUSE_OPERAND (t, i));
-      }
-      break;
-    default:
-      /* There are no additional fields to print.  */
-      break;
-    }
-
- done:
-  if (dump_flag (di, TDF_ADDRESS, NULL))
-    dump_pointer (di, "addr", (void *)t);
-
-  /* Terminate the line.  */
-  fprintf (di->stream, "\n");
-}
-
-/* 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, const_tree node)
-{
-  return (di->flags & flag) && (node != di->node);
-}
-
-/* Dump T, and all its children, on STREAM.  */
-
-void
-dump_node (const_tree t, int flags, FILE *stream)
-{
-  struct dump_info di;
-  dump_queue_p dq;
-  dump_queue_p next_dq;
-
-  /* Initialize the dump-information structure.  */
-  di.stream = stream;
-  di.index = 0;
-  di.column = 0;
-  di.queue = 0;
-  di.queue_end = 0;
-  di.free_list = 0;
-  di.flags = flags;
-  di.node = t;
-  di.nodes = splay_tree_new (splay_tree_compare_pointers, 0,
-			     (splay_tree_delete_value_fn) &free);
-
-  /* Queue up the first node.  */
-  queue (&di, t, DUMP_NONE);
-
-  /* Until the queue is empty, keep dumping nodes.  */
-  while (di.queue)
-    dequeue_and_dump (&di);
-
-  /* Now, clean up.  */
-  for (dq = di.free_list; dq; dq = next_dq)
-    {
-      next_dq = dq->next;
-      free (dq);
-    }
-  splay_tree_delete (di.nodes);
-}
Index: tree-dump.h
===================================================================
--- tree-dump.h	(revision 247784)
+++ tree-dump.h	(working copy)
@@ -1,93 +0,0 @@
-/* Tree-dumping functionality for intermediate representation.
-   Copyright (C) 1999-2017 Free Software Foundation, Inc.
-   Written by Mark Mitchell <m...@codesourcery.com>
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 3, or (at your option) any later
-version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING3.  If not see
-<http://www.gnu.org/licenses/>.  */
-
-#ifndef GCC_TREE_DUMP_H
-#define GCC_TREE_DUMP_H
-
-#include "splay-tree.h"
-#include "dumpfile.h"
-
-typedef struct dump_info *dump_info_p;
-
-/* Flags used with queue functions.  */
-#define DUMP_NONE     0
-#define DUMP_BINFO    1
-
-/* Information about a node to be dumped.  */
-
-typedef struct dump_node_info
-{
-  /* The index for the node.  */
-  unsigned int index;
-  /* Nonzero if the node is a binfo.  */
-  unsigned int binfo_p : 1;
-} *dump_node_info_p;
-
-/* A dump_queue is a link in the queue of things to be dumped.  */
-
-typedef struct dump_queue
-{
-  /* The queued tree node.  */
-  splay_tree_node node;
-  /* The next node in the queue.  */
-  struct dump_queue *next;
-} *dump_queue_p;
-
-/* A dump_info gives information about how we should perform the dump
-   and about the current state of the dump.  */
-
-struct dump_info
-{
-  /* The stream on which to dump the information.  */
-  FILE *stream;
-  /* The original node.  */
-  const_tree node;
-  /* User flags.  */
-  int flags;
-  /* The next unused node index.  */
-  unsigned int index;
-  /* The next column.  */
-  unsigned int column;
-  /* The first node in the queue of nodes to be written out.  */
-  dump_queue_p queue;
-  /* The last node in the queue.  */
-  dump_queue_p queue_end;
-  /* Free queue nodes.  */
-  dump_queue_p free_list;
-  /* The tree nodes which we have already written out.  The
-     keys are the addresses of the nodes; the values are the integer
-     indices we assigned them.  */
-  splay_tree nodes;
-};
-
-/* Dump the CHILD and its children.  */
-#define dump_child(field, child) \
-  queue_and_dump_index (di, field, child, DUMP_NONE)
-
-extern void dump_pointer (dump_info_p, const char *, void *);
-extern void dump_int (dump_info_p, const char *, int);
-extern void dump_string (dump_info_p, const char *);
-extern void dump_string_field (dump_info_p, const char *, const char *);
-extern void queue_and_dump_index (dump_info_p, const char *, const_tree, int);
-extern void queue_and_dump_type (dump_info_p, const_tree);
-extern void dump_function (int, tree);
-extern int dump_flag (dump_info_p, int, const_tree);
-
-#endif /* ! GCC_TREE_DUMP_H */
Index: tree-nested.c
===================================================================
--- tree-nested.c	(revision 247784)
+++ tree-nested.c	(working copy)
@@ -31,7 +31,7 @@
 #include "cgraph.h"
 #include "fold-const.h"
 #include "stor-layout.h"
-#include "tree-dump.h"
+#include "dumpfile.h"
 #include "tree-inline.h"
 #include "gimplify.h"
 #include "gimple-iterator.h"

Reply via email to