+2011-05-02 Jan Hubicka <jh@suse.cz>
+
+ * 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.
+
2011-05-02 Joseph Myers <joseph@codesourcery.com>
* config/m68k/genopt.sh, config/m68k/m68k-isas.def,
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);
}
else
{
- entry = (struct tree_int_map *) *slot;
- ix = entry->to;
+ ix = (size_t) *slot - 1;
if (!insert_at_next_slot_p && ix != *ix_p)
{
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;
else
{
retval = true;
- ix = ((struct tree_int_map *) *slot)->to;
+ ix = (size_t) *slot - 1;
}
if (ix_p)
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
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);
}