diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c index db45740da3cba14a3552f9446651e8f289187fbb..3bacd5c827e1a6436c5916022c04e0d6594c316a 100644 --- a/gcc/tree-vect-patterns.c +++ b/gcc/tree-vect-patterns.c @@ -5169,7 +5169,7 @@ const unsigned int NUM_PATTERNS = ARRAY_SIZE (vect_vect_recog_func_ptrs); /* Mark statements that are involved in a pattern. */ -static inline void +void vect_mark_pattern_stmts (vec_info *vinfo, stmt_vec_info orig_stmt_info, gimple *pattern_stmt, tree pattern_vectype) diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index bf8ea4326597f4211d2772e9db60aa69285b5998..01189d44d892fc42b132bbb7de1c471df45518ae 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -86,7 +86,7 @@ _slp_tree::~_slp_tree () /* Recursively free the memory allocated for the SLP tree rooted at NODE. */ -static void +void vect_free_slp_tree (slp_tree node) { int i; @@ -1120,45 +1120,6 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap, return true; } -/* Traits for the hash_set to record failed SLP builds for a stmt set. - Note we never remove apart from at destruction time so we do not - need a special value for deleted that differs from empty. */ -struct bst_traits -{ - typedef vec value_type; - typedef vec compare_type; - static inline hashval_t hash (value_type); - static inline bool equal (value_type existing, value_type candidate); - static inline bool is_empty (value_type x) { return !x.exists (); } - static inline bool is_deleted (value_type x) { return !x.exists (); } - static const bool empty_zero_p = true; - static inline void mark_empty (value_type &x) { x.release (); } - static inline void mark_deleted (value_type &x) { x.release (); } - static inline void remove (value_type &x) { x.release (); } -}; -inline hashval_t -bst_traits::hash (value_type x) -{ - inchash::hash h; - for (unsigned i = 0; i < x.length (); ++i) - h.add_int (gimple_uid (x[i]->stmt)); - return h.end (); -} -inline bool -bst_traits::equal (value_type existing, value_type candidate) -{ - if (existing.length () != candidate.length ()) - return false; - for (unsigned i = 0; i < existing.length (); ++i) - if (existing[i] != candidate[i]) - return false; - return true; -} - -typedef hash_map , slp_tree, - simple_hashmap_traits > - scalar_stmts_to_slp_tree_map_t; - static slp_tree vect_build_slp_tree_2 (vec_info *vinfo, vec stmts, unsigned int group_size, @@ -1166,7 +1127,7 @@ vect_build_slp_tree_2 (vec_info *vinfo, bool *matches, unsigned *npermutes, unsigned *tree_size, scalar_stmts_to_slp_tree_map_t *bst_map); -static slp_tree +slp_tree vect_build_slp_tree (vec_info *vinfo, vec stmts, unsigned int group_size, poly_uint64 *max_nunits, diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index 2ebcf9f9926ec7175f28391f172800499bbc59db..79926f1a43534635ddca85556a928e364022c40a 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -2047,6 +2047,9 @@ extern int vect_get_place_in_interleaving_chain (stmt_vec_info, stmt_vec_info); extern bool vect_update_shared_vectype (stmt_vec_info, tree); /* In tree-vect-patterns.c. */ +extern void +vect_mark_pattern_stmts (vec_info *, stmt_vec_info, gimple *, tree); + /* Pattern recognition functions. Additional pattern recognition functions can (and will) be added in the future. */ @@ -2058,4 +2061,51 @@ void vect_free_loop_info_assumptions (class loop *); gimple *vect_loop_vectorized_call (class loop *, gcond **cond = NULL); bool vect_stmt_dominates_stmt_p (gimple *, gimple *); +/* Traits for the hash_set to record failed SLP builds for a stmt set. + Note we never remove apart from at destruction time so we do not + need a special value for deleted that differs from empty. */ +struct bst_traits +{ + typedef vec value_type; + typedef vec compare_type; + static inline hashval_t hash (value_type); + static inline bool equal (value_type existing, value_type candidate); + static inline bool is_empty (value_type x) { return !x.exists (); } + static inline bool is_deleted (value_type x) { return !x.exists (); } + static const bool empty_zero_p = true; + static inline void mark_empty (value_type &x) { x.release (); } + static inline void mark_deleted (value_type &x) { x.release (); } + static inline void remove (value_type &x) { x.release (); } +}; +inline hashval_t +bst_traits::hash (value_type x) +{ + inchash::hash h; + for (unsigned i = 0; i < x.length (); ++i) + h.add_int (gimple_uid (x[i]->stmt)); + return h.end (); +} +inline bool +bst_traits::equal (value_type existing, value_type candidate) +{ + if (existing.length () != candidate.length ()) + return false; + for (unsigned i = 0; i < existing.length (); ++i) + if (existing[i] != candidate[i]) + return false; + return true; +} + +typedef hash_map , slp_tree, + simple_hashmap_traits > + scalar_stmts_to_slp_tree_map_t; + +extern void +vect_free_slp_tree (slp_tree node); + +slp_tree +vect_build_slp_tree (vec_info *, vec, unsigned int, + poly_uint64 *, bool *, unsigned *, unsigned *, + scalar_stmts_to_slp_tree_map_t *); + #endif /* GCC_TREE_VECTORIZER_H */