diff options
author | Richard Biener <rguenther@suse.de> | 2013-06-18 14:39:57 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2013-06-18 14:39:57 +0000 |
commit | d579fcda924739ca7e477acc8ac4602372e6e903 (patch) | |
tree | 3ed062f66c02bd2142734bd6798e53cd89f9ba6c | |
parent | 31ee20ba67b2020f64f5068444f2b0409d128881 (diff) | |
download | gcc-d579fcda924739ca7e477acc8ac4602372e6e903.zip gcc-d579fcda924739ca7e477acc8ac4602372e6e903.tar.gz gcc-d579fcda924739ca7e477acc8ac4602372e6e903.tar.bz2 |
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
-rw-r--r-- | gcc/ChangeLog | 18 | ||||
-rw-r--r-- | gcc/Makefile.in | 2 | ||||
-rw-r--r-- | gcc/lto-section-out.c | 88 | ||||
-rw-r--r-- | gcc/lto-streamer-out.c | 2 | ||||
-rw-r--r-- | gcc/lto-streamer.h | 26 |
5 files changed, 32 insertions, 104 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4f0abd3..7e771b5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,23 @@ 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. * cgraphunit.c: Include cfgloop.h. (init_lowered_empty_function): Initialize the loop tree. diff --git a/gcc/Makefile.in b/gcc/Makefile.in index ea18292..d5121f3 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -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) diff --git a/gcc/lto-section-out.c b/gcc/lto-section-out.c index 7997c45..4b44408 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; diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c index b59bc8f..8fe7bd8 100644 --- a/gcc/lto-streamer-out.c +++ b/gcc/lto-streamer-out.c @@ -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, diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h index 58a7f58..a3e2918 100644 --- a/gcc/lto-streamer.h +++ b/gcc/lto-streamer.h @@ -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 (); } |