Commit 7dcfe861 by Jason Merrill Committed by Jason Merrill

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
parent 2401726e
2010-04-07 Jason Merrill <jason@redhat.com> 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 PR c++/41970
* decl.c (grokvardecl): Tweak warning message. * decl.c (grokvardecl): Tweak warning message.
(grokfndecl): Likewise. (grokfndecl): Likewise.
......
...@@ -4975,6 +4975,7 @@ extern void pop_tinst_level (void); ...@@ -4975,6 +4975,7 @@ extern void pop_tinst_level (void);
extern struct tinst_level *outermost_tinst_level(void); extern struct tinst_level *outermost_tinst_level(void);
extern bool parameter_of_template_p (tree, tree); extern bool parameter_of_template_p (tree, tree);
extern void init_template_processing (void); extern void init_template_processing (void);
extern void print_template_statistics (void);
bool template_template_parameter_p (const_tree); bool template_template_parameter_p (const_tree);
extern bool primary_template_instantiation_p (const_tree); extern bool primary_template_instantiation_p (const_tree);
extern tree get_primary_template_innermost_parameters (const_tree); extern tree get_primary_template_innermost_parameters (const_tree);
......
...@@ -18554,4 +18554,19 @@ init_template_processing (void) ...@@ -18554,4 +18554,19 @@ init_template_processing (void)
ggc_free); 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" #include "gt-cp-pt.h"
...@@ -1664,6 +1664,7 @@ cxx_print_statistics (void) ...@@ -1664,6 +1664,7 @@ cxx_print_statistics (void)
{ {
print_search_statistics (); print_search_statistics ();
print_class_statistics (); print_class_statistics ();
print_template_statistics ();
#ifdef GATHER_STATISTICS #ifdef GATHER_STATISTICS
fprintf (stderr, "maximum template instantiation depth reached: %d\n", fprintf (stderr, "maximum template instantiation depth reached: %d\n",
depth_reached); depth_reached);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment