aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorLawrence Crowl <crowl@google.com>2012-10-09 21:21:36 +0000
committerLawrence Crowl <crowl@gcc.gnu.org>2012-10-09 21:21:36 +0000
commit703c8606fa58f4c827deda50f641da57294cc78e (patch)
tree6b83efb5a5d730e31c6760ce9e20be32071b13a4 /gcc/c
parentaa4723d7f56dd0c690c514b50c917c827a3d56dd (diff)
downloadgcc-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/c')
-rw-r--r--gcc/c/ChangeLog6
-rw-r--r--gcc/c/Make-lang.in2
-rw-r--r--gcc/c/c-decl.c16
3 files changed, 16 insertions, 8 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 2a3f9a0..dfe76e6 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,9 @@
+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.
+
2012-10-09 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/54194
diff --git a/gcc/c/Make-lang.in b/gcc/c/Make-lang.in
index 93b8f64..0340d0d 100644
--- a/gcc/c/Make-lang.in
+++ b/gcc/c/Make-lang.in
@@ -162,7 +162,7 @@ c/c-decl.o : c/c-decl.c c/c-lang.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TREE_H) $(C_TREE_H) $(GGC_H) $(TARGET_H) $(FLAGS_H) $(FUNCTION_H) \
output.h debug.h toplev.h intl.h $(TM_P_H) $(TREE_INLINE_H) \
$(TIMEVAR_H) $(OPTS_H) $(C_PRAGMA_H) gt-c-c-decl.h $(CGRAPH_H) \
- $(HASHTAB_H) $(LANGHOOKS_DEF_H) \
+ $(HASH_TABLE_H) $(LANGHOOKS_DEF_H) \
dumpfile.h $(C_COMMON_H) $(CPPLIB_H) $(DIAGNOSTIC_CORE_H) \
$(INPUT_H) langhooks.h pointer-set.h tree-iterator.h \
$(PLUGIN_H) c-family/c-ada-spec.h c-family/c-objc.h
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index a4a8108..80867ca 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -53,7 +53,7 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic-core.h"
#include "dumpfile.h"
#include "cgraph.h"
-#include "hashtab.h"
+#include "hash-table.h"
#include "langhooks-def.h"
#include "pointer-set.h"
#include "plugin.h"
@@ -6895,15 +6895,16 @@ is_duplicate_field (tree x, tree y)
to HTAB, giving errors for any duplicates. */
static void
-detect_field_duplicates_hash (tree fieldlist, htab_t htab)
+detect_field_duplicates_hash (tree fieldlist,
+ hash_table <pointer_hash <tree_node> > htab)
{
tree x, y;
- void **slot;
+ tree_node **slot;
for (x = fieldlist; x ; x = DECL_CHAIN (x))
if ((y = DECL_NAME (x)) != 0)
{
- slot = htab_find_slot (htab, y, INSERT);
+ slot = htab.find_slot (y, INSERT);
if (*slot)
{
error ("duplicate member %q+D", x);
@@ -6923,7 +6924,7 @@ detect_field_duplicates_hash (tree fieldlist, htab_t htab)
&& TREE_CODE (TYPE_NAME (TREE_TYPE (x))) == TYPE_DECL)
{
tree xn = DECL_NAME (TYPE_NAME (TREE_TYPE (x)));
- slot = htab_find_slot (htab, xn, INSERT);
+ slot = htab.find_slot (xn, INSERT);
if (*slot)
error ("duplicate member %q+D", TYPE_NAME (TREE_TYPE (x)));
*slot = xn;
@@ -6995,10 +6996,11 @@ detect_field_duplicates (tree fieldlist)
}
else
{
- htab_t htab = htab_create (37, htab_hash_pointer, htab_eq_pointer, NULL);
+ hash_table <pointer_hash <tree_node> > htab;
+ htab.create (37);
detect_field_duplicates_hash (fieldlist, htab);
- htab_delete (htab);
+ htab.dispose ();
}
}