aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vectorizer.h
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2018-05-16 13:08:04 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2018-05-16 13:08:04 +0000
commit68435eb293a6b9c161936bccab66e4b1f702372b (patch)
treecc78ecc836cfbaccc33a2703cd1f0d2486754a71 /gcc/tree-vectorizer.h
parent311eb8168ea83b8b7ce76735fee8c594cda5a0e0 (diff)
downloadgcc-68435eb293a6b9c161936bccab66e4b1f702372b.zip
gcc-68435eb293a6b9c161936bccab66e4b1f702372b.tar.gz
gcc-68435eb293a6b9c161936bccab66e4b1f702372b.tar.bz2
tree-vectorizer.h (struct stmt_info_for_cost): Add where member.
2018-05-16 Richard Biener <rguenther@suse.de> * tree-vectorizer.h (struct stmt_info_for_cost): Add where member. (dump_stmt_cost): Declare. (add_stmt_cost): Dump cost we add. (add_stmt_costs): New function. (vect_model_simple_cost, vect_model_store_cost, vect_model_load_cost): No longer exported. (vect_analyze_stmt): Adjust prototype. (vectorizable_condition): Likewise. (vectorizable_live_operation): Likewise. (vectorizable_reduction): Likewise. (vectorizable_induction): Likewise. * tree-vect-loop.c (vect_analyze_loop_operations): Create local cost vector to pass to vectorizable_ and record afterwards. (vect_model_reduction_cost): Take cost vector argument and adjust. (vect_model_induction_cost): Likewise. (vectorizable_reduction): Likewise. (vectorizable_induction): Likewise. (vectorizable_live_operation): Likewise. * tree-vect-slp.c (vect_create_new_slp_node): Initialize SLP_TREE_NUMBER_OF_VEC_STMTS. (vect_analyze_slp_cost_1): Remove. (vect_analyze_slp_cost): Likewise. (vect_slp_analyze_node_operations): Take visited args and a target cost vector. Avoid processing already visited stmt sets. (vect_slp_analyze_operations): Use a local cost vector to gather costs and register those of non-discarded instances. (vect_bb_vectorization_profitable_p): Use add_stmt_costs. (vect_schedule_slp_instance): Remove copying of SLP_TREE_NUMBER_OF_VEC_STMTS. Instead assert that it is not zero. * tree-vect-stmts.c (record_stmt_cost): Remove path directly adding cost. Record cost entry location. (vect_prologue_cost_for_slp_op): Function to compute cost of a constant or invariant generated for SLP vect in the prologue, split out from vect_analyze_slp_cost_1. (vect_model_simple_cost): Make static. Adjust for SLP costing. (vect_model_promotion_demotion_cost): Likewise. (vect_model_store_cost): Likewise, make static. (vect_model_load_cost): Likewise. (vectorizable_bswap): Add cost vector arg and adjust. (vectorizable_call): Likewise. (vectorizable_simd_clone_call): Likewise. (vectorizable_conversion): Likewise. (vectorizable_assignment): Likewise. (vectorizable_shift): Likewise. (vectorizable_operation): Likewise. (vectorizable_store): Likewise. (vectorizable_load): Likewise. (vectorizable_condition): Likewise. (vectorizable_comparison): Likewise. (can_vectorize_live_stmts): Likewise. (vect_analyze_stmt): Likewise. (vect_transform_stmt): Adjust calls to vectorizable_*. * tree-vectorizer.c: Include gimple-pretty-print.h. (dump_stmt_cost): New function. From-SVN: r260289
Diffstat (limited to 'gcc/tree-vectorizer.h')
-rw-r--r--gcc/tree-vectorizer.h42
1 files changed, 27 insertions, 15 deletions
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index 049e3dd..1388658 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -94,6 +94,7 @@ enum vect_reduction_type {
struct stmt_info_for_cost {
int count;
enum vect_cost_for_stmt kind;
+ enum vect_cost_model_location where;
gimple *stmt;
int misalign;
};
@@ -1171,6 +1172,9 @@ init_cost (struct loop *loop_info)
return targetm.vectorize.init_cost (loop_info);
}
+extern void dump_stmt_cost (FILE *, void *, int, enum vect_cost_for_stmt,
+ stmt_vec_info, int, enum vect_cost_model_location);
+
/* Alias targetm.vectorize.add_stmt_cost. */
static inline unsigned
@@ -1178,6 +1182,8 @@ add_stmt_cost (void *data, int count, enum vect_cost_for_stmt kind,
stmt_vec_info stmt_info, int misalign,
enum vect_cost_model_location where)
{
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ dump_stmt_cost (dump_file, data, count, kind, stmt_info, misalign, where);
return targetm.vectorize.add_stmt_cost (data, count, kind,
stmt_info, misalign, where);
}
@@ -1199,6 +1205,17 @@ destroy_cost_data (void *data)
targetm.vectorize.destroy_cost_data (data);
}
+inline void
+add_stmt_costs (void *data, stmt_vector_for_cost *cost_vec)
+{
+ stmt_info_for_cost *cost;
+ 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->misalign, cost->where);
+}
+
/*-----------------------------------------------------------------*/
/* Info on data references alignment. */
/*-----------------------------------------------------------------*/
@@ -1422,16 +1439,6 @@ extern bool supportable_narrowing_operation (enum tree_code, tree, tree,
int *, vec<tree> *);
extern stmt_vec_info new_stmt_vec_info (gimple *stmt, vec_info *);
extern void free_stmt_vec_info (gimple *stmt);
-extern void vect_model_simple_cost (stmt_vec_info, int, enum vect_def_type *,
- int, stmt_vector_for_cost *,
- stmt_vector_for_cost *);
-extern void vect_model_store_cost (stmt_vec_info, int, vect_memory_access_type,
- vec_load_store_type, slp_tree,
- stmt_vector_for_cost *,
- stmt_vector_for_cost *);
-extern void vect_model_load_cost (stmt_vec_info, int, vect_memory_access_type,
- slp_tree, stmt_vector_for_cost *,
- stmt_vector_for_cost *);
extern unsigned record_stmt_cost (stmt_vector_for_cost *, int,
enum vect_cost_for_stmt, stmt_vec_info,
int, enum vect_cost_model_location);
@@ -1452,9 +1459,11 @@ extern tree vect_get_vec_def_for_stmt_copy (enum vect_def_type, tree);
extern bool vect_transform_stmt (gimple *, gimple_stmt_iterator *,
bool *, slp_tree, slp_instance);
extern void vect_remove_stores (gimple *);
-extern bool vect_analyze_stmt (gimple *, bool *, slp_tree, slp_instance);
+extern bool vect_analyze_stmt (gimple *, bool *, slp_tree, slp_instance,
+ stmt_vector_for_cost *);
extern bool vectorizable_condition (gimple *, gimple_stmt_iterator *,
- gimple **, tree, int, slp_tree);
+ gimple **, tree, int, slp_tree,
+ stmt_vector_for_cost *);
extern void vect_get_load_cost (struct data_reference *, int, bool,
unsigned int *, unsigned int *,
stmt_vector_for_cost *,
@@ -1539,11 +1548,14 @@ extern tree vect_get_loop_mask (gimple_stmt_iterator *, vec_loop_masks *,
extern struct loop *vect_transform_loop (loop_vec_info);
extern loop_vec_info vect_analyze_loop_form (struct loop *);
extern bool vectorizable_live_operation (gimple *, gimple_stmt_iterator *,
- slp_tree, int, gimple **);
+ slp_tree, int, gimple **,
+ stmt_vector_for_cost *);
extern bool vectorizable_reduction (gimple *, gimple_stmt_iterator *,
- gimple **, slp_tree, slp_instance);
+ gimple **, slp_tree, slp_instance,
+ stmt_vector_for_cost *);
extern bool vectorizable_induction (gimple *, gimple_stmt_iterator *,
- gimple **, slp_tree);
+ gimple **, slp_tree,
+ stmt_vector_for_cost *);
extern tree get_initial_def_for_reduction (gimple *, tree, tree *);
extern bool vect_worthwhile_without_simd_p (vec_info *, tree_code);
extern int vect_get_known_peeling_cost (loop_vec_info, int, int *,