summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2010-04-07 15:54:29 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2010-04-07 15:54:29 +0000
commita9f5259f080a1c114a6de06f2ec67730e4e50f13 (patch)
treea13ecfb3333a065f6e429635e65a28609a892cae
parent5f8e000d9979223bf654d46ba7d844468490f472 (diff)
downloadppe42-gcc-a9f5259f080a1c114a6de06f2ec67730e4e50f13.tar.gz
ppe42-gcc-a9f5259f080a1c114a6de06f2ec67730e4e50f13.zip
* pt.c (print_template_statistics): New.
* cp-tree.h: Declare it. * tree.c (cxx_print_statistics): Call it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158072 138bc75d-0d04-0410-961f-82ee72b054a4
-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 a6e6f3a85e8..d3b0788218d 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 63346736cf6..1350619057a 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 13bb5aadf4d..d1c33d65277 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 35b0da62ea5..27ced53a2b4 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);
OpenPOWER on IntegriCloud