/* Loop Vectorization
- Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
Contributed by Dorit Naishlos <dorit@il.ibm.com>
This file is part of GCC.
#ifndef GCC_TREE_VECTORIZER_H
#define GCC_TREE_VECTORIZER_H
-#ifdef USE_MAPPED_LOCATION
- typedef source_location LOC;
- #define UNKNOWN_LOC UNKNOWN_LOCATION
- #define EXPR_LOC(e) EXPR_LOCATION(e)
- #define LOC_FILE(l) LOCATION_FILE (l)
- #define LOC_LINE(l) LOCATION_LINE (l)
-#else
- typedef source_locus LOC;
- #define UNKNOWN_LOC NULL
- #define EXPR_LOC(e) EXPR_LOCUS(e)
- #define LOC_FILE(l) (l)->file
- #define LOC_LINE(l) (l)->line
-#endif
+typedef source_location LOC;
+#define UNKNOWN_LOC UNKNOWN_LOCATION
+#define EXPR_LOC(e) EXPR_LOCATION(e)
+#define LOC_FILE(l) LOCATION_FILE (l)
+#define LOC_LINE(l) LOCATION_LINE (l)
/* Used for naming of new temporaries. */
enum vect_var_kind {
REPORT_NONE,
REPORT_VECTORIZED_LOOPS,
REPORT_UNVECTORIZED_LOOPS,
+ REPORT_COST,
REPORT_ALIGNMENT,
REPORT_DR_DETAILS,
REPORT_BAD_FORM_LOOPS,
/* Number of iterations. */
tree num_iters;
+ tree num_iters_unchanged;
/* Minimum number of iterations below which vectorization is expected to
not be profitable (as estimated by the cost model).
#define LOOP_VINFO_LOOP(L) (L)->loop
#define LOOP_VINFO_BBS(L) (L)->bbs
#define LOOP_VINFO_NITERS(L) (L)->num_iters
+/* Since LOOP_VINFO_NITERS can change after prologue peeling
+ retain total unchanged scalar loop iterations for cost model. */
+#define LOOP_VINFO_NITERS_UNCHANGED(L) (L)->num_iters_unchanged
#define LOOP_VINFO_COST_MODEL_MIN_ITERS(L) (L)->min_profitable_iters
#define LOOP_VINFO_VECTORIZABLE_P(L) (L)->vectorizable
#define LOOP_VINFO_VECT_FACTOR(L) (L)->vectorization_factor
/* These are some defines for the initial implementation of the vectorizer's
cost model. These will later be target specific hooks. */
-/* Cost of conditional branch. */
-#ifndef TARG_COND_BRANCH_COST
-#define TARG_COND_BRANCH_COST 3
+/* Cost of conditional taken branch. */
+#ifndef TARG_COND_TAKEN_BRANCH_COST
+#define TARG_COND_TAKEN_BRANCH_COST 3
+#endif
+
+/* Cost of conditional not taken branch. */
+#ifndef TARG_COND_NOT_TAKEN_BRANCH_COST
+#define TARG_COND_NOT_TAKEN_BRANCH_COST 1
#endif
/* Cost of any scalar operation, excluding load and store. */
return false;
}
+static inline void
+stmt_vinfo_set_inside_of_loop_cost (stmt_vec_info stmt_info, slp_tree slp_node,
+ int cost)
+{
+ if (slp_node)
+ SLP_TREE_INSIDE_OF_LOOP_COST (slp_node) = cost;
+ else
+ STMT_VINFO_INSIDE_OF_LOOP_COST (stmt_info) = 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;
+}
+
+
/*-----------------------------------------------------------------*/
/* Info on data references alignment. */
/*-----------------------------------------------------------------*/
divide by the vectorization factor, and to peel the first few iterations
to force the alignment of data references in the loop. */
extern struct loop *slpeel_tree_peel_loop_to_edge
- (struct loop *, edge, tree, tree, bool, unsigned int);
+ (struct loop *, edge, tree, tree, bool, unsigned int, bool);
+extern void set_prologue_iterations (basic_block, tree,
+ struct loop *, unsigned int);
+struct loop *tree_duplicate_loop_on_edge (struct loop *, edge);
extern void slpeel_make_loop_iterate_ntimes (struct loop *, tree);
extern bool slpeel_can_duplicate_loop_p (const struct loop *, const_edge);
#ifdef ENABLE_CHECKING
extern loop_vec_info new_loop_vec_info (struct loop *loop);
extern void destroy_loop_vec_info (loop_vec_info, bool);
extern stmt_vec_info new_stmt_vec_info (tree stmt, loop_vec_info);
+extern void free_stmt_vec_info (tree stmt);
/** In tree-vect-analyze.c **/
/* Driver for analysis stage. */
extern loop_vec_info vect_analyze_loop (struct loop *);
extern void vect_free_slp_tree (slp_tree);
-
+extern loop_vec_info vect_analyze_loop_form (struct loop *);
/** In tree-vect-patterns.c **/
/* Pattern recognition functions.