aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorGabriel Dos Reis <gdr@integrable-solutions.net>2003-02-13 04:57:20 +0000
committerGabriel Dos Reis <gdr@gcc.gnu.org>2003-02-13 04:57:20 +0000
commit22ffcc6f9f1bffb267892948349c3cbf4bda2991 (patch)
tree9a3b7172d75f59143babb90fde6ba9ce0208de97 /gcc
parent8d55a4aa3bf047fcec347cac893772a37f08324f (diff)
downloadgcc-22ffcc6f9f1bffb267892948349c3cbf4bda2991.zip
gcc-22ffcc6f9f1bffb267892948349c3cbf4bda2991.tar.gz
gcc-22ffcc6f9f1bffb267892948349c3cbf4bda2991.tar.bz2
timevar.h (POP_TIMEVAR_AND_RETURN): New macro.
* timevar.h (POP_TIMEVAR_AND_RETURN): New macro. cp/ * 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 From-SVN: r62819
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/cp/ChangeLog36
-rw-r--r--gcc/cp/Make-lang.in2
-rw-r--r--gcc/cp/decl.c187
-rw-r--r--gcc/timevar.h3
5 files changed, 162 insertions, 70 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f8edc1b..053d2cc 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2003-02-13 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * timevar.h (POP_TIMEVAR_AND_RETURN): New macro.
+
2003-02-12 Roger Sayle <roger@eyesopen.com>
* config/i386/i386.md (UNSPEC_FPATAN): New UNSPEC constant.
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 9f739ee..45b1497 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,39 @@
+2003-02-13 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
+
2003-02-12 Phil Edwards <pme@gcc.gnu.org>
* decl.c (build_enumerator): Remove unneeded test.
diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
index 347b71a..7d8804c 100644
--- a/gcc/cp/Make-lang.in
+++ b/gcc/cp/Make-lang.in
@@ -221,7 +221,7 @@ cp/cp-lang.o: cp/cp-lang.c $(CXX_TREE_H) $(TM_H) toplev.h langhooks.h \
cp/decl.o: cp/decl.c $(CXX_TREE_H) $(TM_H) flags.h cp/lex.h cp/decl.h stack.h \
output.h $(EXPR_H) except.h toplev.h $(HASHTAB_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
+ debug.h gt-cp-decl.h gtype-cp.h timevar.h
cp/decl2.o: cp/decl2.c $(CXX_TREE_H) $(TM_H) flags.h cp/lex.h cp/decl.h $(EXPR_H) \
output.h except.h toplev.h $(RTL_H) c-common.h gt-cp-decl2.h
cp/typeck2.o: cp/typeck2.c $(CXX_TREE_H) $(TM_H) flags.h toplev.h output.h $(TM_P_H) \
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index d9f29e1..9cb4736 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -50,6 +50,7 @@ Boston, MA 02111-1307, USA. */
#include "c-pragma.h"
#include "diagnostic.h"
#include "debug.h"
+#include "timevar.h"
static tree grokparms (tree);
static const char *redeclaration_error_message (tree, tree);
@@ -1234,8 +1235,9 @@ poplevel (int keep, int reverse, int functionbody)
tree decl;
int leaving_for_scope;
+ timevar_push (TV_NAME_LOOKUP);
if (cfun && !doing_semantic_analysis_p ())
- return NULL_TREE;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
my_friendly_assert (current_binding_level->parm_flag != 2,
19990916);
@@ -1526,7 +1528,7 @@ poplevel (int keep, int reverse, int functionbody)
block = poplevel (keep, reverse, functionbody);
}
- return block;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, block);
}
/* Delete the node BLOCK from the current binding level.
@@ -1614,6 +1616,7 @@ poplevel_class (void)
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
@@ -1678,6 +1681,7 @@ poplevel_class (void)
#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
@@ -2032,6 +2036,7 @@ find_binding (tree name, tree scope)
{
tree iter, prev = NULL_TREE;
+ timevar_push (TV_NAME_LOOKUP);
scope = ORIGINAL_NAMESPACE (scope);
for (iter = IDENTIFIER_NAMESPACE_BINDINGS (name); iter;
@@ -2048,11 +2053,11 @@ find_binding (tree name, tree scope)
TREE_CHAIN (iter) = IDENTIFIER_NAMESPACE_BINDINGS (name);
IDENTIFIER_NAMESPACE_BINDINGS (name) = iter;
}
- return iter;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, iter);
}
prev = iter;
}
- return NULL_TREE;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
}
/* Always returns a binding for name in scope. If the
@@ -2139,6 +2144,9 @@ push_namespace (tree name)
int need_new = 1;
int implicit_use = 0;
int global = 0;
+
+ timevar_push (TV_NAME_LOOKUP);
+
if (!global_namespace)
{
/* This must be ::. */
@@ -2196,6 +2204,8 @@ push_namespace (tree name)
do_using_directive (d);
/* Enter the name space. */
current_namespace = d;
+
+ timevar_pop (TV_NAME_LOOKUP);
}
/* Pop from the scope of the current namespace. */
@@ -2230,6 +2240,7 @@ push_nested_namespace (tree ns)
void
pop_nested_namespace (tree ns)
{
+ timevar_push (TV_NAME_LOOKUP);
while (ns != global_namespace)
{
pop_namespace ();
@@ -2237,6 +2248,7 @@ pop_nested_namespace (tree ns)
}
pop_from_top_level ();
+ timevar_pop (TV_NAME_LOOKUP);
}
@@ -2253,6 +2265,7 @@ store_bindings (tree names, tree old_bindings)
tree t;
tree search_bindings = old_bindings;
+ timevar_push (TV_NAME_LOOKUP);
for (t = names; t; t = TREE_CHAIN (t))
{
tree binding, t1, id;
@@ -2286,7 +2299,7 @@ store_bindings (tree names, tree old_bindings)
skip_it:
;
}
- return old_bindings;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, old_bindings);
}
void
@@ -2297,6 +2310,7 @@ maybe_push_to_top_level (int pseudo)
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;
@@ -2350,6 +2364,7 @@ maybe_push_to_top_level (int pseudo)
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
@@ -2364,6 +2379,7 @@ pop_from_top_level (void)
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 ();
@@ -2386,6 +2402,7 @@ pop_from_top_level (void)
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".
@@ -2437,18 +2454,19 @@ set_identifier_type_value (tree id, tree type)
tree
identifier_type_value (tree id)
{
+ timevar_push (TV_NAME_LOOKUP);
/* There is no type with that name, anywhere. */
if (REAL_IDENTIFIER_TYPE_VALUE (id) == NULL_TREE)
- return 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)
- return REAL_IDENTIFIER_TYPE_VALUE (id);
+ 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, LOOKUP_COMPLAIN);
if (id)
- return TREE_TYPE (id);
- return NULL_TREE;
+ 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.
@@ -2571,6 +2589,7 @@ push_local_name (tree decl)
size_t i, nelts;
tree t, name;
+ timevar_push (TV_NAME_LOOKUP);
if (!local_names)
VARRAY_TREE_INIT (local_names, 8, "local_names");
@@ -2591,11 +2610,12 @@ push_local_name (tree decl)
DECL_DISCRIMINATOR (decl) = 1;
VARRAY_TREE (local_names, i) = decl;
- return;
+ 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.
@@ -2608,6 +2628,7 @@ pushtag (tree name, tree type, int globalize)
{
register struct cp_binding_level *b;
+ timevar_push (TV_NAME_LOOKUP);
b = current_binding_level;
while (b->tag_transparent
|| (b->parm_flag == 2
@@ -2717,6 +2738,7 @@ pushtag (tree name, tree type, int globalize)
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. */
@@ -3686,6 +3708,7 @@ pushdecl (tree x)
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 (),
@@ -3809,7 +3832,7 @@ pushdecl (tree x)
/* Check for duplicate params. */
if (duplicate_decls (x, t))
- return t;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
}
else if ((DECL_EXTERN_C_FUNCTION_P (x)
|| DECL_FUNCTION_TEMPLATE_P (x))
@@ -3822,12 +3845,12 @@ pushdecl (tree x)
TREE_TYPE (x));
/* Throw away the redeclaration. */
- return t;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
}
else if (TREE_CODE (t) != TREE_CODE (x))
{
if (duplicate_decls (x, t))
- return t;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
}
else if (duplicate_decls (x, t))
{
@@ -3836,7 +3859,7 @@ pushdecl (tree x)
else if (TREE_CODE (t) == FUNCTION_DECL)
check_default_args (t);
- return t;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
}
else if (DECL_MAIN_P (x))
{
@@ -3850,7 +3873,7 @@ pushdecl (tree x)
error ("as `%D'", x);
/* We don't try to push this declaration since that
causes a crash. */
- return x;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, x);
}
}
@@ -3868,7 +3891,7 @@ pushdecl (tree x)
{
t = push_overloaded_decl (x, PUSH_LOCAL);
if (t != x)
- return t;
+ 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
@@ -3880,7 +3903,7 @@ pushdecl (tree x)
t = push_overloaded_decl (x, PUSH_GLOBAL);
if (t == x)
add_decl_to_level (x, NAMESPACE_LEVEL (CP_DECL_CONTEXT (t)));
- return t;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
}
/* If declaring a type as a typedef, copy the type (unless we're
@@ -4119,7 +4142,7 @@ pushdecl (tree x)
? NAMESPACE_LEVEL (CP_DECL_CONTEXT (x))
: current_binding_level);
- return x;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, x);
}
/* Same as pushdecl, but define X in binding-level LEVEL. We rely on the
@@ -4131,6 +4154,7 @@ pushdecl_with_scope (tree x, struct cp_binding_level* level)
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)
{
@@ -4147,7 +4171,7 @@ pushdecl_with_scope (tree x, struct cp_binding_level* level)
current_binding_level = b;
}
current_function_decl = function_decl;
- return x;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, x);
}
/* Like pushdecl, only it places X in the current namespace,
@@ -4159,6 +4183,7 @@ pushdecl_namespace_level (tree x)
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
@@ -4192,7 +4217,7 @@ pushdecl_namespace_level (tree x)
*ptr = newval;
}
}
- return t;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
}
/* Like pushdecl, only it places X in GLOBAL_BINDING_LEVEL,
@@ -4201,10 +4226,11 @@ pushdecl_namespace_level (tree x)
tree
pushdecl_top_level (tree x)
{
+ timevar_push (TV_NAME_LOOKUP);
push_to_top_level ();
x = pushdecl_namespace_level (x);
pop_from_top_level ();
- return x;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, x);
}
/* Make the declaration of X appear in CLASS scope. */
@@ -4214,6 +4240,7 @@ pushdecl_class_level (tree x)
{
tree name;
+ timevar_push (TV_NAME_LOOKUP);
/* Get the name of X. */
if (TREE_CODE (x) == OVERLOAD)
name = DECL_NAME (get_first_fn (x));
@@ -4236,6 +4263,7 @@ pushdecl_class_level (tree x)
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
@@ -4274,10 +4302,11 @@ void
push_class_level_binding (tree name, 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)
- return;
+ 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. */
@@ -4327,7 +4356,7 @@ push_class_level_binding (tree name, tree x)
INHERITED_VALUE_BINDING_P (binding) = 0;
TREE_TYPE (shadow) = x;
IDENTIFIER_CLASS_VALUE (name) = x;
- return;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, (void)0);
}
}
@@ -4342,6 +4371,7 @@ push_class_level_binding (tree name, tree x)
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
@@ -4354,18 +4384,20 @@ push_using_decl (tree scope, tree name)
{
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)
- return namespace_bindings_p () ? decl : NULL_TREE;
+ 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;
- return decl;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
}
/* Add namespace to using_directives. Return NULL_TREE if nothing was
@@ -4378,9 +4410,10 @@ push_using_directive (tree used)
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)
- return 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))
@@ -4390,7 +4423,7 @@ push_using_directive (tree used)
ud = current_binding_level->using_directives;
ud = tree_cons (used, ancestor, ud);
current_binding_level->using_directives = ud;
- return ud;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, ud);
}
/* DECL is a FUNCTION_DECL for a non-member function, which may have
@@ -4420,6 +4453,7 @@ push_overloaded_decl (tree decl, int flags)
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
@@ -4452,7 +4486,7 @@ push_overloaded_decl (tree decl, int flags)
decl, fn);
if (duplicate_decls (decl, fn))
- return fn;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, fn);
}
}
else if (old == error_mark_node)
@@ -4462,7 +4496,7 @@ push_overloaded_decl (tree decl, int flags)
{
cp_error_at ("previous non-function declaration `%#D'", old);
error ("conflicts with function declaration `%#D'", decl);
- return decl;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
}
}
@@ -4511,7 +4545,7 @@ push_overloaded_decl (tree decl, int flags)
/* And update the CPLUS_BINDING node. */
BINDING_VALUE (IDENTIFIER_BINDING (name))
= new_binding;
- return decl;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
}
/* We should always find a previous binding in this case. */
@@ -4522,7 +4556,7 @@ push_overloaded_decl (tree decl, int flags)
push_local_binding (name, new_binding, flags);
}
- return decl;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
}
/* Generate an implicit declaration for identifier FUNCTIONID
@@ -4700,18 +4734,19 @@ lookup_label (tree id)
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));
- return NULL_TREE;
+ 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)
- return 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
@@ -4728,7 +4763,7 @@ lookup_label (tree id)
/* Now fill in the information we didn't have before. */
ent->label_decl = decl;
- return decl;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
}
/* Declare a local label named ID. */
@@ -4952,6 +4987,7 @@ define_label (const char* filename, int line, tree name)
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;
@@ -4967,7 +5003,7 @@ define_label (const char* filename, int line, tree name)
if (DECL_INITIAL (decl) != NULL_TREE)
{
error ("duplicate label `%D'", decl);
- return 0;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, 0);
}
else
{
@@ -4982,8 +5018,9 @@ define_label (const char* filename, int line, tree name)
ent->binding_level = current_binding_level;
}
check_previous_gotos (decl);
- return decl;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
}
+ timevar_pop (TV_NAME_LOOKUP);
}
struct cp_switch
@@ -5181,6 +5218,7 @@ lookup_tag (enum tree_code form,
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;
@@ -5190,7 +5228,7 @@ lookup_tag (enum tree_code form,
/* 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);
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, TREE_VALUE (tail));
}
else if (level->namespace_p)
/* Do namespace lookup. */
@@ -5216,18 +5254,18 @@ lookup_tag (enum tree_code form,
if the typedef doesn't refer to a taggable type. */
old = follow_tag_typedef (old);
if (!old)
- return NULL_TREE;
+ 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);
- return NULL_TREE;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
}
- return old;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, old);
}
if (thislevel_only || tail == global_namespace)
- return NULL_TREE;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
}
else
for (tail = level->tags; tail; tail = TREE_CHAIN (tail))
@@ -5241,9 +5279,9 @@ lookup_tag (enum tree_code form,
{
/* Definition isn't the kind we were looking for. */
error ("`%#D' redeclared as %C", TREE_VALUE (tail), form);
- return NULL_TREE;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
}
- return TREE_VALUE (tail);
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, TREE_VALUE (tail));
}
}
if (thislevel_only && ! level->tag_transparent)
@@ -5265,10 +5303,10 @@ lookup_tag (enum tree_code form,
continue;
}
else
- return NULL_TREE;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
}
}
- return NULL_TREE;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
}
/* Given a type, find the tag that was defined for it and return the tag name.
@@ -5283,6 +5321,7 @@ lookup_tag_reverse (tree type, tree name)
{
register struct cp_binding_level *level;
+ timevar_push (TV_NAME_LOOKUP);
for (level = current_binding_level; level; level = level->level_chain)
{
register tree tail;
@@ -5292,11 +5331,11 @@ lookup_tag_reverse (tree type, tree name)
{
if (name)
TREE_PURPOSE (tail) = name;
- return TREE_PURPOSE (tail);
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, TREE_PURPOSE (tail));
}
}
}
- return NULL_TREE;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
}
/* Look up NAME in the NAMESPACE. */
@@ -5307,17 +5346,18 @@ lookup_namespace_name (tree namespace, tree name)
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. */
- return name;
+ 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);
- return error_mark_node;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
}
namespace = ORIGINAL_NAMESPACE (namespace);
@@ -5336,7 +5376,7 @@ lookup_namespace_name (tree namespace, tree name)
val = make_node (CPLUS_BINDING);
if (!qualified_lookup_using_namespace (name, namespace, val, 0))
- return error_mark_node;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
if (BINDING_VALUE (val))
{
@@ -5359,7 +5399,7 @@ lookup_namespace_name (tree namespace, tree name)
{
error ("`%D::%D' is not a template",
namespace, name);
- return error_mark_node;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
}
}
@@ -5371,11 +5411,11 @@ lookup_namespace_name (tree namespace, tree name)
if (!val || !DECL_P(val)
|| !DECL_LANG_SPECIFIC(val)
|| !DECL_ANTICIPATED (val))
- return val;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, val);
}
error ("`%D' undeclared in namespace `%D'", name, namespace);
- return error_mark_node;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
}
/* Hash a TYPENAME_TYPE. K is really of type `tree'. */
@@ -5660,12 +5700,13 @@ select_decl (tree binding, int flags)
tree val;
val = BINDING_VALUE (binding);
+ timevar_push (TV_NAME_LOOKUP);
if (LOOKUP_NAMESPACES_ONLY (flags))
{
/* We are not interested in types. */
if (val && TREE_CODE (val) == NAMESPACE_DECL)
- return val;
- return NULL_TREE;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, val);
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
}
/* If we could have a type and
@@ -5680,7 +5721,7 @@ select_decl (tree binding, int flags)
|| !DECL_CLASS_TEMPLATE_P (val)))
val = NULL_TREE;
- return val;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, val);
}
/* Unscoped lookup of a global: iterate over current namespaces,
@@ -5697,6 +5738,7 @@ unqualified_namespace_lookup (tree name, int flags, tree* spacesp)
struct cp_binding_level *level;
tree val = NULL_TREE;
+ timevar_push (TV_NAME_LOOKUP);
if (spacesp)
*spacesp = NULL_TREE;
@@ -5729,7 +5771,7 @@ unqualified_namespace_lookup (tree name, int flags, tree* spacesp)
if (!lookup_using_namespace (name, b, level->using_directives,
scope, flags, spacesp))
/* Give up because of error. */
- return error_mark_node;
+ 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. */
@@ -5739,7 +5781,7 @@ unqualified_namespace_lookup (tree name, int flags, tree* spacesp)
if (!lookup_using_namespace (name, b, DECL_NAMESPACE_USING (siter),
scope, flags, spacesp))
/* Give up because of error. */
- return error_mark_node;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
if (siter == scope) break;
siter = CP_DECL_CONTEXT (siter);
}
@@ -5748,7 +5790,7 @@ unqualified_namespace_lookup (tree name, int flags, tree* spacesp)
if (scope == global_namespace)
break;
}
- return val;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, val);
}
/* Combine prefer_type and namespaces_only into flags. */
@@ -5890,6 +5932,7 @@ lookup_name_real (tree name,
tree t;
tree val = NULL_TREE;
+ timevar_push (TV_NAME_LOOKUP);
/* Conversion operators are handled specially because ordinary
unqualified name lookup will not find template conversion
operators. */
@@ -5913,10 +5956,10 @@ lookup_name_real (tree name,
class_type = level->this_class;
operators = lookup_fnfields (class_type, name, /*protect=*/0);
if (operators)
- return operators;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, operators);
}
- return NULL_TREE;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
}
flags |= lookup_flags (prefer_type, namespaces_only);
@@ -5965,7 +6008,7 @@ lookup_name_real (tree name,
val = OVL_FUNCTION (val);
}
- return val;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, val);
}
tree
@@ -5995,6 +6038,7 @@ lookup_name_current_level (tree name)
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;
@@ -6013,7 +6057,7 @@ lookup_name_current_level (tree name)
while (1)
{
if (BINDING_LEVEL (IDENTIFIER_BINDING (name)) == b)
- return IDENTIFIER_VALUE (name);
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, IDENTIFIER_VALUE (name));
if (b->keep == 2)
b = b->level_chain;
@@ -6022,7 +6066,7 @@ lookup_name_current_level (tree name)
}
}
- return t;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
}
/* Like lookup_name_current_level, but for types. */
@@ -6032,6 +6076,7 @@ lookup_type_current_level (tree name)
{
register tree t = NULL_TREE;
+ timevar_push (TV_NAME_LOOKUP);
my_friendly_assert (! current_binding_level->namespace_p, 980716);
if (REAL_IDENTIFIER_TYPE_VALUE (name) != NULL_TREE
@@ -6041,7 +6086,8 @@ lookup_type_current_level (tree name)
while (1)
{
if (purpose_member (name, b->type_shadowed))
- return REAL_IDENTIFIER_TYPE_VALUE (name);
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP,
+ REAL_IDENTIFIER_TYPE_VALUE (name));
if (b->keep == 2)
b = b->level_chain;
else
@@ -6049,7 +6095,7 @@ lookup_type_current_level (tree name)
}
}
- return t;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
}
@@ -7892,14 +7938,15 @@ make_rtl_for_nonlocal_decl (tree decl, tree init, const char* asmspec)
void
maybe_inject_for_scope_var (tree decl)
{
+ timevar_push (TV_NAME_LOOKUP);
if (!DECL_NAME (decl))
- return;
+ 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))
- return;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, (void)0);
if (current_binding_level->is_for_scope)
{
@@ -7928,6 +7975,7 @@ maybe_inject_for_scope_var (tree decl)
current_binding_level->is_for_scope = 0;
}
}
+ timevar_pop (TV_NAME_LOOKUP);
}
/* Generate code to initialize DECL (a local variable). */
@@ -12563,6 +12611,7 @@ xref_tag (enum tag_types tag_code, tree name, tree attributes,
struct cp_binding_level *b = current_binding_level;
tree context = NULL_TREE;
+ timevar_push (TV_NAME_LOOKUP);
switch (tag_code)
{
case record_type:
@@ -12765,7 +12814,7 @@ xref_tag (enum tag_types tag_code, tree name, tree attributes,
TYPE_ATTRIBUTES (ref) = attributes;
- return ref;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, ref);
}
tree
diff --git a/gcc/timevar.h b/gcc/timevar.h
index ac01a29..5d5a018 100644
--- a/gcc/timevar.h
+++ b/gcc/timevar.h
@@ -76,6 +76,9 @@ typedef enum
timevar_id_t;
#undef DEFTIMEVAR
+/* Execute the sequence: timevar_pop (TV), return (E); */
+#define POP_TIMEVAR_AND_RETURN(TV, E) return (timevar_pop (TV), (E))
+
extern void init_timevar PARAMS ((void));
extern void timevar_push PARAMS ((timevar_id_t));
extern void timevar_pop PARAMS ((timevar_id_t));