tree.c (count_trees): New debugging function.
authorJason Merrill <jason@redhat.com>
Thu, 15 Jun 2000 21:24:39 +0000 (17:24 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 15 Jun 2000 21:24:39 +0000 (17:24 -0400)
        * 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
gcc/cp/Makefile.in
gcc/cp/init.c
gcc/cp/optimize.c
gcc/cp/pt.c
gcc/cp/semantics.c
gcc/cp/tree.c
gcc/cp/typeck.c

index 77c788d..9dc43ee 100644 (file)
@@ -1,3 +1,15 @@
+2000-06-15  Jason Merrill  <jason@redhat.com>
+
+       * 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  <mark@codesourcery.com>
 
        * cp-tree.h (DECL_PENDING_INLINE_P): Relax checking.
index 51708f8..fa98d3b 100644 (file)
@@ -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 \
index bb07c1b..0dfa403 100644 (file)
@@ -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);
index b803627..1cf5bd7 100644 (file)
@@ -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);
     }
 }
 
index 625fc1a..6286d8f 100644 (file)
@@ -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;
 }
 
index 7d9e1da..49dc5dd 100644 (file)
@@ -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.  */
index 382e254..c890c37 100644 (file)
@@ -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
index 28ac0f3..b167c7e 100644 (file)
@@ -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