summaryrefslogtreecommitdiff
path: root/gcc/lto-section-out.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2013-06-18 14:39:57 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2013-06-18 14:39:57 +0000
commitd579fcda924739ca7e477acc8ac4602372e6e903 (patch)
tree3ed062f66c02bd2142734bd6798e53cd89f9ba6c /gcc/lto-section-out.c
parent31ee20ba67b2020f64f5068444f2b0409d128881 (diff)
Makefile.in (LTO_STREAMER_H): Add pointer-set.h dependency.
2013-06-18 Richard Biener <rguenther@suse.de> * Makefile.in (LTO_STREAMER_H): Add pointer-set.h dependency. * lto-streamer.h: Include pointer-set.h. (struct lto_decl_slot): Remove. (struct lto_tree_ref_encoder): Make tree_hash_table a pointer-map. Remove next_index entry. (lto_hash_decl_slot_node, lto_eq_decl_slot_node, lto_hash_type_slot_node, lto_eq_type_slot_node): Remove. (lto_init_tree_ref_encoder): Adjust. (lto_destroy_tree_ref_encoder): Likewise. * lto-section-out.c (lto_hash_decl_slot_node, lto_eq_decl_slot_node, lto_hash_type_slot_node, lto_eq_type_slot_node): Remove. (lto_output_decl_index): Adjust. (lto_new_out_decl_state): Likewise. (lto_record_function_out_decl_state): Likewise. * lto-streamer-out.c (copy_function): Likewise. From-SVN: r200171
Diffstat (limited to 'gcc/lto-section-out.c')
-rw-r--r--gcc/lto-section-out.c88
1 files changed, 6 insertions, 82 deletions
diff --git a/gcc/lto-section-out.c b/gcc/lto-section-out.c
index 7997c45abd9..4b4440838c5 100644
--- a/gcc/lto-section-out.c
+++ b/gcc/lto-section-out.c
@@ -48,59 +48,7 @@ static vec<lto_out_decl_state_ptr> decl_state_stack;
generate the decl directory later. */
vec<lto_out_decl_state_ptr> lto_function_decl_states;
-/* Returns a hash code for P. */
-hashval_t
-lto_hash_decl_slot_node (const void *p)
-{
- const struct lto_decl_slot *ds = (const struct lto_decl_slot *) p;
-
- /*
- return (hashval_t) DECL_UID (ds->t);
- */
- return (hashval_t) TREE_HASH (ds->t);
-}
-
-
-/* Returns nonzero if P1 and P2 are equal. */
-
-int
-lto_eq_decl_slot_node (const void *p1, const void *p2)
-{
- const struct lto_decl_slot *ds1 =
- (const struct lto_decl_slot *) p1;
- const struct lto_decl_slot *ds2 =
- (const struct lto_decl_slot *) p2;
-
- /*
- return DECL_UID (ds1->t) == DECL_UID (ds2->t);
- */
- return ds1->t == ds2->t;
-}
-
-
-/* Returns a hash code for P. */
-
-hashval_t
-lto_hash_type_slot_node (const void *p)
-{
- const struct lto_decl_slot *ds = (const struct lto_decl_slot *) p;
- return (hashval_t) TYPE_UID (ds->t);
-}
-
-
-/* Returns nonzero if P1 and P2 are equal. */
-
-int
-lto_eq_type_slot_node (const void *p1, const void *p2)
-{
- const struct lto_decl_slot *ds1 =
- (const struct lto_decl_slot *) p1;
- const struct lto_decl_slot *ds2 =
- (const struct lto_decl_slot *) p2;
-
- return TYPE_UID (ds1->t) == TYPE_UID (ds2->t);
-}
/*****************************************************************************
Output routines shared by all of the serialization passes.
@@ -278,29 +226,19 @@ lto_output_decl_index (struct lto_output_stream *obs,
tree name, unsigned int *this_index)
{
void **slot;
- struct lto_decl_slot d_slot;
int index;
bool new_entry_p = FALSE;
- d_slot.t = name;
- slot = htab_find_slot (encoder->tree_hash_table, &d_slot, INSERT);
+ slot = pointer_map_insert (encoder->tree_hash_table, name);
if (*slot == NULL)
{
- struct lto_decl_slot *new_slot
- = (struct lto_decl_slot *) xmalloc (sizeof (struct lto_decl_slot));
- index = encoder->next_index++;
-
- new_slot->t = name;
- new_slot->slot_num = index;
- *slot = new_slot;
+ index = encoder->trees.length ();
+ *slot = (void *)(uintptr_t) index;
encoder->trees.safe_push (name);
new_entry_p = TRUE;
}
else
- {
- struct lto_decl_slot *old_slot = (struct lto_decl_slot *)*slot;
- index = old_slot->slot_num;
- }
+ index = (uintptr_t) *slot;
if (obs)
streamer_write_uhwi_stream (obs, index);
@@ -440,23 +378,9 @@ lto_new_out_decl_state (void)
{
struct lto_out_decl_state *state = XCNEW (struct lto_out_decl_state);
int i;
- htab_hash hash_fn;
- htab_eq eq_fn;
for (i = 0; i < LTO_N_DECL_STREAMS; i++)
- {
- if (i == LTO_DECL_STREAM_TYPE)
- {
- hash_fn = lto_hash_type_slot_node;
- eq_fn = lto_eq_type_slot_node;
- }
- else
- {
- hash_fn = lto_hash_decl_slot_node;
- eq_fn = lto_eq_decl_slot_node;
- }
- lto_init_tree_ref_encoder (&state->streams[i], hash_fn, eq_fn);
- }
+ lto_init_tree_ref_encoder (&state->streams[i]);
return state;
}
@@ -514,7 +438,7 @@ lto_record_function_out_decl_state (tree fn_decl,
for (i = 0; i < LTO_N_DECL_STREAMS; i++)
if (state->streams[i].tree_hash_table)
{
- htab_delete (state->streams[i].tree_hash_table);
+ pointer_map_destroy (state->streams[i].tree_hash_table);
state->streams[i].tree_hash_table = NULL;
}
state->fn_decl = fn_decl;