diff options
author | Lawrence Crowl <crowl@google.com> | 2012-10-09 21:21:36 +0000 |
---|---|---|
committer | Lawrence Crowl <crowl@gcc.gnu.org> | 2012-10-09 21:21:36 +0000 |
commit | 703c8606fa58f4c827deda50f641da57294cc78e (patch) | |
tree | 6b83efb5a5d730e31c6760ce9e20be32071b13a4 /gcc/cp/semantics.c | |
parent | aa4723d7f56dd0c690c514b50c917c827a3d56dd (diff) | |
download | gcc-703c8606fa58f4c827deda50f641da57294cc78e.zip gcc-703c8606fa58f4c827deda50f641da57294cc78e.tar.gz gcc-703c8606fa58f4c827deda50f641da57294cc78e.tar.bz2 |
Change more non-GTY hash tables to use the new type-safe template hash table.
Constify member function parameters that can be const.
Correct a couple of expressions in formerly uninstantiated templates.
The new code is 0.362% faster in bootstrap, with a 99.5% confidence of
being faster.
Tested on x86-64.
Index: gcc/java/ChangeLog
2012-10-01 Lawrence Crowl <crowl@google.com>
* Make-lang.in (JAVA_OBJS): Add dependence on hash-table.o.
(JCFDUMP_OBJS): Add dependence on hash-table.o.
(jcf-io.o): Add dependence on hash-table.h.
* jcf-io.c (memoized_class_lookups): Change to use type-safe hash table.
Index: gcc/c/ChangeLog
2012-10-09 Lawrence Crowl <crowl@google.com>
* Make-lang.in (c-decl.o): Add dependence on hash-table.h.
* c-decl.c (detect_field_duplicates_hash): Change to new type-safe
hash table.
Index: gcc/objc/ChangeLog
2012-10-01 Lawrence Crowl <crowl@google.com>
* Make-lang.in (OBJC_OBJS): Add dependence on hash-table.o.
(objc-act.o): Add dependence on hash-table.h.
* objc-act.c (objc_detect_field_duplicates): Change to new type-safe
hash table.
Index: gcc/ChangeLog
2012-10-09 Lawrence Crowl <crowl@google.com>
* Makefile.in (fold-const.o): Add depencence on hash-table.h.
(dse.o): Likewise.
(cfg.o): Likewise.
* fold-const.c (fold_checksum_tree): Change to new type-safe hash table.
* (print_fold_checksum): Likewise.
* cfg.c (var bb_original): Likewise.
* (var bb_copy): Likewise.
* (var loop_copy): Likewise.
* hash-table.h (template hash_table): Constify parameters for find...
and remove_elt... member functions.
(hash_table::empty) Correct size expression.
(hash_table::clear_slot) Correct deleted entry assignment.
* dse.c (var rtx_group_table): Change to new type-safe hash table.
Index: gcc/cp/ChangeLog
2012-10-09 Lawrence Crowl <crowl@google.com>
* Make-lang.in (class.o): Add dependence on hash-table.h.
(tree.o): Likewise.
(semantics.o): Likewise.
* class.c (fixed_type_or_null): Change to new type-safe hash table.
* tree.c (verify_stmt_tree): Likewise.
(verify_stmt_tree_r): Likewise.
* semantics.c (struct nrv_data): Likewise.
From-SVN: r192273
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r-- | gcc/cp/semantics.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 4b06f30..4beed00 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -43,6 +43,7 @@ along with GCC; see the file COPYING3. If not see #include "target.h" #include "gimple.h" #include "bitmap.h" +#include "hash-table.h" /* There routines provide a modular interface to perform many parsing operations. They may therefore be used during actual parsing, or @@ -3837,7 +3838,7 @@ struct nrv_data { tree var; tree result; - htab_t visited; + hash_table <pointer_hash <tree_node> > visited; }; /* Helper function for walk_tree, used by finalize_nrv below. */ @@ -3846,7 +3847,7 @@ static tree finalize_nrv_r (tree* tp, int* walk_subtrees, void* data) { struct nrv_data *dp = (struct nrv_data *)data; - void **slot; + tree_node **slot; /* No need to walk into types. There wouldn't be any need to walk into non-statements, except that we have to consider STMT_EXPRs. */ @@ -3885,7 +3886,7 @@ finalize_nrv_r (tree* tp, int* walk_subtrees, void* data) /* Avoid walking into the same tree more than once. Unfortunately, we can't just use walk_tree_without duplicates because it would only call us for the first occurrence of dp->var in the function body. */ - slot = htab_find_slot (dp->visited, *tp, INSERT); + slot = dp->visited.find_slot (*tp, INSERT); if (*slot) *walk_subtrees = 0; else @@ -3917,9 +3918,9 @@ finalize_nrv (tree *tp, tree var, tree result) data.var = var; data.result = result; - data.visited = htab_create (37, htab_hash_pointer, htab_eq_pointer, NULL); + data.visited.create (37); cp_walk_tree (tp, finalize_nrv_r, &data, 0); - htab_delete (data.visited); + data.visited.dispose (); } /* Create CP_OMP_CLAUSE_INFO for clause C. Returns true if it is invalid. */ |