summaryrefslogtreecommitdiff
path: root/gcc/tree-vectorizer.h
diff options
context:
space:
mode:
authorwschmidt <wschmidt@138bc75d-0d04-0410-961f-82ee72b054a4>2012-07-25 03:07:08 +0000
committerwschmidt <wschmidt@138bc75d-0d04-0410-961f-82ee72b054a4>2012-07-25 03:07:08 +0000
commitf97dec818c368b95c04c5ef3e12ac682ffde90ae (patch)
treeae51baf9345c38bdbb25531d72d91e057a404b0d /gcc/tree-vectorizer.h
parentc1c4afa047f9cfac11dfaadda2c9d5eb78b0ee8c (diff)
downloadgcc-f97dec818c368b95c04c5ef3e12ac682ffde90ae.tar.gz
2012-07-24 Bill Schmidt <wschmidt@linux.ibm.com>
* doc/tm.texi: Regenerate. * targhooks.c (default_init_cost): Add prologue and epilogue costs. (default_add_stmt_cost): Likewise; also handle NULL stmt_info. (default_finish_cost): Add prologue and epilogue costs. * targhooks.h (default_add_stmt_cost): Change parameter list. (default_finish_cost): Likewise. * target.def (init_cost): Change documentation string. (add_stmt_cost): Change documentation string and parameter list. (finish_cost): Likewise. * target.h (vect_cost_model_location): New enum. * tree-vectorizer.h (struct _slp_tree): Remove cost substruct. (struct _slp_instance): Remove cost substruct; rename stmt_cost_vec to body_cost_vec. (SLP_INSTANCE_OUTSIDE_OF_LOOP_COST): Remove. (SLP_INSTANCE_STMT_COST_VEC): Rename to SLP_INSTANCE_BODY_COST_VEC. (SLP_TREE_OUTSIDE_OF_LOOP_COST): Remove. (struct _vect_peel_extended_info): Rename stmt_cost_vec to body_cost_vec. (struct _stmt_vec_info): Remove cost substruct. (STMT_VINFO_OUTSIDE_OF_LOOP_COST): Remove. (stmt_vinfo_set_outside_of_loop_cost): Remove. (builtin_vectorization_cost): New function. (vect_get_stmt_cost): Change to use builtin_vectorization_cost. (add_stmt_cost): Change parameter list. (finish_cost): Likewise. (vect_model_simple_cost): Likewise. (vect_model_store_cost): Likewise. (vect_model_load_cost): Likewise. (record_stmt_cost): Likewise. (vect_get_load_cost): Likewise. (vect_get_known_peeling_cost): Likewise. * tree-vect-loop.c (vect_get_known_peeling_cost): Change parameter list; call record_stmt_cost for prologue and epilogue costs. (vect_estimate_min_profitable_iters): Call add_stmt_cost for prologue and epilogue costs; remove computation of vec_outside_cost; return vec_prologue_cost and vec_epilogue_cost from finish_cost. (vect_model_reduction_cost): Revise call to add_stmt_cost for body costs; call add_stmt_cost for prologue and epilogue costs. (vect_model_induction_cost): Revise call to add_stmt_cost for body costs; call add_stmt_cost for prologue costs. * tree-vect-data-refs.c (vect_get_data_access_cost): Change parameter list for function and arguments for calls to vect_get_load_cost and vect_get_store_cost. (vect_peeling_hash_get_lowest_cost): Change argument list for calls to vect_get_data_access_cost and vect_get_known_peeling_cost; use temporary vectors prologue_cost_vec and epilogue_cost_vec for the latter call and discard their results; rename stmt_cost_vec to body_cost_vec; correct possible storage leak for body_cost_vec. (vect_peeling_hash_choose_best_peeling): Rename stmt_cost_vec to body_cost_vec. (vect_enhance_data_refs_alignment): Rename stmt_cost_vec to body_cost_vec; add extra dummy parameter on calls to vect_get_data_access_cost; tolerate null si->stmt; add vect_body to argument list on call to add_stmt_cost. * tree-vect-stmts.c (record_stmt_cost): Change parameter list; rename stmt_cost_vec to body_cost_vec; tolerate null stmt_info; call builtin_vectorization_cost; add "where" parameter on call to add_stmt_cost. (vect_model_simple_cost): Change parameter list; call record_stmt_cost for prologue costs; remove call to stmt_vinfo_set_outside_of_loop_cost; rename stmt_cost_vec to body_cost_vec. (vect_model_promotion_demotion_cost): Add vect_body argument to call to add_stmt_cost; call add_stmt_cost for prologue costs; remove call to stmt_vinfo_set_outside_of_loop_cost. (vect_model_store_cost): Change parameter list; call record_stmt_cost for prologue costs; add vect_body argument to call to record_stmt_cost; rename stmt_cost_vec to body_cost_vec; remove call to stmt_vinfo_set_outside_of_loop_cost. (vect_get_store_cost): Rename stmt_cost_vec to body_cost_vec; add vect_body argument to calls to record_stmt_cost. (vect_model_load_cost): Change parameter list; rename stmt_cost_vec to body_cost_vec; add vect_body argument to calls to record_stmt_cost; remove call to stmt_vinfo_set_outside_of_loop_cost. (vect_get_load_cost): Change parameter list; rename stmt_cost_vec to body_cost_vec; add vect_body argument to calls to record_stmt_cost; call record_stmt_cost for prologue costs. (vectorizable_store): Change argument list for call to vect_model_store_cost. (vectorizable_load): Change argument list for call to vect_model_load_cost. (new_stmt_vec_info): Remove assignment to STMT_VINFO_OUTSIDE_OF_LOOP_COST. * config/spu/spu.c (spu_init_cost): Add prologue and epilogue costs. (spu_add_stmt_cost): Likewise; also handle NULL stmt_info. (spu_finish_cost): Add prologue and epilogue costs. * config/i386/i386.c (i386_init_cost): Add prologue and epilogue costs. (i386_add_stmt_cost): Likewise; also handle NULL stmt_info. (i386_finish_cost): Add prologue and epilogue costs. * config/rs6000/rs6000.c (rs6000_init_cost): Add prologue and epilogue costs. (rs6000_add_stmt_cost): Likewise; also handle NULL stmt_info. (rs6000_finish_cost): Add prologue and epilogue costs. * tree-vect-slp.c (vect_free_slp_instance): Rename SLP_INSTANCE_STMT_COST_VEC to SLP_INSTANCE_BODY_COST_VEC. (vect_create_new_slp_node): Remove assignment to SLP_TREE_OUTSIDE_OF_LOOP_COST. (vect_get_and_check_slp_defs): Change parameter list; change argument lists to calls to vect_model_store_cost and vect_model_simple_cost. (vect_build_slp_tree): Change parameter list; change argument lists to calls to vect_model_load_cost, vect_get_and_check_slp_defs, and recursive self-calls; remove setting of outside_cost from SLP_TREE_OUTSIDE_OF_LOOP_COST; add vect_body argument to call to record_stmt_cost. (vect_analyze_slp_instance): Rename stmt_cost_vec to body_cost_vec; rename SLP_INSTANCE_STMT_COST_VEC to SLP_INSTANCE_BODY_COST_VEC; remove assignment to SLP_INSTANCE_OUTSIDE_OF_LOOP_COST; record SLP prologue costs. (vect_bb_vectorization_profitable_p): Rename stmt_cost_vec to body_cost_vec; handle null ci->stmt; add vect_body argument to call to add_stmt_cost; simplify calls to targetm.vectorize. builtin_vectorization_cost; return vec_prologue_cost and vec_epilogue_cost from finish_cost. (vect_update_slp_costs_according_to_vf): Rename stmt_cost_vec to body_cost_vec; add vect_body argument to call to add_stmt_cost. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@189836 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-vectorizer.h')
-rw-r--r--gcc/tree-vectorizer.h81
1 files changed, 32 insertions, 49 deletions
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index 3d2310711ab..96cc52e3df9 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -118,11 +118,6 @@ typedef struct _slp_tree {
scalar elements in one scalar iteration (GROUP_SIZE) multiplied by VF
divided by vector size. */
unsigned int vec_stmts_size;
- /* Vectorization costs associated with SLP node. */
- struct
- {
- int outside_of_loop; /* Statements generated outside loop. */
- } cost;
} *slp_tree;
DEF_VEC_P(slp_tree);
@@ -141,13 +136,7 @@ typedef struct _slp_instance {
unsigned int unrolling_factor;
/* Vectorization costs associated with SLP instance. */
- struct
- {
- int outside_of_loop; /* Statements generated outside loop. */
- } cost;
-
- /* Inside-loop costs. */
- stmt_vector_for_cost stmt_cost_vec;
+ stmt_vector_for_cost body_cost_vec;
/* Loads permutation relatively to the stores, NULL if there is no
permutation. */
@@ -168,8 +157,7 @@ DEF_VEC_ALLOC_P(slp_instance, heap);
#define SLP_INSTANCE_TREE(S) (S)->root
#define SLP_INSTANCE_GROUP_SIZE(S) (S)->group_size
#define SLP_INSTANCE_UNROLLING_FACTOR(S) (S)->unrolling_factor
-#define SLP_INSTANCE_OUTSIDE_OF_LOOP_COST(S) (S)->cost.outside_of_loop
-#define SLP_INSTANCE_STMT_COST_VEC(S) (S)->stmt_cost_vec
+#define SLP_INSTANCE_BODY_COST_VEC(S) (S)->body_cost_vec
#define SLP_INSTANCE_LOAD_PERMUTATION(S) (S)->load_permutation
#define SLP_INSTANCE_LOADS(S) (S)->loads
#define SLP_INSTANCE_FIRST_LOAD_STMT(S) (S)->first_load
@@ -178,7 +166,6 @@ DEF_VEC_ALLOC_P(slp_instance, heap);
#define SLP_TREE_SCALAR_STMTS(S) (S)->stmts
#define SLP_TREE_VEC_STMTS(S) (S)->vec_stmts
#define SLP_TREE_NUMBER_OF_VEC_STMTS(S) (S)->vec_stmts_size
-#define SLP_TREE_OUTSIDE_OF_LOOP_COST(S) (S)->cost.outside_of_loop
/* This structure is used in creation of an SLP tree. Each instance
corresponds to the same operand in a group of scalar stmts in an SLP
@@ -212,7 +199,7 @@ typedef struct _vect_peel_extended_info
struct _vect_peel_info peel_info;
unsigned int inside_cost;
unsigned int outside_cost;
- stmt_vector_for_cost stmt_cost_vec;
+ stmt_vector_for_cost body_cost_vec;
} *vect_peel_extended_info;
/*-----------------------------------------------------------------*/
@@ -566,12 +553,6 @@ typedef struct _stmt_vec_info {
indicates whether the stmt needs to be vectorized. */
enum vect_relevant relevant;
- /* Vectorization costs associated with statement. */
- struct
- {
- int outside_of_loop; /* Statements generated outside loop. */
- } cost;
-
/* The bb_vec_info with respect to which STMT is vectorized. */
bb_vec_info bb_vinfo;
@@ -628,7 +609,6 @@ typedef struct _stmt_vec_info {
#define GROUP_READ_WRITE_DEPENDENCE(S) (S)->read_write_dep
#define STMT_VINFO_RELEVANT_P(S) ((S)->relevant != vect_unused_in_scope)
-#define STMT_VINFO_OUTSIDE_OF_LOOP_COST(S) (S)->cost.outside_of_loop
#define HYBRID_SLP_STMT(S) ((S)->slp_type == hybrid)
#define PURE_SLP_STMT(S) ((S)->slp_type == pure_slp)
@@ -767,18 +747,6 @@ is_loop_header_bb_p (basic_block bb)
return false;
}
-/* Set outside loop vectorization cost. */
-
-static inline void
-stmt_vinfo_set_outside_of_loop_cost (stmt_vec_info stmt_info, slp_tree slp_node,
- int cost)
-{
- if (slp_node)
- SLP_TREE_OUTSIDE_OF_LOOP_COST (slp_node) = cost;
- else
- STMT_VINFO_OUTSIDE_OF_LOOP_COST (stmt_info) = cost;
-}
-
/* Return pow2 (X). */
static inline int
@@ -792,16 +760,22 @@ vect_pow2 (int x)
return res;
}
+/* Alias targetm.vectorize.builtin_vectorization_cost. */
+
+static inline int
+builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost,
+ tree vectype, int misalign)
+{
+ return targetm.vectorize.builtin_vectorization_cost (type_of_cost,
+ vectype, misalign);
+}
+
/* Get cost by calling cost target builtin. */
static inline
int vect_get_stmt_cost (enum vect_cost_for_stmt type_of_cost)
{
- tree dummy_type = NULL;
- int dummy = 0;
-
- return targetm.vectorize.builtin_vectorization_cost (type_of_cost,
- dummy_type, dummy);
+ return builtin_vectorization_cost (type_of_cost, NULL, 0);
}
/* Alias targetm.vectorize.init_cost. */
@@ -816,18 +790,20 @@ init_cost (struct loop *loop_info)
static inline unsigned
add_stmt_cost (void *data, int count, enum vect_cost_for_stmt kind,
- stmt_vec_info stmt_info, int misalign)
+ stmt_vec_info stmt_info, int misalign,
+ enum vect_cost_model_location where)
{
return targetm.vectorize.add_stmt_cost (data, count, kind,
- stmt_info, misalign);
+ stmt_info, misalign, where);
}
/* Alias targetm.vectorize.finish_cost. */
-static inline unsigned
-finish_cost (void *data)
+static inline void
+finish_cost (void *data, unsigned *prologue_cost,
+ unsigned *body_cost, unsigned *epilogue_cost)
{
- return targetm.vectorize.finish_cost (data);
+ targetm.vectorize.finish_cost (data, prologue_cost, body_cost, epilogue_cost);
}
/* Alias targetm.vectorize.destroy_cost_data. */
@@ -905,14 +881,18 @@ extern stmt_vec_info new_stmt_vec_info (gimple stmt, loop_vec_info,
extern void free_stmt_vec_info (gimple stmt);
extern tree vectorizable_function (gimple, tree, tree);
extern void vect_model_simple_cost (stmt_vec_info, int, enum vect_def_type *,
- slp_tree, stmt_vector_for_cost *);
+ stmt_vector_for_cost *,
+ stmt_vector_for_cost *);
extern void vect_model_store_cost (stmt_vec_info, int, bool,
enum vect_def_type, slp_tree,
+ stmt_vector_for_cost *,
stmt_vector_for_cost *);
extern void vect_model_load_cost (stmt_vec_info, int, bool, 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_for_stmt, stmt_vec_info,
+ int, enum vect_cost_model_location);
extern void vect_finish_stmt_generation (gimple, gimple,
gimple_stmt_iterator *);
extern bool vect_mark_stmts_to_be_vectorized (loop_vec_info);
@@ -928,7 +908,8 @@ extern bool vectorizable_condition (gimple, gimple_stmt_iterator *, gimple *,
tree, int, slp_tree);
extern void vect_get_load_cost (struct data_reference *, int, bool,
unsigned int *, unsigned int *,
- stmt_vector_for_cost *);
+ stmt_vector_for_cost *,
+ stmt_vector_for_cost *, bool);
extern void vect_get_store_cost (struct data_reference *, int,
unsigned int *, stmt_vector_for_cost *);
extern bool vect_supportable_shift (enum tree_code, tree);
@@ -992,7 +973,9 @@ extern bool vectorizable_induction (gimple, gimple_stmt_iterator *, gimple *);
extern int vect_estimate_min_profitable_iters (loop_vec_info);
extern tree get_initial_def_for_reduction (gimple, tree, tree *);
extern int vect_min_worthwhile_factor (enum tree_code);
-extern int vect_get_known_peeling_cost (loop_vec_info, int, int *, int);
+extern int vect_get_known_peeling_cost (loop_vec_info, int, int *, int,
+ stmt_vector_for_cost *,
+ stmt_vector_for_cost *);
extern int vect_get_single_scalar_iteration_cost (loop_vec_info);
/* In tree-vect-slp.c. */