Convert tree-vectorizer.h'_loop_vec_info::peeling_htab from htab_t
to hash_table.
* tree-vectorizer.h
New struct peel_info_hasher.
* tree-vect-loop.c
Update dependent calls and types to match.
* tree-vect-data-refs.c
Fold vect_peeling_hash and vect_peeling_hash_eq into struct peel_info_hasher.
Update dependent calls and types to match.
Tested on x86_64.
Okay for branch?
Index: gcc/tree-vectorizer.h
===
--- gcc/tree-vectorizer.h (revision 194381)
+++ gcc/tree-vectorizer.h (working copy)
@@ -192,6 +192,30 @@ typedef struct _vect_peel_extended_info
stmt_vector_for_cost body_cost_vec;
} *vect_peel_extended_info;
+
+/* Peeling hashtable helpers. */
+
+struct peel_info_hasher : typed_free_remove _vect_peel_info
+{
+ typedef _vect_peel_info value_type;
+ typedef _vect_peel_info compare_type;
+ static inline hashval_t hash (const value_type *);
+ static inline bool equal (const value_type *, const compare_type *);
+};
+
+inline hashval_t
+peel_info_hasher::hash (const value_type *peel_info)
+{
+ return (hashval_t) peel_info-npeel;
+}
+
+inline bool
+peel_info_hasher::equal (const value_type *a, const compare_type *b)
+{
+ return (a-npeel == b-npeel);
+}
+
+
/*-*/
/* Info on vectorized loops. */
/*-*/
@@ -276,7 +300,7 @@ typedef struct _loop_vec_info {
vecgimple reduction_chains;
/* Hash table used to choose the best peeling option. */
- htab_t peeling_htab;
+ hash_table peel_info_hasher peeling_htab;
/* Cost data used by the target cost model. */
void *target_cost_data;
Index: gcc/tree-vect-loop.c
===
--- gcc/tree-vect-loop.c(revision 194381)
+++ gcc/tree-vect-loop.c(working copy)
@@ -874,7 +874,6 @@ new_loop_vec_info (struct loop *loop)
LOOP_VINFO_REDUCTION_CHAINS (res).create (10);
LOOP_VINFO_SLP_INSTANCES (res).create (10);
LOOP_VINFO_SLP_UNROLLING_FACTOR (res) = 1;
- LOOP_VINFO_PEELING_HTAB (res) = NULL;
LOOP_VINFO_TARGET_COST_DATA (res) = init_cost (loop);
LOOP_VINFO_PEELING_FOR_GAPS (res) = false;
LOOP_VINFO_OPERANDS_SWAPPED (res) = false;
@@ -969,8 +968,8 @@ destroy_loop_vec_info (loop_vec_info loo
LOOP_VINFO_REDUCTIONS (loop_vinfo).release ();
LOOP_VINFO_REDUCTION_CHAINS (loop_vinfo).release ();
- if (LOOP_VINFO_PEELING_HTAB (loop_vinfo))
-htab_delete (LOOP_VINFO_PEELING_HTAB (loop_vinfo));
+ if (LOOP_VINFO_PEELING_HTAB (loop_vinfo).is_created ())
+LOOP_VINFO_PEELING_HTAB (loop_vinfo).dispose ();
destroy_cost_data (LOOP_VINFO_TARGET_COST_DATA (loop_vinfo));
Index: gcc/Makefile.in
===
--- gcc/Makefile.in (revision 194381)
+++ gcc/Makefile.in (working copy)
@@ -967,7 +967,8 @@ GIMPLE_STREAMER_H = gimple-streamer.h $(
TREE_STREAMER_H = tree-streamer.h $(TREE_H) $(LTO_STREAMER_H) \
$(STREAMER_HOOKS_H)
STREAMER_HOOKS_H = streamer-hooks.h $(TREE_H)
-TREE_VECTORIZER_H = tree-vectorizer.h $(TREE_DATA_REF_H) $(TARGET_H)
+TREE_VECTORIZER_H = tree-vectorizer.h $(TREE_DATA_REF_H) $(TARGET_H) \
+ $(HASH_TABLE_H)
IPA_PROP_H = ipa-prop.h $(TREE_H) $(VEC_H) $(CGRAPH_H) $(GIMPLE_H) alloc-pool.h
IPA_INLINE_H = ipa-inline.h $(IPA_PROP_H)
GSTAB_H = gstab.h stab.def
Index: gcc/tree-vect-data-refs.c
===
--- gcc/tree-vect-data-refs.c (revision 194381)
+++ gcc/tree-vect-data-refs.c (working copy)
@@ -1275,27 +1275,6 @@ vect_get_data_access_cost (struct data_r
}
-static hashval_t
-vect_peeling_hash (const void *elem)
-{
- const struct _vect_peel_info *peel_info;
-
- peel_info = (const struct _vect_peel_info *) elem;
- return (hashval_t) peel_info-npeel;
-}
-
-
-static int
-vect_peeling_hash_eq (const void *elem1, const void *elem2)
-{
- const struct _vect_peel_info *a, *b;
-
- a = (const struct _vect_peel_info *) elem1;
- b = (const struct _vect_peel_info *) elem2;
- return (a-npeel == b-npeel);
-}
-
-
/* Insert DR into peeling hash table with NPEEL as key. */
static void
@@ -1303,12 +1282,11 @@ vect_peeling_hash_insert (loop_vec_info
int npeel)
{
struct _vect_peel_info elem, *slot;
- void **new_slot;
+ _vect_peel_info **new_slot;
bool supportable_dr_alignment = vect_supportable_dr_alignment (dr, true);
elem.npeel = npeel;
- slot = (vect_peel_info) htab_find (LOOP_VINFO_PEELING_HTAB (loop_vinfo),
- elem);
+ slot = LOOP_VINFO_PEELING_HTAB (loop_vinfo).find (elem);
if (slot)
slot-count++;
else
@@ -1317,8 +1295,7 @@ vect_peeling_hash_insert (loop_vec_info
slot-npeel = npeel;
slot-dr = dr;
slot-count = 1;
- new_slot = htab_find_slot