Hello,
This patch is random cleanups on the vtable-verify code.
OK for trunk?
Ciao!
Steven
gcc/
* vtable-verify.h (verify_vtbl_ptr_fndecl): Add GTY markers.
(num_vtable_map_nodes): Remove extern declaration.
(vtbl_mangled_name_types, vtbl_mangled_name_ids): Likewise.
* vtable-verify.c (num_vtable_map_nodes): Make static.
(vtbl_mangled_name_types, vtbl_mangled_name_ids): Likewise.
(verify_vtbl_ptr_fndecl): Remove redundant extern declaration.
cp/
* vtable-class-hierarchy.c (vtable_find_or_create_map_decl):
Make static.
(vtv_compute_class_hierarchy_transitive_closure): Eliminate uses of
num_vtable_map_nodes in lieu of vtbl_map_nodes_vec.length() and of
vtbl_map_nodes_vec.iterate().
(guess_num_vtable_pointers, register_all_pairs,
write_out_vtv_count_data, vtv_register_class_hierarchy_information,
vtv_generate_init_routine): Likewise.
gcc/
* vtable-verify.h (verify_vtbl_ptr_fndecl): Add GTY markers.
(num_vtable_map_nodes): Remove extern declaration.
(vtbl_mangled_name_types, vtbl_mangled_name_ids): Likewise.
* vtable-verify.c (num_vtable_map_nodes): Make static.
(vtbl_mangled_name_types, vtbl_mangled_name_ids): Likewise.
(verify_vtbl_ptr_fndecl): Remove redundant extern declaration.
cp/
* vtable-class-hierarchy.c (vtable_find_or_create_map_decl):
Make static.
(vtv_compute_class_hierarchy_transitive_closure): Eliminate uses of
num_vtable_map_nodes in lieu of vtbl_map_nodes_vec.length() and of
vtbl_map_nodes_vec.iterate().
(guess_num_vtable_pointers, register_all_pairs,
write_out_vtv_count_data, vtv_register_class_hierarchy_information,
vtv_generate_init_routine): Likewise.
Index: vtable-verify.h
===
--- vtable-verify.h (revision 235623)
+++ vtable-verify.h (working copy)
@@ -27,12 +27,8 @@ along with GCC; see the file COPYING3. If not see
be global because it needs to be initialized in the C++ front end, but
used in the middle end (in the vtable verification pass). */
-extern tree verify_vtbl_ptr_fndecl;
+extern GTY(()) tree verify_vtbl_ptr_fndecl;
-/* Global variable keeping track of how many vtable map variables we
- have created. */
-extern unsigned num_vtable_map_nodes;
-
/* Keep track of how many virtual calls we are actually verifying. */
extern int total_num_virtual_calls;
extern int total_num_verified_vcalls;
@@ -127,10 +123,6 @@ extern bool vtv_debug;
/* The global vector of vtbl_map_nodes. */
extern vec vtbl_map_nodes_vec;
-/* The global vectors for mangled class names for anonymous classes. */
-extern GTY(()) vec *vtbl_mangled_name_types;
-extern GTY(()) vec *vtbl_mangled_name_ids;
-
extern void vtbl_register_mangled_name (tree, tree);
extern struct vtbl_map_node *vtbl_map_get_node (tree);
extern struct vtbl_map_node *find_or_create_vtbl_map_node (tree);
Index: vtable-verify.c
===
--- vtable-verify.c (revision 235623)
+++ vtable-verify.c (working copy)
@@ -144,11 +144,13 @@ along with GCC; see the file COPYING3. If not see
#include "vtable-verify.h"
-unsigned num_vtable_map_nodes = 0;
+/* Global variable keeping track of how many vtable map variables we
+ have created. */
+static unsigned num_vtable_map_nodes = 0;
+
int total_num_virtual_calls = 0;
int total_num_verified_vcalls = 0;
-extern GTY(()) tree verify_vtbl_ptr_fndecl;
tree verify_vtbl_ptr_fndecl = NULL_TREE;
/* Keep track of whether or not any virtual call were verified. */
@@ -305,10 +307,8 @@ static vtbl_map_table_type *vtbl_map_hash;
vec vtbl_map_nodes_vec;
/* Vector of mangled names for anonymous classes. */
-extern GTY(()) vec *vtbl_mangled_name_types;
-extern GTY(()) vec *vtbl_mangled_name_ids;
-vec *vtbl_mangled_name_types;
-vec *vtbl_mangled_name_ids;
+static GTY(()) vec *vtbl_mangled_name_types;
+static GTY(()) vec *vtbl_mangled_name_ids;
/* Look up class_type (a type decl for record types) in the
vtbl_mangled_names_*
vectors. This is a linear lookup. Return the associated mangled name for
Index: cp/vtable-class-hierarchy.c
===
--- cp/vtable-class-hierarchy.c (revision 235623)
+++ cp/vtable-class-hierarchy.c (working copy)
@@ -137,8 +137,6 @@ struct work_node {
struct work_node *next;
};
-struct vtbl_map_node *vtable_find_or_create_map_decl (tree);
-
/* As part of vtable verification the compiler generates and inserts
calls to __VLTVerifyVtablePointer, which is in libstdc++. This
function builds and initializes the function decl that is used
@@ -380,7 +378,7 @@ void
vtv_compute_class_hierarchy_transitive_closure (void)
{
struct work_node *worklist = NULL;
- sbitmap inserted = sbitmap_alloc (num_vtable_map_nodes);
+ sbitmap inserted = sbitmap_allo