From 297a5329dca4f22150ec201d48b8de8a730f6447 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 15 Jun 2000 17:24:39 -0400 Subject: [PATCH] tree.c (count_trees): New debugging function. * tree.c (count_trees): New debugging function. * typeck.c (build_x_function_call): Use DECL_FUNCTION_TEMPLATE_P. * init.c (build_member_call): Pull out the name of a DECL. * Makefile.in (semantics.o, pt.o): Depend on TIMEVAR_H. * semantics.c (expand_body): Push to TV_INTEGRATION here. * optimize.c (optimize_function): Not here. * pt.c (instantiate_decl): Push to TV_PARSE. From-SVN: r34568 --- gcc/cp/ChangeLog | 12 ++++++++++++ gcc/cp/Makefile.in | 3 ++- gcc/cp/init.c | 3 +++ gcc/cp/optimize.c | 5 ----- gcc/cp/pt.c | 5 +++++ gcc/cp/semantics.c | 5 ++++- gcc/cp/tree.c | 24 ++++++++++++++++++++++++ gcc/cp/typeck.c | 2 +- 8 files changed, 51 insertions(+), 8 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 77c788d..9dc43ee 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,15 @@ +2000-06-15 Jason Merrill + + * tree.c (count_trees): New debugging function. + + * typeck.c (build_x_function_call): Use DECL_FUNCTION_TEMPLATE_P. + * init.c (build_member_call): Pull out the name of a DECL. + + * Makefile.in (semantics.o, pt.o): Depend on TIMEVAR_H. + * semantics.c (expand_body): Push to TV_INTEGRATION here. + * optimize.c (optimize_function): Not here. + * pt.c (instantiate_decl): Push to TV_PARSE. + 2000-06-15 Mark Mitchell * cp-tree.h (DECL_PENDING_INLINE_P): Relax checking. diff --git a/gcc/cp/Makefile.in b/gcc/cp/Makefile.in index 51708f8..fa98d3b 100644 --- a/gcc/cp/Makefile.in +++ b/gcc/cp/Makefile.in @@ -211,6 +211,7 @@ PARSE_C = $(srcdir)/parse.c EXPR_H = $(srcdir)/../expr.h ../insn-codes.h GGC_H = $(srcdir)/../ggc.h $(srcdir)/../varray.h HTAB_H = $(srcdir)/../../include/hashtab.h +TIMEVAR_H = $(srcdir)/../timevar.h $(srcdir)/../timevar.def parse.o : $(PARSE_C) $(CXX_TREE_H) $(srcdir)/../flags.h lex.h \ $(srcdir)/../except.h $(srcdir)/../output.h $(srcdir)/../system.h \ @@ -306,7 +307,7 @@ repo.o : repo.c $(CXX_TREE_H) \ semantics.o: semantics.c $(CXX_TREE_H) lex.h \ $(srcdir)/../except.h $(srcdir)/../toplev.h \ $(srcdir)/../flags.h $(GGC_H) \ - $(srcdir)/../output.h $(RTL_H) + $(srcdir)/../output.h $(RTL_H) $(TIMEVAR_H) dump.o: dump.c $(CXX_TREE_H) optimize.o: optimize.c $(CXX_TREE_H) \ $(srcdir)/../rtl.h $(srcdir)/../integrate.h ../insn-config.h \ diff --git a/gcc/cp/init.c b/gcc/cp/init.c index bb07c1b..0dfa403 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -1470,6 +1470,9 @@ build_member_call (type, name, parmlist) return build_x_function_call (name, parmlist, current_class_ref); } + if (DECL_P (name)) + name = DECL_NAME (name); + if (type == std_node) return build_x_function_call (do_scoped_id (name, 0), parmlist, current_class_ref); diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c index b803627..1cf5bd7 100644 --- a/gcc/cp/optimize.c +++ b/gcc/cp/optimize.c @@ -28,7 +28,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "input.h" #include "integrate.h" #include "varray.h" -#include "timevar.h" /* To Do: @@ -810,8 +809,6 @@ optimize_function (fn) tree prev_fn; struct saved_scope *s; - timevar_push (TV_INTEGRATION); - /* Clear out ID. */ memset (&id, 0, sizeof (id)); @@ -842,8 +839,6 @@ optimize_function (fn) /* Clean up. */ VARRAY_FREE (id.fns); VARRAY_FREE (id.target_exprs); - - timevar_pop (TV_INTEGRATION); } } diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 625fc1a..6286d8f 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -44,6 +44,7 @@ Boston, MA 02111-1307, USA. */ #include "defaults.h" #include "ggc.h" #include "hashtab.h" +#include "timevar.h" /* The type of functions taking a tree, and some additional data, and returning an int. */ @@ -9530,6 +9531,8 @@ instantiate_decl (d, defer_ok) if (! push_tinst_level (d)) return d; + timevar_push (TV_PARSE); + /* Set TD to the template whose DECL_TEMPLATE_RESULT is the pattern for the instantiation. This is not always the most general template. Consider, for example: @@ -9721,6 +9724,8 @@ out: pop_from_top_level (); pop_tinst_level (); + timevar_pop (TV_PARSE); + return d; } diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 7d9e1da..49dc5dd 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2789,11 +2789,14 @@ expand_body (fn) return; } - timevar_push (TV_EXPAND); + timevar_push (TV_INTEGRATION); /* Optimize the body of the function before expanding it. */ optimize_function (fn); + timevar_pop (TV_INTEGRATION); + timevar_push (TV_EXPAND); + /* Save the current file name and line number. When we expand the body of the function, we'll set LINENO and INPUT_FILENAME so that error-mesages come out in the right places. */ diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 382e254..c890c37 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -1396,6 +1396,30 @@ walk_tree (tp, func, data) #undef WALK_SUBTREE } +int n_trees; + +static tree +count_trees_r (tp, walk_subtrees, data) + tree *tp ATTRIBUTE_UNUSED; + int *walk_subtrees ATTRIBUTE_UNUSED; + void *data ATTRIBUTE_UNUSED; +{ + ++n_trees; + return NULL_TREE; +} + +/* Debugging function for measuring the rough complexity of a tree + representation. */ + +int +count_trees (t) + tree t; +{ + n_trees = 0; + walk_tree (&t, count_trees_r, NULL); + return n_trees; +} + /* Passed to walk_tree. Checks for the use of types with no linkage. */ static tree diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 28ac0f3..b167c7e 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -2578,7 +2578,7 @@ build_x_function_call (function, params, decl) if ((TREE_CODE (function) == FUNCTION_DECL && DECL_STATIC_FUNCTION_P (function)) - || (TREE_CODE (function) == TEMPLATE_DECL + || (DECL_FUNCTION_TEMPLATE_P (function) && DECL_STATIC_FUNCTION_P (DECL_TEMPLATE_RESULT (function)))) return build_member_call (DECL_CONTEXT (function), template_id -- 2.7.4