aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2010-04-07 11:54:29 -0400
committerJason Merrill <jason@gcc.gnu.org>2010-04-07 11:54:29 -0400
commit7dcfe861f19429326f0b82c4fdccd7d7088ae68b (patch)
treea13ecfb3333a065f6e429635e65a28609a892cae /gcc
parent2401726e18691dec7144312cb531aa9e11ca8240 (diff)
downloadgcc-7dcfe861f19429326f0b82c4fdccd7d7088ae68b.zip
gcc-7dcfe861f19429326f0b82c4fdccd7d7088ae68b.tar.gz
gcc-7dcfe861f19429326f0b82c4fdccd7d7088ae68b.tar.bz2
pt.c (print_template_statistics): New.
* pt.c (print_template_statistics): New. * cp-tree.h: Declare it. * tree.c (cxx_print_statistics): Call it. From-SVN: r158072
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/cp-tree.h1
-rw-r--r--gcc/cp/pt.c15
-rw-r--r--gcc/cp/tree.c1
4 files changed, 21 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a6e6f3a..d3b0788 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2010-04-07 Jason Merrill <jason@redhat.com>
+ * pt.c (print_template_statistics): New.
+ * cp-tree.h: Declare it.
+ * tree.c (cxx_print_statistics): Call it.
+
PR c++/41970
* decl.c (grokvardecl): Tweak warning message.
(grokfndecl): Likewise.
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 6334673..1350619 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -4975,6 +4975,7 @@ extern void pop_tinst_level (void);
extern struct tinst_level *outermost_tinst_level(void);
extern bool parameter_of_template_p (tree, tree);
extern void init_template_processing (void);
+extern void print_template_statistics (void);
bool template_template_parameter_p (const_tree);
extern bool primary_template_instantiation_p (const_tree);
extern tree get_primary_template_innermost_parameters (const_tree);
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 13bb5aa..d1c33d6 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -18554,4 +18554,19 @@ init_template_processing (void)
ggc_free);
}
+/* Print stats about the template hash tables for -fstats. */
+
+void
+print_template_statistics (void)
+{
+ fprintf (stderr, "decl_specializations: size %ld, %ld elements, "
+ "%f collisions\n", (long) htab_size (decl_specializations),
+ (long) htab_elements (decl_specializations),
+ htab_collisions (decl_specializations));
+ fprintf (stderr, "type_specializations: size %ld, %ld elements, "
+ "%f collisions\n", (long) htab_size (type_specializations),
+ (long) htab_elements (type_specializations),
+ htab_collisions (type_specializations));
+}
+
#include "gt-cp-pt.h"
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 35b0da6..27ced53 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -1664,6 +1664,7 @@ cxx_print_statistics (void)
{
print_search_statistics ();
print_class_statistics ();
+ print_template_statistics ();
#ifdef GATHER_STATISTICS
fprintf (stderr, "maximum template instantiation depth reached: %d\n",
depth_reached);