aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorGabriel Dos Reis <gdr@integrable-solutions.net>2003-02-14 06:04:41 +0000
committerGabriel Dos Reis <gdr@gcc.gnu.org>2003-02-14 06:04:41 +0000
commitfd295cb213e665379353d4e7b32f8bdcd8df7ade (patch)
tree493575f55d880c051f09fca60d6cad6d860f7535 /gcc
parentddb0ae00a2fefc266ad0cd0fa12de4368c23e97a (diff)
downloadgcc-fd295cb213e665379353d4e7b32f8bdcd8df7ade.zip
gcc-fd295cb213e665379353d4e7b32f8bdcd8df7ade.tar.gz
gcc-fd295cb213e665379353d4e7b32f8bdcd8df7ade.tar.bz2
decl2.c: Include "timevar.h".
* decl2.c: Include "timevar.h". (namespace_ancestor): Time name lookup. (add_using_namespace): Likewise. (lookup_using_namespace): Likewise. (qualified_lookup_using_namespace): Likewise. (decl_namespace): Likewise. (lookup_arg_dependent): Likewise. * lex.c (do_identifier): Likewise. (do_scoped_id): Likewise. * pt.c (lookup_template_class): Likewise. From-SVN: r62892
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog13
-rw-r--r--gcc/cp/decl2.c27
-rw-r--r--gcc/cp/lex.c19
-rw-r--r--gcc/cp/pt.c20
4 files changed, 53 insertions, 26 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a420d29..f5b9be2 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,16 @@
+2003-02-13 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * decl2.c: Include "timevar.h".
+ (namespace_ancestor): Time name lookup.
+ (add_using_namespace): Likewise.
+ (lookup_using_namespace): Likewise.
+ (qualified_lookup_using_namespace): Likewise.
+ (decl_namespace): Likewise.
+ (lookup_arg_dependent): Likewise.
+ * lex.c (do_identifier): Likewise.
+ (do_scoped_id): Likewise.
+ * pt.c (lookup_template_class): Likewise.
+
2003-02-14 Andrew Pinski <pinskia@physics.uc.edu>
* decl.c: (define_label): Fix warning for return 0 instead of NULL.
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 63240dd..0ee4dd3 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -3364,9 +3364,11 @@ is_namespace_ancestor (tree root, tree child)
tree
namespace_ancestor (tree ns1, tree ns2)
{
+ timevar_push (TV_NAME_LOOKUP);
if (is_namespace_ancestor (ns1, ns2))
- return ns1;
- return namespace_ancestor (CP_DECL_CONTEXT (ns1), ns2);
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, ns1);
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP,
+ namespace_ancestor (CP_DECL_CONTEXT (ns1), ns2));
}
/* Insert USED into the using list of USER. Set INDIRECT_flag if this
@@ -3376,9 +3378,10 @@ static void
add_using_namespace (tree user, tree used, bool indirect)
{
tree t;
+ timevar_push (TV_NAME_LOOKUP);
/* Using oneself is a no-op. */
if (user == used)
- return;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, (void)0);
my_friendly_assert (TREE_CODE (user) == NAMESPACE_DECL, 380);
my_friendly_assert (TREE_CODE (used) == NAMESPACE_DECL, 380);
/* Check if we already have this. */
@@ -3388,7 +3391,7 @@ add_using_namespace (tree user, tree used, bool indirect)
if (!indirect)
/* Promote to direct usage. */
TREE_INDIRECT_USING (t) = 0;
- return;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, (void)0);
}
/* Add used to the user's using list. */
@@ -3410,6 +3413,7 @@ add_using_namespace (tree user, tree used, bool indirect)
/* Tell everyone using us about the new used namespaces. */
for (t = DECL_NAMESPACE_USERS (user); t; t = TREE_CHAIN (t))
add_using_namespace (TREE_PURPOSE (t), used, 1);
+ timevar_pop (TV_NAME_LOOKUP);
}
/* Combines two sets of overloaded functions into an OVERLOAD chain, removing
@@ -3551,6 +3555,7 @@ lookup_using_namespace (tree name, tree val, tree usings, tree scope,
{
tree iter;
tree val1;
+ timevar_push (TV_NAME_LOOKUP);
/* Iterate over all used namespaces in current, searching for using
directives of scope. */
for (iter = usings; iter; iter = TREE_CHAIN (iter))
@@ -3563,7 +3568,8 @@ lookup_using_namespace (tree name, tree val, tree usings, tree scope,
/* Resolve ambiguities. */
val = ambiguous_decl (name, val, val1, flags);
}
- return BINDING_VALUE (val) != error_mark_node;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP,
+ BINDING_VALUE (val) != error_mark_node);
}
/* [namespace.qual]
@@ -3580,6 +3586,7 @@ qualified_lookup_using_namespace (tree name, tree scope, tree result,
/* ... and a list of namespace yet to see. */
tree todo = NULL_TREE;
tree usings;
+ timevar_push (TV_NAME_LOOKUP);
/* Look through namespace aliases. */
scope = ORIGINAL_NAMESPACE (scope);
while (scope && (result != error_mark_node))
@@ -3603,7 +3610,7 @@ qualified_lookup_using_namespace (tree name, tree scope, tree result,
else
scope = NULL_TREE; /* If there never was a todo list. */
}
- return result != error_mark_node;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, result != error_mark_node);
}
/* [namespace.memdef]/2 */
@@ -3670,19 +3677,20 @@ set_decl_namespace (tree decl, tree scope, bool friendp)
static tree
decl_namespace (tree decl)
{
+ timevar_push (TV_NAME_LOOKUP);
if (TYPE_P (decl))
decl = TYPE_STUB_DECL (decl);
while (DECL_CONTEXT (decl))
{
decl = DECL_CONTEXT (decl);
if (TREE_CODE (decl) == NAMESPACE_DECL)
- return decl;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
if (TYPE_P (decl))
decl = TYPE_STUB_DECL (decl);
my_friendly_assert (DECL_P (decl), 390);
}
- return global_namespace;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, global_namespace);
}
/* Return the namespace where the current declaration is declared. */
@@ -4064,6 +4072,7 @@ lookup_arg_dependent (tree name, tree fns, tree args)
struct arg_lookup k;
tree fn = NULL_TREE;
+ timevar_push (TV_NAME_LOOKUP);
k.name = name;
k.functions = fns;
k.classes = NULL_TREE;
@@ -4078,7 +4087,7 @@ lookup_arg_dependent (tree name, tree fns, tree args)
unqualified_namespace_lookup (name, 0, &k.namespaces);
arg_assoc_args (&k, args);
- return k.functions;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, k.functions);
}
/* Process a namespace-alias declaration. */
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index 5749fc4..774ed10 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -746,6 +746,7 @@ do_identifier (token, args)
{
register tree id;
+ timevar_push (TV_NAME_LOOKUP);
id = lookup_name (token, 0);
/* Do Koenig lookup if appropriate (inside templates we build lookup
@@ -765,21 +766,22 @@ do_identifier (token, args)
being used as a declarator. So we call it again to get the error
message. */
id = lookup_name (token, 0);
- return error_mark_node;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
}
if (!id || (TREE_CODE (id) == FUNCTION_DECL
&& DECL_ANTICIPATED (id)))
{
if (current_template_parms)
- return build_min_nt (LOOKUP_EXPR, token);
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP,
+ build_min_nt (LOOKUP_EXPR, token));
else if (IDENTIFIER_TYPENAME_P (token))
/* A templated conversion operator might exist. */
- return token;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, token);
else
{
unqualified_name_lookup_error (token);
- return error_mark_node;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
}
}
@@ -815,7 +817,7 @@ do_identifier (token, args)
|| TREE_CODE (id) == USING_DECL))
id = build_min_nt (LOOKUP_EXPR, token);
- return id;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, id);
}
tree
@@ -823,6 +825,7 @@ do_scoped_id (token, id)
tree token;
tree id;
{
+ timevar_push (TV_NAME_LOOKUP);
if (!id || (TREE_CODE (id) == FUNCTION_DECL
&& DECL_ANTICIPATED (id)))
{
@@ -830,7 +833,7 @@ do_scoped_id (token, id)
{
id = build_min_nt (LOOKUP_EXPR, token);
LOOKUP_EXPR_GLOBAL (id) = 1;
- return id;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, id);
}
if (IDENTIFIER_NAMESPACE_VALUE (token) != error_mark_node)
error ("`::%D' undeclared (first use here)", token);
@@ -861,11 +864,11 @@ do_scoped_id (token, id)
{
id = build_min_nt (LOOKUP_EXPR, token);
LOOKUP_EXPR_GLOBAL (id) = 1;
- return id;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, id);
}
/* else just use the decl */
}
- return convert_from_reference (id);
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, convert_from_reference (id));
}
tree
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index e3e0211..cd2e896 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -4031,6 +4031,7 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain)
tree template = NULL_TREE, parmlist;
tree t;
+ timevar_push (TV_NAME_LOOKUP);
if (TREE_CODE (d1) == IDENTIFIER_NODE)
{
if (IDENTIFIER_VALUE (d1)
@@ -4086,7 +4087,7 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain)
{
if (complain & tf_error)
error ("`%T' is not a template", d1);
- return error_mark_node;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
}
if (TREE_CODE (template) != TEMPLATE_DECL
@@ -4102,7 +4103,7 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain)
if (in_decl)
cp_error_at ("for template declaration `%D'", in_decl);
}
- return error_mark_node;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
}
if (DECL_TEMPLATE_TEMPLATE_PARM_P (template))
@@ -4137,10 +4138,10 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain)
arglist2 = coerce_template_parms (parmlist, arglist, template,
complain, /*require_all_args=*/1);
if (arglist2 == error_mark_node)
- return error_mark_node;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
parm = bind_template_template_parm (TREE_TYPE (template), arglist2);
- return parm;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, parm);
}
else
{
@@ -4227,7 +4228,7 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain)
if (arglist == error_mark_node)
/* We were unable to bind the arguments. */
- return error_mark_node;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
/* In the scope of a template class, explicit references to the
template class refer to the type of the template, not any
@@ -4264,7 +4265,7 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain)
}
}
if (found)
- return found;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, found);
for (tp = &DECL_TEMPLATE_INSTANTIATIONS (template);
*tp;
@@ -4280,7 +4281,7 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain)
= DECL_TEMPLATE_INSTANTIATIONS (template);
DECL_TEMPLATE_INSTANTIATIONS (template) = found;
- return TREE_VALUE (found);
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, TREE_VALUE (found));
}
/* This type is a "partial instantiation" if any of the template
@@ -4296,7 +4297,7 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain)
found = xref_tag_from_type (TREE_TYPE (template),
DECL_NAME (template),
/*globalize=*/1);
- return found;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, found);
}
context = tsubst (DECL_CONTEXT (template), arglist,
@@ -4452,8 +4453,9 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain)
code that generates debugging information will crash. */
DECL_IGNORED_P (TYPE_STUB_DECL (t)) = 1;
- return t;
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
}
+ timevar_pop (TV_NAME_LOOKUP);
}
struct pair_fn_data