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
This commit is contained in:
parent
31ee20ba67
commit
d579fcda92
|
@ -1,3 +1,21 @@
|
|||
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.
|
||||
|
||||
2013-06-18 Richard Biener <rguenther@suse.de>
|
||||
|
||||
* Makefile.in (cgraphunit.o): Add $(CFGLOOP_H) dependency.
|
||||
|
|
|
@ -967,7 +967,7 @@ LRA_INT_H = lra.h $(BITMAP_H) $(RECOG_H) $(INSN_ATTR_H) insn-codes.h \
|
|||
DBGCNT_H = dbgcnt.h dbgcnt.def
|
||||
LTO_STREAMER_H = lto-streamer.h $(LINKER_PLUGIN_API_H) $(TARGET_H) \
|
||||
$(CGRAPH_H) $(VEC_H) $(HASH_TABLE_H) $(TREE_H) $(GIMPLE_H) \
|
||||
$(GCOV_IO_H) $(DIAGNOSTIC_H) alloc-pool.h
|
||||
$(GCOV_IO_H) $(DIAGNOSTIC_H) alloc-pool.h pointer-set.h
|
||||
DATA_STREAMER_H = data-streamer.h $(VEC_H) $(LTO_STREAMER_H)
|
||||
GIMPLE_STREAMER_H = gimple-streamer.h $(LTO_STREAMER_H) $(BASIC_BLOCK_H) \
|
||||
$(FUNCTION_H)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1922,9 +1922,9 @@ copy_function (struct cgraph_node *node)
|
|||
So just copy the vector. All the encoders in the in state
|
||||
must be empty where we reach here. */
|
||||
gcc_assert (lto_tree_ref_encoder_size (encoder) == 0);
|
||||
encoder->trees.reserve_exact (n);
|
||||
for (j = 0; j < n; j++)
|
||||
encoder->trees.safe_push (trees[j]);
|
||||
encoder->next_index = n;
|
||||
}
|
||||
|
||||
lto_free_section_data (file_data, LTO_section_function_body, name,
|
||||
|
|
|
@ -33,6 +33,7 @@ along with GCC; see the file COPYING3. If not see
|
|||
#include "alloc-pool.h"
|
||||
#include "gcov-io.h"
|
||||
#include "diagnostic.h"
|
||||
#include "pointer-set.h"
|
||||
|
||||
/* Define when debugging the LTO streamer. This causes the writer
|
||||
to output the numeric value for the memory address of the tree node
|
||||
|
@ -474,21 +475,12 @@ struct GTY(()) lto_tree_ref_table
|
|||
};
|
||||
|
||||
|
||||
/* Mapping between trees and slots in an array. */
|
||||
struct lto_decl_slot
|
||||
{
|
||||
tree t;
|
||||
int slot_num;
|
||||
};
|
||||
|
||||
|
||||
/* The lto_tree_ref_encoder struct is used to encode trees into indices. */
|
||||
|
||||
struct lto_tree_ref_encoder
|
||||
{
|
||||
htab_t tree_hash_table; /* Maps pointers to indices. */
|
||||
unsigned int next_index; /* Next available index. */
|
||||
vec<tree> trees; /* Maps indices to pointers. */
|
||||
pointer_map_t *tree_hash_table; /* Maps pointers to indices. */
|
||||
vec<tree> trees; /* Maps indices to pointers. */
|
||||
};
|
||||
|
||||
|
||||
|
@ -788,10 +780,6 @@ extern void lto_value_range_error (const char *,
|
|||
HOST_WIDE_INT) ATTRIBUTE_NORETURN;
|
||||
|
||||
/* In lto-section-out.c */
|
||||
extern hashval_t lto_hash_decl_slot_node (const void *);
|
||||
extern int lto_eq_decl_slot_node (const void *, const void *);
|
||||
extern hashval_t lto_hash_type_slot_node (const void *);
|
||||
extern int lto_eq_type_slot_node (const void *, const void *);
|
||||
extern void lto_begin_section (const char *, bool);
|
||||
extern void lto_end_section (void);
|
||||
extern void lto_write_stream (struct lto_output_stream *);
|
||||
|
@ -1007,11 +995,9 @@ lto_tag_check_range (enum LTO_tags actual, enum LTO_tags tag1,
|
|||
|
||||
/* Initialize an lto_out_decl_buffer ENCODER. */
|
||||
static inline void
|
||||
lto_init_tree_ref_encoder (struct lto_tree_ref_encoder *encoder,
|
||||
htab_hash hash_fn, htab_eq eq_fn)
|
||||
lto_init_tree_ref_encoder (struct lto_tree_ref_encoder *encoder)
|
||||
{
|
||||
encoder->tree_hash_table = htab_create (37, hash_fn, eq_fn, free);
|
||||
encoder->next_index = 0;
|
||||
encoder->tree_hash_table = pointer_map_create ();
|
||||
encoder->trees.create (0);
|
||||
}
|
||||
|
||||
|
@ -1023,7 +1009,7 @@ lto_destroy_tree_ref_encoder (struct lto_tree_ref_encoder *encoder)
|
|||
{
|
||||
/* Hash table may be delete already. */
|
||||
if (encoder->tree_hash_table)
|
||||
htab_delete (encoder->tree_hash_table);
|
||||
pointer_map_destroy (encoder->tree_hash_table);
|
||||
encoder->trees.release ();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue