summaryrefslogtreecommitdiff
path: root/gcc/tree-vectorizer.h
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-vectorizer.h')
-rw-r--r--gcc/tree-vectorizer.h64
1 files changed, 47 insertions, 17 deletions
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index accac72324f..4ee3c3fbcd7 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -22,6 +22,7 @@ along with GCC; see the file COPYING3. If not see
#define GCC_TREE_VECTORIZER_H
#include "tree-data-ref.h"
+#include "tree-hash-traits.h"
#include "target.h"
/* Used for naming of new temporaries. */
@@ -84,6 +85,11 @@ struct stmt_info_for_cost {
typedef vec<stmt_info_for_cost> stmt_vector_for_cost;
+/* Maps base addresses to an innermost_loop_behavior that gives the maximum
+ known alignment for that base. */
+typedef hash_map<tree_operand_hash,
+ innermost_loop_behavior *> vec_base_alignments;
+
/************************************************************************
SLP
************************************************************************/
@@ -149,22 +155,37 @@ typedef struct _slp_instance {
+/* Describes two objects whose addresses must be unequal for the vectorized
+ loop to be valid. */
+typedef std::pair<tree, tree> vec_object_pair;
+
/* Vectorizer state common between loop and basic-block vectorization. */
struct vec_info {
- enum { bb, loop } kind;
+ enum vec_kind { bb, loop };
+
+ vec_info (vec_kind, void *);
+ ~vec_info ();
+
+ /* The type of vectorization. */
+ vec_kind kind;
/* All SLP instances. */
- vec<slp_instance> slp_instances;
+ auto_vec<slp_instance> slp_instances;
- /* All data references. */
+ /* All data references. Freed by free_data_refs, so not an auto_vec. */
vec<data_reference_p> datarefs;
- /* All data dependences. */
+ /* Maps base addresses to an innermost_loop_behavior that gives the maximum
+ known alignment for that base. */
+ vec_base_alignments base_alignments;
+
+ /* All data dependences. Freed by free_dependence_relations, so not
+ an auto_vec. */
vec<ddr_p> ddrs;
/* All interleaving chains of stores, represented by the first
stmt in the chain. */
- vec<gimple *> grouped_stores;
+ auto_vec<gimple *> grouped_stores;
/* Cost data used by the target cost model. */
void *target_cost_data;
@@ -194,6 +215,8 @@ is_a_helper <_bb_vec_info *>::test (vec_info *i)
/* Info on vectorized loops. */
/*-----------------------------------------------------------------*/
typedef struct _loop_vec_info : public vec_info {
+ _loop_vec_info (struct loop *);
+ ~_loop_vec_info ();
/* The loop to which this info struct refers to. */
struct loop *loop;
@@ -235,29 +258,32 @@ typedef struct _loop_vec_info : public vec_info {
int ptr_mask;
/* The loop nest in which the data dependences are computed. */
- vec<loop_p> loop_nest;
+ auto_vec<loop_p> loop_nest;
/* Data Dependence Relations defining address ranges that are candidates
for a run-time aliasing check. */
- vec<ddr_p> may_alias_ddrs;
+ auto_vec<ddr_p> may_alias_ddrs;
/* Data Dependence Relations defining address ranges together with segment
lengths from which the run-time aliasing check is built. */
- vec<dr_with_seg_len_pair_t> comp_alias_ddrs;
+ auto_vec<dr_with_seg_len_pair_t> comp_alias_ddrs;
+
+ /* Check that the addresses of each pair of objects is unequal. */
+ auto_vec<vec_object_pair> check_unequal_addrs;
/* Statements in the loop that have data references that are candidates for a
runtime (loop versioning) misalignment check. */
- vec<gimple *> may_misalign_stmts;
+ auto_vec<gimple *> may_misalign_stmts;
/* Reduction cycles detected in the loop. Used in loop-aware SLP. */
- vec<gimple *> reductions;
+ auto_vec<gimple *> reductions;
/* All reduction chains in the loop, represented by the first
stmt in the chain. */
- vec<gimple *> reduction_chains;
+ auto_vec<gimple *> reduction_chains;
/* Cost vector for a single scalar iteration. */
- vec<stmt_info_for_cost> scalar_cost_vec;
+ auto_vec<stmt_info_for_cost> scalar_cost_vec;
/* The unrolling factor needed to SLP the loop. In case of that pure SLP is
applied to the loop, i.e., no unrolling is needed, this is 1. */
@@ -339,6 +365,7 @@ typedef struct _loop_vec_info : public vec_info {
#define LOOP_VINFO_MAY_MISALIGN_STMTS(L) (L)->may_misalign_stmts
#define LOOP_VINFO_MAY_ALIAS_DDRS(L) (L)->may_alias_ddrs
#define LOOP_VINFO_COMP_ALIAS_DDRS(L) (L)->comp_alias_ddrs
+#define LOOP_VINFO_CHECK_UNEQUAL_ADDRS(L) (L)->check_unequal_addrs
#define LOOP_VINFO_GROUPED_STORES(L) (L)->grouped_stores
#define LOOP_VINFO_SLP_INSTANCES(L) (L)->slp_instances
#define LOOP_VINFO_SLP_UNROLLING_FACTOR(L) (L)->slp_unrolling_factor
@@ -358,7 +385,8 @@ typedef struct _loop_vec_info : public vec_info {
#define LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT(L) \
((L)->may_misalign_stmts.length () > 0)
#define LOOP_REQUIRES_VERSIONING_FOR_ALIAS(L) \
- ((L)->may_alias_ddrs.length () > 0)
+ ((L)->comp_alias_ddrs.length () > 0 \
+ || (L)->check_unequal_addrs.length () > 0)
#define LOOP_REQUIRES_VERSIONING_FOR_NITERS(L) \
(LOOP_VINFO_NITERS_ASSUMPTIONS (L))
#define LOOP_REQUIRES_VERSIONING(L) \
@@ -390,6 +418,9 @@ nested_in_vect_loop_p (struct loop *loop, gimple *stmt)
typedef struct _bb_vec_info : public vec_info
{
+ _bb_vec_info (gimple_stmt_iterator, gimple_stmt_iterator);
+ ~_bb_vec_info ();
+
basic_block bb;
gimple_stmt_iterator region_begin;
gimple_stmt_iterator region_end;
@@ -793,8 +824,8 @@ void free_stmt_vec_info_vec (void);
static inline stmt_vec_info
vinfo_for_stmt (gimple *stmt)
{
- unsigned int uid = gimple_uid (stmt);
- if (uid == 0)
+ int uid = gimple_uid (stmt);
+ if (uid <= 0)
return NULL;
return stmt_vec_info_vec[uid - 1];
@@ -1141,6 +1172,7 @@ extern bool vect_prune_runtime_alias_test_list (loop_vec_info);
extern bool vect_check_gather_scatter (gimple *, loop_vec_info,
gather_scatter_info *);
extern bool vect_analyze_data_refs (vec_info *, int *);
+extern void vect_record_base_alignments (vec_info *);
extern tree vect_create_data_ref_ptr (gimple *, tree, struct loop *, tree,
tree *, gimple_stmt_iterator *,
gimple **, bool, bool *,
@@ -1168,7 +1200,6 @@ extern tree vect_create_addr_base_for_vector_ref (gimple *, gimple_seq *,
/* In tree-vect-loop.c. */
/* FORNOW: Used in tree-parloops.c. */
-extern void destroy_loop_vec_info (loop_vec_info, bool);
extern gimple *vect_force_simple_reduction (loop_vec_info, gimple *,
bool *, bool);
/* Drive for loop analysis stage. */
@@ -1217,7 +1248,6 @@ void vect_pattern_recog (vec_info *);
/* In tree-vectorizer.c. */
unsigned vectorize_loops (void);
-void vect_destroy_datarefs (vec_info *);
bool vect_stmt_in_region_p (vec_info *, gimple *);
void vect_free_loop_info_assumptions (struct loop *);