Index: gcc/c-family/c.opt
===================================================================
--- gcc/c-family/c.opt	(revision 174568)
+++ gcc/c-family/c.opt	(working copy)
@@ -921,22 +921,10 @@
 C ObjC Var(flag_plan9_extensions)
 Enable Plan 9 language extensions
 
-fpph
-C++ Var(flag_pph)
--fpph   Enable pre-parsed header (PPH) support
-
 fpph-debug=
 C++ Joined RejectNegative UInteger Var(flag_pph_debug)
 -fpph-debug=N   Enable debugging output at level N from PPH support
 
-fpph-decls=
-C++ Joined RejectNegative UInteger Var(flag_pph_decls)
--fpph-decls=N   Enable declaration identifier output at level N from PPH support
-
-fpph-decls-debug=
-C++ Joined RejectNegative UInteger Var(flag_pph_decls_debug)
--fpph-decls=N   Enable declaration identifier output at level N from PPH support
-
 fpph-dump-tree
 C++ Var(flag_pph_dump_tree)
 -fpph-dump-tree	Dump global namespace tree around PPH reads/writes.
@@ -953,14 +941,6 @@
 C++ ObjC++ Joined MissingArgError(missing filename after %qs)
 -fpph-map=<file-name>   A file of mappings from #include to PPH file
 
-fpph-stats
-C++ Var(flag_pph_stats)
--fpph-stats	Enable statistics gathering for PPH
-
-fpph-tracer=
-C++ Joined RejectNegative UInteger Var(flag_pph_tracer)
--fpph-tracer	Enable tracing of PPH streaming operations
-
 fpph-untree
 C++ Var(flag_pph_untree)
 -fpph-untree   Report unrecognized trees while streaming PPH.
Index: gcc/cp/decl.c
===================================================================
--- gcc/cp/decl.c	(revision 174568)
+++ gcc/cp/decl.c	(working copy)
@@ -2311,7 +2311,7 @@
 tree
 duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
 {
-  tree gooddecl, baddecl;
+  tree gooddecl;
 
   gooddecl = duplicate_decls_internal (newdecl, olddecl, newdecl_is_friend);
 
@@ -2321,13 +2321,6 @@
   if (gooddecl == NULL_TREE)
     return NULL_TREE;
 
-  baddecl = (gooddecl == newdecl) ? olddecl : newdecl;
-  if (lang_hooks.pph_uncatch_tree)
-    lang_hooks.pph_uncatch_tree (baddecl);
-
-  if (lang_hooks.pph_catch_tree)
-    lang_hooks.pph_catch_tree (gooddecl);
-
   return gooddecl;
 }
 
@@ -2598,7 +2591,6 @@
   tree ret;
   bool subtime = timevar_cond_start (TV_NAME_LOOKUP);
   ret = lookup_label_1 (id);
-  pph_catch_name_lookup (ret);
   timevar_cond_stop (TV_NAME_LOOKUP, subtime);
   return ret;
 }
@@ -2931,7 +2923,6 @@
   tree ret;
   timevar_start (TV_NAME_LOOKUP);
   ret = define_label_1 (location, name);
-  pph_catch_name_lookup (ret);
   timevar_stop (TV_NAME_LOOKUP);
   return ret;
 }
@@ -11559,7 +11550,6 @@
   tree ret;
   timevar_start (TV_NAME_LOOKUP);
   ret = xref_tag_1 (tag_code, name, scope, template_header_p);
-  pph_catch_name_lookup (ret);
   timevar_stop (TV_NAME_LOOKUP);
   return ret;
 }
Index: gcc/cp/pph.c
===================================================================
--- gcc/cp/pph.c	(revision 174568)
+++ gcc/cp/pph.c	(working copy)
@@ -38,50 +38,14 @@
 #include "pph.h"
 #include "pph-streamer.h"
 
-/* Statistics collected for PTH/PPH.  */
+/* Statistics collected for PTH.  */
 struct pth_stats_d pth_stats;
-struct pph_stats_d pph_stats;
 
-/* Forward declarations to solve cyclical references.  */
-static void pph_print_trees_tokens (VEC(tree,heap) *, cp_token *, cp_token *);
-
-/* Map of decl dependencies.  */
-static struct pph_decl_deps_d *pph_decl_deps = NULL;
-
-/* Tree catcher for the incremental compiler.  Whenever this array is
-   allocated, make_node_stat() will push certain trees into this array.  */
-static VEC(tree,heap) *pph_tree_catcher = NULL;
-
-/* Catcher for name lookups.  This stores every name lookup performed
-   on identifiers while we are catching ASTs in the parser.  */
-static VEC(tree,heap) *pph_name_lookups = NULL;
-
-/* Since identifiers may be looked up more than once during parsing,
-   this set prevents duplicate symbols from being placed in
-   pph_name_lookups.  */
-static struct pointer_set_t *pph_name_lookups_set = NULL;
-
-/* This map stores the token locations where a given symbol was looked
-   up.  When an identifier is looked up and resolved to symbol S, we
-   check where the current token pointer is and save it in a vector
-   associated with S.  */
-static struct pointer_map_t *pph_nl_token_map = NULL;
-
 /* Log file where PPH analysis is written to.  Controlled by
    -fpph_logfile.  If this flag is not given, stdout is used.  */
 FILE *pph_logfile = NULL;
 
-/* Cache of token ranges for head of symbol declarations.  For each
-   *_DECL tree intercepted during parsing, we store the vector of
-   tokens that make up the head of the declaration for the node.  */
-static struct pointer_map_t *pph_decl_head_token_cache = NULL;
 
-/* Cache of token ranges for body of symbol declarations.  For each
-   *_DECL tree intercepted during parsing, we store the vector of
-   tokens that make up the body of the declaration for the node.  */
-static struct pointer_map_t *pph_decl_body_token_cache = NULL;
-
-
 /* Return true if path P1 and path P2 point to the same file.  */
 
 static inline bool
@@ -90,29 +54,6 @@
   return strcmp (lrealpath (p1), lrealpath (p2)) == 0;
 }
 
-/* Expand and print location LOC to FILE.  If FILE is NULL, pph_logfile
-   is used.  */
-
-static void
-pph_debug_location (FILE *file, location_t loc)
-{
-  expanded_location xloc;
-  file = (file) ? file : pph_logfile;
-  xloc = expand_location (loc);
-  fprintf (file, "%s:%d:%d", lrealpath (xloc.file), xloc.line, xloc.column);
-}
-
-
-/* Expand and print the location of tree T to FILE.  If FILE is NULL,
-   pph_logfile is used.  */
-
-static void
-pph_debug_loc_of_tree (FILE *file, tree t)
-{
-  pph_debug_location (file, DECL_SOURCE_LOCATION (t));
-}
-
-
 /* Hash and comparison functions for the directory of cached images.  */
 
 static hashval_t
@@ -2295,1916 +2236,6 @@
 }
 
 
-static void
-pph_log_exposed (cp_parser *parser, const char *end)
-{
-  if (flag_pph_decls_debug >= 2)
-    {
-      cp_token *pos = cp_lexer_token_position (parser->lexer, false);
-      fprintf (pph_logfile, "PPH: %s exposed declaration at ", end);
-      pph_debug_location (pph_logfile, pos->location);
-      fprintf (pph_logfile, "\n");
-    }
-}
-
-
-/* Allocate the various arrays, maps and sets used to collect ASTs and
-   their dependencies during parsing.  This memory is allocated and
-   freed for every grammar rule intercepted by pph_start_exposed() and
-   pph_stop_exposed().  */
-
-static void
-pph_allocate_catcher_memory (void)
-{
-  /* Note.  pph_tree_catcher *must* be instantiated to indicate that
-     we are going to be catching trees during parsing.  */
-  pph_tree_catcher = VEC_alloc (tree, heap, 5);
-  pph_decl_head_token_cache = pointer_map_create ();
-  pph_decl_body_token_cache = pointer_map_create ();
-  pph_decl_deps = XCNEW (struct pph_decl_deps_d);
-  pph_decl_deps->header = pointer_map_create ();
-  pph_decl_deps->body = pointer_map_create ();
-  pph_name_lookups = NULL;
-  pph_name_lookups_set = pointer_set_create ();
-  pph_nl_token_map = pointer_map_create ();
-}
-
-
-/* Free all the memory allocated by pph_allocate_catcher_memory.  */
-
-static void
-pph_free_catcher_memory (void)
-{
-  VEC_free (tree, heap, pph_tree_catcher);
-
-  pointer_map_destroy (pph_decl_head_token_cache);
-  pph_decl_head_token_cache = NULL;
-
-  pointer_map_destroy (pph_decl_body_token_cache);
-  pph_decl_body_token_cache = NULL;
-
-  pointer_map_destroy (pph_decl_deps->header);
-  pointer_map_destroy (pph_decl_deps->body);
-  free (pph_decl_deps);
-  pph_decl_deps = NULL;
-
-  VEC_free (tree, heap, pph_name_lookups);
-
-  pointer_set_destroy (pph_name_lookups_set);
-  pph_name_lookups_set = NULL;
-
-  pointer_map_destroy (pph_nl_token_map);
-  pph_nl_token_map = NULL;
-}
-
-
-/* Start collecting ASTs and dependencies.  */
-
-cp_token *
-pph_start_exposed (cp_parser *parser)
-{
-  if (flag_pph_decls_debug >= 2)
-    {
-      timevar_push (TV_PPH_MANAGE);
-
-      if (flag_pph_decls_debug >= 4)
-        fprintf (pph_logfile, "\n--------------------------------------------------------------------------\n");
-      pph_log_exposed (parser, "start");
-      pph_allocate_catcher_memory ();
-      timevar_pop (TV_PPH_MANAGE);
-
-      return parser->lexer->next_token; /* the first token */
-    }
-  else
-    return NULL;
-}
-
-/* Return the token cache associated with tree node T.  */
-
-static VEC(cp_token, heap) *
-pph_lookup_head_token_cache_for (tree t)
-{
-  void **slot = pointer_map_contains (pph_decl_head_token_cache, t);
-  if (slot)
-    return ((VEC(cp_token, heap) *) *slot);
-
-  return NULL;
-}
-
-static VEC(cp_token, heap) *
-pph_lookup_body_token_cache_for (tree t)
-{
-  void **slot = pointer_map_contains (pph_decl_body_token_cache, t);
-  if (slot)
-    return ((VEC(cp_token, heap) *) *slot);
-
-  return NULL;
-}
-
-
-/* Set the token cache associated with tree node T to CACHE.  */
-
-static void
-pph_set_head_token_cache_for (tree t, VEC(cp_token, heap) *cache)
-{
-  void **slot = pointer_map_insert (pph_decl_head_token_cache, t);
-  *slot = (void *) cache;
-}
-
-static void
-pph_set_body_token_cache_for (tree t, VEC(cp_token, heap) *cache)
-{
-  void **slot = pointer_map_insert (pph_decl_body_token_cache, t);
-  *slot = (void *) cache;
-}
-
-/* Emulate the copying of declarations into the parser cache.  Deep
-   copy all the declarations in V.  */
-
-static void
-pph_copy_decls_into_cache (VEC(tree, heap) *v)
-{
-  unsigned i;
-  static tree t_copy, type_copy, t;
-  void **slot;
-  VEC(tree, heap) *ast_cache, *old_pph_tree_catcher, *old_pph_name_lookups;
-  static struct pointer_map_t *hunk_to_decls_map = NULL;
-  static htab_t cache_dir = NULL;
-  const char *fname;
-
-  timevar_push (TV_PPH_CACHE_IN);
-
-  if (hunk_to_decls_map == NULL)
-    hunk_to_decls_map = pointer_map_create ();
-
-  if (cache_dir == NULL)
-    cache_dir = htab_create (10, htab_hash_pointer, htab_eq_pointer, 0);
-
-  /* We will be copying trees, which will call into the tree catching
-     routines.  Prevent that.  */
-  old_pph_tree_catcher = pph_tree_catcher;
-  old_pph_name_lookups = pph_name_lookups;
-  pph_tree_catcher = pph_name_lookups = NULL;
-
-  /* Copy every declaration in V into the cache.  */
-  for (i = 0; VEC_iterate (tree, v, i, t); i++)
-    {
-      /* 1- Determine the token hunk H that owns T.  We first determine
-	 the PTH image and then which hunk inside that PTH image.  For
-	 choosing the hunk within the image, we simulate a second
-	 hash table lookup hashing the location to the token hunk.  */
-      pth_image *image, *hunk;
-      VEC(cp_token, heap) *head_tokens, *body_tokens;
-      cp_token *first;
-
-      head_tokens = pph_lookup_head_token_cache_for (t);
-      body_tokens = pph_lookup_body_token_cache_for (t);
-      if (VEC_empty (cp_token, head_tokens))
-	continue;
-      first = VEC_index (cp_token, head_tokens, 0);
-      fname = LOCATION_FILE (first->location);
-      slot = htab_find_slot (cache_dir, fname, INSERT);
-      if (*slot == NULL)
-	{
-	  image = XCNEW (pth_image);
-	  *slot = CONST_CAST (char *, fname);
-	}
-      else
-	image = *((pth_image **) slot);
-
-      /* For now, re-do the pth_image_lookup to simulate the lookup of
-	 the hunk within the image.  */
-      slot = htab_find_slot (cache_dir, fname, NO_INSERT);
-      hunk = *((pth_image **) slot);
-
-      /* Insert dummy uses for head_tokens, body_tokens and image.  */
-      if (i > VEC_length (tree, v))
-	{
-	  free (head_tokens);
-	  free (body_tokens);
-	  free (image);
-	}
-
-      /* 2- Find the tree cache associated with HUNK.  */
-      slot = pointer_map_insert (hunk_to_decls_map, hunk);
-      ast_cache = (VEC(tree, heap) *) *slot;
-
-      /* 3- Copy T and its type into the cache associated with HUNK.
-	 If T has a body (a FUNCTION_DECL), copy the body.  FIXME pph,
-	 copying ASTs will need new copying code to be implemented,
-	 the current routines do not handle everything that can be
-	 generated by the C++ FE.  */
-      t_copy = copy_decl (t);
-      if (!type_copy || TREE_TYPE (t))
-	type_copy = copy_type (TREE_TYPE (t));
-      if (TREE_CODE (t) == FUNCTION_DECL)
-	walk_tree (&DECL_SAVED_TREE (t_copy), copy_tree_r, (void *)1, NULL);
-      VEC_safe_push (tree, heap, ast_cache, t_copy);
-      *slot = (void *) ast_cache;
-    }
-
-  PPH_STATS_INCR (cached_decls, VEC_length (tree, v));
-
-  /* Restore tree and lookup catchers.  */
-  pph_tree_catcher = old_pph_tree_catcher;
-  pph_name_lookups = old_pph_name_lookups;
-
-  timevar_pop (TV_PPH_CACHE_IN);
-}
-
-
-/* Emulate the cache actions needed to get a declaration out of the
-   parser cache and instantiate it into the current compilation context.  */
-
-static void
-pph_copy_decls_outof_cache (VEC(tree, heap) *v)
-{
-  unsigned i;
-  tree t;
-  static VEC(tree, heap) *compilation_context = NULL;
-  VEC(tree, heap) *old_pph_tree_catcher, *old_pph_name_lookups;
-
-  /* Conceptually, this will be called with a token hunk that contains
-     all the declarations that we want to instantiate.  */
-  timevar_push (TV_PPH_CACHE_OUT);
-
-  /* We will be copying trees, which will call into the tree catching
-     routines.  Prevent that.  */
-  old_pph_tree_catcher = pph_tree_catcher;
-  old_pph_name_lookups = pph_name_lookups;
-  pph_tree_catcher = pph_name_lookups = NULL;
-
-  /* 1- Verify that the hunk is valid.  Traverse all the declarations
-     checking that none have been tainted.  */
-  for (i = 0; VEC_iterate (tree, v, i, t); i++)
-    {
-      /* If T is not valid, none of its users is valid.  */
-      if (1 || TREE_VISITED (t))
-	{
-	  unsigned j;
-	  tree r;
-	  for (j = 0; VEC_iterate (tree, v, j, r); j++)
-	    TREE_VISITED (r) = TREE_VISITED (r);
-	}
-    }
-
-  /* 2- Copy all the trees in the hunk to the current compilation context.  */
-  for (i = 0; VEC_iterate (tree, v, i, t); i++)
-    {
-      static tree t_copy, type_copy;
-      
-      t_copy = copy_decl (t);
-      if (!type_copy || TREE_TYPE (t))
-	type_copy = copy_type (TREE_TYPE (t));
-      if (TREE_CODE (t) == FUNCTION_DECL)
-	walk_tree (&DECL_SAVED_TREE (t_copy), copy_tree_r, (void *)1, NULL);
-
-      /* Emulate restoration into compilation context.  FIXME pph, this is
-	 missing the name lookups that may be required.  Estimate this
-	 separately from the number of name lookup operations and the
-	 time spent doing name lookups.  */
-      VEC_safe_push (tree, heap, compilation_context, t_copy);
-    }
-
-  PPH_STATS_INCR (restored_decls, VEC_length (tree, v));
-
-  /* Restore tree and lookup catchers.  */
-  pph_tree_catcher = old_pph_tree_catcher;
-  pph_name_lookups = old_pph_name_lookups;
-
-  timevar_pop (TV_PPH_CACHE_OUT);
-}
-
-void
-pph_stop_exposed (cp_parser *parser, cp_token *first_token)
-{
-  if (flag_pph_decls_debug >= 2 && !VEC_empty (tree, pph_tree_catcher))
-    {
-      cp_token *last_token;
-
-      timevar_push (TV_PPH_MANAGE);
-
-      last_token = parser->lexer->next_token;
-      pph_print_trees_tokens (pph_tree_catcher, first_token, last_token);
-      pph_copy_decls_into_cache (pph_tree_catcher);
-      pph_copy_decls_outof_cache (pph_tree_catcher);
-      PPH_STATS_INCR (cached_refs, VEC_length(tree, pph_name_lookups));
-      pph_free_catcher_memory ();
-      if (flag_pph_decls_debug >= 4)
-        pph_log_exposed (parser, "stop");
-
-      timevar_pop (TV_PPH_MANAGE);
-    }
-}
-
-
-/* PPH printing help.  */
-
-static void
-pph_debug_tree (tree t, bool body)
-{
-  if (t == NULL)
-    {
-      fprintf (pph_logfile, "nulldecl");
-      return;
-    }
-
-  if (!DECL_P (t))
-    {
-      fprintf (pph_logfile, "__%s__", tree_code_name[TREE_CODE (t)]);
-      return;
-    }
-
-  if (flag_pph_decls >= 2)
-    fprintf (pph_logfile, "%s ", tree_code_name[TREE_CODE (t)]);
-  fprintf (pph_logfile, "%d", (DECL_UID (t) << 1) + body);
-  if (flag_pph_decls >= 1)
-    fprintf (pph_logfile, " '%s'", get_name (t));
-  if (flag_pph_decls >= 3)
-    {
-      fprintf (pph_logfile, " ");
-      pph_debug_loc_of_tree (pph_logfile, t);
-      if (flag_pph_decls >= 4)
-        fprintf (pph_logfile, " @%p", (void *) t);
-    }
-}
-
-static void
-pph_debug_type (tree t, bool body)
-{
-  tree t_decl;
-  if (t == NULL)
-    {
-      fprintf (pph_logfile, "nulltype");
-      return;
-    }
-  t_decl = get_type_decl (t);
-  if (t_decl == NULL)
-    fprintf (pph_logfile, "nameless");
-  else
-    pph_debug_tree (t_decl, body);
-}
-
-/* Return true if tree T has been caught already.  */
-
-static bool
-pph_tree_caught_p (tree t)
-{
-  return (pph_lookup_head_token_cache_for (t) != NULL);
-}
-
-/* Collect the tokens needed for the head of DECL.
-   This assumes that the current token is positioned right after
-   the end of the declarator expression for DECL (i.e., it should
-   be called from grokdeclarator).  */
-
-static VEC(cp_token, heap) *
-pph_catch_head_tokens_for (tree t)
-{
-  cp_token *tok, *last, *first;
-  cp_lexer *lexer;
-  VEC(cp_token, heap) *tokens;
-
-  gcc_assert (t != error_mark_node);
-
-  tokens = pph_lookup_head_token_cache_for (t);
-  if (tokens)
-    {
-      fprintf (stderr, "*** ");
-      pph_debug_location (stderr, input_location);
-      fprintf (stderr, ": Tried to catch head tokens more than once for: ");
-      print_generic_stmt (stderr, t, 0);
-      gcc_unreachable ();
-    }
-
-  lexer = the_parser->lexer;
-
-  /* Look for the tokens backwards until the first brace or semicolon.  */
-  first = last = lexer->next_token;
-  for (tok = last - 1; tok >= VEC_address (cp_token, lexer->buffer); tok--)
-    {
-      if (tok->type == CPP_OPEN_BRACE
-	  || tok->type == CPP_CLOSE_BRACE
-	  || tok->type == CPP_SEMICOLON)
-	break;
-
-      first = tok;
-    }
-
-  /* Now include any trailing semicolon.  */
-  if (last->type == CPP_SEMICOLON)
-    last++;
-
-  /* Add all the tokens in [FIRST, LAST) to TOKENS.  */
-  for (tok = first; tok != last; tok++)
-    VEC_safe_push (cp_token, heap, tokens, tok);
-
-  pph_set_head_token_cache_for (t, tokens);
-
-  return tokens;
-}
-
-
-/* Collect the tokens needed for the body of DECL.
-   This assumes that the current token is positioned right after
-   the end of the declarator expression for DECL (i.e., it should
-   be called from grokdeclarator).  */
-
-static VEC(cp_token, heap) *
-pph_catch_body_tokens_for (tree t)
-{
-  cp_token *tok, *last, *first;
-  cp_lexer *lexer;
-  VEC(cp_token, heap) *tokens;
-
-  gcc_assert (t != error_mark_node);
-
-  tokens = pph_lookup_body_token_cache_for (t);
-  if (tokens)
-    {
-      fprintf (stderr, "*** ");
-      pph_debug_location (stderr, input_location);
-      fprintf (stderr, ": Tried to catch body tokens more than once for: ");
-      print_generic_stmt (stderr, t, 0);
-      gcc_unreachable ();
-    }
-
-  lexer = the_parser->lexer;
-
-  /* Look for the tokens forwards until the closing brace or semicolon.  */
-  first = last = lexer->next_token;
-  tok = first;
-  if (tok->type == CPP_EQ || tok->type == CPP_OPEN_PAREN)
-    {
-      /* Skip a variable-like definition.  Find the semicolon.  */
-      /* FIXME pph - This code changes with C++0x.  */
-      for (; tok <= VEC_last (cp_token, lexer->buffer); tok++)
-        if (tok->type == CPP_SEMICOLON)
-          break;
-      last = tok;
-    }
-  else if (tok->type == CPP_OPEN_BRACE || tok->type == CPP_COLON)
-    {
-      /* Skip a class-like or function-like definition.
-         Skip to a left brace, then skip to the matching right brace.  */
-      /* FIXME pph - This code changes with C++0x.  */
-      int nesting = 0;
-      for (; tok <= VEC_last (cp_token, lexer->buffer); tok++)
-        if (tok->type == CPP_OPEN_BRACE)
-          nesting++;
-        else if (tok->type == CPP_CLOSE_BRACE)
-          {
-            if ( nesting <= 1)
-              break;
-            else
-              nesting--;
-          }
-      last = tok;
-    }
-  else
-    return NULL; /* no body */
-
-  /* Add all the tokens in [FIRST, LAST) to TOKENS.  */
-  for (tok = first; tok <= last; tok++)
-    VEC_safe_push (cp_token, heap, tokens, tok);
-
-  pph_set_body_token_cache_for (t, tokens);
-
-  return tokens;
-}
-
-
-/* Return the dependencies for tree node T.  If HEADER_P is true, it
-   returns the dependencies for the header of T's declaration.
-   Otherwise, it returns dependencies for T's body.  */
-
-static VEC(tree,gc) *
-pph_lookup_dependencies_for (tree t, bool header_p)
-{
-  struct pointer_map_t *map;
-  void **slot;
-
-  map = (header_p) ? pph_decl_deps->header : pph_decl_deps->body;
-  slot = pointer_map_contains (map, t);
-  if (slot)
-    return ((VEC(tree,gc) *) *slot);
-
-  return NULL;
-}
-
-
-/* Set the dependencies for tree node T to DEPS.  If HEADER_P is true,
-   DEPS are the dependencies for T's header.  Otherwise, DEPS are the
-   dependencies for T's body.  */
-
-static void
-pph_set_dependencies_for (tree t, VEC(tree,gc) *deps, bool header_p)
-{
-  void **slot;
-  struct pointer_map_t *map;
-
-  map = (header_p) ? pph_decl_deps->header : pph_decl_deps->body;
-  slot = pointer_map_insert (map, t);
-  *slot = (void *) deps;
-}
-
-#define PPH_ARTIFICIAL(t) \
-(DECL_ARTIFICIAL (t) && !DECL_IMPLICIT_TYPEDEF_P (t))
-
-static bool
-is_namespace (tree container)
-{
-  enum tree_code code;
-
-  if (container == NULL)
-    return true;
-
-  code = TREE_CODE (container);
-  if (code == NAMESPACE_DECL)
-    return true;
-
-  return false;
-}
-
-/* Find the exposed declaration containing a symbol lookup.  */
-
-static tree
-pph_null_exposed (const char *reason)
-{
-  if (flag_pph_decls_debug >= 3)
-    fprintf (pph_logfile, "%s\n", reason);
-  return NULL;
-}
-
-static tree
-pph_live_exposed (tree t, bool body)
-{
-  if (PPH_ARTIFICIAL (t))
-    return pph_null_exposed ("Artificial symbols are not exposed.");
-
-  if (flag_pph_decls_debug >= 3)
-    {
-      if (t == NULL)
-        fprintf (pph_logfile, "(null)");
-      else
-        pph_debug_tree (t, body);
-      fprintf (pph_logfile, "\n");
-    }
-  return t;
-}
-
-static tree
-pph_find_exposed_for (tree t, bool *body)
-{
-  tree container;
-  enum tree_code code, t_code;
-  bool in_class;
-  *body = false; /* By default, we only depend on heads. */
-  for ( ; ; t = container, *body = true)
-    {
-      reclassify:
-      if (t == NULL)
-        {
-          PPH_STATS_INCR (bad_lookups, 1);
-          return pph_null_exposed ("NULLOID"); /* FIXME pph */
-        }
-      if (flag_pph_decls_debug >= 3)
-        {
-          fprintf (pph_logfile, "      exposed for ");
-          pph_debug_tree (t, false);
-          fprintf (pph_logfile, " is ");
-        }
-      code = TREE_CODE (t);
-      switch (code)
-        {
-	  /* Types common to C and C++.  */
-	  case ARRAY_TYPE:
-	  case BOOLEAN_TYPE:
-	  case COMPLEX_TYPE:
-	  case ENUMERAL_TYPE:
-	  case FIXED_POINT_TYPE:
-	  case FUNCTION_TYPE:
-	  case INTEGER_TYPE:
-	  case LANG_TYPE:
-	  case METHOD_TYPE:
-	  case OFFSET_TYPE:
-	  case POINTER_TYPE:
-	  case QUAL_UNION_TYPE:
-	  case REAL_TYPE:
-	  case RECORD_TYPE:
-	  case REFERENCE_TYPE:
-	  case UNION_TYPE:
-	  case VECTOR_TYPE:
-	  case VOID_TYPE:
-	  /* C++-specific types.  */
-	  case BOUND_TEMPLATE_TEMPLATE_PARM:
-	  case TEMPLATE_TEMPLATE_PARM:
-	  case TEMPLATE_TYPE_PARM:
-	  case TYPENAME_TYPE:
-	  case TYPEOF_TYPE:
-	  case UNBOUND_CLASS_TEMPLATE:
-	  case TYPE_ARGUMENT_PACK:
-	  case TYPE_PACK_EXPANSION:
-	  case DECLTYPE_TYPE:
-            {
-              if (TYPE_NAME (t) == NULL)
-                return pph_null_exposed ("Anonymous Type");
-              else
-                t = TYPE_NAME (t);
-              /* FALLTHRU */
-            }
-
-          case TYPE_DECL:
-            {
-              container = DECL_CONTEXT (t);
-              in_class = container && CLASS_TYPE_P (container);
-              t_code = TREE_CODE (TREE_TYPE (t));
-              /* FIXME pph: Why DECL_TEMPLATE_TEMPLATE_PARM_P does not apply
-                 here?  It is a template template parameter, but the tree code
-                 is inconsistent.  */
-              if (DECL_TEMPLATE_PARM_P (t)
-                  || t_code == TEMPLATE_TEMPLATE_PARM
-                  || t_code == BOUND_TEMPLATE_TEMPLATE_PARM)
-                return pph_null_exposed ("TMPLPARM");
-
-              if (is_namespace (container))
-                return pph_live_exposed (t, *body);
-              break;
-            }
-
-          case VAR_DECL:
-            {
-              /* If var is lazy, depend on its body, not its head.  */
-              tree enclass = DECL_CONTEXT (t);
-              bool in_class = enclass && CLASS_TYPE_P (enclass);
-              bool defined = DECL_INITIAL (t) != NULL;
-                             /* FIXME pph: DECL_INITIALIZED_P (t)  */
-              if (defined && (in_class || !DECL_THIS_EXTERN (t))
-                  && decl_constant_var_p (t))
-                *body = true;
-
-              container = DECL_CONTEXT (t);
-              in_class = container && CLASS_TYPE_P (container);
-              if (in_class && DECL_THIS_STATIC (t))
-                container = TYPE_CONTEXT (container);
-              if (is_namespace (container))
-                return pph_live_exposed (t, *body);
-	      break;
-            }
-
-          case FUNCTION_DECL:
-            {
-              /* If function is lazy, depend on body.  */
-              bool defined = DECL_INITIAL (t) != NULL;
-              if (defined && (DECL_DECLARED_INLINE_P (t)
-                              || DECL_USE_TEMPLATE (t) != 2))
-                *body = true;
-
-              container = DECL_CONTEXT (t);
-              in_class = container && CLASS_TYPE_P (container);
-              if (in_class)
-                container = TYPE_CONTEXT (container);
-              if (is_namespace (container))
-                return pph_live_exposed (t, *body);;
-              break;
-            }
-
-          case TEMPLATE_DECL:
-            {
-              int generic = DECL_USE_TEMPLATE (t);
-              if (generic != 2)
-                {
-                  t = DECL_TEMPLATE_RESULT (t);
-                  if (flag_pph_decls_debug >= 3)
-                    fprintf (pph_logfile, "template redirected\n");
-                  goto reclassify;
-                }
-            }
-
-          case SCOPE_REF:
-            return pph_null_exposed ("SCOPE_REF"); /* FIXME pph */
-
-          case OVERLOAD:
-            return pph_null_exposed ("OVERLOAD"); /* FIXME pph */
-
-	  case BASELINK:
-	    container = BASELINK_BINFO (t);
-	    break;
-
-	  case TREE_BINFO:
-	    container = BINFO_TYPE (t);
-	    break;
-
-	  case TREE_LIST:
-	    t = TREE_VALUE (t);
-	    /* Fallthru  */
-
-          default:
-            {
-              if (t == NULL)
-                {
-                  PPH_STATS_INCR (bad_lookups, 1);
-                  return pph_null_exposed ("NULLOID"); /* FIXME pph */
-                }
-	      else if (!DECL_P (t))
-                {
-                  PPH_STATS_INCR (bad_lookups, 1);
-                  return pph_null_exposed ("BOZOID"); /* FIXME pph */
-                  /*FIXME pph:
-		  fatal_error ("Expecting a *_decl node.  Got %s",
-			       tree_code_name[TREE_CODE (t)]);
-                  */
-                }
-
-              container = DECL_CONTEXT (t);
-              in_class = container && CLASS_TYPE_P (container);
-              if (is_namespace (container))
-                return pph_null_exposed ("UNKNOWN");
-              break;
-            }
-        }
-      if (flag_pph_decls_debug >= 3)
-        {
-          pph_debug_tree (container, *body);
-          fprintf (pph_logfile, "\n");
-        }
-    }
-}
-
-
-/* Collect the AST nodes that node T depends on.  HEADER_P is true if
-   we should collect ASTs from T's header.  Otherwise, we collect
-   ASTs from T's body.  */
-
-static VEC(tree,gc) *
-pph_catch_dependencies_for (tree t, bool header_p)
-{
-  VEC(cp_token, heap) *tokens;
-  unsigned i;
-  cp_token *tok;
-  VEC(tree,gc) *deps;
-
-  tokens = (header_p)
-	   ? pph_lookup_head_token_cache_for (t)
-	   : pph_lookup_body_token_cache_for (t);
-
-  if (tokens == NULL)
-    tokens = (header_p)
-	     ? pph_catch_head_tokens_for (t)
-	     : pph_catch_body_tokens_for (t);
-
-  deps = pph_lookup_dependencies_for (t, header_p);
-
-  for (i = 0; VEC_iterate (cp_token, tokens, i, tok); i++)
-    if (tok->type == CPP_NAME)
-      VEC_safe_push (tree, gc, deps, tok->u.value);
-
-  pph_set_dependencies_for (t, deps, header_p);
-
-  return deps;
-}
-
-
-/* Intercept tree node T by storing it in pph_tree_catcher and collecting
-   the tokens used in its instantiation.  */
-
-void
-pph_catch_tree (tree t)
-{
-  /* Only collect trees if the parser instantiated pph_tree_catcher
-     and we are currently parsing from the main lexer.  */
-  if (pph_tree_catcher && the_parser->lexer->buffer && !pph_tree_caught_p (t))
-    {
-      timevar_push (TV_PPH_MANAGE);
-
-      VEC_safe_push (tree, heap, pph_tree_catcher, t);
-      pph_catch_head_tokens_for (t);
-      pph_catch_body_tokens_for (t);
-      pph_catch_dependencies_for (t, true);
-      pph_catch_dependencies_for (t, false);
-
-      timevar_pop (TV_PPH_MANAGE);
-    }
-}
-
-
-/* Retract a caught tree.  */
-
-void
-pph_uncatch_tree (tree t)
-{
-  /* Only uncollect trees if the parser instantiated pph_tree_catcher
-     and we are currently parsing from the main lexer.  */
-  if (pph_tree_catcher && the_parser->lexer->buffer)
-    {
-      int i;
-      tree u;
-
-      timevar_push (TV_PPH_MANAGE);
-
-      /* Find the index; if present, remove it.  */
-      for (i = 0; VEC_iterate (tree, pph_tree_catcher, i, u); i++)
-        {
-          if (u == t)
-            {
-              VEC_ordered_remove (tree, pph_tree_catcher, i);
-              break;
-            }
-        }
-
-      timevar_pop (TV_PPH_MANAGE);
-    }
-}
-
-
-/* Given a set of tokens TOKENS, return the symbols from pph_name_lookups
-   that occur in TOKENS.  The returned vector is, then, the set of all
-   symbols that were resolved via name lookups during parsing.  This set
-   is a subset of all the CPP_NAME tokens in TOKENS.  */
-
-static void
-pph_locate_name_lookups_in (VEC(cp_token, heap) *tokens,
-                            VEC(tree,gc) **heads_found,
-                            VEC(tree,gc) **bodies_found)
-{
-  unsigned i;
-  tree t;
-  cp_token *first, *last;
-
-  *heads_found = NULL;
-  *bodies_found = NULL;
-
-  if (tokens == NULL || VEC_empty (cp_token, tokens))
-      return;
-
-  first = VEC_index (cp_token, tokens, 0);
-  last = VEC_last (cp_token, tokens);
-
-  for (i = 0; VEC_iterate (tree, pph_name_lookups, i, t); i++)
-    {
-      unsigned j;
-      cp_token *tok;
-      VEC(cp_token, heap) *lookup_locations;
-      void **slot;
-      bool pushed = false;
-
-      slot = pointer_map_contains (pph_nl_token_map, t);
-      gcc_assert (slot && *slot);
-      lookup_locations = (VEC(cp_token, heap) *) *slot;
-      for (j = 0; VEC_iterate (cp_token, lookup_locations, j, tok); j++)
-	{
-	  if (tok->location >= first->location
-	      && tok->location <= last->location)
-	    {
-              if (!pushed)
-                {
-                  bool body;
-                  tree exposed = pph_find_exposed_for (t, &body);
-                  if (exposed)
-                    {
-                      if (body)
-                        VEC_safe_push (tree, gc, *bodies_found, exposed);
-                      else
-                        VEC_safe_push (tree, gc, *heads_found, exposed);
-                      pushed = true;
-                    }
-                }
-
-              /* Avoid double-counting lookups by removing the lookup
-                 location after a class member declaration has found it.
-                 To make that work, we must remove all redundant entries.  */
-              if (flag_pph_decls_debug >= 4)
-                {
-                  fprintf (pph_logfile, "      lookup in %p for ",
-                           (void*)lookup_locations);
-                  pph_debug_tree (t, false);
-                  fprintf (pph_logfile, " found at ");
-                  pph_debug_location (pph_logfile, tok->location);
-                  fprintf (pph_logfile, "\n");
-                  fprintf (pph_logfile, "        vector length from %d",
-                           VEC_length (cp_token, lookup_locations));
-                  
-                }
-              /* This code is slow, but VEC won't let me null entires.  */
-              VEC_ordered_remove (cp_token, lookup_locations, j);
-              /* We have just shifted down all later entries,
-                 and need to counteract the upcoming index increment.  */
-              j--;
-              if (flag_pph_decls_debug >= 4)
-                {
-                  fprintf (pph_logfile, " to %d\n",
-                           VEC_length (cp_token, lookup_locations));
-                }
-	    }
-	}
-    }
-}
-
-
-/* Print all the trees in V and the tokens in the token range
-   [TOK1, TOK2).  */
-
-static VEC(cp_token, heap) *
-pph_print_copy_tokens (cp_token *tok1, cp_token *tok2)
-{
-  cp_token *tok;
-  VEC(cp_token, heap) *vtok;
-
-  /* If TOK2 is CPP_EOF, it will have the address of eof_token, which
-     will make the loop below go off the deep end.  Detect this and
-     make TOK2 the last token in the lexer buffer instead.  */
-  if (tok2 == &eof_token)
-    tok2 = VEC_last (cp_token, the_parser->lexer->buffer);
-
-  vtok = NULL;
-  for (tok = tok1; tok != tok2; tok++)
-    VEC_safe_push (cp_token, heap, vtok, tok);
-
-  return vtok;
-}
-
-static void
-pph_print_token_range (VEC(tree,heap) *v, VEC(cp_token, heap) *vtok)
-{
-  unsigned i;
-  tree t;
-
-  if (flag_pph_decls_debug >= 4)
-    {
-      fprintf (pph_logfile, "PPH: hunk location ");
-      pph_debug_location (pph_logfile, VEC_index (cp_token, vtok, 0)->location);
-      fprintf (pph_logfile, " to ");
-      pph_debug_location (pph_logfile, VEC_last (cp_token, vtok)->location);
-      fprintf (pph_logfile, "\n");
-      fprintf (pph_logfile, "PPH: hunk tokens ");
-      cp_lexer_dump_tokens (stderr, (VEC(cp_token, gc) *)vtok, NULL, 0, NULL);
-      fprintf (pph_logfile, "PPH: hunk ASTs:\n");
-      for (i = 0; VEC_iterate (tree, v, i, t); i++)
-        {
-          pph_debug_tree (t, true);
-          /* FIXME pph: this may not be right; we may not care.  */
-          print_generic_stmt (stderr, t, 0);
-        }
-      fprintf (pph_logfile, "PPH: hunk decls:\n");
-    }
-}
-
-static void
-pph_print_dependence (bool user_body, bool used_body,
-                      tree t, tree d)
-{
-  static bool prior_user_body = false;
-  static bool prior_used_body = false;
-  static tree prior_t = NULL;
-  static tree prior_d = NULL;
-  if (flag_pph_decls_debug >= 2)
-    {
-      fprintf (pph_logfile, "    pd_base ");
-      pph_debug_tree (t, user_body);
-      fprintf (pph_logfile, " on ");
-      pph_debug_tree (d, used_body);
-      fprintf (pph_logfile, "\n");
-    }
-  if (t && d && DECL_P (t) && DECL_P (d) && (t != d || user_body != used_body))
-    {
-      if (PPH_ARTIFICIAL (t))
-        {
-          /* Okay, find the real symbol this articial one belongs to.  */
-          d = pph_find_exposed_for (d, &used_body);
-          if (d == NULL)
-            return;
-          used_body = true;
-        }
-      if (user_body != prior_user_body
-          || used_body != prior_used_body
-          || t != prior_t
-          || d != prior_d)
-        {
-          fprintf (pph_logfile, "depend ");
-          pph_debug_tree (t, user_body);
-          fprintf (pph_logfile, " uses ");
-          pph_debug_tree (d, used_body);
-          fprintf (pph_logfile, "\n");
-          prior_user_body = user_body;
-          prior_used_body = used_body;
-          prior_t = t;
-          prior_d = d;
-        }
-    }
-}
-
-static void
-pph_print_depend_template (tree tmpl_info, tree t)
-{
-  tree tmpl_decl;
-  tree tmpl_ptrn;
-  if (flag_pph_decls_debug >= 2)
-    {
-      fprintf (pph_logfile, "    pd_template ");
-      pph_debug_tree (t, true);
-      fprintf (pph_logfile, " %p", (void*)tmpl_info);
-      fprintf (pph_logfile, "\n");
-    }
-  tmpl_decl = TI_TEMPLATE (tmpl_info);
-  if (TREE_CODE (tmpl_decl) == OVERLOAD)
-    tmpl_decl = OVL_CURRENT (tmpl_decl);
-  tmpl_ptrn = DECL_TEMPLATE_RESULT (tmpl_decl);
-  if (tmpl_ptrn && t != tmpl_ptrn)
-    {
-      /* This is a template, but not the pattern.  */
-      pph_print_dependence (true, true, t, tmpl_ptrn);
-    }
-}
-
-/* Print the dependence of a head of declaration 
-   on the body of a type that the head uses directly.
-   If either of these is not exposed,
-   find the body of the exposed declaration that contains it.  */
-
-static void
-pph_print_depend_decl (tree user, tree used)
-{
-  if (flag_pph_decls_debug >= 2)
-    {
-      fprintf (pph_logfile, "    pd_decl ");
-      pph_debug_tree (user, false);
-      fprintf (pph_logfile, " on ");
-      pph_debug_tree (used, false);
-      fprintf (pph_logfile, "\n");
-    }
-  if (user != NULL)
-    {
-      if (used != NULL)
-        {
-          bool body;
-          tree exp_for_user = pph_find_exposed_for (user, &body);
-          tree exp_for_used = pph_find_exposed_for (used, &body);
-          if (exp_for_user && exp_for_used && exp_for_user != exp_for_used)
-            pph_print_dependence (exp_for_user != user, true,
-                                  exp_for_user, exp_for_used);
-        }
-    }
-}
-
-static void
-pph_print_depend_type (tree decl, tree type)
-{
-  tree type_decl;
-  if (flag_pph_decls_debug >= 2)
-    {
-      fprintf (pph_logfile, "    pd_type ");
-      pph_debug_tree (decl, false);
-      fprintf (pph_logfile, " on ");
-      pph_debug_type (type, false);
-      fprintf (pph_logfile, "\n");
-    }
-  if (type != NULL)
-    {
-      type_decl = get_type_decl (type);
-      pph_print_depend_decl (decl, type_decl);
-    }
-}
-
-static void
-pph_print_depend_type_type (tree t)
-{
-  tree t_type;
-  tree field;
-
-  if (flag_pph_decls_debug >= 2)
-    {
-      fprintf (pph_logfile, "    depending on typedecl type ");
-      pph_debug_tree (t, false);
-      fprintf (pph_logfile, "\n");
-    }
-
-  t_type = TREE_TYPE (t);
-  field = TYPE_FIELDS (t_type); 
-  for (; field; field = TREE_CHAIN(field))
-    {
-      if (flag_pph_decls_debug >= 2)
-        {
-          fprintf (pph_logfile, "    field ");
-          pph_debug_tree (field, false);
-        }
-      if (TREE_CODE (field) == FIELD_DECL)
-        {
-          tree f_type = TREE_TYPE (field);
-          if (flag_pph_decls_debug >= 2)
-            {
-              fprintf (pph_logfile, " of type ");
-              pph_debug_type (f_type, false);
-              if (DECL_FIELD_IS_BASE (field))
-                fprintf (pph_logfile, " is a base field!!\n");
-              else
-                fprintf (pph_logfile, " is a plain field\n");
-            }
-          pph_print_depend_type (t, f_type);
-        }
-      else if (TREE_CODE (field) == TYPE_DECL)
-        {
-        tree f_type = TREE_TYPE (field);
-        if (flag_pph_decls_debug >= 2)
-          {
-            fprintf (pph_logfile, " of type ");
-            pph_debug_type (f_type, false);
-            fprintf (pph_logfile, " is a type field\n");
-          }
-        pph_print_depend_type (t, f_type);
-        }
-    }
-
-  if (flag_pph_decls_debug >= 2)
-    {
-      fprintf (pph_logfile, "    end of fields\n");
-    }
-}
-
-static void
-pph_print_depend_func_type (tree t)
-{
-  /* We must print a dependence of the head of the function
-     on the body of the types of its signature.  */
-
-  tree args;
-  tree func_type;
-
-  if (flag_pph_decls_debug >= 2)
-    {
-      fprintf (pph_logfile, "    depending on function type ");
-      pph_debug_tree (t, false);
-      fprintf (pph_logfile, "\n");
-    }
-
-  func_type = TREE_TYPE (t);
-  pph_print_depend_type (t, TREE_TYPE (func_type)); /* return type */
-  for (args = TYPE_ARG_TYPES (func_type); args; args = TREE_CHAIN (args))
-    pph_print_depend_type (t, TREE_VALUE (args)); /* parameter */
-
-  if (DECL_VIRTUAL_P (t))
-    {
-      tree ctx_type = DECL_CONTEXT (t);
-      tree ctx_decl = get_type_decl (ctx_type);
-      /* Virtual functions depend on containing class's body.*/
-      pph_print_depend_type (t, ctx_type);
-      /* The virtual class's body also depends on the function
-         for construction of the vtable. */
-      pph_print_dependence (true, true, ctx_decl, t);
-    }
-}
-
-static void
-pph_print_depend_var_type (tree t)
-{
-  if (flag_pph_decls_debug >= 2)
-    {
-      fprintf (pph_logfile, "    depending on var/field type ");
-      pph_debug_tree (t, false);
-      fprintf (pph_logfile, "\n");
-    }
-
-  pph_print_depend_type (t, TREE_TYPE (t));
-}
-
-enum decl_exposure { HIDDEN, EXPOSED, NEEDED };
-
-static enum decl_exposure
-pph_get_decl_exposure (tree t)
-{
-  tree container;
-  tree type;
-  tree tmpl_info;
-  bool defined = false;
-  bool inlined = false;
-  bool needed = false;
-  int generic = 0;
-  enum tree_code code = TREE_CODE (t);
-
-  if (flag_pph_decls_debug >= 2)
-    {
-      fprintf (pph_logfile, "    get_exposure for ");
-      pph_debug_tree (t, false);
-      fprintf (pph_logfile, "\n");
-    }
-
-  /* For DECL_USE_TEMPLATE and CLASSTYPE_USE_TEMPLATE,
-      1=implicit instantiation
-      2=partial or explicit specialization, e.g.: 
-	  template <> int min<int> (int, int),
-      3=explicit instantiation, e.g.:
-	  template int min<int> (int, int);
-  */
-
-  if (code == TYPE_DECL)
-    {
-      pph_print_depend_type_type (t);
-
-      container = DECL_CONTEXT (t);
-      if (!is_namespace (container))
-        return HIDDEN;
-      type = TREE_TYPE (t);
-      defined = COMPLETE_TYPE_P (type);
-
-      /* FIXME pph: Why DECL_TEMPLATE_TEMPLATE_PARM_P does not apply
-         here?  It is a template template parameter, but the tree code
-         is inconsistent.  */
-      if (DECL_TEMPLATE_PARM_P (t)
-          || TREE_CODE (type) == TEMPLATE_TEMPLATE_PARM
-          || TREE_CODE (type) == BOUND_TEMPLATE_TEMPLATE_PARM)
-        return HIDDEN;
-      if (CLASS_TYPE_P (t))
-        {
-          tmpl_info = CLASSTYPE_TEMPLATE_INFO (type);
-          generic = CLASSTYPE_USE_TEMPLATE (type);
-        }
-      else
-        {
-          tmpl_info = NULL;
-          generic = 0;
-        }
-      if (generic == 1)
-        return HIDDEN;
-      if (tmpl_info != NULL)
-        {
-          pph_print_depend_template (tmpl_info, t);
-          needed = defined && generic == 3;
-        }
-      else
-        {
-          needed = false;
-        }
-    }
-  else if (code == VAR_DECL)
-    {
-      tree enclass = DECL_CONTEXT (t);
-      bool in_class = enclass && CLASS_TYPE_P (enclass);
-      /* If the VAR_DECL is in a class, it must be a static member.  */
-      container = enclass;
-      if (in_class)
-        container = TYPE_CONTEXT (enclass);
-
-      pph_print_depend_var_type (t);
-
-      if (!is_namespace (container))
-          return HIDDEN;
-      defined = DECL_INITIAL (t) != NULL /* FIXME pph: DECL_INITIALIZED_P (t)  */;
-      type = TREE_TYPE (t);
-      needed = !((!defined && (in_class || DECL_THIS_EXTERN (t)))
-                 || decl_constant_var_p (t));
-      if (in_class)
-        {
-          tmpl_info = DECL_TEMPLATE_INFO (t);
-          generic = DECL_USE_TEMPLATE (t);
-          if (generic == 1)
-            return HIDDEN;
-        }
-      else
-        {
-          tmpl_info = NULL;
-          generic = 0;
-        }
-      if (tmpl_info != NULL)
-        {
-          pph_print_depend_template (tmpl_info, t);
-          needed = needed && generic == 3;
-        }
-    }
-  else if (code == FUNCTION_DECL)
-    {
-      if (flag_pph_decls_debug >= 2)
-        {
-          fprintf (pph_logfile, "    depending on function ");
-          pph_debug_tree (t, false);
-          fprintf (pph_logfile, "\n");
-        }
-
-      container = DECL_CONTEXT (t);
-      if (container && CLASS_TYPE_P (container))
-          container = TYPE_CONTEXT (DECL_CONTEXT (t));
-
-      pph_print_depend_func_type (t);
-
-      if (!is_namespace (container))
-        return HIDDEN;
-      inlined = DECL_DECLARED_INLINE_P (t);
-      defined = DECL_INITIAL (t) != NULL;
-      tmpl_info = DECL_TEMPLATE_INFO (t);
-      generic = DECL_USE_TEMPLATE (t);
-      if (tmpl_info != NULL)
-        {
-          if (generic == 2)
-              needed = defined && !inlined;
-          else
-            {
-              pph_print_depend_template (tmpl_info, t);
-              needed = defined && !inlined && generic == 3;
-            }
-        }
-      else
-        {
-          needed = defined && !inlined;
-        }
-    }
-  else
-    {
-      gcc_assert (code < MAX_TREE_CODES);
-      return HIDDEN;
-    }
-
-  if (needed)
-    return NEEDED;
-  else
-    return EXPOSED;
-}
-
-static void
-pph_print_dependences (bool user_body, bool used_body,
-                        tree t, VEC(tree,gc) *deps)
-{
-  unsigned j;
-  tree d;
-  for (j = 0; VEC_iterate (tree, deps, j, d); j++)
-      pph_print_dependence (user_body, used_body, t, d);
-}
-
-/* Print the head of declaration T and its dependencies. N_HEAD_TOKENS
-   is the number of tokens taken by T's head.  N_HEAD_ITOKENS is the
-   number of invisible tokens.
-   
-   HEAD_TOKENS is the array of tokens in the head (note that the
-   length of this array may be different than N_HEAD_TOKENS, due to
-   adjustments made by the caller).
-
-   If CONTAINER is set, then T is a member of it.  */
-
-static void
-pph_print_declaration_head (tree t, bool artificial, tree container,
-                            unsigned n_head_tokens, unsigned n_head_invis,
-			    VEC(cp_token, heap) *head_tokens)
-{
-  VEC(tree,gc) *sym_head_deps, *sym_body_deps;
-  enum tree_code code = TREE_CODE (t);
-
-  fprintf (pph_logfile, "declaration ");
-  pph_debug_tree (t, false);
-
-  fprintf (pph_logfile, " htok %u,%u", n_head_tokens, n_head_invis);
-
-  /*FIXME pph: We want to get rid of most artificial tokens;
-    this is temporary to find them.  */
-  if (artificial)
-    fprintf (pph_logfile, " artificial");
-
-  if (container)
-    {
-      fprintf (pph_logfile, " mbrof ");
-      pph_debug_tree (get_type_decl (container), true);
-    }
-
-  fprintf (pph_logfile, "\n");
-
-  /* Template instances should depend on their pattern body.  */
-  if (artificial)
-    {
-      if (code == TYPE_DECL)
-        {
-          tree t_type = TREE_TYPE (t);
-          if (CLASS_TYPE_P (t_type))
-            {
-              tree tmpl_info = CLASSTYPE_TEMPLATE_INFO (t_type);
-              if (tmpl_info != NULL)
-                pph_print_depend_template (tmpl_info, t);
-            }
-        }
-      else if (code == VAR_DECL || code == FUNCTION_DECL)
-        {
-          tree tmpl_info;
-          tmpl_info = (DECL_LANG_SPECIFIC (t)) ? DECL_TEMPLATE_INFO (t) : NULL;
-          if (tmpl_info != NULL)
-            pph_print_depend_template (tmpl_info, t);
-        }
-    }
-  else
-    {
-      /* From the name dependencies, determine symbol dependencies
-	 by correlating the location of the looked-up symbols with
-	 the tokens in HEAD_TOKENS and BODY_TOKENS.  */
-      if (flag_pph_decls_debug >= 2)
-        fprintf (pph_logfile, "  begin normal dependences\n");
-      pph_locate_name_lookups_in (head_tokens, &sym_head_deps, &sym_body_deps);
-      pph_print_dependences (false, false, t, sym_head_deps);
-      pph_print_dependences (true, false, t, sym_body_deps);
-      if (flag_pph_decls_debug >= 2)
-        fprintf (pph_logfile, "  end normal dependences\n");
-    }
-}
-
-
-/* Print the head of declaration T and its dependencies. N_BODY_TOKENS
-   is the number of tokens taken by T's head.  N_BODY_ITOKENS is the
-   number of invisible tokens.
-
-   BODY_TOKENS is the array of tokens in the head (note that the
-   length of this array may be different than N_BODY_TOKENS, due to
-   adjustments made by the caller).
-
-   EXPOSURE indicates the exposure of T.
-
-   N_SUBTOKENS is the number of tokens that declarations inside T's
-   body have used up, those should be subtracted from the total number
-   of tokens in T to avoid double counting. */
-
-static void
-pph_print_declaration_body (tree t, bool artificial,
-                            enum decl_exposure exposure,
-                            unsigned n_body_tokens, unsigned n_body_invis,
-                            VEC(cp_token, heap) *body_tokens)
-{
-  VEC(tree,gc) *sym_head_deps, *sym_body_deps;
-  const char* msg;
-
-  fprintf (pph_logfile, "declaration ");
-  pph_debug_tree (t, true);
-
-  fprintf (pph_logfile, " btok %u,%u", n_body_tokens, n_body_invis);
-
-  /* FIXME pph: We want to get rid of most artificial tokens;
-     this is temporary to find them.  */
-  if (artificial)
-    msg = "artificial";
-  else if (exposure == NEEDED)
-    msg = "needed";
-  else
-    msg = "lazy";
-  fprintf (pph_logfile, " %s", msg);
-
-  fprintf (pph_logfile, "\n");
-
-  pph_print_dependence (true, false, t, t); /* body depends on its head */
-
-  if (flag_pph_decls_debug >= 2)
-    fprintf (pph_logfile, "  begin normal dependences\n");
-  pph_locate_name_lookups_in (body_tokens, &sym_head_deps, &sym_body_deps);
-  pph_print_dependences (true, false, t, sym_head_deps);
-  pph_print_dependences (true, false, t, sym_body_deps);
-  if (flag_pph_decls_debug >= 2)
-    fprintf (pph_logfile, "  end normal dependences\n");
-}
-
-
-/* Compute the implicit cost of a method F.  */
-
-static unsigned
-pph_find_special_methods (tree f)
-{
-  unsigned found = 0;
-  tree o;
-  if (TREE_CODE (f) == OVERLOAD)
-    {
-      for (o = f; o; o = OVL_NEXT (o))
-        found |= pph_find_special_methods (OVL_CURRENT (o));
-    }
-  else if (TREE_CODE (f) == TEMPLATE_DECL)
-    found |= pph_find_special_methods (DECL_TEMPLATE_RESULT (f));
-  else
-    {
-      gcc_assert (TREE_CODE (f) == FUNCTION_DECL);
-      if (DECL_ARTIFICIAL (f))
-        return found;
-      if (DECL_CONSTRUCTOR_P (f))
-        if (DECL_COPY_CONSTRUCTOR_P (f))
-          found |= (1<<2); /* copy constructor */
-        else
-          found |= (1<<1); /* default constructor */
-      else if (DECL_DESTRUCTOR_P (f))
-        found |= (1<<0); /* destructor */
-      else if (DECL_ASSIGNMENT_OPERATOR_P (f))
-        found |= (1<<3); /* copy assign op */
-    }
-  return found;
-}
-
-/* Compute the implicit cost of a class type T_TYPE.  */
-
-static unsigned
-pph_implicit_class_cost (tree t_type)
-{
-  VEC(tree,gc) *methods;
-  unsigned idx;
-  unsigned mbrs;
-  unsigned cost = 0;
-  unsigned found = 0;
-
-  /* Gather general statistics.  */
-  unsigned fields = fields_length (t_type); /* also direct bases */
-  unsigned vptr = (TYPE_POLYMORPHIC_P (t_type) ? 1 : 0);
-  unsigned slots = fields + vptr;
-  unsigned vbases = VEC_length (tree, CLASSTYPE_VBASECLASSES (t_type));
-  unsigned vtables = list_length (CLASSTYPE_VTABLES (t_type));
-
-  /* Assign cost of implicit special member variables.  */
-  /* These costs are somewhat arbitrary.  */
-  cost += 20 * (CLASSTYPE_TYPEINFO_VAR (t_type) != NULL); /* typeinfo */
-  cost += 4 * vbases * vtables; /* virtual tables */
-
-  /* Assign cost of implicit special member functions.  */
-  /* First find them.  */
-  methods = CLASSTYPE_METHOD_VEC (t_type);
-  if (methods != NULL)
-    for (idx = 0;  idx < VEC_length (tree, methods);  idx++)
-      {
-        tree ovld = VEC_index (tree, methods, idx);
-        if (ovld)
-          found |= pph_find_special_methods (ovld);
-      }
-  /* These costs are somewhat arbitrary.  */
-  /* FIXME pph: These queries seem to not work for templates.
-     We can accept the inaccuracy for now.  */
-  mbrs =  slots * 2 + vbases * 4;
-  if (!(found & (1<<2))) /* copy constructor */
-    {
-      if (TYPE_HAS_TRIVIAL_COPY_ASSIGN (t_type))
-        cost += 4;
-      else
-        cost += (8 + 2*mbrs) * (vbases > 0 ? 2 : 1);
-    }
-  if (!(found & (1<<1))) /* default constructor */
-    if (!TYPE_HAS_TRIVIAL_DFLT (t_type))
-      cost += 4 + mbrs;
-  if (!(found & (1<<0))) /* destructor */
-    if (!TYPE_HAS_TRIVIAL_DESTRUCTOR (t_type))
-      cost += (8 + 2*mbrs) * (vbases > 0 ? 2 : 1);
-  if (!(found & (1<<3))) /* copy assign op */
-    {
-      if (TYPE_HAS_TRIVIAL_COPY_ASSIGN (t_type))
-        cost += 4;
-      else
-        cost += (8 + 2*mbrs);
-    }
-
-  return cost;
-}
-
-
-/* Print declaration T with the given EXPOSURE.  If T has a body with
-   N tokens, subtract N_SUBTOKENS from it before printing them.  
-   This is used when printing class declarations.  The caller first
-   prints all the declarations inside the class, followed by the 
-   class declaration itself, to avoid double counting tokens in the class
-   body, they are subtracted from the total count.
-
-   PRIMARY is true when T is the very first declaration captured
-   during a pph_start_exposed/pph_stop_exposed region.  If T is a
-   member of a class, and it happens to be the first declaration
-   captured, it means that T is an out-of-line definition.
-   
-   If T is a member of a class, and PARENT is the TYPE_DECL for that
-   class, it means that we are printing the in-class declaration of T.
-   In that case, when we print the parent, we should subtract the
-   tokens attributed to T.  So, in these cases return the total
-   number of tokens printed in T's head and body.  Otherwise,
-   return 0.  */
-
-static unsigned
-pph_print_declaration (tree t, enum decl_exposure exposure,
-                       unsigned n_subtokens, bool primary, tree parent)
-{
-  tree container = NULL;
-  enum tree_code code = TREE_CODE (t);
-  bool is_member = false;
-  bool artificial = PPH_ARTIFICIAL (t);
-  bool print_head = true, print_body = true;
-
-  /* The cost of a declaration is proportional to the number of tokens.
-     Artificial symbols are not represented in the file, so they do
-     not have tokens.  We represent their cost as a number of
-     invisible tokens.  */
-  VEC(cp_token, heap) *head_tokens = pph_lookup_head_token_cache_for (t);
-  unsigned n_head_tokens = VEC_length (cp_token, head_tokens);
-  unsigned n_head_invis = 0;
-  VEC(cp_token, heap) *body_tokens = pph_lookup_body_token_cache_for (t);
-  unsigned n_body_tokens = VEC_length (cp_token, body_tokens);
-  unsigned n_body_invis = 0;
-  unsigned n_member_tokens = 0;
-
-  /* If this is a member of a class, count the number of tokens in the
-     member that overlap with the containing class. */
-  if (code == FUNCTION_DECL || code == VAR_DECL)
-    {
-      container = DECL_CONTEXT (t);
-      if (container && CLASS_TYPE_P (container))
-	{
-	  is_member = true;
-	  if (parent && container == TREE_TYPE (parent))
-	    n_member_tokens = n_head_tokens + n_body_tokens;
-	}
-    }
-
-  /* Now we need to adjust costs, and head/body printing.  */
-
-  if (code == VAR_DECL)
-    {
-      if (artificial)
-        /* Artificial static member variables get their token
-           counts from the calling expression, which isn't helpful.
-           Build the cost into the class instead.  All of which
-           means suppress this decl.  */
-        return 0;
-
-      if (DECL_NONTRIVIALLY_INITIALIZED_P (t)
-          && !DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (t))
-        n_body_invis += 10;
-
-      if (is_member)
-        {
-          if (primary) /* Must be an out-of-line declaration/definition.  */
-            {
-              /* Merge out-of-line member definitions into the body.
-                 This merge prevents two heads for the same symbol.  */
-              n_body_tokens += n_head_tokens;
-              n_body_invis += n_head_invis;
-              n_head_tokens = 0;
-              n_head_invis = 0;
-              print_head = false;
-              /* Out-of-line member variable declarations are definitions,
-                 and hence need to be generated.  */
-              exposure = NEEDED;
-            }
-          else /* Not primary; must be an in-line declaration/definition.  */
-            {
-              /* The only var bodies in the class are manifest constants;
-                 merge them into the head.  */
-              n_head_tokens += n_body_tokens;
-              n_head_invis += n_body_invis;
-              n_body_tokens = 0;
-              n_body_invis = 0;
-              print_body = false;
-	    }
-        }
-      else /* not is_member */
-        {
-          if (exposure == EXPOSED)
-            {
-              /* Merge manifest constants into the head.
-                 This code sweeps up extern declarations with no bodies,
-                 but that's okay.  */
-              n_head_tokens += n_body_tokens;
-              n_head_invis += n_body_invis;
-              n_body_tokens = 0;
-              n_body_invis = 0;
-              print_body = false;
-            }
-        }
-      if (exposure == NEEDED)
-        n_body_invis += 4; /* For emitting the actual variable declaration. */
-    }
-  else if (code == FUNCTION_DECL)
-    {
-      /* Pure function declarations get no body.  */
-      if (exposure == EXPOSED && !artificial
-          && n_body_tokens == 0 && n_body_invis == 0)
-        print_body = false;
-      if (artificial)
-        {
-          if (is_member)
-            {
-              /* Artificial special member functions get their token
-                 counts from the calling expression, which isn't helpful.
-                 Build the cost into the class instead.  All of which
-                 means suppress this decl.  */
-              return 0;
-            }
-        }
-    }
-  else if (code == TYPE_DECL)
-    {
-      tree t_type = TREE_TYPE (t);
-
-      if (artificial)
-        return 0;
-
-      if (DECL_IMPLICIT_TYPEDEF_P (t)
-	  && CLASS_TYPE_P (t_type)
-          && TYPE_LANG_SPECIFIC (t_type))
-        {
-          tree tmpl_info;
-          int generic;
-
-          n_body_invis += pph_implicit_class_cost (t_type);
-
-          tmpl_info = CLASSTYPE_TEMPLATE_INFO (t_type);
-          if (tmpl_info)
-            {
-              generic = CLASSTYPE_USE_TEMPLATE (t_type);
-              if (generic == 1)
-                {
-                  /* Implicit instantiations have no visibile tokens.  */
-                  n_head_invis += n_head_tokens;
-                  n_head_tokens = 0;
-                  n_body_invis += n_body_tokens;
-                  n_body_tokens = 0;
-                }
-              else if (generic == 3)
-                {
-                  /* Explicit instantiations have no bodies,
-                     but they are work.  This approximation is
-                     unjustified, but we are presuming that explicit
-                     instantiations are rare in application code. */
-                  n_body_invis += 15;
-                  exposure = NEEDED;
-                }
-              if (generic != 2)
-                {
-                  bool defined;
-                  defined = CLASS_TYPE_P (t_type) && COMPLETE_TYPE_P (t_type);
-                  if (defined)
-                    pph_print_depend_template (tmpl_info, t);
-                }
-            }
-          else if (primary)
-            {
-              /* Now subtract the sum of members from the body of the class.
-                 This prevents double counting when emitting the parent.
-                 For non-primary class symbols, this value will be zero.  */
-              gcc_assert (n_body_tokens >= n_subtokens);
-	      n_body_tokens -= n_subtokens;
-            }
-        }
-      else if (TREE_CODE (t_type) == ENUMERAL_TYPE)
-        {
-          /* No additional work for enum.  */
-        }
-      else
-        {
-          /* Not artificial, not a C++ class, not an enum;
-             so must be a pure typedef.  They have no body.  */
-          gcc_assert (n_body_tokens == 0 && n_body_invis == 0);
-          print_body = false;
-        }
-    }
-
-  if (print_head)
-    pph_print_declaration_head (t, artificial, (is_member) ? container : NULL,
-                                n_head_tokens, n_head_invis, head_tokens);
-
-  if (print_body)
-    pph_print_declaration_body (t, artificial, exposure,
-                                n_body_tokens, n_body_invis, body_tokens);
-
-  if (flag_pph_decls_debug >= 4)
-    {
-      fprintf (pph_logfile, "    Declarator head tokens: ");
-      cp_lexer_debug_tokens ((VEC(cp_token, gc) *)head_tokens);
-      fprintf (pph_logfile, "    Declarator body tokens: ");
-      cp_lexer_debug_tokens ((VEC(cp_token, gc) *)body_tokens);
-      fprintf (pph_logfile, "\n");
-    }
-
-  return n_member_tokens;
-}
-
-static void
-pph_print_declarations (VEC(tree,heap) *v)
-{
-  unsigned i, j, n, first_ix;
-  tree t, first, parent;
-  enum decl_exposure exposure;
-  unsigned n_subtokens = 0;
-
-  if (VEC_empty (tree, v))
-    return;
-
-  /* If the first AST in V is a class/structure declaration, process
-     the sub-declarations first.  This will accumulate the tokens in
-     the sub-declarations, so that when we print the class itself
-     we don't double count the tokens in its body.  */
-
-  /* Skip over un-exposed declarations, like template parameters. */
-  n = VEC_length (tree, v);
-  for ( i = 0; VEC_iterate (tree, v, i, t); i++)
-    {
-      exposure = pph_get_decl_exposure (t);
-      if (exposure >= EXPOSED)
-        break;
-    }
-  if (i >= n)
-    return; /* No exposed decls. */
-
-  first = VEC_index (tree, v, i);
-  if (VEC_length (tree, v) > i+1
-      && TREE_CODE (first) == TYPE_DECL
-      && CLASS_TYPE_P (TREE_TYPE (first)))
-    {
-      parent = first;
-      first_ix = i+1;
-    }
-  else
-    {
-      parent = NULL;
-      first_ix = i;
-    }
-
-  for (j = first_ix; VEC_iterate (tree, v, j, t); j++)
-    {
-      exposure = pph_get_decl_exposure (t);
-      if (exposure >= EXPOSED)
-        n_subtokens += pph_print_declaration (t, exposure, 0U, i == j, parent);
-    }
-
-  /* If we didn't print the first declaration, print it now.  */
-  if (first_ix > i)
-    {
-      exposure = pph_get_decl_exposure (first);
-      if (exposure >= EXPOSED)
-	pph_print_declaration (first, exposure, n_subtokens, true, NULL);
-    }
-}
-
-static void
-pph_print_trees_tokens (VEC(tree,heap) *v, cp_token *tok1, cp_token *tok2)
-{
-  VEC(cp_token, heap) *vtok;
-
-  vtok = pph_print_copy_tokens (tok1, tok2);
-  if (vtok == NULL)
-    return;
-
-  pph_print_token_range (v, vtok);
-  pph_print_declarations (v);
-  fprintf (pph_logfile, "\n");
-}
-
-
-/* Intercept the result of a name lookup operation requested by the
-   parser while we are intercepting AST creation.  T is the result
-   of a name lookup done by the parser.  If this is the first time
-   we see it, store it in pph_name_lookups.  */
-
-void
-pph_catch_name_lookup (tree t)
-{
-  if (t == NULL_TREE || t == error_mark_node || pph_tree_catcher == NULL)
-    return;
-
-  timevar_push (TV_PPH_MANAGE);
-
-  PPH_STATS_INCR (name_lookups, 1);
-
-  if (the_parser->lexer)
-    {
-      /* If we are parsing, we are stopped one token past the identifier
-	 that we have just looked up.  Store the token where we have seen
-	 this identifier so that we can determine whether the identifier
-	 was accessed in a head or a body.
-
-	 Note that we do this for every instance we find for T, so that
-	 we can store all the locations where T was accessed from.  */
-      VEC(cp_token, heap) *tokens;
-      cp_token *tok;
-      void **slot;
-
-      slot = pointer_map_insert (pph_nl_token_map, t);
-      tokens = (VEC(cp_token, heap) *) *slot;
-      tok = the_parser->lexer->next_token - 1;
-      VEC_safe_push (cp_token, heap, tokens, tok);
-      *slot = tokens;
-    }
-
-  /* Make sure we do not store the same decl more than once.  */
-  if (pointer_set_insert (pph_name_lookups_set, t))
-    {
-      timevar_pop (TV_PPH_MANAGE);
-      return;
-    }
-
-  VEC_safe_push (tree, heap, pph_name_lookups, t);
-  timevar_pop (TV_PPH_MANAGE);
-}
-
-
-/* Print statistics for the PPH cache.  */
-
-static void
-pph_print_stats (void)
-{
-  fprintf (stderr, "\nPPH cache statistics\n");
-  fprintf (stderr, "Number of tokens in the lexer:           %lu\n",
-	   pph_stats.lexed_tokens);
-  fprintf (stderr, "Number of tokens consumed by the parser: %lu\n",
-	   pph_stats.parsed_tokens);
-  fprintf (stderr, "Number of declarations cached in:        %lu\n",
-	   pph_stats.cached_decls);
-  fprintf (stderr, "Number of declarations restored:         %lu\n",
-	   pph_stats.restored_decls);
-  fprintf (stderr, "Number of cached decl references:        %lu\n",
-	   pph_stats.cached_refs);
-  fprintf (stderr, "Number of name lookups:                  %lu\n",
-	   pph_stats.name_lookups);
-  fprintf (stderr, "Number of bad lookups:                   %lu\n",
-	   pph_stats.bad_lookups);
-}
-
-
 /* Initialize PPH support.  */
 
 void
@@ -4252,9 +2283,6 @@
         error ("header lacks guard for PPH: %s", offending_file);
     }
 
-  if (flag_pph_stats)
-    pph_print_stats ();
-
   if (flag_pph_debug >= 1)
     fprintf (pph_logfile, "PPH: Finishing.\n");
 
Index: gcc/cp/pph.h
===================================================================
--- gcc/cp/pph.h	(revision 174568)
+++ gcc/cp/pph.h	(working copy)
@@ -208,68 +208,12 @@
 	      pth_stats.CNT += (N);		\
 	} while (0)
 
-
-/* Statistics on PPH.  */
-
-struct pph_stats_d
-{
-  /* Number of tokens parsed in this TU.  */
-  size_t parsed_tokens;
-
-  /* Number of tokens in the lexer buffer.  */
-  size_t lexed_tokens;
-
-  /* Number of declarations copied into the parser cache.  */
-  size_t cached_decls;
-
-  /* Number of declarations restored from the parser cache.  */
-  size_t restored_decls;
-
-  /* Number of references rebound when going in/out of the cache.  */
-  size_t cached_refs;
-
-  /* Number of name lookups done by the parser.  */
-  size_t name_lookups;
-
-  /* Number of decl lookups that were changed to something weird.  */
-  size_t bad_lookups;
-};
-
-extern struct pph_stats_d pph_stats;
-  
-#define PPH_STATS_INCR(CNT,N)			\
-  	do {					\
-	    if (flag_pph_stats)			\
-	      pph_stats.CNT += (N);		\
-	} while (0)
-
-
-/* Maps for tracking decl dependencies.  For each *_DECL tree intercepted
-   during parsing, we store the trees on which the node depends for
-   its declaration.  Two maps are kept, one for the head of the declaration
-   and another for its body.  */
-struct pph_decl_deps_d
-{
-  /* Symbol dependencies on the declaration header.  */
-  struct pointer_map_t *header;
-
-  /* Symbol dependencies on the declaration body.  */
-  struct pointer_map_t *body;
-};
-
 /* Global state.  FIXME pph, get rid of these.  */
 
 /* Log file where PPH analysis is written to.  Controlled by
    -fpph_logfile.  If this flag is not given, stdout is used.  */
 extern FILE *pph_logfile;
 
-#define PPH_POP_TIMEVAR_AND_RETURN(TV, T)				\
-  do {									\
-    pph_catch_name_lookup (T);						\
-    POP_TIMEVAR_AND_RETURN(TV, T);					\
-  } while (0)
-
-
 /* In pph.c  */
 extern void pth_init (cp_lexer *);
 extern void pth_finish (void);
@@ -278,12 +222,7 @@
 extern pth_image *pth_image_lookup (pth_state *, const char *, cpp_reader *);
 extern pth_state *pth_get_state (void);
 extern void pth_print_stats (FILE *, cp_lexer *);
-extern cp_token *pph_start_exposed (cp_parser *);
-extern void pph_stop_exposed (cp_parser *, cp_token *);
 extern void pph_init (void);
 extern void pph_finish (void);
-extern void pph_catch_tree (tree);
-extern void pph_uncatch_tree (tree);
-extern void pph_catch_name_lookup (tree);
 
 #endif  /* GCC_CP_PPH_H  */
Index: gcc/cp/pt.c
===================================================================
--- gcc/cp/pt.c	(revision 174568)
+++ gcc/cp/pt.c	(working copy)
@@ -7173,7 +7173,6 @@
   timevar_push (TV_TEMPLATE_INST);
   ret = lookup_template_class_1 (d1, arglist, in_decl, context,
                                  entering_scope, complain);
-  pph_catch_name_lookup (ret);
   timevar_pop (TV_TEMPLATE_INST);
   return ret;
 }
Index: gcc/cp/parser.c
===================================================================
--- gcc/cp/parser.c	(revision 174568)
+++ gcc/cp/parser.c	(working copy)
@@ -663,8 +663,6 @@
       cp_lexer_debug_tokens (lexer->buffer);
     }
 
-  PPH_STATS_INCR (lexed_tokens, VEC_length (cp_token, lexer->buffer));
-
   if (flag_pth_stats)
     pth_print_stats (pph_logfile, lexer);
 
@@ -1048,8 +1046,6 @@
       putc ('\n', cp_lexer_debug_stream);
     }
 
-  PPH_STATS_INCR (parsed_tokens, 1);
-
   return token;
 }
 
@@ -9614,32 +9610,24 @@
       if (token2.type == CPP_LESS
 	  && cp_lexer_peek_nth_token (parser->lexer, 3)->type == CPP_GREATER)
         {
-          cp_token *pph_first_token = pph_start_exposed (parser);
 	  cp_parser_explicit_specialization (parser);
-          pph_stop_exposed (parser, pph_first_token);
         }
       /* `template <' indicates a template declaration.  */
       else if (token2.type == CPP_LESS)
         {
-          cp_token *pph_first_token = pph_start_exposed (parser);
 	  cp_parser_template_declaration (parser, /*member_p=*/false);
-          pph_stop_exposed (parser, pph_first_token);
         }
       /* Anything else must be an explicit instantiation.  */
       else
         {
-          cp_token *pph_first_token = pph_start_exposed (parser);
 	  cp_parser_explicit_instantiation (parser);
-          pph_stop_exposed (parser, pph_first_token);
         }
     }
   /* If the next token is `export', then we have a template
      declaration.  */
   else if (token1.keyword == RID_EXPORT)
     {
-      cp_token *pph_first_token = pph_start_exposed (parser);
       cp_parser_template_declaration (parser, /*member_p=*/false);
-      pph_stop_exposed (parser, pph_first_token);
     }
   /* If the next token is `extern', 'static' or 'inline' and the one
      after that is `template', we have a GNU extended explicit
@@ -9650,9 +9638,7 @@
 	       || token1.keyword == RID_INLINE)
 	   && token2.keyword == RID_TEMPLATE)
     {
-      cp_token *pph_first_token = pph_start_exposed (parser);
       cp_parser_explicit_instantiation (parser);
-      pph_stop_exposed (parser, pph_first_token);
     }
   /* If the next token is `namespace', check for a named or unnamed
      namespace definition.  */
@@ -9681,9 +9667,7 @@
   else
     {
       /* Try to parse a block-declaration, or a function-definition.  */
-      cp_token *pph_first_token = pph_start_exposed (parser);
       cp_parser_block_declaration (parser, /*statement_p=*/false);
-      pph_stop_exposed (parser, pph_first_token);
     }
 
   /* Free any declarators allocated.  */
@@ -13536,9 +13520,6 @@
 						    /*declarator=*/NULL))
 	    return error_mark_node;
 	  type = xref_tag (tag_type, identifier, ts, template_p);
-          if (flag_pph_decls_debug >= 4)
-            fprintf (pph_logfile, "PPH: creating tag %p %s in hunk #\n",
-                     (void*)identifier, IDENTIFIER_POINTER (identifier));
 	}
     }
 
@@ -19420,7 +19401,7 @@
    NULL_TREE otherwise.  */
 
 static tree
-cp_parser_lookup_name_1 (cp_parser *parser, tree name,
+cp_parser_lookup_name (cp_parser *parser, tree name,
 		       enum tag_types tag_type,
 		       bool is_template,
 		       bool is_namespace,
@@ -19664,26 +19645,6 @@
 }
 
 
-/* Wrapper for cp_parser_lookup_name_1.  Call pph_catch_name_lookup
-   for every resolved NAME.  */
-
-static tree
-cp_parser_lookup_name (cp_parser *parser, tree name,
-		       enum tag_types tag_type,
-		       bool is_template,
-		       bool is_namespace,
-		       bool check_dependency,
-		       tree *ambiguous_decls,
-		       location_t name_location)
-{
-  tree t = cp_parser_lookup_name_1 (parser, name, tag_type, is_template,
-				    is_namespace, check_dependency,
-				    ambiguous_decls, name_location);
-  pph_catch_name_lookup (t);
-  return t;
-}
-
-
 /* Like cp_parser_lookup_name, but for use in the typical case where
    CHECK_ACCESS is TRUE, IS_TYPE is FALSE, IS_TEMPLATE is FALSE,
    IS_NAMESPACE is FALSE, and CHECK_DEPENDENCY is TRUE.  */
Index: gcc/cp/pph-streamer.c
===================================================================
--- gcc/cp/pph-streamer.c	(revision 174568)
+++ gcc/cp/pph-streamer.c	(working copy)
@@ -147,188 +147,6 @@
 }
 
 
-/* Data types supported by the PPH tracer.  */
-enum pph_trace_type
-{
-    PPH_TRACE_TREE,
-    PPH_TRACE_REF,
-    PPH_TRACE_UINT,
-    PPH_TRACE_BYTES,
-    PPH_TRACE_STRING,
-    PPH_TRACE_CHAIN,
-    PPH_TRACE_BITPACK
-};
-
-
-/* Print tracing information for STREAM on pph_logfile.  DATA is the
-   memory area to display, SIZE is the number of bytes to print, TYPE
-   is the kind of data to print.  */
-
-static void
-pph_trace (pph_stream *stream, const void *data, unsigned int nbytes,
-		  enum pph_trace_type type)
-{
-  const char *op = (stream->write_p) ? "<<" : ">>";
-  const char *type_s[] = { "tree", "ref", "uint", "bytes", "string", "chain",
-                           "bitpack" };
-
-  if ((type == PPH_TRACE_TREE || type == PPH_TRACE_CHAIN)
-      && !data
-      && flag_pph_tracer <= 3)
-    return;
-
-  fprintf (pph_logfile, "*** %s: %s%s/%u, value=",
-	   stream->name, op, type_s[type], (unsigned) nbytes);
-
-  switch (type)
-    {
-    case PPH_TRACE_TREE:
-      {
-	const_tree t = (const_tree) data;
-	if (t)
-	  {
-	    print_generic_expr (pph_logfile, CONST_CAST (union tree_node *, t),
-				0);
-	    fprintf (pph_logfile, ", code=%s", tree_code_name[TREE_CODE (t)]);
-	  }
-	else
-	  fprintf (pph_logfile, "NULL_TREE");
-      }
-      break;
-
-    case PPH_TRACE_REF:
-      {
-	const_tree t = (const_tree) data;
-	if (t)
-	  {
-	    print_generic_expr (pph_logfile, CONST_CAST (union tree_node *, t),
-				0);
-	    fprintf (pph_logfile, ", code=%s", tree_code_name[TREE_CODE (t)]);
-	  }
-	else
-	  fprintf (pph_logfile, "NULL_TREE");
-      }
-      break;
-
-    case PPH_TRACE_UINT:
-      {
-	unsigned int val = *((const unsigned int *) data);
-	fprintf (pph_logfile, "%u (0x%x)", val, val);
-      }
-      break;
-
-    case PPH_TRACE_BYTES:
-      {
-	size_t i;
-	const char *buffer = (const char *) data;
-	for (i = 0; i < MIN (nbytes, 100); i++)
-	  {
-	    if (ISPRINT (buffer[i]))
-	      fprintf (pph_logfile, "%c", buffer[i]);
-	    else
-	      fprintf (pph_logfile, "[0x%02x]", (unsigned int) buffer[i]);
-	  }
-      }
-      break;
-
-    case PPH_TRACE_STRING:
-      if (data)
-	fprintf (pph_logfile, "%.*s", (int) nbytes, (const char *) data);
-      else
-	fprintf (pph_logfile, "<nil>");
-      break;
-
-    case PPH_TRACE_CHAIN:
-      {
-	const_tree t = (const_tree) data;
-	print_generic_expr (pph_logfile, CONST_CAST (union tree_node *, t),
-			    TDF_SLIM);
-	fprintf (pph_logfile, " (%d nodes in chain)", list_length (t));
-      }
-      break;
-
-    case PPH_TRACE_BITPACK:
-      {
-	const struct bitpack_d *bp = (const struct bitpack_d *) data;
-	fprintf (pph_logfile, "0x%lx", bp->word);
-      }
-    break;
-
-    default:
-      gcc_unreachable ();
-    }
-
-  fputc ('\n', pph_logfile);
-}
-
-
-/* Show tracing information for T on STREAM.  */
-
-void
-pph_trace_tree (pph_stream *stream, tree t, bool ref_p)
-{
-  pph_trace (stream, t, t ? tree_code_size (TREE_CODE (t)) : 0,
-		    ref_p ? PPH_TRACE_REF : PPH_TRACE_TREE);
-}
-
-
-/* Show tracing information for VAL on STREAM.  */
-
-void
-pph_trace_uint (pph_stream *stream, unsigned int val)
-{
-  pph_trace (stream, &val, sizeof (val), PPH_TRACE_UINT);
-}
-
-
-/* Show tracing information for NBYTES bytes of memory area DATA on
-   STREAM.  */
-
-void
-pph_trace_bytes (pph_stream *stream, const void *data, size_t nbytes)
-{
-  pph_trace (stream, data, nbytes, PPH_TRACE_BYTES);
-}
-
-
-/* Show tracing information for S on STREAM.  */
-
-void
-pph_trace_string (pph_stream *stream, const char *s)
-{
-  pph_trace (stream, s, s ? strlen (s) : 0, PPH_TRACE_STRING);
-}
-
-
-/* Show tracing information for LEN bytes of S on STREAM.  */
-
-void
-pph_trace_string_with_length (pph_stream *stream, const char *s,
-				     unsigned int len)
-{
-  pph_trace (stream, s, len, PPH_TRACE_STRING);
-}
-
-
-/* Show tracing information for a tree chain starting with T on STREAM.  */
-
-void
-pph_trace_chain (pph_stream *stream, tree t)
-{
-  pph_trace (stream, t, t ? tree_code_size (TREE_CODE (t)) : 0,
-		    PPH_TRACE_CHAIN);
-}
-
-
-/* Show tracing information for a bitpack BP on STREAM.  */
-
-void
-pph_trace_bitpack (pph_stream *stream, struct bitpack_d *bp)
-{
-  pph_trace (stream, bp, sizeof (*bp), PPH_TRACE_BITPACK);
-}
-
-
 /* Insert DATA in STREAM's pickle cache at slot IX.  If DATA already
    existed in the cache, IX must be the same as the previous entry.  */
 
Index: gcc/cp/call.c
===================================================================
--- gcc/cp/call.c	(revision 174568)
+++ gcc/cp/call.c	(working copy)
@@ -1759,7 +1759,6 @@
       if (cand)
         {
 	  conv = cand->second_conv;
-          pph_catch_name_lookup (DECL_ORIGIN (cand->fn));
         }
 
       /* We used to try to bind a reference to a temporary here, but that
@@ -5016,7 +5015,6 @@
 	    result = error_mark_node;
 	  else
             {
-              pph_catch_name_lookup (DECL_ORIGIN (cand->fn));
 	      result = build_over_call (cand, LOOKUP_NORMAL, complain);
             }
 	}
@@ -5578,7 +5576,6 @@
 	for (i = 0; i < cand->num_convs; ++i)
 	  cand->convs[i]->user_conv_p = true;
 
-        pph_catch_name_lookup (DECL_ORIGIN (cand->fn));
 	expr = build_over_call (cand, LOOKUP_NORMAL, complain);
 
 	/* If this is a constructor or a function returning an aggr type,
@@ -7206,7 +7203,6 @@
 	      if (fn_p)
 		*fn_p = fn;
 	      /* Build the actual CALL_EXPR.  */
-              pph_catch_name_lookup (DECL_ORIGIN (cand->fn));
 	      call = build_over_call (cand, flags, complain);
 	      /* In an expression of the form `a->f()' where `f' turns
 		 out to be a static member function, `a' is
Index: gcc/cp/pph-streamer.h
===================================================================
--- gcc/cp/pph-streamer.h	(revision 174568)
+++ gcc/cp/pph-streamer.h	(working copy)
@@ -124,13 +124,6 @@
 /* In pph-streamer.c.  */
 pph_stream *pph_stream_open (const char *, const char *);
 void pph_stream_close (pph_stream *);
-void pph_trace_tree (pph_stream *, tree, bool ref_p);
-void pph_trace_uint (pph_stream *, unsigned int);
-void pph_trace_bytes (pph_stream *, const void *, size_t);
-void pph_trace_string (pph_stream *, const char *);
-void pph_trace_string_with_length (pph_stream *, const char *, unsigned);
-void pph_trace_chain (pph_stream *, tree);
-void pph_trace_bitpack (pph_stream *, struct bitpack_d *);
 void pph_cache_insert_at (pph_stream *, void *, unsigned);
 bool pph_cache_add (pph_stream *, void *, unsigned *);
 void *pph_cache_get (pph_stream *, unsigned);
@@ -170,8 +163,6 @@
 static inline void
 pph_out_tree (pph_stream *stream, tree t, bool ref_p)
 {
-  if (flag_pph_tracer >= 1)
-    pph_trace_tree (stream, t, ref_p);
   lto_output_tree (stream->ob, t, ref_p);
 }
 
@@ -185,38 +176,29 @@
   size_t i;
   for (i = 0; i < c; ++i)
     {
-      if (flag_pph_tracer >= 1)
-        pph_trace_tree (stream, a[i], ref_p);
       lto_output_tree (stream->ob, a[i], ref_p);
     }
 }
 #endif
 
-/* Output AST T to STREAM.  If REF_P is true, output a reference to T.
-   If -fpph-tracer is set to TLEVEL or higher, T is sent to
-   pph_trace_tree.  */
+/* Output AST T to STREAM.  If REF_P is true, output a reference to T.  */
 static inline void
-pph_out_tree_or_ref_1 (pph_stream *stream, tree t, bool ref_p, int tlevel)
+pph_out_tree_or_ref_1 (pph_stream *stream, tree t, bool ref_p)
 {
-  if (flag_pph_tracer >= tlevel)
-    pph_trace_tree (stream, t, ref_p);
   lto_output_tree_or_ref (stream->ob, t, ref_p);
 }
 
-/* Output AST T to STREAM.  If REF_P is true, output a reference to T.
-   Trigger tracing at -fpph-tracer=2.  */
+/* Output AST T to STREAM.  If REF_P is true, output a reference to T.  */
 static inline void
 pph_out_tree_or_ref (pph_stream *stream, tree t, bool ref_p)
 {
-  pph_out_tree_or_ref_1 (stream, t, ref_p, 2);
+  pph_out_tree_or_ref_1 (stream, t, ref_p);
 }
 
 /* Write an unsigned int VALUE to STREAM.  */
 static inline void
 pph_out_uint (pph_stream *stream, unsigned int value)
 {
-  if (flag_pph_tracer >= 4)
-    pph_trace_uint (stream, value);
   lto_output_sleb128_stream (stream->ob->main_stream, value);
 }
 
@@ -224,8 +206,6 @@
 static inline void
 pph_out_uchar (pph_stream *stream, unsigned char value)
 {
-  if (flag_pph_tracer >= 4)
-    pph_trace_uint (stream, value);
   lto_output_1_stream (stream->ob->main_stream, value);
 }
 
@@ -233,8 +213,6 @@
 static inline void
 pph_out_bytes (pph_stream *stream, const void *p, size_t n)
 {
-  if (flag_pph_tracer >= 4)
-    pph_trace_bytes (stream, p, n);
   lto_output_data_stream (stream->ob->main_stream, p, n);
 }
 
@@ -242,8 +220,6 @@
 static inline void
 pph_out_string (pph_stream *stream, const char *str)
 {
-  if (flag_pph_tracer >= 4)
-    pph_trace_string (stream, str);
   lto_output_string (stream->ob, stream->ob->main_stream, str);
 }
 
@@ -254,8 +230,6 @@
 {
   if (str)
     {
-      if (flag_pph_tracer >= 4)
-	pph_trace_string_with_length (stream, str, len);
       lto_output_string_with_length (stream->ob, stream->ob->main_stream,
 				     str, len + 1);
     }
@@ -263,8 +237,6 @@
     {
       /* lto_output_string_with_length does not handle NULL strings,
 	 but lto_output_string does.  */
-      if (flag_pph_tracer >= 4)
-	pph_trace_string (stream, str);
       pph_out_string (stream, NULL);
     }
 }
@@ -282,8 +254,6 @@
   pph_out_uint (stream, c);
   for (i = 0; VEC_iterate (tree, v, i, t); i++)
     {
-      if (flag_pph_tracer >= 1)
-        pph_trace_tree (stream, t, ref_p);
       lto_output_tree (stream->ob, t, ref_p);
     }
 }
@@ -294,8 +264,6 @@
 static inline void
 pph_out_chain (pph_stream *stream, tree first, bool ref_p)
 {
-  if (flag_pph_tracer >= 2)
-    pph_trace_chain (stream, first);
   lto_output_chain (stream->ob, first, ref_p);
 }
 
@@ -304,8 +272,6 @@
 pph_out_bitpack (pph_stream *stream, struct bitpack_d *bp)
 {
   gcc_assert (stream->ob->main_stream == bp->stream);
-  if (flag_pph_tracer >= 4)
-    pph_trace_bitpack (stream, bp);
   lto_output_bitpack (bp);
 }
 
@@ -315,8 +281,6 @@
 {
   HOST_WIDE_INT unsigned n = lto_input_uleb128 (stream->ib);
   gcc_assert (n == (unsigned) n);
-  if (flag_pph_tracer >= 4)
-    pph_trace_uint (stream, n);
   return (unsigned) n;
 }
 
@@ -324,10 +288,7 @@
 static inline unsigned char
 pph_in_uchar (pph_stream *stream)
 {
-  unsigned char n = lto_input_1_unsigned (stream->ib);
-  if (flag_pph_tracer >= 4)
-    pph_trace_uint (stream, n);
-  return n;
+  return lto_input_1_unsigned (stream->ib);
 }
 
 /* Read N bytes from STREAM into P.  The caller is responsible for 
@@ -336,8 +297,6 @@
 pph_in_bytes (pph_stream *stream, void *p, size_t n)
 {
   lto_input_data_block (stream->ib, p, n);
-  if (flag_pph_tracer >= 4)
-    pph_trace_bytes (stream, p, n);
 }
 
 /* Read and return a string of up to MAX characters from STREAM.
@@ -347,20 +306,14 @@
 static inline const char *
 pph_in_string (pph_stream *stream)
 {
-  const char *s = lto_input_string (stream->data_in, stream->ib);
-  if (flag_pph_tracer >= 4)
-    pph_trace_string (stream, s);
-  return s;
+  return lto_input_string (stream->data_in, stream->ib);
 }
 
 /* Load an AST from STREAM.  Return the corresponding tree.  */
 static inline tree
 pph_in_tree (pph_stream *stream)
 {
-  tree t = lto_input_tree (stream->ib, stream->data_in);
-  if (flag_pph_tracer >= 4)
-    pph_trace_tree (stream, t, false); /* FIXME pph: always false? */
-  return t;
+  return lto_input_tree (stream->ib, stream->data_in);
 }
 
 /* Load into an array A of cardinality C of AST from STREAM.  */
@@ -372,10 +325,7 @@
   size_t i;
   for (i = 0; i < c; ++i)
     {
-      tree t = lto_input_tree (stream->ib, stream->data_in);
-      if (flag_pph_tracer >= 4)
-        pph_trace_tree (stream, t, false); /* FIXME pph: always false? */
-      a[i] = t;
+      a[i] = lto_input_tree (stream->ib, stream->data_in);
     }
 }
 #endif
@@ -391,8 +341,6 @@
   for (i = 0; i < c; ++i)
     {
       tree t = lto_input_tree (stream->ib, stream->data_in);
-      if (flag_pph_tracer >= 4)
-        pph_trace_tree (stream, t, false); /* FIXME pph: always false? */
       VEC_safe_push (tree, gc, v, t);
     }
 }
@@ -402,20 +350,14 @@
 static inline tree
 pph_in_chain (pph_stream *stream)
 {
-  tree t = lto_input_chain (stream->ib, stream->data_in);
-  if (flag_pph_tracer >= 2)
-    pph_trace_chain (stream, t);
-  return t;
+  return lto_input_chain (stream->ib, stream->data_in);
 }
 
 /* Read a bitpack from STREAM.  */
 static inline struct bitpack_d
 pph_in_bitpack (pph_stream *stream)
 {
-  struct bitpack_d bp = lto_input_bitpack (stream->ib);
-  if (flag_pph_tracer >= 4)
-    pph_trace_bitpack (stream, &bp);
-  return bp;
+  return lto_input_bitpack (stream->ib);
 }
 
 #endif  /* GCC_CP_PPH_STREAMER_H  */
Index: gcc/cp/pph-streamer-out.c
===================================================================
--- gcc/cp/pph-streamer-out.c	(revision 174568)
+++ gcc/cp/pph-streamer-out.c	(working copy)
@@ -262,9 +262,9 @@
 pph_out_ld_min (pph_stream *stream, struct lang_decl_min *ldm,
 		         bool ref_p)
 {
-  pph_out_tree_or_ref_1 (stream, ldm->template_info, ref_p, 1);
+  pph_out_tree_or_ref_1 (stream, ldm->template_info, ref_p);
   if (ldm->base.u2sel == 0)
-    pph_out_tree_or_ref_1 (stream, ldm->u2.access, ref_p, 1);
+    pph_out_tree_or_ref_1 (stream, ldm->u2.access, ref_p);
   else if (ldm->base.u2sel == 1)
     pph_out_uint (stream, ldm->u2.discriminator);
   else
@@ -429,7 +429,7 @@
       saved_chain = TREE_CHAIN (t);
       TREE_CHAIN (t) = NULL_TREE;
 
-      pph_out_tree_or_ref_1 (stream, t, ref_p, 2);
+      pph_out_tree_or_ref_1 (stream, t, ref_p);
 
       TREE_CHAIN (t) = saved_chain;
     }
@@ -856,7 +856,7 @@
     case IMPORTED_DECL:
     case LABEL_DECL:
     case RESULT_DECL:
-      pph_out_tree_or_ref_1 (stream, DECL_INITIAL (expr), ref_p, 3);
+      pph_out_tree_or_ref_1 (stream, DECL_INITIAL (expr), ref_p);
       break;
 
     case CONST_DECL:
@@ -866,28 +866,28 @@
     case USING_DECL:
     case VAR_DECL:
       /* FIXME pph: Should we merge DECL_INITIAL into lang_specific? */
-      pph_out_tree_or_ref_1 (stream, DECL_INITIAL (expr), ref_p, 3);
+      pph_out_tree_or_ref_1 (stream, DECL_INITIAL (expr), ref_p);
       pph_out_lang_specific (stream, expr, ref_p);
       break;
 
     case FUNCTION_DECL:
-      pph_out_tree_or_ref_1 (stream, DECL_INITIAL (expr), ref_p, 3);
+      pph_out_tree_or_ref_1 (stream, DECL_INITIAL (expr), ref_p);
       pph_out_lang_specific (stream, expr, ref_p);
-      pph_out_tree_or_ref_1 (stream, DECL_SAVED_TREE (expr), ref_p, 3);
+      pph_out_tree_or_ref_1 (stream, DECL_SAVED_TREE (expr), ref_p);
       break;
 
     case TYPE_DECL:
-      pph_out_tree_or_ref_1 (stream, DECL_INITIAL (expr), ref_p, 3);
+      pph_out_tree_or_ref_1 (stream, DECL_INITIAL (expr), ref_p);
       pph_out_lang_specific (stream, expr, ref_p);
-      pph_out_tree_or_ref_1 (stream, DECL_ORIGINAL_TYPE (expr), ref_p, 3);
+      pph_out_tree_or_ref_1 (stream, DECL_ORIGINAL_TYPE (expr), ref_p);
       break;
 
     case TEMPLATE_DECL:
-      pph_out_tree_or_ref_1 (stream, DECL_INITIAL (expr), ref_p, 3);
+      pph_out_tree_or_ref_1 (stream, DECL_INITIAL (expr), ref_p);
       pph_out_lang_specific (stream, expr, ref_p);
-      pph_out_tree_or_ref_1 (stream, DECL_TEMPLATE_RESULT (expr), ref_p, 3);
-      pph_out_tree_or_ref_1 (stream, DECL_TEMPLATE_PARMS (expr), ref_p, 3);
-      pph_out_tree_or_ref_1 (stream, DECL_CONTEXT (expr), ref_p, 3);
+      pph_out_tree_or_ref_1 (stream, DECL_TEMPLATE_RESULT (expr), ref_p);
+      pph_out_tree_or_ref_1 (stream, DECL_TEMPLATE_PARMS (expr), ref_p);
+      pph_out_tree_or_ref_1 (stream, DECL_CONTEXT (expr), ref_p);
       break;
 
     /* tcc_type */
@@ -915,7 +915,7 @@
     case RECORD_TYPE:
     case UNION_TYPE:
       pph_out_lang_type (stream, expr, ref_p);
-      pph_out_tree_or_ref_1 (stream, TYPE_BINFO (expr), ref_p, 3);
+      pph_out_tree_or_ref_1 (stream, TYPE_BINFO (expr), ref_p);
       break;
 
     case BOUND_TEMPLATE_TEMPLATE_PARM:
@@ -925,7 +925,7 @@
     case TYPENAME_TYPE:
     case TYPEOF_TYPE:
       pph_out_lang_type (stream, expr, ref_p);
-      pph_out_tree_or_ref_1 (stream, TYPE_CACHED_VALUES (expr), ref_p, 3);
+      pph_out_tree_or_ref_1 (stream, TYPE_CACHED_VALUES (expr), ref_p);
       /* Note that we are using TYPED_CACHED_VALUES for it access to
          the generic .values field of types. */
       break;
@@ -945,7 +945,7 @@
 
         /* Write the statements.  */
         for (i = tsi_start (expr); !tsi_end_p (i); tsi_next (&i))
-	  pph_out_tree_or_ref_1 (stream, tsi_stmt (i), ref_p, 3);
+	  pph_out_tree_or_ref_1 (stream, tsi_stmt (i), ref_p);
       }
       break;
 
@@ -962,7 +962,7 @@
     /* tcc_exceptional */
 
     case OVERLOAD:
-      pph_out_tree_or_ref_1 (stream, OVL_CURRENT (expr), ref_p, 3);
+      pph_out_tree_or_ref_1 (stream, OVL_CURRENT (expr), ref_p);
       break;
 
     case IDENTIFIER_NODE:
@@ -970,15 +970,15 @@
         struct lang_identifier *id = LANG_IDENTIFIER_CAST (expr);
         pph_out_cxx_binding (stream, id->namespace_bindings, ref_p);
         pph_out_cxx_binding (stream, id->bindings, ref_p);
-        pph_out_tree_or_ref_1 (stream, id->class_template_info, ref_p, 3);
-        pph_out_tree_or_ref_1 (stream, id->label_value, ref_p, 3);
+        pph_out_tree_or_ref_1 (stream, id->class_template_info, ref_p);
+        pph_out_tree_or_ref_1 (stream, id->label_value, ref_p);
       }
       break;
 
     case BASELINK:
-      pph_out_tree_or_ref_1 (stream, BASELINK_BINFO (expr), ref_p, 3);
-      pph_out_tree_or_ref_1 (stream, BASELINK_FUNCTIONS (expr), ref_p, 3);
-      pph_out_tree_or_ref_1 (stream, BASELINK_ACCESS_BINFO (expr), ref_p, 3);
+      pph_out_tree_or_ref_1 (stream, BASELINK_BINFO (expr), ref_p);
+      pph_out_tree_or_ref_1 (stream, BASELINK_FUNCTIONS (expr), ref_p);
+      pph_out_tree_or_ref_1 (stream, BASELINK_ACCESS_BINFO (expr), ref_p);
       break;
 
     case TEMPLATE_INFO:
@@ -993,7 +993,7 @@
         pph_out_uint (stream, p->level);
         pph_out_uint (stream, p->orig_level);
         pph_out_uint (stream, p->num_siblings);
-        pph_out_tree_or_ref_1 (stream, p->decl, ref_p, 3);
+        pph_out_tree_or_ref_1 (stream, p->decl, ref_p);
         /* FIXME pph: Is TEMPLATE_PARM_PARAMETER_PACK using TREE_LANG_FLAG_0
            already handled?  */
       }
Index: gcc/cp/cp-objcp-common.h
===================================================================
--- gcc/cp/cp-objcp-common.h	(revision 174568)
+++ gcc/cp/cp-objcp-common.h	(working copy)
@@ -147,10 +147,6 @@
 #define LANG_HOOKS_OMP_FINISH_CLAUSE cxx_omp_finish_clause
 #undef LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE
 #define LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE cxx_omp_privatize_by_reference
-#undef LANG_HOOKS_PPH_CATCH_TREE
-#define LANG_HOOKS_PPH_CATCH_TREE pph_catch_tree
-#undef LANG_HOOKS_PPH_UNCATCH_TREE
-#define LANG_HOOKS_PPH_UNCATCH_TREE pph_uncatch_tree
 
 #undef LANG_HOOKS_EH_USE_CXA_END_CLEANUP
 #define LANG_HOOKS_EH_USE_CXA_END_CLEANUP true
Index: gcc/cp/name-lookup.c
===================================================================
--- gcc/cp/name-lookup.c	(revision 174568)
+++ gcc/cp/name-lookup.c	(working copy)
@@ -555,12 +555,6 @@
 		&& (!TREE_PUBLIC (decl) || DECL_DECLARED_INLINE_P (decl))))
           {
 	    VEC_safe_push (tree, gc, b->static_decls, decl);
-            if (flag_pph_decls_debug >= 3)
-              {
-                fprintf (stderr, "Adding %p to static_decls:\n", (void*)decl);
-                print_generic_expr (stderr, decl, 0);
-                fprintf (stderr, "\n");
-              }
           }
     }
 }
@@ -1855,7 +1849,6 @@
   tree ret;
   timevar_start (TV_NAME_LOOKUP);
   ret = identifier_type_value_1 (id);
-  pph_catch_name_lookup (ret);
   timevar_stop (TV_NAME_LOOKUP);
   return ret;
 }
@@ -2150,7 +2143,6 @@
   tree ret;
   bool subtime = timevar_cond_start (TV_NAME_LOOKUP);
   ret = pushdecl_with_scope_1 (x, level, is_friend);
-  pph_catch_name_lookup (ret);
   timevar_cond_stop (TV_NAME_LOOKUP, subtime);
   return ret;
 }
@@ -4787,7 +4779,6 @@
   tree ret;
   bool subtime = timevar_cond_start (TV_NAME_LOOKUP);
   ret = lookup_type_scope_1 (name, scope);
-  pph_catch_name_lookup (ret);
   timevar_cond_stop (TV_NAME_LOOKUP, subtime);
   return ret;
 }
@@ -4842,7 +4833,6 @@
   tree ret;
   bool subtime = timevar_cond_start (TV_NAME_LOOKUP);
   ret = lookup_name_innermost_nonclass_level_1 (name);
-  pph_catch_name_lookup (ret);
   timevar_cond_stop (TV_NAME_LOOKUP, subtime);
   return ret;
 }
@@ -5430,7 +5420,6 @@
   tree ret;
   timevar_start (TV_NAME_LOOKUP);
   ret = lookup_arg_dependent_1 (name, fns, args, include_std);
-  pph_catch_name_lookup (ret);
   timevar_stop (TV_NAME_LOOKUP);
   return ret;
 }
@@ -5710,7 +5699,6 @@
   tree ret;
   bool subtime = timevar_cond_start (TV_NAME_LOOKUP);
   ret = pushtag_1 (name, type, scope);
-  pph_catch_name_lookup (ret);
   timevar_cond_stop (TV_NAME_LOOKUP, subtime);
   return ret;
 }
