* tree-loop-distribution.c (struct partition): New field recording
[official-gcc.git] / gcc / tree-vectorizer.h
blob8935e78afea3742a6f29de72b8e4739630bd9689
1 /* Vectorizer
2 Copyright (C) 2003-2017 Free Software Foundation, Inc.
3 Contributed by Dorit Naishlos <dorit@il.ibm.com>
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
10 version.
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
21 #ifndef GCC_TREE_VECTORIZER_H
22 #define GCC_TREE_VECTORIZER_H
24 #include "tree-data-ref.h"
25 #include "target.h"
27 /* Used for naming of new temporaries. */
28 enum vect_var_kind {
29 vect_simple_var,
30 vect_pointer_var,
31 vect_scalar_var,
32 vect_mask_var
35 /* Defines type of operation. */
36 enum operation_type {
37 unary_op = 1,
38 binary_op,
39 ternary_op
42 /* Define type of available alignment support. */
43 enum dr_alignment_support {
44 dr_unaligned_unsupported,
45 dr_unaligned_supported,
46 dr_explicit_realign,
47 dr_explicit_realign_optimized,
48 dr_aligned
51 /* Define type of def-use cross-iteration cycle. */
52 enum vect_def_type {
53 vect_uninitialized_def = 0,
54 vect_constant_def = 1,
55 vect_external_def,
56 vect_internal_def,
57 vect_induction_def,
58 vect_reduction_def,
59 vect_double_reduction_def,
60 vect_nested_cycle,
61 vect_unknown_def_type
64 /* Define type of reduction. */
65 enum vect_reduction_type {
66 TREE_CODE_REDUCTION,
67 COND_REDUCTION,
68 INTEGER_INDUC_COND_REDUCTION,
69 CONST_COND_REDUCTION
72 #define VECTORIZABLE_CYCLE_DEF(D) (((D) == vect_reduction_def) \
73 || ((D) == vect_double_reduction_def) \
74 || ((D) == vect_nested_cycle))
76 /* Structure to encapsulate information about a group of like
77 instructions to be presented to the target cost model. */
78 struct stmt_info_for_cost {
79 int count;
80 enum vect_cost_for_stmt kind;
81 gimple *stmt;
82 int misalign;
85 typedef vec<stmt_info_for_cost> stmt_vector_for_cost;
87 /************************************************************************
88 SLP
89 ************************************************************************/
90 typedef struct _slp_tree *slp_tree;
92 /* A computation tree of an SLP instance. Each node corresponds to a group of
93 stmts to be packed in a SIMD stmt. */
94 struct _slp_tree {
95 /* Nodes that contain def-stmts of this node statements operands. */
96 vec<slp_tree> children;
97 /* A group of scalar stmts to be vectorized together. */
98 vec<gimple *> stmts;
99 /* Load permutation relative to the stores, NULL if there is no
100 permutation. */
101 vec<unsigned> load_permutation;
102 /* Vectorized stmt/s. */
103 vec<gimple *> vec_stmts;
104 /* Number of vector stmts that are created to replace the group of scalar
105 stmts. It is calculated during the transformation phase as the number of
106 scalar elements in one scalar iteration (GROUP_SIZE) multiplied by VF
107 divided by vector size. */
108 unsigned int vec_stmts_size;
109 /* Whether the scalar computations use two different operators. */
110 bool two_operators;
111 /* The DEF type of this node. */
112 enum vect_def_type def_type;
116 /* SLP instance is a sequence of stmts in a loop that can be packed into
117 SIMD stmts. */
118 typedef struct _slp_instance {
119 /* The root of SLP tree. */
120 slp_tree root;
122 /* Size of groups of scalar stmts that will be replaced by SIMD stmt/s. */
123 unsigned int group_size;
125 /* The unrolling factor required to vectorized this SLP instance. */
126 unsigned int unrolling_factor;
128 /* The group of nodes that contain loads of this SLP instance. */
129 vec<slp_tree> loads;
130 } *slp_instance;
133 /* Access Functions. */
134 #define SLP_INSTANCE_TREE(S) (S)->root
135 #define SLP_INSTANCE_GROUP_SIZE(S) (S)->group_size
136 #define SLP_INSTANCE_UNROLLING_FACTOR(S) (S)->unrolling_factor
137 #define SLP_INSTANCE_LOADS(S) (S)->loads
139 #define SLP_TREE_CHILDREN(S) (S)->children
140 #define SLP_TREE_SCALAR_STMTS(S) (S)->stmts
141 #define SLP_TREE_VEC_STMTS(S) (S)->vec_stmts
142 #define SLP_TREE_NUMBER_OF_VEC_STMTS(S) (S)->vec_stmts_size
143 #define SLP_TREE_LOAD_PERMUTATION(S) (S)->load_permutation
144 #define SLP_TREE_TWO_OPERATORS(S) (S)->two_operators
145 #define SLP_TREE_DEF_TYPE(S) (S)->def_type
149 /* Vectorizer state common between loop and basic-block vectorization. */
150 struct vec_info {
151 enum { bb, loop } kind;
153 /* All SLP instances. */
154 vec<slp_instance> slp_instances;
156 /* All data references. */
157 vec<data_reference_p> datarefs;
159 /* All data dependences. */
160 vec<ddr_p> ddrs;
162 /* All interleaving chains of stores, represented by the first
163 stmt in the chain. */
164 vec<gimple *> grouped_stores;
166 /* Cost data used by the target cost model. */
167 void *target_cost_data;
170 struct _loop_vec_info;
171 struct _bb_vec_info;
173 template<>
174 template<>
175 inline bool
176 is_a_helper <_loop_vec_info *>::test (vec_info *i)
178 return i->kind == vec_info::loop;
181 template<>
182 template<>
183 inline bool
184 is_a_helper <_bb_vec_info *>::test (vec_info *i)
186 return i->kind == vec_info::bb;
190 /*-----------------------------------------------------------------*/
191 /* Info on vectorized loops. */
192 /*-----------------------------------------------------------------*/
193 typedef struct _loop_vec_info : public vec_info {
195 /* The loop to which this info struct refers to. */
196 struct loop *loop;
198 /* The loop basic blocks. */
199 basic_block *bbs;
201 /* Number of latch executions. */
202 tree num_itersm1;
203 /* Number of iterations. */
204 tree num_iters;
205 /* Number of iterations of the original loop. */
206 tree num_iters_unchanged;
207 /* Condition under which this loop is analyzed and versioned. */
208 tree num_iters_assumptions;
210 /* Threshold of number of iterations below which vectorzation will not be
211 performed. It is calculated from MIN_PROFITABLE_ITERS and
212 PARAM_MIN_VECT_LOOP_BOUND. */
213 unsigned int th;
215 /* Unrolling factor */
216 int vectorization_factor;
218 /* Unknown DRs according to which loop was peeled. */
219 struct data_reference *unaligned_dr;
221 /* peeling_for_alignment indicates whether peeling for alignment will take
222 place, and what the peeling factor should be:
223 peeling_for_alignment = X means:
224 If X=0: Peeling for alignment will not be applied.
225 If X>0: Peel first X iterations.
226 If X=-1: Generate a runtime test to calculate the number of iterations
227 to be peeled, using the dataref recorded in the field
228 unaligned_dr. */
229 int peeling_for_alignment;
231 /* The mask used to check the alignment of pointers or arrays. */
232 int ptr_mask;
234 /* The loop nest in which the data dependences are computed. */
235 vec<loop_p> loop_nest;
237 /* Data Dependence Relations defining address ranges that are candidates
238 for a run-time aliasing check. */
239 vec<ddr_p> may_alias_ddrs;
241 /* Data Dependence Relations defining address ranges together with segment
242 lengths from which the run-time aliasing check is built. */
243 vec<dr_with_seg_len_pair_t> comp_alias_ddrs;
245 /* Statements in the loop that have data references that are candidates for a
246 runtime (loop versioning) misalignment check. */
247 vec<gimple *> may_misalign_stmts;
249 /* Reduction cycles detected in the loop. Used in loop-aware SLP. */
250 vec<gimple *> reductions;
252 /* All reduction chains in the loop, represented by the first
253 stmt in the chain. */
254 vec<gimple *> reduction_chains;
256 /* Cost vector for a single scalar iteration. */
257 vec<stmt_info_for_cost> scalar_cost_vec;
259 /* The unrolling factor needed to SLP the loop. In case of that pure SLP is
260 applied to the loop, i.e., no unrolling is needed, this is 1. */
261 unsigned slp_unrolling_factor;
263 /* Cost of a single scalar iteration. */
264 int single_scalar_iteration_cost;
266 /* Is the loop vectorizable? */
267 bool vectorizable;
269 /* When we have grouped data accesses with gaps, we may introduce invalid
270 memory accesses. We peel the last iteration of the loop to prevent
271 this. */
272 bool peeling_for_gaps;
274 /* When the number of iterations is not a multiple of the vector size
275 we need to peel off iterations at the end to form an epilogue loop. */
276 bool peeling_for_niter;
278 /* Reductions are canonicalized so that the last operand is the reduction
279 operand. If this places a constant into RHS1, this decanonicalizes
280 GIMPLE for other phases, so we must track when this has occurred and
281 fix it up. */
282 bool operands_swapped;
284 /* True if there are no loop carried data dependencies in the loop.
285 If loop->safelen <= 1, then this is always true, either the loop
286 didn't have any loop carried data dependencies, or the loop is being
287 vectorized guarded with some runtime alias checks, or couldn't
288 be vectorized at all, but then this field shouldn't be used.
289 For loop->safelen >= 2, the user has asserted that there are no
290 backward dependencies, but there still could be loop carried forward
291 dependencies in such loops. This flag will be false if normal
292 vectorizer data dependency analysis would fail or require versioning
293 for alias, but because of loop->safelen >= 2 it has been vectorized
294 even without versioning for alias. E.g. in:
295 #pragma omp simd
296 for (int i = 0; i < m; i++)
297 a[i] = a[i + k] * c;
298 (or #pragma simd or #pragma ivdep) we can vectorize this and it will
299 DTRT even for k > 0 && k < m, but without safelen we would not
300 vectorize this, so this field would be false. */
301 bool no_data_dependencies;
303 /* Mark loops having masked stores. */
304 bool has_mask_store;
306 /* If if-conversion versioned this loop before conversion, this is the
307 loop version without if-conversion. */
308 struct loop *scalar_loop;
310 /* For loops being epilogues of already vectorized loops
311 this points to the original vectorized loop. Otherwise NULL. */
312 _loop_vec_info *orig_loop_info;
314 } *loop_vec_info;
316 /* Access Functions. */
317 #define LOOP_VINFO_LOOP(L) (L)->loop
318 #define LOOP_VINFO_BBS(L) (L)->bbs
319 #define LOOP_VINFO_NITERSM1(L) (L)->num_itersm1
320 #define LOOP_VINFO_NITERS(L) (L)->num_iters
321 /* Since LOOP_VINFO_NITERS and LOOP_VINFO_NITERSM1 can change after
322 prologue peeling retain total unchanged scalar loop iterations for
323 cost model. */
324 #define LOOP_VINFO_NITERS_UNCHANGED(L) (L)->num_iters_unchanged
325 #define LOOP_VINFO_NITERS_ASSUMPTIONS(L) (L)->num_iters_assumptions
326 #define LOOP_VINFO_COST_MODEL_THRESHOLD(L) (L)->th
327 #define LOOP_VINFO_VECTORIZABLE_P(L) (L)->vectorizable
328 #define LOOP_VINFO_VECT_FACTOR(L) (L)->vectorization_factor
329 #define LOOP_VINFO_PTR_MASK(L) (L)->ptr_mask
330 #define LOOP_VINFO_LOOP_NEST(L) (L)->loop_nest
331 #define LOOP_VINFO_DATAREFS(L) (L)->datarefs
332 #define LOOP_VINFO_DDRS(L) (L)->ddrs
333 #define LOOP_VINFO_INT_NITERS(L) (TREE_INT_CST_LOW ((L)->num_iters))
334 #define LOOP_VINFO_PEELING_FOR_ALIGNMENT(L) (L)->peeling_for_alignment
335 #define LOOP_VINFO_UNALIGNED_DR(L) (L)->unaligned_dr
336 #define LOOP_VINFO_MAY_MISALIGN_STMTS(L) (L)->may_misalign_stmts
337 #define LOOP_VINFO_MAY_ALIAS_DDRS(L) (L)->may_alias_ddrs
338 #define LOOP_VINFO_COMP_ALIAS_DDRS(L) (L)->comp_alias_ddrs
339 #define LOOP_VINFO_GROUPED_STORES(L) (L)->grouped_stores
340 #define LOOP_VINFO_SLP_INSTANCES(L) (L)->slp_instances
341 #define LOOP_VINFO_SLP_UNROLLING_FACTOR(L) (L)->slp_unrolling_factor
342 #define LOOP_VINFO_REDUCTIONS(L) (L)->reductions
343 #define LOOP_VINFO_REDUCTION_CHAINS(L) (L)->reduction_chains
344 #define LOOP_VINFO_TARGET_COST_DATA(L) (L)->target_cost_data
345 #define LOOP_VINFO_PEELING_FOR_GAPS(L) (L)->peeling_for_gaps
346 #define LOOP_VINFO_OPERANDS_SWAPPED(L) (L)->operands_swapped
347 #define LOOP_VINFO_PEELING_FOR_NITER(L) (L)->peeling_for_niter
348 #define LOOP_VINFO_NO_DATA_DEPENDENCIES(L) (L)->no_data_dependencies
349 #define LOOP_VINFO_SCALAR_LOOP(L) (L)->scalar_loop
350 #define LOOP_VINFO_HAS_MASK_STORE(L) (L)->has_mask_store
351 #define LOOP_VINFO_SCALAR_ITERATION_COST(L) (L)->scalar_cost_vec
352 #define LOOP_VINFO_SINGLE_SCALAR_ITERATION_COST(L) (L)->single_scalar_iteration_cost
353 #define LOOP_VINFO_ORIG_LOOP_INFO(L) (L)->orig_loop_info
355 #define LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT(L) \
356 ((L)->may_misalign_stmts.length () > 0)
357 #define LOOP_REQUIRES_VERSIONING_FOR_ALIAS(L) \
358 ((L)->may_alias_ddrs.length () > 0)
359 #define LOOP_REQUIRES_VERSIONING_FOR_NITERS(L) \
360 (LOOP_VINFO_NITERS_ASSUMPTIONS (L))
361 #define LOOP_REQUIRES_VERSIONING(L) \
362 (LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT (L) \
363 || LOOP_REQUIRES_VERSIONING_FOR_ALIAS (L) \
364 || LOOP_REQUIRES_VERSIONING_FOR_NITERS (L))
366 #define LOOP_VINFO_NITERS_KNOWN_P(L) \
367 (tree_fits_shwi_p ((L)->num_iters) && tree_to_shwi ((L)->num_iters) > 0)
369 #define LOOP_VINFO_EPILOGUE_P(L) \
370 (LOOP_VINFO_ORIG_LOOP_INFO (L) != NULL)
372 #define LOOP_VINFO_ORIG_VECT_FACTOR(L) \
373 (LOOP_VINFO_VECT_FACTOR (LOOP_VINFO_ORIG_LOOP_INFO (L)))
375 static inline loop_vec_info
376 loop_vec_info_for_loop (struct loop *loop)
378 return (loop_vec_info) loop->aux;
381 static inline bool
382 nested_in_vect_loop_p (struct loop *loop, gimple *stmt)
384 return (loop->inner
385 && (loop->inner == (gimple_bb (stmt))->loop_father));
388 typedef struct _bb_vec_info : public vec_info
390 basic_block bb;
391 gimple_stmt_iterator region_begin;
392 gimple_stmt_iterator region_end;
393 } *bb_vec_info;
395 #define BB_VINFO_BB(B) (B)->bb
396 #define BB_VINFO_GROUPED_STORES(B) (B)->grouped_stores
397 #define BB_VINFO_SLP_INSTANCES(B) (B)->slp_instances
398 #define BB_VINFO_DATAREFS(B) (B)->datarefs
399 #define BB_VINFO_DDRS(B) (B)->ddrs
400 #define BB_VINFO_TARGET_COST_DATA(B) (B)->target_cost_data
402 static inline bb_vec_info
403 vec_info_for_bb (basic_block bb)
405 return (bb_vec_info) bb->aux;
408 /*-----------------------------------------------------------------*/
409 /* Info on vectorized defs. */
410 /*-----------------------------------------------------------------*/
411 enum stmt_vec_info_type {
412 undef_vec_info_type = 0,
413 load_vec_info_type,
414 store_vec_info_type,
415 shift_vec_info_type,
416 op_vec_info_type,
417 call_vec_info_type,
418 call_simd_clone_vec_info_type,
419 assignment_vec_info_type,
420 condition_vec_info_type,
421 comparison_vec_info_type,
422 reduc_vec_info_type,
423 induc_vec_info_type,
424 type_promotion_vec_info_type,
425 type_demotion_vec_info_type,
426 type_conversion_vec_info_type,
427 loop_exit_ctrl_vec_info_type
430 /* Indicates whether/how a variable is used in the scope of loop/basic
431 block. */
432 enum vect_relevant {
433 vect_unused_in_scope = 0,
435 /* The def is only used outside the loop. */
436 vect_used_only_live,
437 /* The def is in the inner loop, and the use is in the outer loop, and the
438 use is a reduction stmt. */
439 vect_used_in_outer_by_reduction,
440 /* The def is in the inner loop, and the use is in the outer loop (and is
441 not part of reduction). */
442 vect_used_in_outer,
444 /* defs that feed computations that end up (only) in a reduction. These
445 defs may be used by non-reduction stmts, but eventually, any
446 computations/values that are affected by these defs are used to compute
447 a reduction (i.e. don't get stored to memory, for example). We use this
448 to identify computations that we can change the order in which they are
449 computed. */
450 vect_used_by_reduction,
452 vect_used_in_scope
455 /* The type of vectorization that can be applied to the stmt: regular loop-based
456 vectorization; pure SLP - the stmt is a part of SLP instances and does not
457 have uses outside SLP instances; or hybrid SLP and loop-based - the stmt is
458 a part of SLP instance and also must be loop-based vectorized, since it has
459 uses outside SLP sequences.
461 In the loop context the meanings of pure and hybrid SLP are slightly
462 different. By saying that pure SLP is applied to the loop, we mean that we
463 exploit only intra-iteration parallelism in the loop; i.e., the loop can be
464 vectorized without doing any conceptual unrolling, cause we don't pack
465 together stmts from different iterations, only within a single iteration.
466 Loop hybrid SLP means that we exploit both intra-iteration and
467 inter-iteration parallelism (e.g., number of elements in the vector is 4
468 and the slp-group-size is 2, in which case we don't have enough parallelism
469 within an iteration, so we obtain the rest of the parallelism from subsequent
470 iterations by unrolling the loop by 2). */
471 enum slp_vect_type {
472 loop_vect = 0,
473 pure_slp,
474 hybrid
477 /* Describes how we're going to vectorize an individual load or store,
478 or a group of loads or stores. */
479 enum vect_memory_access_type {
480 /* An access to an invariant address. This is used only for loads. */
481 VMAT_INVARIANT,
483 /* A simple contiguous access. */
484 VMAT_CONTIGUOUS,
486 /* A contiguous access that goes down in memory rather than up,
487 with no additional permutation. This is used only for stores
488 of invariants. */
489 VMAT_CONTIGUOUS_DOWN,
491 /* A simple contiguous access in which the elements need to be permuted
492 after loading or before storing. Only used for loop vectorization;
493 SLP uses separate permutes. */
494 VMAT_CONTIGUOUS_PERMUTE,
496 /* A simple contiguous access in which the elements need to be reversed
497 after loading or before storing. */
498 VMAT_CONTIGUOUS_REVERSE,
500 /* An access that uses IFN_LOAD_LANES or IFN_STORE_LANES. */
501 VMAT_LOAD_STORE_LANES,
503 /* An access in which each scalar element is loaded or stored
504 individually. */
505 VMAT_ELEMENTWISE,
507 /* A hybrid of VMAT_CONTIGUOUS and VMAT_ELEMENTWISE, used for grouped
508 SLP accesses. Each unrolled iteration uses a contiguous load
509 or store for the whole group, but the groups from separate iterations
510 are combined in the same way as for VMAT_ELEMENTWISE. */
511 VMAT_STRIDED_SLP,
513 /* The access uses gather loads or scatter stores. */
514 VMAT_GATHER_SCATTER
517 typedef struct data_reference *dr_p;
519 typedef struct _stmt_vec_info {
521 enum stmt_vec_info_type type;
523 /* Indicates whether this stmts is part of a computation whose result is
524 used outside the loop. */
525 bool live;
527 /* Stmt is part of some pattern (computation idiom) */
528 bool in_pattern_p;
530 /* Is this statement vectorizable or should it be skipped in (partial)
531 vectorization. */
532 bool vectorizable;
534 /* The stmt to which this info struct refers to. */
535 gimple *stmt;
537 /* The vec_info with respect to which STMT is vectorized. */
538 vec_info *vinfo;
540 /* The vector type to be used for the LHS of this statement. */
541 tree vectype;
543 /* The vectorized version of the stmt. */
544 gimple *vectorized_stmt;
547 /* The following is relevant only for stmts that contain a non-scalar
548 data-ref (array/pointer/struct access). A GIMPLE stmt is expected to have
549 at most one such data-ref. */
551 /* Information about the data-ref (access function, etc),
552 relative to the inner-most containing loop. */
553 struct data_reference *data_ref_info;
555 /* Information about the data-ref relative to this loop
556 nest (the loop that is being considered for vectorization). */
557 innermost_loop_behavior dr_wrt_vec_loop;
559 /* For loop PHI nodes, the base and evolution part of it. This makes sure
560 this information is still available in vect_update_ivs_after_vectorizer
561 where we may not be able to re-analyze the PHI nodes evolution as
562 peeling for the prologue loop can make it unanalyzable. The evolution
563 part is still correct after peeling, but the base may have changed from
564 the version here. */
565 tree loop_phi_evolution_base_unchanged;
566 tree loop_phi_evolution_part;
568 /* Used for various bookkeeping purposes, generally holding a pointer to
569 some other stmt S that is in some way "related" to this stmt.
570 Current use of this field is:
571 If this stmt is part of a pattern (i.e. the field 'in_pattern_p' is
572 true): S is the "pattern stmt" that represents (and replaces) the
573 sequence of stmts that constitutes the pattern. Similarly, the
574 related_stmt of the "pattern stmt" points back to this stmt (which is
575 the last stmt in the original sequence of stmts that constitutes the
576 pattern). */
577 gimple *related_stmt;
579 /* Used to keep a sequence of def stmts of a pattern stmt if such exists. */
580 gimple_seq pattern_def_seq;
582 /* List of datarefs that are known to have the same alignment as the dataref
583 of this stmt. */
584 vec<dr_p> same_align_refs;
586 /* Selected SIMD clone's function info. First vector element
587 is SIMD clone's function decl, followed by a pair of trees (base + step)
588 for linear arguments (pair of NULLs for other arguments). */
589 vec<tree> simd_clone_info;
591 /* Classify the def of this stmt. */
592 enum vect_def_type def_type;
594 /* Whether the stmt is SLPed, loop-based vectorized, or both. */
595 enum slp_vect_type slp_type;
597 /* Interleaving and reduction chains info. */
598 /* First element in the group. */
599 gimple *first_element;
600 /* Pointer to the next element in the group. */
601 gimple *next_element;
602 /* For data-refs, in case that two or more stmts share data-ref, this is the
603 pointer to the previously detected stmt with the same dr. */
604 gimple *same_dr_stmt;
605 /* The size of the group. */
606 unsigned int size;
607 /* For stores, number of stores from this group seen. We vectorize the last
608 one. */
609 unsigned int store_count;
610 /* For loads only, the gap from the previous load. For consecutive loads, GAP
611 is 1. */
612 unsigned int gap;
614 /* The minimum negative dependence distance this stmt participates in
615 or zero if none. */
616 unsigned int min_neg_dist;
618 /* Not all stmts in the loop need to be vectorized. e.g, the increment
619 of the loop induction variable and computation of array indexes. relevant
620 indicates whether the stmt needs to be vectorized. */
621 enum vect_relevant relevant;
623 /* For loads if this is a gather, for stores if this is a scatter. */
624 bool gather_scatter_p;
626 /* True if this is an access with loop-invariant stride. */
627 bool strided_p;
629 /* For both loads and stores. */
630 bool simd_lane_access_p;
632 /* Classifies how the load or store is going to be implemented
633 for loop vectorization. */
634 vect_memory_access_type memory_access_type;
636 /* For reduction loops, this is the type of reduction. */
637 enum vect_reduction_type v_reduc_type;
639 /* For CONST_COND_REDUCTION, record the reduc code. */
640 enum tree_code const_cond_reduc_code;
642 /* On a reduction PHI the reduction type as detected by
643 vect_force_simple_reduction. */
644 enum vect_reduction_type reduc_type;
646 /* On a reduction PHI the def returned by vect_force_simple_reduction.
647 On the def returned by vect_force_simple_reduction the
648 corresponding PHI. */
649 gimple *reduc_def;
651 /* The number of scalar stmt references from active SLP instances. */
652 unsigned int num_slp_uses;
653 } *stmt_vec_info;
655 /* Information about a gather/scatter call. */
656 struct gather_scatter_info {
657 /* The FUNCTION_DECL for the built-in gather/scatter function. */
658 tree decl;
660 /* The loop-invariant base value. */
661 tree base;
663 /* The original scalar offset, which is a non-loop-invariant SSA_NAME. */
664 tree offset;
666 /* Each offset element should be multiplied by this amount before
667 being added to the base. */
668 int scale;
670 /* The definition type for the vectorized offset. */
671 enum vect_def_type offset_dt;
673 /* The type of the vectorized offset. */
674 tree offset_vectype;
677 /* Access Functions. */
678 #define STMT_VINFO_TYPE(S) (S)->type
679 #define STMT_VINFO_STMT(S) (S)->stmt
680 inline loop_vec_info
681 STMT_VINFO_LOOP_VINFO (stmt_vec_info stmt_vinfo)
683 if (loop_vec_info loop_vinfo = dyn_cast <loop_vec_info> (stmt_vinfo->vinfo))
684 return loop_vinfo;
685 return NULL;
687 inline bb_vec_info
688 STMT_VINFO_BB_VINFO (stmt_vec_info stmt_vinfo)
690 if (bb_vec_info bb_vinfo = dyn_cast <bb_vec_info> (stmt_vinfo->vinfo))
691 return bb_vinfo;
692 return NULL;
694 #define STMT_VINFO_RELEVANT(S) (S)->relevant
695 #define STMT_VINFO_LIVE_P(S) (S)->live
696 #define STMT_VINFO_VECTYPE(S) (S)->vectype
697 #define STMT_VINFO_VEC_STMT(S) (S)->vectorized_stmt
698 #define STMT_VINFO_VECTORIZABLE(S) (S)->vectorizable
699 #define STMT_VINFO_DATA_REF(S) (S)->data_ref_info
700 #define STMT_VINFO_GATHER_SCATTER_P(S) (S)->gather_scatter_p
701 #define STMT_VINFO_STRIDED_P(S) (S)->strided_p
702 #define STMT_VINFO_MEMORY_ACCESS_TYPE(S) (S)->memory_access_type
703 #define STMT_VINFO_SIMD_LANE_ACCESS_P(S) (S)->simd_lane_access_p
704 #define STMT_VINFO_VEC_REDUCTION_TYPE(S) (S)->v_reduc_type
705 #define STMT_VINFO_VEC_CONST_COND_REDUC_CODE(S) (S)->const_cond_reduc_code
707 #define STMT_VINFO_DR_WRT_VEC_LOOP(S) (S)->dr_wrt_vec_loop
708 #define STMT_VINFO_DR_BASE_ADDRESS(S) (S)->dr_wrt_vec_loop.base_address
709 #define STMT_VINFO_DR_INIT(S) (S)->dr_wrt_vec_loop.init
710 #define STMT_VINFO_DR_OFFSET(S) (S)->dr_wrt_vec_loop.offset
711 #define STMT_VINFO_DR_STEP(S) (S)->dr_wrt_vec_loop.step
712 #define STMT_VINFO_DR_BASE_ALIGNMENT(S) (S)->dr_wrt_vec_loop.base_alignment
713 #define STMT_VINFO_DR_BASE_MISALIGNMENT(S) \
714 (S)->dr_wrt_vec_loop.base_misalignment
715 #define STMT_VINFO_DR_OFFSET_ALIGNMENT(S) \
716 (S)->dr_wrt_vec_loop.offset_alignment
717 #define STMT_VINFO_DR_STEP_ALIGNMENT(S) \
718 (S)->dr_wrt_vec_loop.step_alignment
720 #define STMT_VINFO_IN_PATTERN_P(S) (S)->in_pattern_p
721 #define STMT_VINFO_RELATED_STMT(S) (S)->related_stmt
722 #define STMT_VINFO_PATTERN_DEF_SEQ(S) (S)->pattern_def_seq
723 #define STMT_VINFO_SAME_ALIGN_REFS(S) (S)->same_align_refs
724 #define STMT_VINFO_SIMD_CLONE_INFO(S) (S)->simd_clone_info
725 #define STMT_VINFO_DEF_TYPE(S) (S)->def_type
726 #define STMT_VINFO_GROUP_FIRST_ELEMENT(S) (S)->first_element
727 #define STMT_VINFO_GROUP_NEXT_ELEMENT(S) (S)->next_element
728 #define STMT_VINFO_GROUP_SIZE(S) (S)->size
729 #define STMT_VINFO_GROUP_STORE_COUNT(S) (S)->store_count
730 #define STMT_VINFO_GROUP_GAP(S) (S)->gap
731 #define STMT_VINFO_GROUP_SAME_DR_STMT(S) (S)->same_dr_stmt
732 #define STMT_VINFO_GROUPED_ACCESS(S) ((S)->first_element != NULL && (S)->data_ref_info)
733 #define STMT_VINFO_LOOP_PHI_EVOLUTION_BASE_UNCHANGED(S) (S)->loop_phi_evolution_base_unchanged
734 #define STMT_VINFO_LOOP_PHI_EVOLUTION_PART(S) (S)->loop_phi_evolution_part
735 #define STMT_VINFO_MIN_NEG_DIST(S) (S)->min_neg_dist
736 #define STMT_VINFO_NUM_SLP_USES(S) (S)->num_slp_uses
737 #define STMT_VINFO_REDUC_TYPE(S) (S)->reduc_type
738 #define STMT_VINFO_REDUC_DEF(S) (S)->reduc_def
740 #define GROUP_FIRST_ELEMENT(S) (S)->first_element
741 #define GROUP_NEXT_ELEMENT(S) (S)->next_element
742 #define GROUP_SIZE(S) (S)->size
743 #define GROUP_STORE_COUNT(S) (S)->store_count
744 #define GROUP_GAP(S) (S)->gap
745 #define GROUP_SAME_DR_STMT(S) (S)->same_dr_stmt
747 #define STMT_VINFO_RELEVANT_P(S) ((S)->relevant != vect_unused_in_scope)
749 #define HYBRID_SLP_STMT(S) ((S)->slp_type == hybrid)
750 #define PURE_SLP_STMT(S) ((S)->slp_type == pure_slp)
751 #define STMT_SLP_TYPE(S) (S)->slp_type
753 struct dataref_aux {
754 int misalignment;
755 /* If true the alignment of base_decl needs to be increased. */
756 bool base_misaligned;
757 tree base_decl;
760 #define DR_VECT_AUX(dr) ((dataref_aux *)(dr)->aux)
762 #define VECT_MAX_COST 1000
764 /* The maximum number of intermediate steps required in multi-step type
765 conversion. */
766 #define MAX_INTERM_CVT_STEPS 3
768 /* The maximum vectorization factor supported by any target (V64QI). */
769 #define MAX_VECTORIZATION_FACTOR 64
771 /* Nonzero if TYPE represents a (scalar) boolean type or type
772 in the middle-end compatible with it (unsigned precision 1 integral
773 types). Used to determine which types should be vectorized as
774 VECTOR_BOOLEAN_TYPE_P. */
776 #define VECT_SCALAR_BOOLEAN_TYPE_P(TYPE) \
777 (TREE_CODE (TYPE) == BOOLEAN_TYPE \
778 || ((TREE_CODE (TYPE) == INTEGER_TYPE \
779 || TREE_CODE (TYPE) == ENUMERAL_TYPE) \
780 && TYPE_PRECISION (TYPE) == 1 \
781 && TYPE_UNSIGNED (TYPE)))
783 extern vec<stmt_vec_info> stmt_vec_info_vec;
785 void init_stmt_vec_info_vec (void);
786 void free_stmt_vec_info_vec (void);
788 /* Return a stmt_vec_info corresponding to STMT. */
790 static inline stmt_vec_info
791 vinfo_for_stmt (gimple *stmt)
793 unsigned int uid = gimple_uid (stmt);
794 if (uid == 0)
795 return NULL;
797 return stmt_vec_info_vec[uid - 1];
800 /* Set vectorizer information INFO for STMT. */
802 static inline void
803 set_vinfo_for_stmt (gimple *stmt, stmt_vec_info info)
805 unsigned int uid = gimple_uid (stmt);
806 if (uid == 0)
808 gcc_checking_assert (info);
809 uid = stmt_vec_info_vec.length () + 1;
810 gimple_set_uid (stmt, uid);
811 stmt_vec_info_vec.safe_push (info);
813 else
815 gcc_checking_assert (info == NULL);
816 stmt_vec_info_vec[uid - 1] = info;
820 /* Return the earlier statement between STMT1 and STMT2. */
822 static inline gimple *
823 get_earlier_stmt (gimple *stmt1, gimple *stmt2)
825 unsigned int uid1, uid2;
827 if (stmt1 == NULL)
828 return stmt2;
830 if (stmt2 == NULL)
831 return stmt1;
833 uid1 = gimple_uid (stmt1);
834 uid2 = gimple_uid (stmt2);
836 if (uid1 == 0 || uid2 == 0)
837 return NULL;
839 gcc_checking_assert (uid1 <= stmt_vec_info_vec.length ()
840 && uid2 <= stmt_vec_info_vec.length ());
842 if (uid1 < uid2)
843 return stmt1;
844 else
845 return stmt2;
848 /* Return the later statement between STMT1 and STMT2. */
850 static inline gimple *
851 get_later_stmt (gimple *stmt1, gimple *stmt2)
853 unsigned int uid1, uid2;
855 if (stmt1 == NULL)
856 return stmt2;
858 if (stmt2 == NULL)
859 return stmt1;
861 uid1 = gimple_uid (stmt1);
862 uid2 = gimple_uid (stmt2);
864 if (uid1 == 0 || uid2 == 0)
865 return NULL;
867 gcc_assert (uid1 <= stmt_vec_info_vec.length ());
868 gcc_assert (uid2 <= stmt_vec_info_vec.length ());
870 if (uid1 > uid2)
871 return stmt1;
872 else
873 return stmt2;
876 /* Return TRUE if a statement represented by STMT_INFO is a part of a
877 pattern. */
879 static inline bool
880 is_pattern_stmt_p (stmt_vec_info stmt_info)
882 gimple *related_stmt;
883 stmt_vec_info related_stmt_info;
885 related_stmt = STMT_VINFO_RELATED_STMT (stmt_info);
886 if (related_stmt
887 && (related_stmt_info = vinfo_for_stmt (related_stmt))
888 && STMT_VINFO_IN_PATTERN_P (related_stmt_info))
889 return true;
891 return false;
894 /* Return true if BB is a loop header. */
896 static inline bool
897 is_loop_header_bb_p (basic_block bb)
899 if (bb == (bb->loop_father)->header)
900 return true;
901 gcc_checking_assert (EDGE_COUNT (bb->preds) == 1);
902 return false;
905 /* Return pow2 (X). */
907 static inline int
908 vect_pow2 (int x)
910 int i, res = 1;
912 for (i = 0; i < x; i++)
913 res *= 2;
915 return res;
918 /* Alias targetm.vectorize.builtin_vectorization_cost. */
920 static inline int
921 builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost,
922 tree vectype, int misalign)
924 return targetm.vectorize.builtin_vectorization_cost (type_of_cost,
925 vectype, misalign);
928 /* Get cost by calling cost target builtin. */
930 static inline
931 int vect_get_stmt_cost (enum vect_cost_for_stmt type_of_cost)
933 return builtin_vectorization_cost (type_of_cost, NULL, 0);
936 /* Alias targetm.vectorize.init_cost. */
938 static inline void *
939 init_cost (struct loop *loop_info)
941 return targetm.vectorize.init_cost (loop_info);
944 /* Alias targetm.vectorize.add_stmt_cost. */
946 static inline unsigned
947 add_stmt_cost (void *data, int count, enum vect_cost_for_stmt kind,
948 stmt_vec_info stmt_info, int misalign,
949 enum vect_cost_model_location where)
951 return targetm.vectorize.add_stmt_cost (data, count, kind,
952 stmt_info, misalign, where);
955 /* Alias targetm.vectorize.finish_cost. */
957 static inline void
958 finish_cost (void *data, unsigned *prologue_cost,
959 unsigned *body_cost, unsigned *epilogue_cost)
961 targetm.vectorize.finish_cost (data, prologue_cost, body_cost, epilogue_cost);
964 /* Alias targetm.vectorize.destroy_cost_data. */
966 static inline void
967 destroy_cost_data (void *data)
969 targetm.vectorize.destroy_cost_data (data);
972 /*-----------------------------------------------------------------*/
973 /* Info on data references alignment. */
974 /*-----------------------------------------------------------------*/
975 inline void
976 set_dr_misalignment (struct data_reference *dr, int val)
978 dataref_aux *data_aux = DR_VECT_AUX (dr);
980 if (!data_aux)
982 data_aux = XCNEW (dataref_aux);
983 dr->aux = data_aux;
986 data_aux->misalignment = val;
989 inline int
990 dr_misalignment (struct data_reference *dr)
992 return DR_VECT_AUX (dr)->misalignment;
995 /* Reflects actual alignment of first access in the vectorized loop,
996 taking into account peeling/versioning if applied. */
997 #define DR_MISALIGNMENT(DR) dr_misalignment (DR)
998 #define SET_DR_MISALIGNMENT(DR, VAL) set_dr_misalignment (DR, VAL)
999 #define DR_MISALIGNMENT_UNKNOWN (-1)
1001 /* Return TRUE if the data access is aligned, and FALSE otherwise. */
1003 static inline bool
1004 aligned_access_p (struct data_reference *data_ref_info)
1006 return (DR_MISALIGNMENT (data_ref_info) == 0);
1009 /* Return TRUE if the alignment of the data access is known, and FALSE
1010 otherwise. */
1012 static inline bool
1013 known_alignment_for_access_p (struct data_reference *data_ref_info)
1015 return (DR_MISALIGNMENT (data_ref_info) != DR_MISALIGNMENT_UNKNOWN);
1018 /* Return the behavior of DR with respect to the vectorization context
1019 (which for outer loop vectorization might not be the behavior recorded
1020 in DR itself). */
1022 static inline innermost_loop_behavior *
1023 vect_dr_behavior (data_reference *dr)
1025 gimple *stmt = DR_STMT (dr);
1026 stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
1027 loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
1028 if (loop_vinfo == NULL
1029 || !nested_in_vect_loop_p (LOOP_VINFO_LOOP (loop_vinfo), stmt))
1030 return &DR_INNERMOST (dr);
1031 else
1032 return &STMT_VINFO_DR_WRT_VEC_LOOP (stmt_info);
1035 /* Return true if the vect cost model is unlimited. */
1036 static inline bool
1037 unlimited_cost_model (loop_p loop)
1039 if (loop != NULL && loop->force_vectorize
1040 && flag_simd_cost_model != VECT_COST_MODEL_DEFAULT)
1041 return flag_simd_cost_model == VECT_COST_MODEL_UNLIMITED;
1042 return (flag_vect_cost_model == VECT_COST_MODEL_UNLIMITED);
1045 /* Source location */
1046 extern source_location vect_location;
1048 /*-----------------------------------------------------------------*/
1049 /* Function prototypes. */
1050 /*-----------------------------------------------------------------*/
1052 /* Simple loop peeling and versioning utilities for vectorizer's purposes -
1053 in tree-vect-loop-manip.c. */
1054 extern void slpeel_make_loop_iterate_ntimes (struct loop *, tree);
1055 extern bool slpeel_can_duplicate_loop_p (const struct loop *, const_edge);
1056 struct loop *slpeel_tree_duplicate_loop_to_edge_cfg (struct loop *,
1057 struct loop *, edge);
1058 extern void vect_loop_versioning (loop_vec_info, unsigned int, bool);
1059 extern struct loop *vect_do_peeling (loop_vec_info, tree, tree,
1060 tree *, int, bool, bool);
1061 extern source_location find_loop_location (struct loop *);
1062 extern bool vect_can_advance_ivs_p (loop_vec_info);
1064 /* In tree-vect-stmts.c. */
1065 extern unsigned int current_vector_size;
1066 extern tree get_vectype_for_scalar_type (tree);
1067 extern tree get_mask_type_for_scalar_type (tree);
1068 extern tree get_same_sized_vectype (tree, tree);
1069 extern bool vect_is_simple_use (tree, vec_info *, gimple **,
1070 enum vect_def_type *);
1071 extern bool vect_is_simple_use (tree, vec_info *, gimple **,
1072 enum vect_def_type *, tree *);
1073 extern bool supportable_widening_operation (enum tree_code, gimple *, tree,
1074 tree, enum tree_code *,
1075 enum tree_code *, int *,
1076 vec<tree> *);
1077 extern bool supportable_narrowing_operation (enum tree_code, tree, tree,
1078 enum tree_code *,
1079 int *, vec<tree> *);
1080 extern stmt_vec_info new_stmt_vec_info (gimple *stmt, vec_info *);
1081 extern void free_stmt_vec_info (gimple *stmt);
1082 extern void vect_model_simple_cost (stmt_vec_info, int, enum vect_def_type *,
1083 int, stmt_vector_for_cost *,
1084 stmt_vector_for_cost *);
1085 extern void vect_model_store_cost (stmt_vec_info, int, vect_memory_access_type,
1086 enum vect_def_type, slp_tree,
1087 stmt_vector_for_cost *,
1088 stmt_vector_for_cost *);
1089 extern void vect_model_load_cost (stmt_vec_info, int, vect_memory_access_type,
1090 slp_tree, stmt_vector_for_cost *,
1091 stmt_vector_for_cost *);
1092 extern unsigned record_stmt_cost (stmt_vector_for_cost *, int,
1093 enum vect_cost_for_stmt, stmt_vec_info,
1094 int, enum vect_cost_model_location);
1095 extern void vect_finish_stmt_generation (gimple *, gimple *,
1096 gimple_stmt_iterator *);
1097 extern bool vect_mark_stmts_to_be_vectorized (loop_vec_info);
1098 extern tree vect_get_vec_def_for_operand_1 (gimple *, enum vect_def_type);
1099 extern tree vect_get_vec_def_for_operand (tree, gimple *, tree = NULL);
1100 extern void vect_get_vec_defs (tree, tree, gimple *, vec<tree> *,
1101 vec<tree> *, slp_tree);
1102 extern void vect_get_vec_defs_for_stmt_copy (enum vect_def_type *,
1103 vec<tree> *, vec<tree> *);
1104 extern tree vect_init_vector (gimple *, tree, tree,
1105 gimple_stmt_iterator *);
1106 extern tree vect_get_vec_def_for_stmt_copy (enum vect_def_type, tree);
1107 extern bool vect_transform_stmt (gimple *, gimple_stmt_iterator *,
1108 bool *, slp_tree, slp_instance);
1109 extern void vect_remove_stores (gimple *);
1110 extern bool vect_analyze_stmt (gimple *, bool *, slp_tree);
1111 extern bool vectorizable_condition (gimple *, gimple_stmt_iterator *,
1112 gimple **, tree, int, slp_tree);
1113 extern void vect_get_load_cost (struct data_reference *, int, bool,
1114 unsigned int *, unsigned int *,
1115 stmt_vector_for_cost *,
1116 stmt_vector_for_cost *, bool);
1117 extern void vect_get_store_cost (struct data_reference *, int,
1118 unsigned int *, stmt_vector_for_cost *);
1119 extern bool vect_supportable_shift (enum tree_code, tree);
1120 extern tree vect_gen_perm_mask_any (tree, const unsigned char *);
1121 extern tree vect_gen_perm_mask_checked (tree, const unsigned char *);
1122 extern void optimize_mask_stores (struct loop*);
1124 /* In tree-vect-data-refs.c. */
1125 extern bool vect_can_force_dr_alignment_p (const_tree, unsigned int);
1126 extern enum dr_alignment_support vect_supportable_dr_alignment
1127 (struct data_reference *, bool);
1128 extern tree vect_get_smallest_scalar_type (gimple *, HOST_WIDE_INT *,
1129 HOST_WIDE_INT *);
1130 extern bool vect_analyze_data_ref_dependences (loop_vec_info, int *);
1131 extern bool vect_slp_analyze_instance_dependence (slp_instance);
1132 extern bool vect_enhance_data_refs_alignment (loop_vec_info);
1133 extern bool vect_analyze_data_refs_alignment (loop_vec_info);
1134 extern bool vect_verify_datarefs_alignment (loop_vec_info);
1135 extern bool vect_slp_analyze_and_verify_instance_alignment (slp_instance);
1136 extern bool vect_analyze_data_ref_accesses (vec_info *);
1137 extern bool vect_prune_runtime_alias_test_list (loop_vec_info);
1138 extern bool vect_check_gather_scatter (gimple *, loop_vec_info,
1139 gather_scatter_info *);
1140 extern bool vect_analyze_data_refs (vec_info *, int *);
1141 extern tree vect_create_data_ref_ptr (gimple *, tree, struct loop *, tree,
1142 tree *, gimple_stmt_iterator *,
1143 gimple **, bool, bool *,
1144 tree = NULL_TREE);
1145 extern tree bump_vector_ptr (tree, gimple *, gimple_stmt_iterator *, gimple *,
1146 tree);
1147 extern tree vect_create_destination_var (tree, tree);
1148 extern bool vect_grouped_store_supported (tree, unsigned HOST_WIDE_INT);
1149 extern bool vect_store_lanes_supported (tree, unsigned HOST_WIDE_INT);
1150 extern bool vect_grouped_load_supported (tree, bool, unsigned HOST_WIDE_INT);
1151 extern bool vect_load_lanes_supported (tree, unsigned HOST_WIDE_INT);
1152 extern void vect_permute_store_chain (vec<tree> ,unsigned int, gimple *,
1153 gimple_stmt_iterator *, vec<tree> *);
1154 extern tree vect_setup_realignment (gimple *, gimple_stmt_iterator *, tree *,
1155 enum dr_alignment_support, tree,
1156 struct loop **);
1157 extern void vect_transform_grouped_load (gimple *, vec<tree> , int,
1158 gimple_stmt_iterator *);
1159 extern void vect_record_grouped_load_vectors (gimple *, vec<tree> );
1160 extern tree vect_get_new_vect_var (tree, enum vect_var_kind, const char *);
1161 extern tree vect_get_new_ssa_name (tree, enum vect_var_kind,
1162 const char * = NULL);
1163 extern tree vect_create_addr_base_for_vector_ref (gimple *, gimple_seq *,
1164 tree, tree = NULL_TREE);
1166 /* In tree-vect-loop.c. */
1167 /* FORNOW: Used in tree-parloops.c. */
1168 extern void destroy_loop_vec_info (loop_vec_info, bool);
1169 extern gimple *vect_force_simple_reduction (loop_vec_info, gimple *,
1170 bool *, bool);
1171 /* Drive for loop analysis stage. */
1172 extern loop_vec_info vect_analyze_loop (struct loop *, loop_vec_info);
1173 extern tree vect_build_loop_niters (loop_vec_info, bool * = NULL);
1174 extern void vect_gen_vector_loop_niters (loop_vec_info, tree, tree *, bool);
1175 /* Drive for loop transformation stage. */
1176 extern struct loop *vect_transform_loop (loop_vec_info);
1177 extern loop_vec_info vect_analyze_loop_form (struct loop *);
1178 extern bool vectorizable_live_operation (gimple *, gimple_stmt_iterator *,
1179 slp_tree, int, gimple **);
1180 extern bool vectorizable_reduction (gimple *, gimple_stmt_iterator *,
1181 gimple **, slp_tree);
1182 extern bool vectorizable_induction (gimple *, gimple_stmt_iterator *,
1183 gimple **, slp_tree);
1184 extern tree get_initial_def_for_reduction (gimple *, tree, tree *);
1185 extern int vect_min_worthwhile_factor (enum tree_code);
1186 extern int vect_get_known_peeling_cost (loop_vec_info, int, int *,
1187 stmt_vector_for_cost *,
1188 stmt_vector_for_cost *,
1189 stmt_vector_for_cost *);
1191 /* In tree-vect-slp.c. */
1192 extern void vect_free_slp_instance (slp_instance);
1193 extern bool vect_transform_slp_perm_load (slp_tree, vec<tree> ,
1194 gimple_stmt_iterator *, int,
1195 slp_instance, bool, unsigned *);
1196 extern bool vect_slp_analyze_operations (vec<slp_instance> slp_instances,
1197 void *);
1198 extern bool vect_schedule_slp (vec_info *);
1199 extern bool vect_analyze_slp (vec_info *, unsigned);
1200 extern bool vect_make_slp_decision (loop_vec_info);
1201 extern void vect_detect_hybrid_slp (loop_vec_info);
1202 extern void vect_get_slp_defs (vec<tree> , slp_tree, vec<vec<tree> > *);
1203 extern bool vect_slp_bb (basic_block);
1204 extern gimple *vect_find_last_scalar_stmt_in_slp (slp_tree);
1205 extern bool is_simple_and_all_uses_invariant (gimple *, loop_vec_info);
1207 /* In tree-vect-patterns.c. */
1208 /* Pattern recognition functions.
1209 Additional pattern recognition functions can (and will) be added
1210 in the future. */
1211 typedef gimple *(* vect_recog_func_ptr) (vec<gimple *> *, tree *, tree *);
1212 #define NUM_PATTERNS 14
1213 void vect_pattern_recog (vec_info *);
1215 /* In tree-vectorizer.c. */
1216 unsigned vectorize_loops (void);
1217 void vect_destroy_datarefs (vec_info *);
1218 bool vect_stmt_in_region_p (vec_info *, gimple *);
1219 void vect_free_loop_info_assumptions (struct loop *);
1221 #endif /* GCC_TREE_VECTORIZER_H */