diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2018-07-31 14:21:56 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2018-07-31 14:21:56 +0000 |
commit | dbe1b846648fad29d105e2e503120a4279a32593 (patch) | |
tree | 802554bcedd96fbe606d76e35cf2b1dc4d319c9d /gcc/tree-vectorizer.h | |
parent | 0d0a4e205bb6da84e9218c483acf7b13453f0698 (diff) | |
download | gcc-dbe1b846648fad29d105e2e503120a4279a32593.zip gcc-dbe1b846648fad29d105e2e503120a4279a32593.tar.gz gcc-dbe1b846648fad29d105e2e503120a4279a32593.tar.bz2 |
[10/46] Temporarily make stmt_vec_info a class
This patch turns stmt_vec_info into an unspeakably bad wrapper class
and adds an implicit conversion to the associated gimple stmt.
Having this conversion makes the rest of the series easier to write,
but since the class goes away again at the end of the series, I've
not bothered adding any comments or tried to make it pretty.
2018-07-31 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* tree-vectorizer.h (stmt_vec_info): Temporarily change from
a typedef to a wrapper class.
(NULL_STMT_VEC_INFO): New macro.
(vec_info::stmt_infos): Change to vec<stmt_vec_info>.
(stmt_vec_info::operator*): New function.
(stmt_vec_info::operator gimple *): Likewise.
(set_vinfo_for_stmt): Use NULL_STMT_VEC_INFO.
(add_stmt_costs): Likewise.
* tree-vect-loop-manip.c (iv_phi_p): Likewise.
* tree-vect-loop.c (vect_compute_single_scalar_iteration_cost)
(vect_get_known_peeling_cost): Likewise.
(vect_estimate_min_profitable_iters): Likewise.
* tree-vect-patterns.c (vect_init_pattern_stmt): Likewise.
* tree-vect-slp.c (vect_remove_slp_scalar_calls): Likewise.
* tree-vect-stmts.c (vect_build_gather_load_calls): Likewise.
(vectorizable_store, free_stmt_vec_infos): Likewise.
(new_stmt_vec_info): Change return type of xcalloc to
_stmt_vec_info *.
From-SVN: r263125
Diffstat (limited to 'gcc/tree-vectorizer.h')
-rw-r--r-- | gcc/tree-vectorizer.h | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index cbec2fb..31d2db4 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -21,12 +21,31 @@ along with GCC; see the file COPYING3. If not see #ifndef GCC_TREE_VECTORIZER_H #define GCC_TREE_VECTORIZER_H +class stmt_vec_info { +public: + stmt_vec_info () {} + stmt_vec_info (struct _stmt_vec_info *ptr) : m_ptr (ptr) {} + struct _stmt_vec_info *operator-> () const { return m_ptr; } + struct _stmt_vec_info &operator* () const; + operator struct _stmt_vec_info * () const { return m_ptr; } + operator gimple * () const; + operator void * () const { return m_ptr; } + operator bool () const { return m_ptr; } + bool operator == (const stmt_vec_info &x) { return x.m_ptr == m_ptr; } + bool operator == (_stmt_vec_info *x) { return x == m_ptr; } + bool operator != (const stmt_vec_info &x) { return x.m_ptr != m_ptr; } + bool operator != (_stmt_vec_info *x) { return x != m_ptr; } + +private: + struct _stmt_vec_info *m_ptr; +}; + +#define NULL_STMT_VEC_INFO (stmt_vec_info (NULL)) + #include "tree-data-ref.h" #include "tree-hash-traits.h" #include "target.h" -typedef struct _stmt_vec_info *stmt_vec_info; - /* Used for naming of new temporaries. */ enum vect_var_kind { vect_simple_var, @@ -229,7 +248,7 @@ struct vec_info { vec_info_shared *shared; /* The mapping of GIMPLE UID to stmt_vec_info. */ - vec<struct _stmt_vec_info *> stmt_vec_infos; + vec<stmt_vec_info> stmt_vec_infos; /* All SLP instances. */ auto_vec<slp_instance> slp_instances; @@ -1052,6 +1071,17 @@ STMT_VINFO_BB_VINFO (stmt_vec_info stmt_vinfo) && TYPE_PRECISION (TYPE) == 1 \ && TYPE_UNSIGNED (TYPE))) +inline _stmt_vec_info & +stmt_vec_info::operator* () const +{ + return *m_ptr; +} + +inline stmt_vec_info::operator gimple * () const +{ + return m_ptr ? m_ptr->stmt : NULL; +} + extern vec<stmt_vec_info> *stmt_vec_info_vec; void set_stmt_vec_info_vec (vec<stmt_vec_info> *); @@ -1084,7 +1114,7 @@ set_vinfo_for_stmt (gimple *stmt, stmt_vec_info info) } else { - gcc_checking_assert (info == NULL); + gcc_checking_assert (info == NULL_STMT_VEC_INFO); (*stmt_vec_info_vec)[uid - 1] = info; } } @@ -1261,7 +1291,9 @@ add_stmt_costs (void *data, stmt_vector_for_cost *cost_vec) unsigned i; FOR_EACH_VEC_ELT (*cost_vec, i, cost) add_stmt_cost (data, cost->count, cost->kind, - cost->stmt ? vinfo_for_stmt (cost->stmt) : NULL, + (cost->stmt + ? vinfo_for_stmt (cost->stmt) + : NULL_STMT_VEC_INFO), cost->misalign, cost->where); } |