C++ PATCH to cp/decl.c: Timing name lookup

Gabriel Dos Reis gdr@integrable-solutions.net
Tue Feb 11 14:16:00 GMT 2003


Hi,

  I've applied the patch below to gcc-3_3-branch for timing name
lookup.  Not all functions involved in name lookup issues have been
instrumented, but most of them are involved.  Forthcoming patches will
add some bits here and there.  Please, run the compiler with
-ftime-report and report what you think is interesting.

Bootstrapped and tested on an i686-pc-linux-gnu.  A slightly modified
version will be applied to mainline.

-- Gaby

2003-02-11  Gabriel Dos Reis  <gdr@integrable-solutions.net>

	* decl.c: Include "timevar.h".
	(poplevel): Time name lookup.
	(find_binding): Likewise.
	(push_namespace): Likewise.
	(pop_nested_namespace): Likewise.
	(store_bindings): Likewise.
	(maybe_push_to_top_level): Likewise.
	(pop_from_top_level): Likewise.
	(push_local_name): Likewise.
	(pushtag): Likewise.
	(pushdecl): Likewise.
	(pushdecl_with_scope): Likewise.
	(pushdecl_namespace_level): Likewise.
	(pushdecl_top_level): Likewise.
	(pushdecl_class_level): Likewise.
	(push_class_level_binding): Likewise.
	(push_using_decl): Likewise.
	(push_using_directive): Likewise.
	(push_overloaded_decl): Likewise.
	(lookup_label): Likewise.
	(define_label): Likewise.
	(lookup_tag): Likewise.
	(lookup_tag_reverse): Likewise.
	(lookup_namespace_name): Likewise.
	(select_decl): Likewise.
	(unqualified_namespace_lookup): Likewise.
	(lookup_name_real): Likewise.
	(lookup_name_current_level): Likewise.
	(lookup_type_current_level): Likewise.
	(maybe_inject_for_scope_var): Likewise.
	(xref_tag): Likewise.

	* Make-lang.in (cp/decl.o): Add dependency on timevar.h

Index: Make-lang.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/Make-lang.in,v
retrieving revision 1.125.4.1
diff -p -r1.125.4.1 Make-lang.in
*** Make-lang.in	26 Jan 2003 11:31:41 -0000	1.125.4.1
--- Make-lang.in	11 Feb 2003 14:08:12 -0000
*************** cp/cp-lang.o: cp/cp-lang.c $(CXX_TREE_H)
*** 237,243 ****
  cp/decl.o: cp/decl.c $(CXX_TREE_H) flags.h cp/lex.h cp/decl.h stack.h \
    output.h $(EXPR_H) except.h toplev.h $(HASHTAB_H) $(GGC_H) $(RTL_H) \
    cp/operators.def $(TM_P_H) tree-inline.h diagnostic.h c-pragma.h \
!   debug.h gt-cp-decl.h gtype-cp.h
  cp/decl2.o: cp/decl2.c $(CXX_TREE_H) flags.h cp/lex.h cp/decl.h $(EXPR_H) \
    output.h except.h toplev.h $(GGC_H) $(RTL_H) c-common.h gt-cp-decl2.h
  cp/typeck2.o: cp/typeck2.c $(CXX_TREE_H) flags.h toplev.h output.h $(TM_P_H) \
--- 237,243 ----
  cp/decl.o: cp/decl.c $(CXX_TREE_H) flags.h cp/lex.h cp/decl.h stack.h \
    output.h $(EXPR_H) except.h toplev.h $(HASHTAB_H) $(GGC_H) $(RTL_H) \
    cp/operators.def $(TM_P_H) tree-inline.h diagnostic.h c-pragma.h \
!   debug.h gt-cp-decl.h gtype-cp.h timevar.h
  cp/decl2.o: cp/decl2.c $(CXX_TREE_H) flags.h cp/lex.h cp/decl.h $(EXPR_H) \
    output.h except.h toplev.h $(GGC_H) $(RTL_H) c-common.h gt-cp-decl2.h
  cp/typeck2.o: cp/typeck2.c $(CXX_TREE_H) flags.h toplev.h output.h $(TM_P_H) \
Index: decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.965.2.7
diff -p -r1.965.2.7 decl.c
*** decl.c	28 Jan 2003 03:24:43 -0000	1.965.2.7
--- decl.c	11 Feb 2003 14:08:13 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 49,54 ****
--- 49,55 ----
  #include "c-pragma.h"
  #include "diagnostic.h"
  #include "debug.h"
+ #include "timevar.h"
  
  static tree grokparms				PARAMS ((tree));
  static const char *redeclaration_error_message	PARAMS ((tree, tree));
*************** poplevel (keep, reverse, functionbody)
*** 1276,1283 ****
    tree decl;
    int leaving_for_scope;
  
    if (cfun && !doing_semantic_analysis_p ())
!     return NULL_TREE;
  
    my_friendly_assert (current_binding_level->parm_flag != 2,
  		      19990916);
--- 1277,1286 ----
    tree decl;
    int leaving_for_scope;
  
+   timevar_push (TV_NAME_LOOKUP);
+ 
    if (cfun && !doing_semantic_analysis_p ())
!     POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
  
    my_friendly_assert (current_binding_level->parm_flag != 2,
  		      19990916);
*************** poplevel (keep, reverse, functionbody)
*** 1568,1574 ****
        block = poplevel (keep, reverse, functionbody);
      }
  
!   return block;
  }
  
  /* Delete the node BLOCK from the current binding level.
--- 1571,1577 ----
        block = poplevel (keep, reverse, functionbody);
      }
  
!   POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, block);
  }
  
  /* Delete the node BLOCK from the current binding level.
*************** poplevel_class ()
*** 1659,1664 ****
--- 1662,1669 ----
    register struct cp_binding_level *level = class_binding_level;
    tree shadowed;
  
+   timevar_push (TV_NAME_LOOKUP);
+ 
    my_friendly_assert (level != 0, 354);
  
    /* If we're leaving a toplevel class, don't bother to do the setting
*************** poplevel_class ()
*** 1723,1728 ****
--- 1728,1735 ----
  #endif /* defined(DEBUG_BINDING_LEVELS) */
  
    pop_binding_level ();
+ 
+   timevar_pop (TV_NAME_LOOKUP);
  }
  
  /* We are entering the scope of a class.  Clear IDENTIFIER_CLASS_VALUE
*************** find_binding (name, scope)
*** 2103,2108 ****
--- 2110,2117 ----
  {
    tree iter, prev = NULL_TREE;
  
+   timevar_push (TV_NAME_LOOKUP);
+ 
    scope = ORIGINAL_NAMESPACE (scope);
  
    for (iter = IDENTIFIER_NAMESPACE_BINDINGS (name); iter;
*************** find_binding (name, scope)
*** 2119,2129 ****
  	      TREE_CHAIN (iter) = IDENTIFIER_NAMESPACE_BINDINGS (name);
  	      IDENTIFIER_NAMESPACE_BINDINGS (name) = iter;
  	    }
! 	  return iter;
  	}
        prev = iter;
      }
!   return NULL_TREE;
  }
  
  /* Always returns a binding for name in scope. If the
--- 2128,2138 ----
  	      TREE_CHAIN (iter) = IDENTIFIER_NAMESPACE_BINDINGS (name);
  	      IDENTIFIER_NAMESPACE_BINDINGS (name) = iter;
  	    }
! 	  POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, iter);
  	}
        prev = iter;
      }
!   POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
  }
  
  /* Always returns a binding for name in scope. If the
*************** push_namespace (name)
*** 2218,2223 ****
--- 2227,2235 ----
    int need_new = 1;
    int implicit_use = 0;
    int global = 0;
+   
+   timevar_push (TV_NAME_LOOKUP);
+   
    if (!global_namespace)
      {
        /* This must be ::.  */
*************** push_namespace (name)
*** 2275,2280 ****
--- 2287,2294 ----
      do_using_directive (d);
    /* Enter the name space.  */
    current_namespace = d;
+ 
+   timevar_pop (TV_NAME_LOOKUP);
  }
  
  /* Pop from the scope of the current namespace.  */
*************** void
*** 2311,2316 ****
--- 2325,2331 ----
  pop_nested_namespace (ns)
       tree ns;
  {
+   timevar_push (TV_NAME_LOOKUP);
    while (ns != global_namespace)
      {
        pop_namespace ();
*************** pop_nested_namespace (ns)
*** 2318,2323 ****
--- 2333,2339 ----
      }
  
    pop_from_top_level ();
+   timevar_pop (TV_NAME_LOOKUP);
  }
  
  
*************** store_bindings (names, old_bindings)
*** 2335,2340 ****
--- 2351,2357 ----
    tree t;
    tree search_bindings = old_bindings;
  
+   timevar_push (TV_NAME_LOOKUP);
    for (t = names; t; t = TREE_CHAIN (t))
      {
        tree binding, t1, id;
*************** store_bindings (names, old_bindings)
*** 2368,2374 ****
      skip_it:
        ;
      }
!   return old_bindings;
  }
  
  void
--- 2385,2391 ----
      skip_it:
        ;
      }
!   POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, old_bindings);
  }
  
  void
*************** maybe_push_to_top_level (pseudo)
*** 2380,2385 ****
--- 2397,2404 ----
    tree old_bindings;
    int need_pop;
  
+   timevar_push (TV_NAME_LOOKUP);
+ 
    s = (struct saved_scope *) ggc_alloc_cleared (sizeof (struct saved_scope));
  
    b = scope_chain ? current_binding_level : 0;
*************** maybe_push_to_top_level (pseudo)
*** 2432,2437 ****
--- 2451,2457 ----
    VARRAY_TREE_INIT (current_lang_base, 10, "current_lang_base");
    current_lang_name = lang_name_cplusplus;
    current_namespace = global_namespace;
+   timevar_pop (TV_NAME_LOOKUP);
  }
  
  void
*************** pop_from_top_level ()
*** 2446,2451 ****
--- 2466,2473 ----
    struct saved_scope *s = scope_chain;
    tree t;
  
+   timevar_push (TV_NAME_LOOKUP);
+ 
    /* Clear out class-level bindings cache.  */
    if (previous_class_type)
      invalidate_class_lookup_cache ();
*************** pop_from_top_level ()
*** 2468,2473 ****
--- 2490,2497 ----
      pop_function_context_from (NULL_TREE);
    current_function_decl = s->function_decl;
    last_function_parms = s->last_parms;
+ 
+   timevar_pop (TV_NAME_LOOKUP);
  }
  
  /* Push a definition of struct, union or enum tag "name".
*************** tree
*** 2523,2540 ****
  identifier_type_value (id)
       tree id;
  {
    /* There is no type with that name, anywhere.  */
    if (REAL_IDENTIFIER_TYPE_VALUE (id) == NULL_TREE)
!     return NULL_TREE;
    /* This is not the type marker, but the real thing.  */
    if (REAL_IDENTIFIER_TYPE_VALUE (id) != global_type_node)
!     return REAL_IDENTIFIER_TYPE_VALUE (id);
    /* Have to search for it. It must be on the global level, now.
       Ask lookup_name not to return non-types.  */
    id = lookup_name_real (id, 2, 1, 0);
    if (id)
!     return TREE_TYPE (id);
!   return NULL_TREE;
  }
  
  /* Pop off extraneous binding levels left over due to syntax errors.
--- 2547,2565 ----
  identifier_type_value (id)
       tree id;
  {
+   timevar_push (TV_NAME_LOOKUP);
    /* There is no type with that name, anywhere.  */
    if (REAL_IDENTIFIER_TYPE_VALUE (id) == NULL_TREE)
!     POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
    /* This is not the type marker, but the real thing.  */
    if (REAL_IDENTIFIER_TYPE_VALUE (id) != global_type_node)
!     POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, REAL_IDENTIFIER_TYPE_VALUE (id));
    /* Have to search for it. It must be on the global level, now.
       Ask lookup_name not to return non-types.  */
    id = lookup_name_real (id, 2, 1, 0);
    if (id)
!     POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, TREE_TYPE (id));
!   POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
  }
  
  /* Pop off extraneous binding levels left over due to syntax errors.
*************** push_local_name (decl)
*** 2661,2666 ****
--- 2686,2693 ----
    size_t i, nelts;
    tree t, name;
  
+   timevar_push (TV_NAME_LOOKUP);
+ 
    if (!local_names)
      VARRAY_TREE_INIT (local_names, 8, "local_names");
  
*************** push_local_name (decl)
*** 2681,2691 ****
  	    DECL_DISCRIMINATOR (decl) = 1;
  
  	  VARRAY_TREE (local_names, i) = decl;
! 	  return;
  	}
      }
  
    VARRAY_PUSH_TREE (local_names, decl);
  }
  
  /* Push a tag name NAME for struct/class/union/enum type TYPE.
--- 2708,2719 ----
  	    DECL_DISCRIMINATOR (decl) = 1;
  
  	  VARRAY_TREE (local_names, i) = decl;
! 	  POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, (void)0);
  	}
      }
  
    VARRAY_PUSH_TREE (local_names, decl);
+   timevar_pop (TV_NAME_LOOKUP);
  }
  
  /* Push a tag name NAME for struct/class/union/enum type TYPE.
*************** pushtag (name, type, globalize)
*** 2700,2705 ****
--- 2728,2735 ----
  {
    register struct cp_binding_level *b;
  
+   timevar_push (TV_NAME_LOOKUP);
+ 
    b = current_binding_level;
    while (b->tag_transparent
  	 || (b->parm_flag == 2
*************** pushtag (name, type, globalize)
*** 2809,2814 ****
--- 2839,2846 ----
        tree d = build_decl (TYPE_DECL, NULL_TREE, type);
        TYPE_STUB_DECL (type) = pushdecl_with_scope (d, b);
      }
+ 
+   timevar_pop (TV_NAME_LOOKUP);
  }
  
  /* Counter used to create anonymous type names.  */
*************** pushdecl (x)
*** 3782,3787 ****
--- 3814,3821 ----
    register tree name;
    int need_new_binding;
  
+   timevar_push (TV_NAME_LOOKUP);
+ 
    /* We shouldn't be calling pushdecl when we're generating RTL for a
       function that we already did semantic analysis on previously.  */
    my_friendly_assert (!cfun || doing_semantic_analysis_p (),
*************** pushdecl (x)
*** 3905,3911 ****
  
  	      /* Check for duplicate params.  */
  	      if (duplicate_decls (x, t))
! 		return t;
  	    }
  	  else if ((DECL_EXTERN_C_FUNCTION_P (x)
  		    || DECL_FUNCTION_TEMPLATE_P (x))
--- 3939,3945 ----
  
  	      /* Check for duplicate params.  */
  	      if (duplicate_decls (x, t))
! 		POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
  	    }
  	  else if ((DECL_EXTERN_C_FUNCTION_P (x)
  		    || DECL_FUNCTION_TEMPLATE_P (x))
*************** pushdecl (x)
*** 3918,3929 ****
  			    TREE_TYPE (x));
  
  	      /* Throw away the redeclaration.  */
! 	      return t;
  	    }
  	  else if (TREE_CODE (t) != TREE_CODE (x))
  	    {
  	      if (duplicate_decls (x, t))
! 		return t;
  	    }
  	  else if (duplicate_decls (x, t))
  	    {
--- 3952,3963 ----
  			    TREE_TYPE (x));
  
  	      /* Throw away the redeclaration.  */
! 	      POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
  	    }
  	  else if (TREE_CODE (t) != TREE_CODE (x))
  	    {
  	      if (duplicate_decls (x, t))
! 		POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
  	    }
  	  else if (duplicate_decls (x, t))
  	    {
*************** pushdecl (x)
*** 3932,3938 ****
  	      else if (TREE_CODE (t) == FUNCTION_DECL)
  		check_default_args (t);
  
! 	      return t;
  	    }
  	  else if (DECL_MAIN_P (x))
  	    {
--- 3966,3972 ----
  	      else if (TREE_CODE (t) == FUNCTION_DECL)
  		check_default_args (t);
  
! 	      POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
  	    }
  	  else if (DECL_MAIN_P (x))
  	    {
*************** pushdecl (x)
*** 3946,3952 ****
  	      error ("as `%D'", x);
  	      /* We don't try to push this declaration since that
  		 causes a crash.  */
! 	      return x;
  	    }
  	}
  
--- 3980,3986 ----
  	      error ("as `%D'", x);
  	      /* We don't try to push this declaration since that
  		 causes a crash.  */
! 	      POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, x);
  	    }
  	}
  
*************** pushdecl (x)
*** 3964,3970 ****
  	{
  	  t = push_overloaded_decl (x, PUSH_LOCAL);
  	  if (t != x)
! 	    return t;
  	  if (!namespace_bindings_p ())
  	    /* We do not need to create a binding for this name;
  	       push_overloaded_decl will have already done so if
--- 3998,4004 ----
  	{
  	  t = push_overloaded_decl (x, PUSH_LOCAL);
  	  if (t != x)
! 	    POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
  	  if (!namespace_bindings_p ())
  	    /* We do not need to create a binding for this name;
  	       push_overloaded_decl will have already done so if
*************** pushdecl (x)
*** 3976,3982 ****
  	  t = push_overloaded_decl (x, PUSH_GLOBAL);
  	  if (t == x)
  	    add_decl_to_level (x, NAMESPACE_LEVEL (CP_DECL_CONTEXT (t)));
! 	  return t;
  	}
  
        /* If declaring a type as a typedef, copy the type (unless we're
--- 4010,4016 ----
  	  t = push_overloaded_decl (x, PUSH_GLOBAL);
  	  if (t == x)
  	    add_decl_to_level (x, NAMESPACE_LEVEL (CP_DECL_CONTEXT (t)));
! 	  POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
  	}
  
        /* If declaring a type as a typedef, copy the type (unless we're
*************** pushdecl (x)
*** 4211,4217 ****
  		       ? NAMESPACE_LEVEL (CP_DECL_CONTEXT (x))
  		       : current_binding_level);
  
!   return x;
  }
  
  /* Same as pushdecl, but define X in binding-level LEVEL.  We rely on the
--- 4245,4251 ----
  		       ? NAMESPACE_LEVEL (CP_DECL_CONTEXT (x))
  		       : current_binding_level);
  
!   POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, x);
  }
  
  /* Same as pushdecl, but define X in binding-level LEVEL.  We rely on the
*************** pushdecl_with_scope (x, level)
*** 4225,4230 ****
--- 4259,4266 ----
    register struct cp_binding_level *b;
    tree function_decl = current_function_decl;
  
+   timevar_push (TV_NAME_LOOKUP);
+ 
    current_function_decl = NULL_TREE;
    if (level->parm_flag == 2)
      {
*************** pushdecl_with_scope (x, level)
*** 4241,4247 ****
        current_binding_level = b;
      }
    current_function_decl = function_decl;
!   return x;
  }
  
  /* Like pushdecl, only it places X in the current namespace,
--- 4277,4283 ----
        current_binding_level = b;
      }
    current_function_decl = function_decl;
!   POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, x);
  }
  
  /* Like pushdecl, only it places X in the current namespace,
*************** pushdecl_namespace_level (x)
*** 4254,4259 ****
--- 4290,4296 ----
    register struct cp_binding_level *b = current_binding_level;
    register tree t;
  
+   timevar_push (TV_NAME_LOOKUP);
    t = pushdecl_with_scope (x, NAMESPACE_LEVEL (current_namespace));
  
    /* Now, the type_shadowed stack may screw us.  Munge it so it does
*************** pushdecl_namespace_level (x)
*** 4287,4293 ****
  	  *ptr = newval;
          }
      }
!   return t;
  }
  
  /* Like pushdecl, only it places X in GLOBAL_BINDING_LEVEL,
--- 4324,4330 ----
  	  *ptr = newval;
          }
      }
!   POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
  }
  
  /* Like pushdecl, only it places X in GLOBAL_BINDING_LEVEL,
*************** tree
*** 4297,4306 ****
  pushdecl_top_level (x)
       tree x;
  {
    push_to_top_level ();
    x = pushdecl_namespace_level (x);
    pop_from_top_level ();
!   return x;
  }
  
  /* Make the declaration of X appear in CLASS scope.  */
--- 4334,4344 ----
  pushdecl_top_level (x)
       tree x;
  {
+   timevar_push (TV_NAME_LOOKUP);
    push_to_top_level ();
    x = pushdecl_namespace_level (x);
    pop_from_top_level ();
!   POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, x);
  }
  
  /* Make the declaration of X appear in CLASS scope.  */
*************** pushdecl_class_level (x)
*** 4311,4316 ****
--- 4349,4355 ----
  {
    tree name;
  
+   timevar_push (TV_NAME_LOOKUP);
    /* Get the name of X.  */
    if (TREE_CODE (x) == OVERLOAD)
      name = DECL_NAME (get_first_fn (x));
*************** pushdecl_class_level (x)
*** 4333,4338 ****
--- 4372,4378 ----
        for (f = TYPE_FIELDS (TREE_TYPE (x)); f; f = TREE_CHAIN (f))
  	pushdecl_class_level (f);
      }
+   timevar_pop (TV_NAME_LOOKUP);
  }
  
  /* Enter DECL into the symbol table, if that's appropriate.  Returns
*************** push_class_level_binding (name, x)
*** 4374,4383 ****
       tree x;
  {
    tree binding;
    /* The class_binding_level will be NULL if x is a template
       parameter name in a member template.  */
    if (!class_binding_level)
!     return;
  
    /* Make sure that this new member does not have the same name
       as a template parameter.  */
--- 4414,4425 ----
       tree x;
  {
    tree binding;
+   
+   timevar_push (TV_NAME_LOOKUP);
    /* The class_binding_level will be NULL if x is a template
       parameter name in a member template.  */
    if (!class_binding_level)
!     POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, (void)0);
  
    /* Make sure that this new member does not have the same name
       as a template parameter.  */
*************** push_class_level_binding (name, x)
*** 4427,4433 ****
  	    INHERITED_VALUE_BINDING_P (binding) = 0;
  	    TREE_TYPE (shadow) = x;
  	    IDENTIFIER_CLASS_VALUE (name) = x;
! 	    return;
  	  }
      }
  
--- 4469,4475 ----
  	    INHERITED_VALUE_BINDING_P (binding) = 0;
  	    TREE_TYPE (shadow) = x;
  	    IDENTIFIER_CLASS_VALUE (name) = x;
! 	    POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, (void)0);
  	  }
      }
  
*************** push_class_level_binding (name, x)
*** 4442,4447 ****
--- 4484,4490 ----
  	 what to pop later.  */
        TREE_TYPE (class_binding_level->class_shadowed) = x;
      }
+   timevar_pop (TV_NAME_LOOKUP);
  }
  
  /* Insert another USING_DECL into the current binding level, returning
*************** push_using_decl (scope, name)
*** 4456,4473 ****
  {
    tree decl;
  
    my_friendly_assert (TREE_CODE (scope) == NAMESPACE_DECL, 383);
    my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 384);
    for (decl = current_binding_level->usings; decl; decl = TREE_CHAIN (decl))
      if (DECL_INITIAL (decl) == scope && DECL_NAME (decl) == name)
        break;
    if (decl)
!     return namespace_bindings_p () ? decl : NULL_TREE;
    decl = build_lang_decl (USING_DECL, name, void_type_node);
    DECL_INITIAL (decl) = scope;
    TREE_CHAIN (decl) = current_binding_level->usings;
    current_binding_level->usings = decl;
!   return decl;
  }
  
  /* Add namespace to using_directives. Return NULL_TREE if nothing was
--- 4499,4519 ----
  {
    tree decl;
  
+   timevar_push (TV_NAME_LOOKUP);
+ 
    my_friendly_assert (TREE_CODE (scope) == NAMESPACE_DECL, 383);
    my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 384);
    for (decl = current_binding_level->usings; decl; decl = TREE_CHAIN (decl))
      if (DECL_INITIAL (decl) == scope && DECL_NAME (decl) == name)
        break;
    if (decl)
!     POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP,
! 			    namespace_bindings_p () ? decl : NULL_TREE);
    decl = build_lang_decl (USING_DECL, name, void_type_node);
    DECL_INITIAL (decl) = scope;
    TREE_CHAIN (decl) = current_binding_level->usings;
    current_binding_level->usings = decl;
!   POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
  }
  
  /* Add namespace to using_directives. Return NULL_TREE if nothing was
*************** push_using_directive (used)
*** 4481,4489 ****
    tree ud = current_binding_level->using_directives;
    tree iter, ancestor;
  
    /* Check if we already have this.  */
    if (purpose_member (used, ud) != NULL_TREE)
!     return NULL_TREE;
  
    /* Recursively add all namespaces used.  */
    for (iter = DECL_NAMESPACE_USING (used); iter; iter = TREE_CHAIN (iter))
--- 4527,4537 ----
    tree ud = current_binding_level->using_directives;
    tree iter, ancestor;
  
+   timevar_push (TV_NAME_LOOKUP);
+ 
    /* Check if we already have this.  */
    if (purpose_member (used, ud) != NULL_TREE)
!     POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
  
    /* Recursively add all namespaces used.  */
    for (iter = DECL_NAMESPACE_USING (used); iter; iter = TREE_CHAIN (iter))
*************** push_using_directive (used)
*** 4493,4499 ****
    ud = current_binding_level->using_directives;
    ud = tree_cons (used, ancestor, ud);
    current_binding_level->using_directives = ud;
!   return ud;
  }
  
  /* DECL is a FUNCTION_DECL for a non-member function, which may have
--- 4541,4547 ----
    ud = current_binding_level->using_directives;
    ud = tree_cons (used, ancestor, ud);
    current_binding_level->using_directives = ud;
!   POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, ud);
  }
  
  /* DECL is a FUNCTION_DECL for a non-member function, which may have
*************** push_overloaded_decl (decl, flags)
*** 4525,4530 ****
--- 4573,4580 ----
    tree new_binding;
    int doing_global = (namespace_bindings_p () || !(flags & PUSH_LOCAL));
  
+   timevar_push (TV_NAME_LOOKUP);
+ 
    if (doing_global)
      old = namespace_binding (name, DECL_CONTEXT (decl));
    else
*************** push_overloaded_decl (decl, flags)
*** 4557,4563 ****
  			  decl, fn);
  
  	      if (duplicate_decls (decl, fn))
! 		return fn;
  	    }
  	}
        else if (old == error_mark_node)
--- 4607,4613 ----
  			  decl, fn);
  
  	      if (duplicate_decls (decl, fn))
! 		POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, fn);
  	    }
  	}
        else if (old == error_mark_node)
*************** push_overloaded_decl (decl, flags)
*** 4567,4573 ****
  	{
  	  cp_error_at ("previous non-function declaration `%#D'", old);
  	  error ("conflicts with function declaration `%#D'", decl);
! 	  return decl;
  	}
      }
  
--- 4617,4623 ----
  	{
  	  cp_error_at ("previous non-function declaration `%#D'", old);
  	  error ("conflicts with function declaration `%#D'", decl);
! 	  POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
  	}
      }
  
*************** push_overloaded_decl (decl, flags)
*** 4616,4622 ****
  		/* And update the CPLUS_BINDING node.  */
  		BINDING_VALUE (IDENTIFIER_BINDING (name))
  		  = new_binding;
! 		return decl;
  	      }
  
  	  /* We should always find a previous binding in this case.  */
--- 4666,4672 ----
  		/* And update the CPLUS_BINDING node.  */
  		BINDING_VALUE (IDENTIFIER_BINDING (name))
  		  = new_binding;
! 		POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
  	      }
  
  	  /* We should always find a previous binding in this case.  */
*************** push_overloaded_decl (decl, flags)
*** 4627,4633 ****
        push_local_binding (name, new_binding, flags);
      }
  
!   return decl;
  }
  
  /* Generate an implicit declaration for identifier FUNCTIONID
--- 4677,4683 ----
        push_local_binding (name, new_binding, flags);
      }
  
!   POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
  }
  
  /* Generate an implicit declaration for identifier FUNCTIONID
*************** lookup_label (id)
*** 4811,4828 ****
    tree decl;
    struct named_label_list *ent;
  
    /* You can't use labels at global scope.  */
    if (current_function_decl == NULL_TREE)
      {
        error ("label `%s' referenced outside of any function",
  	     IDENTIFIER_POINTER (id));
!       return NULL_TREE;
      }
  
    /* See if we've already got this label.  */
    decl = IDENTIFIER_LABEL_VALUE (id);
    if (decl != NULL_TREE && DECL_CONTEXT (decl) == current_function_decl)
!     return decl;
  
    /* Record this label on the list of labels used in this function.
       We do this before calling make_label_decl so that we get the
--- 4861,4880 ----
    tree decl;
    struct named_label_list *ent;
  
+   timevar_push (TV_NAME_LOOKUP);
+ 
    /* You can't use labels at global scope.  */
    if (current_function_decl == NULL_TREE)
      {
        error ("label `%s' referenced outside of any function",
  	     IDENTIFIER_POINTER (id));
!       POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
      }
  
    /* See if we've already got this label.  */
    decl = IDENTIFIER_LABEL_VALUE (id);
    if (decl != NULL_TREE && DECL_CONTEXT (decl) == current_function_decl)
!     POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
  
    /* Record this label on the list of labels used in this function.
       We do this before calling make_label_decl so that we get the
*************** lookup_label (id)
*** 4839,4845 ****
    /* Now fill in the information we didn't have before.  */
    ent->label_decl = decl;
  
!   return decl;
  }
  
  /* Declare a local label named ID.  */
--- 4891,4897 ----
    /* Now fill in the information we didn't have before.  */
    ent->label_decl = decl;
  
!   POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
  }
  
  /* Declare a local label named ID.  */
*************** define_label (filename, line, name)
*** 5073,5078 ****
--- 5125,5132 ----
    struct named_label_list *ent;
    register struct cp_binding_level *p;
  
+   timevar_push (TV_NAME_LOOKUP);
+ 
    for (ent = named_labels; ent; ent = ent->next)
      if (ent->label_decl == decl)
        break;
*************** define_label (filename, line, name)
*** 5088,5094 ****
    if (DECL_INITIAL (decl) != NULL_TREE)
      {
        error ("duplicate label `%D'", decl);
!       return 0;
      }
    else
      {
--- 5142,5148 ----
    if (DECL_INITIAL (decl) != NULL_TREE)
      {
        error ("duplicate label `%D'", decl);
!       POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, 0);
      }
    else
      {
*************** define_label (filename, line, name)
*** 5103,5109 ****
  	  ent->binding_level = current_binding_level;
  	}
        check_previous_gotos (decl);
!       return decl;
      }
  }
  
--- 5157,5163 ----
  	  ent->binding_level = current_binding_level;
  	}
        check_previous_gotos (decl);
!       POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
      }
  }
  
*************** lookup_tag (form, name, binding_level, t
*** 5311,5316 ****
--- 5365,5372 ----
       if THISLEVEL_ONLY.  */
    int allow_template_parms_p = 1;
  
+   timevar_push (TV_NAME_LOOKUP);
+ 
    for (level = binding_level; level; level = level->level_chain)
      {
        register tree tail;
*************** lookup_tag (form, name, binding_level, t
*** 5320,5326 ****
  	    /* There's no need for error checking here, because
  	       anon names are unique throughout the compilation.  */
  	    if (TYPE_IDENTIFIER (TREE_VALUE (tail)) == name)
! 	      return TREE_VALUE (tail);
  	  }
        else if (level->namespace_p)
  	/* Do namespace lookup.  */
--- 5376,5382 ----
  	    /* There's no need for error checking here, because
  	       anon names are unique throughout the compilation.  */
  	    if (TYPE_IDENTIFIER (TREE_VALUE (tail)) == name)
! 	      POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, TREE_VALUE (tail));
  	  }
        else if (level->namespace_p)
  	/* Do namespace lookup.  */
*************** lookup_tag (form, name, binding_level, t
*** 5346,5363 ****
  		   if the typedef doesn't refer to a taggable type.  */
  		old = follow_tag_typedef (old);
  		if (!old)
! 		  return NULL_TREE;
  		if (TREE_CODE (old) != form
  		    && (form == ENUMERAL_TYPE
  			|| TREE_CODE (old) == ENUMERAL_TYPE))
  		  {
  		    error ("`%#D' redeclared as %C", old, form);
! 		    return NULL_TREE;
  		  }
! 		return old;
  	      }
  	    if (thislevel_only || tail == global_namespace)
! 	      return NULL_TREE;
  	  }
        else
  	for (tail = level->tags; tail; tail = TREE_CHAIN (tail))
--- 5402,5419 ----
  		   if the typedef doesn't refer to a taggable type.  */
  		old = follow_tag_typedef (old);
  		if (!old)
! 		  POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
  		if (TREE_CODE (old) != form
  		    && (form == ENUMERAL_TYPE
  			|| TREE_CODE (old) == ENUMERAL_TYPE))
  		  {
  		    error ("`%#D' redeclared as %C", old, form);
! 		    POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
  		  }
! 		POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, old);
  	      }
  	    if (thislevel_only || tail == global_namespace)
! 	      POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
  	  }
        else
  	for (tail = level->tags; tail; tail = TREE_CHAIN (tail))
*************** lookup_tag (form, name, binding_level, t
*** 5371,5379 ****
  		  {
  		    /* Definition isn't the kind we were looking for.  */
  		    error ("`%#D' redeclared as %C", TREE_VALUE (tail), form);
! 		    return NULL_TREE;
  		  }
! 		return TREE_VALUE (tail);
  	      }
  	  }
        if (thislevel_only && ! level->tag_transparent)
--- 5427,5435 ----
  		  {
  		    /* Definition isn't the kind we were looking for.  */
  		    error ("`%#D' redeclared as %C", TREE_VALUE (tail), form);
! 		    POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
  		  }
! 		POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, TREE_VALUE (tail));
  	      }
  	  }
        if (thislevel_only && ! level->tag_transparent)
*************** lookup_tag (form, name, binding_level, t
*** 5395,5404 ****
  	      continue;
  	    }
  	  else
! 	    return NULL_TREE;
  	}
      }
!   return NULL_TREE;
  }
  
  #if 0
--- 5451,5460 ----
  	      continue;
  	    }
  	  else
! 	    POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
  	}
      }
!   POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
  }
  
  #if 0
*************** lookup_tag_reverse (type, name)
*** 5424,5429 ****
--- 5480,5487 ----
  {
    register struct cp_binding_level *level;
  
+   timevar_push (TV_NAME_LOOKUP);
+ 
    for (level = current_binding_level; level; level = level->level_chain)
      {
        register tree tail;
*************** lookup_tag_reverse (type, name)
*** 5433,5443 ****
  	    {
  	      if (name)
  		TREE_PURPOSE (tail) = name;
! 	      return TREE_PURPOSE (tail);
  	    }
  	}
      }
!   return NULL_TREE;
  }
  
  /* Look up NAME in the NAMESPACE.  */
--- 5491,5501 ----
  	    {
  	      if (name)
  		TREE_PURPOSE (tail) = name;
! 	      POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, TREE_PURPOSE (tail));
  	    }
  	}
      }
!   POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
  }
  
  /* Look up NAME in the NAMESPACE.  */
*************** lookup_namespace_name (namespace, name)
*** 5449,5465 ****
    tree val;
    tree template_id = NULL_TREE;
  
    my_friendly_assert (TREE_CODE (namespace) == NAMESPACE_DECL, 370);
  
    if (TREE_CODE (name) == NAMESPACE_DECL)
      /* This happens for A::B<int> when B is a namespace.  */
!     return name;
    else if (TREE_CODE (name) == TEMPLATE_DECL)
      {
        /* This happens for A::B where B is a template, and there are no
  	 template arguments.  */
        error ("invalid use of `%D'", name);
!       return error_mark_node;
      }
  
    namespace = ORIGINAL_NAMESPACE (namespace);
--- 5507,5525 ----
    tree val;
    tree template_id = NULL_TREE;
  
+   timevar_push (TV_NAME_LOOKUP);
+ 
    my_friendly_assert (TREE_CODE (namespace) == NAMESPACE_DECL, 370);
  
    if (TREE_CODE (name) == NAMESPACE_DECL)
      /* This happens for A::B<int> when B is a namespace.  */
!     POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, name);
    else if (TREE_CODE (name) == TEMPLATE_DECL)
      {
        /* This happens for A::B where B is a template, and there are no
  	 template arguments.  */
        error ("invalid use of `%D'", name);
!       POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
      }
  
    namespace = ORIGINAL_NAMESPACE (namespace);
*************** lookup_namespace_name (namespace, name)
*** 5478,5484 ****
  
    val = make_node (CPLUS_BINDING);
    if (!qualified_lookup_using_namespace (name, namespace, val, 0))
!     return error_mark_node;
  
    if (BINDING_VALUE (val))
      {
--- 5538,5544 ----
  
    val = make_node (CPLUS_BINDING);
    if (!qualified_lookup_using_namespace (name, namespace, val, 0))
!     POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
  
    if (BINDING_VALUE (val))
      {
*************** lookup_namespace_name (namespace, name)
*** 5501,5507 ****
  	    {
  	      error ("`%D::%D' is not a template",
  			namespace, name);
! 	      return error_mark_node;
  	    }
  	}
  
--- 5561,5567 ----
  	    {
  	      error ("`%D::%D' is not a template",
  			namespace, name);
! 	      POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
  	    }
  	}
  
*************** lookup_namespace_name (namespace, name)
*** 5513,5523 ****
        if (!val || !DECL_P(val)
            || !DECL_LANG_SPECIFIC(val)
            || !DECL_ANTICIPATED (val))
!         return val;
      }
  
    error ("`%D' undeclared in namespace `%D'", name, namespace);
!   return error_mark_node;
  }
  
  /* Hash a TYPENAME_TYPE.  K is really of type `tree'.  */
--- 5573,5583 ----
        if (!val || !DECL_P(val)
            || !DECL_LANG_SPECIFIC(val)
            || !DECL_ANTICIPATED (val))
!         POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, val);
      }
  
    error ("`%D' undeclared in namespace `%D'", name, namespace);
!   POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
  }
  
  /* Hash a TYPENAME_TYPE.  K is really of type `tree'.  */
*************** select_decl (binding, flags)
*** 5824,5837 ****
       int flags;
  {
    tree val;
    val = BINDING_VALUE (binding);
  
    if (LOOKUP_NAMESPACES_ONLY (flags))
      {
        /* We are not interested in types.  */
        if (val && TREE_CODE (val) == NAMESPACE_DECL)
!         return val;
!       return NULL_TREE;
      }
  
    /* If we could have a type and
--- 5884,5900 ----
       int flags;
  {
    tree val;
+   
+   timevar_push (TV_NAME_LOOKUP);
+ 
    val = BINDING_VALUE (binding);
  
    if (LOOKUP_NAMESPACES_ONLY (flags))
      {
        /* We are not interested in types.  */
        if (val && TREE_CODE (val) == NAMESPACE_DECL)
!         POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, val);
!       POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
      }
  
    /* If we could have a type and
*************** select_decl (binding, flags)
*** 5846,5852 ****
  	       || !DECL_CLASS_TEMPLATE_P (val)))
      val = NULL_TREE;
  
!   return val;
  }
  
  /* Unscoped lookup of a global: iterate over current namespaces,
--- 5909,5915 ----
  	       || !DECL_CLASS_TEMPLATE_P (val)))
      val = NULL_TREE;
  
!   POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, val);
  }
  
  /* Unscoped lookup of a global: iterate over current namespaces,
*************** unqualified_namespace_lookup (name, flag
*** 5866,5871 ****
--- 5929,5935 ----
    struct cp_binding_level *level;
    tree val = NULL_TREE;
  
+   timevar_push (TV_NAME_LOOKUP);
    if (spacesp)
      *spacesp = NULL_TREE;
  
*************** unqualified_namespace_lookup (name, flag
*** 5898,5904 ****
  	if (!lookup_using_namespace (name, b, level->using_directives,
                                       scope, flags, spacesp))
  	  /* Give up because of error.  */
! 	  return error_mark_node;
  
        /* Add all _DECLs seen through global using-directives.  */
        /* XXX local and global using lists should work equally.  */
--- 5962,5968 ----
  	if (!lookup_using_namespace (name, b, level->using_directives,
                                       scope, flags, spacesp))
  	  /* Give up because of error.  */
! 	  POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
  
        /* Add all _DECLs seen through global using-directives.  */
        /* XXX local and global using lists should work equally.  */
*************** unqualified_namespace_lookup (name, flag
*** 5908,5914 ****
  	  if (!lookup_using_namespace (name, b, DECL_NAMESPACE_USING (siter),
  				       scope, flags, spacesp))
  	    /* Give up because of error.  */
! 	    return error_mark_node;
  	  if (siter == scope) break;
  	  siter = CP_DECL_CONTEXT (siter);
  	}
--- 5972,5978 ----
  	  if (!lookup_using_namespace (name, b, DECL_NAMESPACE_USING (siter),
  				       scope, flags, spacesp))
  	    /* Give up because of error.  */
! 	    POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
  	  if (siter == scope) break;
  	  siter = CP_DECL_CONTEXT (siter);
  	}
*************** unqualified_namespace_lookup (name, flag
*** 5917,5923 ****
        if (scope == global_namespace)
  	break;
      }
!   return val;
  }
  
  /* Combine prefer_type and namespaces_only into flags.  */
--- 5981,5987 ----
        if (scope == global_namespace)
  	break;
      }
!   POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, val);
  }
  
  /* Combine prefer_type and namespaces_only into flags.  */
*************** lookup_name_real (name, prefer_type, non
*** 6068,6073 ****
--- 6132,6139 ----
    int flags;
    int val_is_implicit_typename = 0;
  
+   timevar_push (TV_NAME_LOOKUP);
+ 
    /* Hack: copy flag set by parser, if set.  */
    if (only_namespace_names)
      namespaces_only = 1;
*************** lookup_name_real (name, prefer_type, non
*** 6093,6099 ****
        if (type)
  	{
  	  if (type == error_mark_node)
! 	    return error_mark_node;
  	  if (TREE_CODE (type) == TYPENAME_TYPE && TREE_TYPE (type))
  	    type = TREE_TYPE (type);
  
--- 6159,6165 ----
        if (type)
  	{
  	  if (type == error_mark_node)
! 	    POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
  	  if (TREE_CODE (type) == TYPENAME_TYPE && TREE_TYPE (type))
  	    type = TREE_TYPE (type);
  
*************** lookup_name_real (name, prefer_type, non
*** 6107,6113 ****
  	      val = make_node (CPLUS_BINDING);
  	      flags |= LOOKUP_COMPLAIN;
  	      if (!qualified_lookup_using_namespace (name, type, val, flags))
! 		return NULL_TREE;
  	      val = select_decl (val, flags);
  	    }
  	  else if (! IS_AGGR_TYPE (type)
--- 6173,6179 ----
  	      val = make_node (CPLUS_BINDING);
  	      flags |= LOOKUP_COMPLAIN;
  	      if (!qualified_lookup_using_namespace (name, type, val, flags))
! 		POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
  	      val = select_decl (val, flags);
  	    }
  	  else if (! IS_AGGR_TYPE (type)
*************** does not match lookup in the current sco
*** 6240,6246 ****
    else if (from_obj)
      val = from_obj;
  
!   return val;
  }
  
  tree
--- 6306,6312 ----
    else if (from_obj)
      val = from_obj;
  
!   POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, val);
  }
  
  tree
*************** lookup_name_current_level (name)
*** 6284,6289 ****
--- 6350,6357 ----
    struct cp_binding_level *b;
    tree t = NULL_TREE;
  
+   timevar_push (TV_NAME_LOOKUP);
+ 
    b = current_binding_level;
    while (b->parm_flag == 2)
      b = b->level_chain;
*************** lookup_name_current_level (name)
*** 6302,6308 ****
        while (1)
  	{
  	  if (BINDING_LEVEL (IDENTIFIER_BINDING (name)) == b)
! 	    return IDENTIFIER_VALUE (name);
  
  	  if (b->keep == 2)
  	    b = b->level_chain;
--- 6370,6376 ----
        while (1)
  	{
  	  if (BINDING_LEVEL (IDENTIFIER_BINDING (name)) == b)
! 	    POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, IDENTIFIER_VALUE (name));
  
  	  if (b->keep == 2)
  	    b = b->level_chain;
*************** lookup_name_current_level (name)
*** 6311,6317 ****
  	}
      }
  
!   return t;
  }
  
  /* Like lookup_name_current_level, but for types.  */
--- 6379,6385 ----
  	}
      }
  
!   POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
  }
  
  /* Like lookup_name_current_level, but for types.  */
*************** lookup_type_current_level (name)
*** 6321,6326 ****
--- 6389,6396 ----
       tree name;
  {
    register tree t = NULL_TREE;
+   
+   timevar_push (TV_NAME_LOOKUP);
  
    my_friendly_assert (! current_binding_level->namespace_p, 980716);
  
*************** lookup_type_current_level (name)
*** 6331,6337 ****
        while (1)
  	{
  	  if (purpose_member (name, b->type_shadowed))
! 	    return REAL_IDENTIFIER_TYPE_VALUE (name);
  	  if (b->keep == 2)
  	    b = b->level_chain;
  	  else
--- 6401,6408 ----
        while (1)
  	{
  	  if (purpose_member (name, b->type_shadowed))
! 	    POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP,
! 				    REAL_IDENTIFIER_TYPE_VALUE (name));
  	  if (b->keep == 2)
  	    b = b->level_chain;
  	  else
*************** lookup_type_current_level (name)
*** 6339,6345 ****
  	}
      }
  
!   return t;
  }
  
  void
--- 6410,6416 ----
  	}
      }
  
!   POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
  }
  
  void
*************** void
*** 8223,8236 ****
  maybe_inject_for_scope_var (decl)
       tree decl;
  {
    if (!DECL_NAME (decl))
!     return;
    
    /* Declarations of __FUNCTION__ and its ilk appear magically when
       the variable is first used.  If that happens to be inside a
       for-loop, we don't want to do anything special.  */
    if (DECL_PRETTY_FUNCTION_P (decl))
!     return;
  
    if (current_binding_level->is_for_scope)
      {
--- 8294,8309 ----
  maybe_inject_for_scope_var (decl)
       tree decl;
  {
+   timevar_push (TV_NAME_LOOKUP);
+ 
    if (!DECL_NAME (decl))
!     POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, (void)0);
    
    /* Declarations of __FUNCTION__ and its ilk appear magically when
       the variable is first used.  If that happens to be inside a
       for-loop, we don't want to do anything special.  */
    if (DECL_PRETTY_FUNCTION_P (decl))
!     POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, (void)0);
  
    if (current_binding_level->is_for_scope)
      {
*************** maybe_inject_for_scope_var (decl)
*** 8261,8266 ****
--- 8334,8341 ----
        else if (DECL_IN_MEMORY_P (decl))
  	preserve_temp_slots (DECL_RTL (decl));
      }
+ 
+   timevar_pop (TV_NAME_LOOKUP);
  }
  
  /* Generate code to initialize DECL (a local variable).  */
*************** xref_tag (enum tag_types tag_code, tree 
*** 13035,13040 ****
--- 13110,13117 ----
    struct cp_binding_level *b = current_binding_level;
    tree context = NULL_TREE;
  
+   timevar_push (TV_NAME_LOOKUP);
+ 
    switch (tag_code)
      {
      case record_type:
*************** xref_tag (enum tag_types tag_code, tree 
*** 13237,13243 ****
  
    TYPE_ATTRIBUTES (ref) = attributes;
  
!   return ref;
  }
  
  tree
--- 13314,13320 ----
  
    TYPE_ATTRIBUTES (ref) = attributes;
  
!   POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, ref);
  }
  
  tree



More information about the Gcc-patches mailing list