diff options
author | Trevor Saunders <tsaunders@mozilla.com> | 2014-06-24 13:21:53 +0000 |
---|---|---|
committer | Trevor Saunders <tbsaunde@gcc.gnu.org> | 2014-06-24 13:21:53 +0000 |
commit | 84baa4b968f2dbf4e85e49dba9215ad0f0f3ddc8 (patch) | |
tree | 8527b8e2f9f9bb9c3a525567a8e393965e2ad66c /gcc/tree-ssa-reassoc.c | |
parent | c203e8a73b2f12a1da52a16a0c4a50e62b42445b (diff) | |
download | gcc-84baa4b968f2dbf4e85e49dba9215ad0f0f3ddc8.zip gcc-84baa4b968f2dbf4e85e49dba9215ad0f0f3ddc8.tar.gz gcc-84baa4b968f2dbf4e85e49dba9215ad0f0f3ddc8.tar.bz2 |
allow storing values directly in hash tables
gcc/
* hash-table.h: Add a template arg to choose between storing values
and storing pointers to values, and then provide partial
specializations for both.
* tree-browser.c (tree_upper_hasher): Provide the type the hash table
should store, not the type values should point to.
* tree-into-ssa.c (var_info_hasher): Likewise.
* tree-ssa-dom.c (expr_elt_hasher): Likewise.
* tree-complex.c: Adjust.
* tree-hasher.h (int_tree_hasher): store int_tree_map in the hash
table instead of int_tree_map *.
* tree-parloops.c: Adjust.
* tree-ssa-reassoc.c (ocount_hasher): Don't lie to hash_map about what
type is being stored.
* tree-vectorizer.c: Adjust.
From-SVN: r211937
Diffstat (limited to 'gcc/tree-ssa-reassoc.c')
-rw-r--r-- | gcc/tree-ssa-reassoc.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index 4d0d6c2..4903f48 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -1023,32 +1023,36 @@ static vec<oecount> cvec; /* Oecount hashtable helpers. */ -struct oecount_hasher : typed_noop_remove <void> +struct oecount_hasher { - /* Note that this hash table stores integers, not pointers. - So, observe the casting in the member functions. */ - typedef void value_type; - typedef void compare_type; - static inline hashval_t hash (const value_type *); - static inline bool equal (const value_type *, const compare_type *); + typedef int value_type; + typedef int compare_type; + typedef int store_values_directly; + static inline hashval_t hash (const value_type &); + static inline bool equal (const value_type &, const compare_type &); + static bool is_deleted (int &v) { return v == 1; } + static void mark_deleted (int &e) { e = 1; } + static bool is_empty (int &v) { return v == 0; } + static void mark_empty (int &e) { e = 0; } + static void remove (int &) {} }; /* Hash function for oecount. */ inline hashval_t -oecount_hasher::hash (const value_type *p) +oecount_hasher::hash (const value_type &p) { - const oecount *c = &cvec[(size_t)p - 42]; + const oecount *c = &cvec[p - 42]; return htab_hash_pointer (c->op) ^ (hashval_t)c->oecode; } /* Comparison function for oecount. */ inline bool -oecount_hasher::equal (const value_type *p1, const compare_type *p2) +oecount_hasher::equal (const value_type &p1, const compare_type &p2) { - const oecount *c1 = &cvec[(size_t)p1 - 42]; - const oecount *c2 = &cvec[(size_t)p2 - 42]; + const oecount *c1 = &cvec[p1 - 42]; + const oecount *c2 = &cvec[p2 - 42]; return (c1->oecode == c2->oecode && c1->op == c2->op); } @@ -1473,23 +1477,23 @@ undistribute_ops_list (enum tree_code opcode, FOR_EACH_VEC_ELT (subops[i], j, oe1) { oecount c; - void **slot; - size_t idx; + int *slot; + int idx; c.oecode = oecode; c.cnt = 1; c.id = next_oecount_id++; c.op = oe1->op; cvec.safe_push (c); idx = cvec.length () + 41; - slot = ctable.find_slot ((void *)idx, INSERT); + slot = ctable.find_slot (idx, INSERT); if (!*slot) { - *slot = (void *)idx; + *slot = idx; } else { cvec.pop (); - cvec[(size_t)*slot - 42].cnt++; + cvec[*slot - 42].cnt++; } } } |