Patchwork [pph] Make pph.h _the_ interface header. (issue5247044)

login
register
mail settings
Submitter Lawrence Crowl
Date Oct. 8, 2011, 3:29 a.m.
Message ID <20111008032930.1DE642225ED@jade.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/118408/
State New
Headers show

Comments

Lawrence Crowl - Oct. 8, 2011, 3:29 a.m.
This patch makes pph.h the single interface header for PPH.
The pph-streamer.h header is now an internal header for use
within the pph*.c files.  Some declarations have moved from
one header to the other to make that possible.



--
This patch is available for review at http://codereview.appspot.com/5247044

Patch

Index: gcc/cp/ChangeLog.pph

2011-10-07   Lawrence Crowl  <crowl@google.com>

	* pph-streamer.h (typedef pph_stream): Move to pph.h.
	(enum pph_symtab_action): Likewise.
	(enum pph_record_marker): Likewise.
	(enum pph_tag): Likewise.
	(extern pph_out_uint): Liekwise.
	(extern pph_out_location): Likewise.
	(extern pph_out_tree): Likewise.
	(extern pph_out_record_marker): Likewise.
	(extern pph_add_decl_to_symtab): Likewise.
	(extern pph_in_uint): Likewise.
	(extern pph_in_location): Likewise.
	(extern pph_in_tree): Likewise.
	(extern pph_record_marker): Likewise.
	(extern struct binding_table_s): Likewise.
	(extern pph_out_binding_table): Likewise.
	(extern pph_in_binding_table): Likewise.
	(extern pph_out_pending_templates_list): Likewise.
	(extern pph_out_spec_entry_tables): Likewise.
	(extern pph_in_pending_templates_list): Likewise.
	(extern pph_in_spec_entry_tables): Likewise.
	(pph_writer_enabled_p): Likewise.
	(pph_enabled_p): Likewise.

	* pph.h (cp_token_hunk): Remove unused.
	(cp_token_hunk_ptr): Likewise.
	(DEF_VEC_P (cp_token_hunk_ptr)): Likewise.
	(DEF_VEC_ALLOC_P (cp_token_hunk_ptr,gc)): Likewise.
	(#error diagnostic): Likewise.
	(extern pph_tree_code_text): Move to pph-streamer.h.
	(extern pph_dump_min_decl): Likewise.
	(extern pph_dump_namespace): Likewise.

	* pph.h: Remove includes for hashtab.h, line-map.h, parser.h, and
	timevar.h.
	* pph-streamer.h: Add include pph.h.
	* pph-streamer-in.c: Add include parser.h.
	* pph-streamer-out.c: Likewise.
	* decl.c: Include pph.h instead of pph-streamer.h.
	* semantics.c: Likewise.
	* parser.c: Remove include of pph-streamer.h.
	* name-lookup.c: Likewise.
	* Make-lang.in: Adjust dependences to reflect the above.


Index: gcc/cp/decl.c
===================================================================
--- gcc/cp/decl.c	(revision 179580)
+++ gcc/cp/decl.c	(working copy)
@@ -33,6 +33,7 @@  along with GCC; see the file COPYING3.  
 #include "coretypes.h"
 #include "tm.h"
 #include "tree.h"
+#include "pph.h"
 #include "flags.h"
 #include "cp-tree.h"
 #include "tree-iterator.h"
@@ -54,7 +55,6 @@  along with GCC; see the file COPYING3.  
 #include "pointer-set.h"
 #include "splay-tree.h"
 #include "plugin.h"
-#include "pph-streamer.h"
 
 /* Possible cases of bad specifiers type used by bad_specifiers. */
 enum bad_spec_place {
Index: gcc/cp/Make-lang.in
===================================================================
--- gcc/cp/Make-lang.in	(revision 179580)
+++ gcc/cp/Make-lang.in	(working copy)
@@ -265,10 +265,9 @@  CXX_TREE_H = $(TREE_H) cp/name-lookup.h 
 	$(srcdir)/../include/hashtab.h
 CXX_PARSER_H = tree.h c-family/c-pragma.h cp/parser.h
 CXX_PRETTY_PRINT_H = cp/cxx-pretty-print.h $(C_PRETTY_PRINT_H)
-CXX_PPH_H = $(srcdir)/../libcpp/include/line-map.h $(HASHTAB_H) \
-	$(CXX_PARSER_H) $(TIMEVAR_H) $(CXX_TREE_H) cp/pph.h
-CXX_PPH_STREAMER_H = $(LTO_STREAMER_H) cp/pph-streamer.h $(TREE_H) \
-	$(DATA_STREAMER_H) $(TREE_STREAMER_H)
+CXX_PPH_H = $(CXX_TREE_H) cp/pph.h
+CXX_PPH_STREAMER_H = $(LTO_STREAMER_H) $(DATA_STREAMER_H) $(TREE_STREAMER_H) \
+	$(TREE_H) $(CXX_PPH_H) cp/pph-streamer.h
 
 cp/lex.o: cp/lex.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) \
   $(C_PRAGMA_H) output.h input.h cp/operators.def $(TM_P_H) \
@@ -281,7 +280,7 @@  cp/decl.o: cp/decl.c $(CXX_TREE_H) $(TM_
   cp/operators.def $(TM_P_H) $(TREE_INLINE_H) $(DIAGNOSTIC_H) $(C_PRAGMA_H) \
   debug.h gt-cp-decl.h $(TIMEVAR_H) $(TARGET_H) $(PLUGIN_H) \
   intl.h tree-iterator.h pointer-set.h $(SPLAY_TREE_H) \
-  c-family/c-objc.h $(CXX_PPH_STREAMER_H)
+  c-family/c-objc.h $(CXX_PPH_H)
 cp/decl2.o: cp/decl2.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) cp/decl.h \
   output.h toplev.h $(C_COMMON_H) gt-cp-decl2.h $(CGRAPH_H) \
   $(C_PRAGMA_H) $(TREE_DUMP_H) intl.h $(TARGET_H) $(GIMPLE_H) pointer-set.h \
@@ -301,7 +300,7 @@  cp/class.o: cp/class.c $(CXX_TREE_H) $(T
   $(SPLAY_TREE_H) pointer-set.h
 cp/call.o: cp/call.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) toplev.h \
   $(DIAGNOSTIC_CORE_H) intl.h gt-cp-call.h convert.h $(TARGET_H) langhooks.h \
-  $(TIMEVAR_H) $(CXX_PPH_H) c-family/c-objc.h
+  $(TIMEVAR_H) c-family/c-objc.h
 cp/friend.o: cp/friend.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H)
 cp/init.o: cp/init.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) \
   $(EXCEPT_H) $(TARGET_H)
@@ -332,7 +331,7 @@  cp/repo.o: cp/repo.c $(CXX_TREE_H) $(TM_
 cp/semantics.o: cp/semantics.c $(CXX_TREE_H) $(TM_H) toplev.h \
   $(FLAGS_H) output.h $(RTL_H) $(TIMEVAR_H) \
   $(TREE_INLINE_H) $(CGRAPH_H) $(TARGET_H) $(C_COMMON_H) $(GIMPLE_H) \
-  bitmap.h gt-cp-semantics.h c-family/c-objc.h $(CXX_PPH_STREAMER_H)
+  bitmap.h gt-cp-semantics.h c-family/c-objc.h $(CXX_PPH_H)
 cp/dump.o: cp/dump.c $(CXX_TREE_H) $(TM_H) $(TREE_DUMP_H)
 cp/optimize.o: cp/optimize.c $(CXX_TREE_H) $(TM_H) \
   input.h $(PARAMS_H) debug.h $(TREE_INLINE_H) $(GIMPLE_H) \
@@ -342,13 +341,13 @@  cp/mangle.o: cp/mangle.c $(CXX_TREE_H) $
 cp/parser.o: cp/parser.c $(CXX_TREE_H) $(TM_H) $(DIAGNOSTIC_CORE_H) \
   gt-cp-parser.h output.h $(TARGET_H) $(PLUGIN_H) intl.h \
   c-family/c-objc.h tree-pretty-print.h $(CXX_PARSER_H) $(TIMEVAR.H) \
-  $(CXX_PPH_H) $(CXX_PPH_STREAMER_H)
+  $(CXX_PPH_H)
 cp/cp-gimplify.o: cp/cp-gimplify.c $(CXX_TREE_H) $(C_COMMON_H) \
 	$(TM_H) coretypes.h pointer-set.h tree-iterator.h $(SPLAY_TREE_H)
 cp/name-lookup.o: cp/name-lookup.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
 	$(TM_H) $(CXX_TREE_H) $(TIMEVAR_H) gt-cp-name-lookup.h \
 	$(DIAGNOSTIC_CORE_H) $(FLAGS_H) debug.h tree-pretty-print.h \
-	$(CXX_PPH_H) $(CXX_PPH_STREAMER_H) pointer-set.h
+	$(CXX_PPH_H) pointer-set.h
 cp/cxx-pretty-print.o: cp/cxx-pretty-print.c $(CXX_PRETTY_PRINT_H) \
   $(CONFIG_H) $(SYSTEM_H) $(TM_H) coretypes.h $(CXX_TREE_H) tree-pretty-print.h
 cp/pph.o: cp/pph.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(CPPLIB_H) \
@@ -362,8 +361,8 @@  cp/pph-streamer.o: cp/pph-streamer.c $(C
 cp/pph-streamer-out.o: cp/pph-streamer-out.c $(CONFIG_H) $(SYSTEM_H) \
 	coretypes.h $(TREE_H) tree-pretty-print.h $(LTO_STREAMER_H) \
 	$(CXX_PPH_STREAMER_H) $(CXX_PPH_H) $(TREE_PASS_H) version.h \
-	cppbuiltin.h tree-iterator.h $(CGRAPH_H)
+	$(CXX_PARSER_H) cppbuiltin.h tree-iterator.h $(CGRAPH_H)
 cp/pph-streamer-in.o: cp/pph-streamer-in.c $(CONFIG_H) $(SYSTEM_H) \
 	coretypes.h $(TREE_H) tree-pretty-print.h $(LTO_STREAMER_H) \
 	$(CXX_PPH_STREAMER_H) $(CXX_PPH_H) $(TREE_PASS_H) version.h \
-	cppbuiltin.h tree-iterator.h toplev.h
+	$(CXX_PARSER_H) cppbuiltin.h tree-iterator.h toplev.h
Index: gcc/cp/pph.h
===================================================================
--- gcc/cp/pph.h	(revision 179580)
+++ gcc/cp/pph.h	(working copy)
@@ -22,39 +22,105 @@  along with GCC; see the file COPYING3.  
 #ifndef GCC_CP_PPH_H
 #define GCC_CP_PPH_H
 
-/* In order for the format checking to accept the C++ front end
-   diagnostic framework extensions, you must include this file before
-   diagnostic-core.h, not after.  We override the definition of GCC_DIAG_STYLE
-   in c-common.h.  */
-#undef GCC_DIAG_STYLE
-#define GCC_DIAG_STYLE __gcc_cxxdiag__
-#if defined(GCC_DIAGNOSTIC_CORE_H) || defined (GCC_C_COMMON_H)
-#error \
-In order for the format checking to accept the C++ front end diagnostic \
-framework extensions, you must include this file before diagnostic-core.h and \
-c-common.h, not after.
-#endif
-
-#include "line-map.h"
-#include "hashtab.h"
 #include "cp/cp-tree.h"
-#include "parser.h"
-#include "timevar.h"
 
-/* A set of contiguous tokens within a single file.  */
-typedef struct GTY(()) cp_token_hunk
-{
-  /* Captured identifier and macro state.  */
-  cpp_idents_used identifiers;
 
-  /* The array of tokens.  */
-  VEC(cp_token,gc) *buffer;
-} cp_token_hunk;
+/* Types.  */
 
-typedef struct cp_token_hunk *cp_token_hunk_ptr;
+/* PPH streams.  */
+typedef struct pph_stream pph_stream;
+
+/* Actions associated with each symbol table entry.  These indicate
+   what the reader should do when registering each entry with the
+   middle-end.  */
+enum pph_symtab_action {
+  /* Declare this symbol with rest_of_decl_compilation.  */
+  PPH_SYMTAB_DECLARE = 0x23,
+
+  /* Expand this function with expand_or_defer_fn.  */
+  PPH_SYMTAB_EXPAND
+};
+
+/* Record markers.  */
+enum pph_record_marker {
+  /* This record contains the physical representation of the memory data.  */
+  PPH_RECORD_START = 0x23,
+
+  /* Like PPH_RECORD_START, but the reconstructed data should not be
+     added to the pickle cache (see pph_cache_should_handle).  */
+  PPH_RECORD_START_NO_CACHE,
+
+  /* Start a mutated reference.  This marker indicates that this data
+     already existed in the cache for another PPH image, but it has
+     mutated since it was inserted into the cache:
+
+     - The writer will pickle the object again as if it had not
+       been pickled before.
+
+     - The reader uses this as an indication that it should not
+       allocate a new object, it should simply unpickle the object on
+       top of the already allocated object.  */
+  PPH_RECORD_START_MUTATED,
+
+  /* End of record marker.  If a record starts with PPH_RECORD_END, the
+     reader should return a NULL pointer.  */
+  PPH_RECORD_END,
+
+  /* Internal reference.  This marker indicates that this data has
+     been written before and it resides in the pickle cache for the
+     current image.  Following this marker, the reader will find the
+     cache slot where the data has been stored.  */
+  PPH_RECORD_IREF,
+
+  /* External reference.  This marker indicates that this data has
+     been written before and it resides in the pickle cache for
+     another image.  Following this marker, the reader will find two
+     indices: (1) the index into the include table where the other
+     image lives, and (2) the cache slot into that image's pickle
+     cache where the data resides.  */
+  PPH_RECORD_XREF,
+
+  /* Preloaded reference. This marker indicates that this data is a preloaded
+     node created by the front-end at the beginning of compilation, which we
+     do not need to stream out as it will already exist on the way in.  */
+  PPH_RECORD_PREF
+};
+
+/* Record type tags.  Every record saved on a PPH image contains a data
+   tag to identify the data structure saved in that record.  */
+enum pph_tag {
+  PPH_null = 0,
+
+  /* The tags below are named after the data types they represent.
+
+     Note that to simplify tag management, we reserve enough
+     values to fit all the tree codes.  This guarantees that for
+     every tree code C and PPH tag T, (unsigned) C == (unsigned) T.
+
+     The value PPH_any_tree is used when reading tree records.  Since
+     the reader does not have enough context, it will generally not
+     know what kind of tree is about to read, all it knows is that it
+     should be a valid tree code.  */
+  PPH_any_tree = MAX_TREE_CODES,
+
+  /* Maintain the tags below in alphabetical order.  */
+  PPH_binding_entry,
+  PPH_binding_table,
+  PPH_cgraph_node,
+  PPH_cp_binding_level,
+  PPH_cp_class_binding,
+  PPH_cp_label_binding,
+  PPH_cxx_binding,
+  PPH_function,
+  PPH_lang_decl,
+  PPH_lang_type,
+  PPH_language_function,
+  PPH_sorted_fields_type,
+
+  /* This tag must always be last.  */
+  PPH_NUM_TAGS
+};
 
-DEF_VEC_P (cp_token_hunk_ptr);
-DEF_VEC_ALLOC_P (cp_token_hunk_ptr,gc);
 
 /* Global state.  FIXME pph, get rid of these.  */
 
@@ -62,12 +128,56 @@  DEF_VEC_ALLOC_P (cp_token_hunk_ptr,gc);
    -fpph-logfile.  If this flag is not given, stdout is used.  */
 extern FILE *pph_logfile;
 
+
+/* Extern functions.  */
+
 /* In pph.c  */
 extern void pph_init (void);
 extern void pph_finish (void);
-extern const char *pph_tree_code_text (enum tree_code code);
-extern void pph_dump_min_decl (FILE *file, tree decl);
 extern void pph_dump_tree_name (FILE *file, tree t, int flags);
-extern void pph_dump_namespace (FILE *, tree ns);
+
+/* In pph-streamer-out.c.  */
+extern void pph_out_uint (pph_stream *stream, unsigned int value);
+extern void pph_out_location (pph_stream *stream, location_t loc);
+extern void pph_out_tree (pph_stream *stream, tree t);
+extern void pph_out_record_marker (pph_stream *stream,
+			enum pph_record_marker marker, enum pph_tag tag);
+void pph_add_decl_to_symtab (tree, enum pph_symtab_action, bool, bool);
+
+/* In pph-streamer-in.c.  */
+extern unsigned int pph_in_uint (pph_stream *stream);
+extern location_t pph_in_location (pph_stream *stream);
+extern tree pph_in_tree (pph_stream *stream);
+extern enum pph_record_marker pph_in_record_marker (pph_stream *stream,
+			enum pph_tag *tag_p);
+
+/* In name-lookup.c.  */
+struct binding_table_s;
+void pph_out_binding_table (pph_stream *, struct binding_table_s *);
+struct binding_table_s *pph_in_binding_table (pph_stream *);
+
+/* In pt.c.  */
+extern void pph_out_pending_templates_list (pph_stream *stream);
+extern void pph_out_spec_entry_tables (pph_stream *stream);
+extern void pph_in_pending_templates_list (pph_stream *stream);
+extern void pph_in_spec_entry_tables (pph_stream *stream);
+
+
+/* Inline functions.  */
+
+/* Return true if we are generating a PPH image.  */
+static inline bool
+pph_writer_enabled_p (void)
+{
+  return pph_out_file != NULL;
+}
+
+/* Return true if PPH has been enabled.  */
+static inline bool
+pph_enabled_p (void)
+{
+  return pph_writer_enabled_p () || pph_reader_enabled_p ();
+}
+
 
 #endif  /* GCC_CP_PPH_H  */
Index: gcc/cp/pph-streamer-in.c
===================================================================
--- gcc/cp/pph-streamer-in.c	(revision 179698)
+++ gcc/cp/pph-streamer-in.c	(working copy)
@@ -32,6 +32,7 @@  along with GCC; see the file COPYING3.  
 #include "version.h"
 #include "cppbuiltin.h"
 #include "toplev.h"
+#include "parser.h"
 
 typedef char *char_p;
 DEF_VEC_P(char_p);
Index: gcc/cp/semantics.c
===================================================================
--- gcc/cp/semantics.c	(revision 179580)
+++ gcc/cp/semantics.c	(working copy)
@@ -29,6 +29,7 @@  along with GCC; see the file COPYING3.  
 #include "coretypes.h"
 #include "tm.h"
 #include "tree.h"
+#include "pph.h"
 #include "cp-tree.h"
 #include "c-family/c-common.h"
 #include "c-family/c-objc.h"
@@ -45,7 +46,6 @@  along with GCC; see the file COPYING3.  
 #include "target.h"
 #include "gimple.h"
 #include "bitmap.h"
-#include "pph-streamer.h"
 
 /* There routines provide a modular interface to perform many parsing
    operations.  They may therefore be used during actual parsing, or
Index: gcc/cp/parser.c
===================================================================
--- gcc/cp/parser.c	(revision 179580)
+++ gcc/cp/parser.c	(working copy)
@@ -26,7 +26,6 @@  along with GCC; see the file COPYING3.  
 #include "timevar.h"
 #include "cpplib.h"
 #include "pph.h"
-#include "pph-streamer.h"
 #include "tree.h"
 #include "cp-tree.h"
 #include "intl.h"
Index: gcc/cp/pph-streamer-out.c
===================================================================
--- gcc/cp/pph-streamer-out.c	(revision 179698)
+++ gcc/cp/pph-streamer-out.c	(working copy)
@@ -32,6 +32,7 @@  along with GCC; see the file COPYING3.  
 #include "version.h"
 #include "cppbuiltin.h"
 #include "cgraph.h"
+#include "parser.h"
 
 /* PPH stream that we are currently generating.  FIXME pph, this
    global is needed because we call back from various parts of the
Index: gcc/cp/pph-streamer.h
===================================================================
--- gcc/cp/pph-streamer.h	(revision 179699)
+++ gcc/cp/pph-streamer.h	(working copy)
@@ -25,87 +25,7 @@  along with GCC; see the file COPYING3.  
 #include "data-streamer.h"
 #include "tree-streamer.h"
 #include "tree.h"
-
-/* Record markers.  */
-enum pph_record_marker {
-  /* This record contains the physical representation of the memory data.  */
-  PPH_RECORD_START = 0x23,
-
-  /* Like PPH_RECORD_START, but the reconstructed data should not be
-     added to the pickle cache (see pph_cache_should_handle).  */
-  PPH_RECORD_START_NO_CACHE,
-
-  /* Start a mutated reference.  This marker indicates that this data
-     already existed in the cache for another PPH image, but it has
-     mutated since it was inserted into the cache:
-
-     - The writer will pickle the object again as if it had not
-       been pickled before.
-
-     - The reader uses this as an indication that it should not
-       allocate a new object, it should simply unpickle the object on
-       top of the already allocated object.  */
-  PPH_RECORD_START_MUTATED,
-
-  /* End of record marker.  If a record starts with PPH_RECORD_END, the
-     reader should return a NULL pointer.  */
-  PPH_RECORD_END,
-
-  /* Internal reference.  This marker indicates that this data has
-     been written before and it resides in the pickle cache for the
-     current image.  Following this marker, the reader will find the
-     cache slot where the data has been stored.  */
-  PPH_RECORD_IREF,
-
-  /* External reference.  This marker indicates that this data has
-     been written before and it resides in the pickle cache for
-     another image.  Following this marker, the reader will find two
-     indices: (1) the index into the include table where the other
-     image lives, and (2) the cache slot into that image's pickle
-     cache where the data resides.  */
-  PPH_RECORD_XREF,
-
-  /* Preloaded reference. This marker indicates that this data is a preloaded
-     node created by the front-end at the beginning of compilation, which we
-     do not need to stream out as it will already exist on the way in.  */
-  PPH_RECORD_PREF
-};
-
-/* Record type tags.  Every record saved on a PPH image contains a data
-   tag to identify the data structure saved in that record.  */
-enum pph_tag {
-  PPH_null = 0,
-
-  /* The tags below are named after the data types they represent.
-
-     Note that to simplify tag management, we reserve enough
-     values to fit all the tree codes.  This guarantees that for
-     every tree code C and PPH tag T, (unsigned) C == (unsigned) T.
-
-     The value PPH_any_tree is used when reading tree records.  Since
-     the reader does not have enough context, it will generally not
-     know what kind of tree is about to read, all it knows is that it
-     should be a valid tree code.  */
-  PPH_any_tree = MAX_TREE_CODES,
-
-  /* Maintain the tags below in alphabetical order.  */
-  PPH_binding_entry,
-  PPH_binding_table,
-  PPH_cgraph_node,
-  PPH_cp_binding_level,
-  PPH_cp_class_binding,
-  PPH_cp_label_binding,
-  PPH_cxx_binding,
-  PPH_function,
-  PPH_lang_decl,
-  PPH_lang_type,
-  PPH_language_function,
-  PPH_sorted_fields_type,
-
-  /* This tag must always be last.  */
-  PPH_NUM_TAGS
-};
-
+#include "pph.h"
 
 /* Line table markers. We only stream line table entries from the parent header
    file, other entries are referred to by the name of the file which is then
@@ -202,18 +122,6 @@  typedef struct pph_cache {
 } pph_cache;
 
 
-/* Actions associated with each symbol table entry.  These indicate
-   what the reader should do when registering each entry with the
-   middle-end.  */
-enum pph_symtab_action {
-  /* Declare this symbol with rest_of_decl_compilation.  */
-  PPH_SYMTAB_DECLARE = 0x23,
-
-  /* Expand this function with expand_or_defer_fn.  */
-  PPH_SYMTAB_EXPAND
-};
-
-
 /* Symbol table entry.  */
 typedef struct pph_symtab_entry
 {
@@ -239,7 +147,6 @@  typedef struct pph_symtab
 } pph_symtab;
 
 /* Vector of pph_stream pointers.  */
-struct pph_stream;
 typedef struct pph_stream *pph_stream_ptr;
 DEF_VEC_P(pph_stream_ptr);
 DEF_VEC_ALLOC_P(pph_stream_ptr,heap);
@@ -255,7 +162,7 @@  extern VEC(pph_stream_ptr, heap) *pph_re
 
 /* A PPH stream contains all the data and attributes needed to
    write symbols, declarations and other parsing products to disk.  */
-typedef struct pph_stream {
+struct pph_stream {
   /* Path name of the PPH file.  */
   const char *name;
 
@@ -304,7 +211,7 @@  typedef struct pph_stream {
     will be able to instantiate these symbols in the same order that
     they were instantiated originally.  */
   pph_symtab symtab;
-} pph_stream;
+};
 
 /* Filter values to avoid emitting certain objects to a PPH file.  */
 #define PPHF_NONE		0
@@ -312,6 +219,11 @@  typedef struct pph_stream {
 #define PPHF_NO_XREFS		(1 << 1)
 #define PPHF_NO_PREFS		(1 << 2)
 
+/* In pph.c  */
+extern const char *pph_tree_code_text (enum tree_code code);
+extern void pph_dump_min_decl (FILE *file, tree decl);
+extern void pph_dump_namespace (FILE *, tree ns);
+
 /* In pph-streamer.c.  */
 void pph_init_preloaded_cache (void);
 pph_stream *pph_stream_open (const char *, const char *);
@@ -337,17 +249,11 @@  void pph_flush_buffers (pph_stream *);
 void pph_init_write (pph_stream *);
 void pph_write_tree (struct output_block *, tree, bool);
 void pph_write_mergeable_chain (pph_stream *, tree);
-void pph_add_decl_to_symtab (tree, enum pph_symtab_action, bool, bool);
 void pph_add_include (pph_stream *);
 void pph_writer_init (void);
 void pph_writer_finish (void);
 void pph_write_location (struct output_block *, location_t);
 
-/* In name-lookup.c.  */
-struct binding_table_s;
-void pph_out_binding_table (pph_stream *, struct binding_table_s *);
-struct binding_table_s *pph_in_binding_table (pph_stream *);
-
 /* In pph-streamer-in.c.  */
 void pph_init_read (pph_stream *);
 tree pph_read_tree (struct lto_input_block *, struct data_in *);
@@ -355,28 +261,9 @@  location_t pph_read_location (struct lto
 void pph_read_file (const char *);
 void pph_reader_finish (void);
 
-/* In pt.c.  */
-extern void pph_out_pending_templates_list (pph_stream *stream);
-extern void pph_in_pending_templates_list (pph_stream *stream);
-extern void pph_out_spec_entry_tables (pph_stream *stream);
-extern void pph_in_spec_entry_tables (pph_stream *stream);
-
 
 /* Inline functions.  */
 
-/* Return true if we are generating a PPH image.  */
-static inline bool
-pph_writer_enabled_p (void)
-{
-  return pph_out_file != NULL;
-}
-
-/* Return true if PPH has been enabled.  */
-static inline bool
-pph_enabled_p (void)
-{
-  return pph_writer_enabled_p () || pph_reader_enabled_p ();
-}
 
 /* Return the pickle cache in STREAM corresponding to MARKER.
    if MARKER is PPH_RECORD_IREF, it returns the cache in STREAM itself.
@@ -437,23 +324,6 @@  pph_cache_find (pph_stream *stream, enum
 }
 
 
-extern void pph_out_tree (pph_stream *stream, tree t);
-
-extern void pph_out_uint (pph_stream *stream, unsigned int value);
-
-extern void pph_out_location (pph_stream *stream, location_t loc);
-
-extern unsigned int pph_in_uint (pph_stream *stream);
-extern location_t pph_in_location (pph_stream *stream);
-extern tree pph_in_tree (pph_stream *stream);
-
-
-extern void pph_out_record_marker (pph_stream *stream,
-		enum pph_record_marker marker, enum pph_tag tag);
-extern enum pph_record_marker pph_in_record_marker (pph_stream *stream,
-		enum pph_tag *tag_p);
-
-
 /* Return true if MARKER is PPH_RECORD_IREF, PPH_RECORD_XREF,
    or PPH_RECORD_PREF.  */
 
Index: gcc/cp/name-lookup.c
===================================================================
--- gcc/cp/name-lookup.c	(revision 179580)
+++ gcc/cp/name-lookup.c	(working copy)
@@ -35,7 +35,6 @@  along with GCC; see the file COPYING3.  
 #include "c-family/c-pragma.h"
 #include "tree-pretty-print.h"
 #include "params.h"
-#include "pph-streamer.h"
 #include "pointer-set.h"
 
 /* The bindings for a particular name in a particular scope.  */