summaryrefslogtreecommitdiff
path: root/gcc/lto-streamer.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2011-05-02 16:44:04 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2011-05-02 16:44:04 +0000
commit3ed05fdb5f910fcb79a94524aa7e469cde4d169f (patch)
tree7e48f380b12a761366bd63d9aaa630f22481114f /gcc/lto-streamer.c
parent01753b0186e363b5b44bb371e480a5159999499b (diff)
downloadgcc-3ed05fdb5f910fcb79a94524aa7e469cde4d169f.tar.gz
* lto-streamer.c (lto_streamer_cache_insert_1,
lto_streamer_cache_lookup, lto_streamer_cache_create, lto_streamer_cache_delete): Use pointer map instead of hashtable. * lto-streamer.h (lto_streamer_cache_d): Turn node_map into pointer_map. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@173259 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/lto-streamer.c')
-rw-r--r--gcc/lto-streamer.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/gcc/lto-streamer.c b/gcc/lto-streamer.c
index 80927927dcc..be54305d2c5 100644
--- a/gcc/lto-streamer.c
+++ b/gcc/lto-streamer.c
@@ -348,26 +348,20 @@ lto_streamer_cache_insert_1 (struct lto_streamer_cache_d *cache,
bool insert_at_next_slot_p)
{
void **slot;
- struct tree_int_map d_entry, *entry;
unsigned ix;
bool existed_p;
gcc_assert (t);
- d_entry.base.from = t;
- slot = htab_find_slot (cache->node_map, &d_entry, INSERT);
- if (*slot == NULL)
+ slot = pointer_map_insert (cache->node_map, t);
+ if (!*slot)
{
/* Determine the next slot to use in the cache. */
if (insert_at_next_slot_p)
ix = VEC_length (tree, cache->nodes);
else
ix = *ix_p;
-
- entry = (struct tree_int_map *)pool_alloc (cache->node_map_entries);
- entry->base.from = t;
- entry->to = ix;
- *slot = entry;
+ *slot = (void *)(size_t) (ix + 1);
lto_streamer_cache_add_to_node_array (cache, ix, t);
@@ -376,8 +370,7 @@ lto_streamer_cache_insert_1 (struct lto_streamer_cache_d *cache,
}
else
{
- entry = (struct tree_int_map *) *slot;
- ix = entry->to;
+ ix = (size_t) *slot - 1;
if (!insert_at_next_slot_p && ix != *ix_p)
{
@@ -442,14 +435,12 @@ lto_streamer_cache_lookup (struct lto_streamer_cache_d *cache, tree t,
unsigned *ix_p)
{
void **slot;
- struct tree_int_map d_slot;
bool retval;
unsigned ix;
gcc_assert (t);
- d_slot.base.from = t;
- slot = htab_find_slot (cache->node_map, &d_slot, NO_INSERT);
+ slot = pointer_map_contains (cache->node_map, t);
if (slot == NULL)
{
retval = false;
@@ -458,7 +449,7 @@ lto_streamer_cache_lookup (struct lto_streamer_cache_d *cache, tree t,
else
{
retval = true;
- ix = ((struct tree_int_map *) *slot)->to;
+ ix = (size_t) *slot - 1;
}
if (ix_p)
@@ -608,11 +599,7 @@ lto_streamer_cache_create (void)
cache = XCNEW (struct lto_streamer_cache_d);
- cache->node_map = htab_create (101, tree_int_map_hash, tree_int_map_eq, NULL);
-
- cache->node_map_entries = create_alloc_pool ("node map",
- sizeof (struct tree_int_map),
- 100);
+ cache->node_map = pointer_map_create ();
/* Load all the well-known tree nodes that are always created by
the compiler on startup. This prevents writing them out
@@ -636,8 +623,7 @@ lto_streamer_cache_delete (struct lto_streamer_cache_d *c)
if (c == NULL)
return;
- htab_delete (c->node_map);
- free_alloc_pool (c->node_map_entries);
+ pointer_map_destroy (c->node_map);
VEC_free (tree, heap, c->nodes);
free (c);
}