aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-streamer.c
diff options
context:
space:
mode:
authorTrevor Saunders <tsaunders@mozilla.com>2014-06-24 13:22:11 +0000
committerTrevor Saunders <tbsaunde@gcc.gnu.org>2014-06-24 13:22:11 +0000
commit1eb68d2d011dd181aca030e98ab02f29375e89da (patch)
treee42565bc6a235c9d4d379f34d53a38e7f997cb45 /gcc/tree-streamer.c
parent84baa4b968f2dbf4e85e49dba9215ad0f0f3ddc8 (diff)
downloadgcc-1eb68d2d011dd181aca030e98ab02f29375e89da.zip
gcc-1eb68d2d011dd181aca030e98ab02f29375e89da.tar.gz
gcc-1eb68d2d011dd181aca030e98ab02f29375e89da.tar.bz2
add hash_map class
gcc/ * alloc-pool.c (alloc_pool_hash): Use hash_map instead of hash_table. * dominance.c (iterate_fix_dominators): Use hash_map instead of pointer_map. * hash-map.h: New file. * ipa-comdats.c: Use hash_map instead of pointer_map. * ipa.c: Likewise. * lto-section-out.c: Adjust. * lto-streamer.h: Replace pointer_map with hash_map. * symtab.c (verify_symtab): Likewise. * tree-ssa-strlen.c (decl_to_stridxlist_htab): Likewise. * tree-ssa-uncprop.c (val_ssa_equiv): Likewise. * tree-streamer.h: Likewise. * tree-streamer.c: Adjust. * pointer-set.h: Remove pointer_map. gcc/lto/ * lto.c (canonical_type_hash_cache): Use hash_map instead of pointer_map. From-SVN: r211938
Diffstat (limited to 'gcc/tree-streamer.c')
-rw-r--r--gcc/tree-streamer.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/gcc/tree-streamer.c b/gcc/tree-streamer.c
index 517bf77..17f3045 100644
--- a/gcc/tree-streamer.c
+++ b/gcc/tree-streamer.c
@@ -28,6 +28,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-ssa-alias.h"
#include "internal-fn.h"
#include "gimple-expr.h"
+#include "hash-map.h"
#include "is-a.h"
#include "gimple.h"
#include "streamer-hooks.h"
@@ -134,13 +135,11 @@ streamer_tree_cache_insert_1 (struct streamer_tree_cache_d *cache,
tree t, hashval_t hash, unsigned *ix_p,
bool insert_at_next_slot_p)
{
- unsigned *slot;
- unsigned ix;
bool existed_p;
gcc_assert (t);
- slot = cache->node_map->insert (t, &existed_p);
+ unsigned int &ix = cache->node_map->get_or_insert (t, &existed_p);
if (!existed_p)
{
/* Determine the next slot to use in the cache. */
@@ -148,14 +147,11 @@ streamer_tree_cache_insert_1 (struct streamer_tree_cache_d *cache,
ix = cache->next_idx++;
else
ix = *ix_p;
- *slot = ix;
streamer_tree_cache_add_to_node_array (cache, ix, t, hash);
}
else
{
- ix = *slot;
-
if (!insert_at_next_slot_p && ix != *ix_p)
{
/* If the caller wants to insert T at a specific slot
@@ -163,7 +159,6 @@ streamer_tree_cache_insert_1 (struct streamer_tree_cache_d *cache,
the requested location slot. */
ix = *ix_p;
streamer_tree_cache_add_to_node_array (cache, ix, t, hash);
- *slot = ix;
}
}
@@ -231,7 +226,7 @@ streamer_tree_cache_lookup (struct streamer_tree_cache_d *cache, tree t,
gcc_assert (t);
- slot = cache->node_map->contains (t);
+ slot = cache->node_map->get (t);
if (slot == NULL)
{
retval = false;
@@ -332,7 +327,7 @@ streamer_tree_cache_create (bool with_hashes, bool with_map, bool with_vec)
cache = XCNEW (struct streamer_tree_cache_d);
if (with_map)
- cache->node_map = new pointer_map<unsigned>;
+ cache->node_map = new hash_map<tree, unsigned> (251);
cache->next_idx = 0;
if (with_vec)
cache->nodes.create (165);
@@ -356,8 +351,8 @@ streamer_tree_cache_delete (struct streamer_tree_cache_d *c)
if (c == NULL)
return;
- if (c->node_map)
- delete c->node_map;
+ delete c->node_map;
+ c->node_map = NULL;
c->nodes.release ();
c->hashes.release ();
free (c);