aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vectorizer.c
diff options
context:
space:
mode:
authorTamar Christina <tamar.christina@arm.com>2020-12-13 13:53:48 +0000
committerTamar Christina <tamar.christina@arm.com>2020-12-13 13:53:48 +0000
commit10bbba9145700e2c3b4709c1041c66d8ff85c7f1 (patch)
treeb8c7d225b028590a0716073890e91419bb899974 /gcc/tree-vectorizer.c
parent501f470267445e037614649639d17a1b32b4a9aa (diff)
downloadgcc-10bbba9145700e2c3b4709c1041c66d8ff85c7f1.zip
gcc-10bbba9145700e2c3b4709c1041c66d8ff85c7f1.tar.gz
gcc-10bbba9145700e2c3b4709c1041c66d8ff85c7f1.tar.bz2
middle-end: Refactor and expose some vectorizer helper functions.
This is a small refactoring which exposes some helper functions in the vectorizer so they can be used in other places. gcc/ChangeLog: * tree-vect-patterns.c (vect_mark_pattern_stmts): Remove static inline. * tree-vect-slp.c (vect_create_new_slp_node): Remove static and only set smts if valid. * tree-vectorizer.c (vec_info::add_pattern_stmt): New. (vec_info::set_vinfo_for_stmt): Optionally enforce read-only. * tree-vectorizer.h (struct _slp_tree): Use new types. (lane_permutation_t, lane_permutation_t): New. (vect_create_new_slp_node, vect_mark_pattern_stmts): New.
Diffstat (limited to 'gcc/tree-vectorizer.c')
-rw-r--r--gcc/tree-vectorizer.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
index f9e2642..3992849 100644
--- a/gcc/tree-vectorizer.c
+++ b/gcc/tree-vectorizer.c
@@ -525,6 +525,19 @@ vec_info::add_stmt (gimple *stmt)
return res;
}
+/* Record that STMT belongs to the vectorizable region. Create a new
+ stmt_vec_info and mark VECINFO as being related and return the new
+ stmt_vec_info. */
+
+stmt_vec_info
+vec_info::add_pattern_stmt (gimple *stmt, stmt_vec_info stmt_info)
+{
+ stmt_vec_info res = new_stmt_vec_info (stmt);
+ set_vinfo_for_stmt (stmt, res, false);
+ STMT_VINFO_RELATED_STMT (res) = stmt_info;
+ return res;
+}
+
/* If STMT has an associated stmt_vec_info, return that vec_info, otherwise
return null. It is safe to call this function on any statement, even if
it might not be part of the vectorizable region. */
@@ -702,12 +715,12 @@ vec_info::new_stmt_vec_info (gimple *stmt)
/* Associate STMT with INFO. */
void
-vec_info::set_vinfo_for_stmt (gimple *stmt, stmt_vec_info info)
+vec_info::set_vinfo_for_stmt (gimple *stmt, stmt_vec_info info, bool check_ro)
{
unsigned int uid = gimple_uid (stmt);
if (uid == 0)
{
- gcc_assert (!stmt_vec_info_ro);
+ gcc_assert (!check_ro || !stmt_vec_info_ro);
gcc_checking_assert (info);
uid = stmt_vec_infos.length () + 1;
gimple_set_uid (stmt, uid);