Commit ddf98a96 by Richard Sandiford Committed by Richard Sandiford

[46/46] Turn stmt_vec_info back into a typedef

This patch removes the stmt_vec_info wrapper class added near the
beginning of the series and turns stmt_vec_info back into a typedef.

2018-07-31  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* tree-vectorizer.h (stmt_vec_info): Turn back into a typedef.
	(NULL_STMT_VEC_INFO): Delete.
	(stmt_vec_info::operator*): Likewise.
	(stmt_vec_info::operator gimple *): Likewise.
	* tree-vect-loop.c (vectorizable_reduction): Use NULL instead
	of NULL_STMT_VEC_INFO.
	* tree-vect-patterns.c (vect_init_pattern_stmt): Likewise.
	(vect_reassociating_reduction_p): Likewise.
	* tree-vect-stmts.c (vect_build_gather_load_calls): Likewise.
	(vectorizable_store): Likewise.
	* tree-vectorizer.c (vec_info::set_vinfo_for_stmt): Likewise.
	(vec_info::free_stmt_vec_infos): Likewise.

From-SVN: r263161
parent dddecc5c
2018-07-31 Richard Sandiford <richard.sandiford@arm.com> 2018-07-31 Richard Sandiford <richard.sandiford@arm.com>
* tree-vectorizer.h (stmt_vec_info): Turn back into a typedef.
(NULL_STMT_VEC_INFO): Delete.
(stmt_vec_info::operator*): Likewise.
(stmt_vec_info::operator gimple *): Likewise.
* tree-vect-loop.c (vectorizable_reduction): Use NULL instead
of NULL_STMT_VEC_INFO.
* tree-vect-patterns.c (vect_init_pattern_stmt): Likewise.
(vect_reassociating_reduction_p): Likewise.
* tree-vect-stmts.c (vect_build_gather_load_calls): Likewise.
(vectorizable_store): Likewise.
* tree-vectorizer.c (vec_info::set_vinfo_for_stmt): Likewise.
(vec_info::free_stmt_vec_infos): Likewise.
2018-07-31 Richard Sandiford <richard.sandiford@arm.com>
* tree-vectorizer.h (vect_stmt_in_region_p): Delete. * tree-vectorizer.h (vect_stmt_in_region_p): Delete.
* tree-vectorizer.c (vect_stmt_in_region_p): Likewise. * tree-vectorizer.c (vect_stmt_in_region_p): Likewise.
......
...@@ -6755,7 +6755,7 @@ vectorizable_reduction (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, ...@@ -6755,7 +6755,7 @@ vectorizable_reduction (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
if (slp_node) if (slp_node)
neutral_op = neutral_op_for_slp_reduction neutral_op = neutral_op_for_slp_reduction
(slp_node_instance->reduc_phis, code, (slp_node_instance->reduc_phis, code,
REDUC_GROUP_FIRST_ELEMENT (stmt_info) != NULL_STMT_VEC_INFO); REDUC_GROUP_FIRST_ELEMENT (stmt_info) != NULL);
if (double_reduc && reduction_type == FOLD_LEFT_REDUCTION) if (double_reduc && reduction_type == FOLD_LEFT_REDUCTION)
{ {
......
...@@ -104,7 +104,7 @@ vect_init_pattern_stmt (gimple *pattern_stmt, stmt_vec_info orig_stmt_info, ...@@ -104,7 +104,7 @@ vect_init_pattern_stmt (gimple *pattern_stmt, stmt_vec_info orig_stmt_info,
{ {
vec_info *vinfo = orig_stmt_info->vinfo; vec_info *vinfo = orig_stmt_info->vinfo;
stmt_vec_info pattern_stmt_info = vinfo->lookup_stmt (pattern_stmt); stmt_vec_info pattern_stmt_info = vinfo->lookup_stmt (pattern_stmt);
if (pattern_stmt_info == NULL_STMT_VEC_INFO) if (pattern_stmt_info == NULL)
pattern_stmt_info = orig_stmt_info->vinfo->add_stmt (pattern_stmt); pattern_stmt_info = orig_stmt_info->vinfo->add_stmt (pattern_stmt);
gimple_set_bb (pattern_stmt, gimple_bb (orig_stmt_info->stmt)); gimple_set_bb (pattern_stmt, gimple_bb (orig_stmt_info->stmt));
...@@ -819,7 +819,7 @@ vect_reassociating_reduction_p (stmt_vec_info stmt_vinfo) ...@@ -819,7 +819,7 @@ vect_reassociating_reduction_p (stmt_vec_info stmt_vinfo)
{ {
return (STMT_VINFO_DEF_TYPE (stmt_vinfo) == vect_reduction_def return (STMT_VINFO_DEF_TYPE (stmt_vinfo) == vect_reduction_def
? STMT_VINFO_REDUC_TYPE (stmt_vinfo) != FOLD_LEFT_REDUCTION ? STMT_VINFO_REDUC_TYPE (stmt_vinfo) != FOLD_LEFT_REDUCTION
: REDUC_GROUP_FIRST_ELEMENT (stmt_vinfo) != NULL_STMT_VEC_INFO); : REDUC_GROUP_FIRST_ELEMENT (stmt_vinfo) != NULL);
} }
/* As above, but also require it to have code CODE and to be a reduction /* As above, but also require it to have code CODE and to be a reduction
......
...@@ -2847,7 +2847,7 @@ vect_build_gather_load_calls (stmt_vec_info stmt_info, ...@@ -2847,7 +2847,7 @@ vect_build_gather_load_calls (stmt_vec_info stmt_info,
new_stmt_info = loop_vinfo->lookup_def (var); new_stmt_info = loop_vinfo->lookup_def (var);
} }
if (prev_stmt_info == NULL_STMT_VEC_INFO) if (prev_stmt_info == NULL)
STMT_VINFO_VEC_STMT (stmt_info) = *vec_stmt = new_stmt_info; STMT_VINFO_VEC_STMT (stmt_info) = *vec_stmt = new_stmt_info;
else else
STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt_info; STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt_info;
...@@ -6578,7 +6578,7 @@ vectorizable_store (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, ...@@ -6578,7 +6578,7 @@ vectorizable_store (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
stmt_vec_info new_stmt_info stmt_vec_info new_stmt_info
= vect_finish_stmt_generation (stmt_info, new_stmt, gsi); = vect_finish_stmt_generation (stmt_info, new_stmt, gsi);
if (prev_stmt_info == NULL_STMT_VEC_INFO) if (prev_stmt_info == NULL)
STMT_VINFO_VEC_STMT (stmt_info) = *vec_stmt = new_stmt_info; STMT_VINFO_VEC_STMT (stmt_info) = *vec_stmt = new_stmt_info;
else else
STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt_info; STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt_info;
......
...@@ -660,7 +660,7 @@ vec_info::set_vinfo_for_stmt (gimple *stmt, stmt_vec_info info) ...@@ -660,7 +660,7 @@ vec_info::set_vinfo_for_stmt (gimple *stmt, stmt_vec_info info)
} }
else else
{ {
gcc_checking_assert (info == NULL_STMT_VEC_INFO); gcc_checking_assert (info == NULL);
stmt_vec_infos[uid - 1] = info; stmt_vec_infos[uid - 1] = info;
} }
} }
...@@ -673,7 +673,7 @@ vec_info::free_stmt_vec_infos (void) ...@@ -673,7 +673,7 @@ vec_info::free_stmt_vec_infos (void)
unsigned int i; unsigned int i;
stmt_vec_info info; stmt_vec_info info;
FOR_EACH_VEC_ELT (stmt_vec_infos, i, info) FOR_EACH_VEC_ELT (stmt_vec_infos, i, info)
if (info != NULL_STMT_VEC_INFO) if (info != NULL)
free_stmt_vec_info (info); free_stmt_vec_info (info);
stmt_vec_infos.release (); stmt_vec_infos.release ();
} }
......
...@@ -21,26 +21,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -21,26 +21,7 @@ along with GCC; see the file COPYING3. If not see
#ifndef GCC_TREE_VECTORIZER_H #ifndef GCC_TREE_VECTORIZER_H
#define GCC_TREE_VECTORIZER_H #define GCC_TREE_VECTORIZER_H
class stmt_vec_info { typedef struct _stmt_vec_info *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-data-ref.h"
#include "tree-hash-traits.h" #include "tree-hash-traits.h"
...@@ -1091,17 +1072,6 @@ STMT_VINFO_BB_VINFO (stmt_vec_info stmt_vinfo) ...@@ -1091,17 +1072,6 @@ STMT_VINFO_BB_VINFO (stmt_vec_info stmt_vinfo)
&& TYPE_PRECISION (TYPE) == 1 \ && TYPE_PRECISION (TYPE) == 1 \
&& TYPE_UNSIGNED (TYPE))) && 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;
}
static inline bool static inline bool
nested_in_vect_loop_p (struct loop *loop, stmt_vec_info stmt_info) nested_in_vect_loop_p (struct loop *loop, stmt_vec_info stmt_info)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment