This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
(C++) patch to add count_trees
- To: gcc-patches at gcc dot gnu dot org
- Subject: (C++) patch to add count_trees
- From: Jason Merrill <jason at redhat dot com>
- Date: Thu, 15 Jun 2000 14:23:38 -0700
Useful for measuring the effects of tree inlining.
2000-06-15 Jason Merrill <jason@redhat.com>
* tree.c (count_trees): New debugging function.
Index: tree.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/tree.c,v
retrieving revision 1.202
diff -c -p -r1.202 tree.c
*** tree.c 2000/06/05 10:49:11 1.202
--- tree.c 2000/06/15 21:19:02
*************** walk_tree (tp, func, data)
*** 1396,1401 ****
--- 1396,1422 ----
#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;
+ }
+
+ int
+ count_trees (tp)
+ tree *tp;
+ {
+ n_trees = 0;
+ walk_tree (tp, count_trees_r, NULL);
+ return n_trees;
+ }
+
/* Passed to walk_tree. Checks for the use of types with no linkage. */
static tree