tree-vectorizer.h 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143
  1. /* Vectorizer
  2. Copyright (C) 2003-2015 Free Software Foundation, Inc.
  3. Contributed by Dorit Naishlos <dorit@il.ibm.com>
  4. This file is part of GCC.
  5. GCC is free software; you can redistribute it and/or modify it under
  6. the terms of the GNU General Public License as published by the Free
  7. Software Foundation; either version 3, or (at your option) any later
  8. version.
  9. GCC is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  12. for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with GCC; see the file COPYING3. If not see
  15. <http://www.gnu.org/licenses/>. */
  16. #ifndef GCC_TREE_VECTORIZER_H
  17. #define GCC_TREE_VECTORIZER_H
  18. #include "tree-data-ref.h"
  19. #include "target.h"
  20. #include "hash-table.h"
  21. /* Used for naming of new temporaries. */
  22. enum vect_var_kind {
  23. vect_simple_var,
  24. vect_pointer_var,
  25. vect_scalar_var
  26. };
  27. /* Defines type of operation. */
  28. enum operation_type {
  29. unary_op = 1,
  30. binary_op,
  31. ternary_op
  32. };
  33. /* Define type of available alignment support. */
  34. enum dr_alignment_support {
  35. dr_unaligned_unsupported,
  36. dr_unaligned_supported,
  37. dr_explicit_realign,
  38. dr_explicit_realign_optimized,
  39. dr_aligned
  40. };
  41. /* Define type of def-use cross-iteration cycle. */
  42. enum vect_def_type {
  43. vect_uninitialized_def = 0,
  44. vect_constant_def = 1,
  45. vect_external_def,
  46. vect_internal_def,
  47. vect_induction_def,
  48. vect_reduction_def,
  49. vect_double_reduction_def,
  50. vect_nested_cycle,
  51. vect_unknown_def_type
  52. };
  53. #define VECTORIZABLE_CYCLE_DEF(D) (((D) == vect_reduction_def) \
  54. || ((D) == vect_double_reduction_def) \
  55. || ((D) == vect_nested_cycle))
  56. /* Structure to encapsulate information about a group of like
  57. instructions to be presented to the target cost model. */
  58. typedef struct _stmt_info_for_cost {
  59. int count;
  60. enum vect_cost_for_stmt kind;
  61. gimple stmt;
  62. int misalign;
  63. } stmt_info_for_cost;
  64. typedef vec<stmt_info_for_cost> stmt_vector_for_cost;
  65. static inline void
  66. add_stmt_info_to_vec (stmt_vector_for_cost *stmt_cost_vec, int count,
  67. enum vect_cost_for_stmt kind, gimple stmt, int misalign)
  68. {
  69. stmt_info_for_cost si;
  70. si.count = count;
  71. si.kind = kind;
  72. si.stmt = stmt;
  73. si.misalign = misalign;
  74. stmt_cost_vec->safe_push (si);
  75. }
  76. /************************************************************************
  77. SLP
  78. ************************************************************************/
  79. typedef struct _slp_tree *slp_tree;
  80. /* A computation tree of an SLP instance. Each node corresponds to a group of
  81. stmts to be packed in a SIMD stmt. */
  82. struct _slp_tree {
  83. /* Nodes that contain def-stmts of this node statements operands. */
  84. vec<slp_tree> children;
  85. /* A group of scalar stmts to be vectorized together. */
  86. vec<gimple> stmts;
  87. /* Load permutation relative to the stores, NULL if there is no
  88. permutation. */
  89. vec<unsigned> load_permutation;
  90. /* Vectorized stmt/s. */
  91. vec<gimple> vec_stmts;
  92. /* Number of vector stmts that are created to replace the group of scalar
  93. stmts. It is calculated during the transformation phase as the number of
  94. scalar elements in one scalar iteration (GROUP_SIZE) multiplied by VF
  95. divided by vector size. */
  96. unsigned int vec_stmts_size;
  97. };
  98. /* SLP instance is a sequence of stmts in a loop that can be packed into
  99. SIMD stmts. */
  100. typedef struct _slp_instance {
  101. /* The root of SLP tree. */
  102. slp_tree root;
  103. /* Size of groups of scalar stmts that will be replaced by SIMD stmt/s. */
  104. unsigned int group_size;
  105. /* The unrolling factor required to vectorized this SLP instance. */
  106. unsigned int unrolling_factor;
  107. /* Vectorization costs associated with SLP instance. */
  108. stmt_vector_for_cost body_cost_vec;
  109. /* The group of nodes that contain loads of this SLP instance. */
  110. vec<slp_tree> loads;
  111. /* The first scalar load of the instance. The created vector loads will be
  112. inserted before this statement. */
  113. gimple first_load;
  114. } *slp_instance;
  115. /* Access Functions. */
  116. #define SLP_INSTANCE_TREE(S) (S)->root
  117. #define SLP_INSTANCE_GROUP_SIZE(S) (S)->group_size
  118. #define SLP_INSTANCE_UNROLLING_FACTOR(S) (S)->unrolling_factor
  119. #define SLP_INSTANCE_BODY_COST_VEC(S) (S)->body_cost_vec
  120. #define SLP_INSTANCE_LOADS(S) (S)->loads
  121. #define SLP_INSTANCE_FIRST_LOAD_STMT(S) (S)->first_load
  122. #define SLP_TREE_CHILDREN(S) (S)->children
  123. #define SLP_TREE_SCALAR_STMTS(S) (S)->stmts
  124. #define SLP_TREE_VEC_STMTS(S) (S)->vec_stmts
  125. #define SLP_TREE_NUMBER_OF_VEC_STMTS(S) (S)->vec_stmts_size
  126. #define SLP_TREE_LOAD_PERMUTATION(S) (S)->load_permutation
  127. /* This structure is used in creation of an SLP tree. Each instance
  128. corresponds to the same operand in a group of scalar stmts in an SLP
  129. node. */
  130. typedef struct _slp_oprnd_info
  131. {
  132. /* Def-stmts for the operands. */
  133. vec<gimple> def_stmts;
  134. /* Information about the first statement, its vector def-type, type, the
  135. operand itself in case it's constant, and an indication if it's a pattern
  136. stmt. */
  137. enum vect_def_type first_dt;
  138. tree first_op_type;
  139. bool first_pattern;
  140. } *slp_oprnd_info;
  141. /* This struct is used to store the information of a data reference,
  142. including the data ref itself, the access offset (calculated by summing its
  143. offset and init) and the segment length for aliasing checks.
  144. This is used to merge alias checks. */
  145. struct dr_with_seg_len
  146. {
  147. dr_with_seg_len (data_reference_p d, tree len)
  148. : dr (d),
  149. offset (size_binop (PLUS_EXPR, DR_OFFSET (d), DR_INIT (d))),
  150. seg_len (len) {}
  151. data_reference_p dr;
  152. tree offset;
  153. tree seg_len;
  154. };
  155. /* This struct contains two dr_with_seg_len objects with aliasing data
  156. refs. Two comparisons are generated from them. */
  157. struct dr_with_seg_len_pair_t
  158. {
  159. dr_with_seg_len_pair_t (const dr_with_seg_len& d1,
  160. const dr_with_seg_len& d2)
  161. : first (d1), second (d2) {}
  162. dr_with_seg_len first;
  163. dr_with_seg_len second;
  164. };
  165. typedef struct _vect_peel_info
  166. {
  167. int npeel;
  168. struct data_reference *dr;
  169. unsigned int count;
  170. } *vect_peel_info;
  171. typedef struct _vect_peel_extended_info
  172. {
  173. struct _vect_peel_info peel_info;
  174. unsigned int inside_cost;
  175. unsigned int outside_cost;
  176. stmt_vector_for_cost body_cost_vec;
  177. } *vect_peel_extended_info;
  178. /* Peeling hashtable helpers. */
  179. struct peel_info_hasher : typed_free_remove <_vect_peel_info>
  180. {
  181. typedef _vect_peel_info value_type;
  182. typedef _vect_peel_info compare_type;
  183. static inline hashval_t hash (const value_type *);
  184. static inline bool equal (const value_type *, const compare_type *);
  185. };
  186. inline hashval_t
  187. peel_info_hasher::hash (const value_type *peel_info)
  188. {
  189. return (hashval_t) peel_info->npeel;
  190. }
  191. inline bool
  192. peel_info_hasher::equal (const value_type *a, const compare_type *b)
  193. {
  194. return (a->npeel == b->npeel);
  195. }
  196. /*-----------------------------------------------------------------*/
  197. /* Info on vectorized loops. */
  198. /*-----------------------------------------------------------------*/
  199. typedef struct _loop_vec_info {
  200. /* The loop to which this info struct refers to. */
  201. struct loop *loop;
  202. /* The loop basic blocks. */
  203. basic_block *bbs;
  204. /* Number of latch executions. */
  205. tree num_itersm1;
  206. /* Number of iterations. */
  207. tree num_iters;
  208. /* Number of iterations of the original loop. */
  209. tree num_iters_unchanged;
  210. /* Minimum number of iterations below which vectorization is expected to
  211. not be profitable (as estimated by the cost model).
  212. -1 indicates that vectorization will not be profitable.
  213. FORNOW: This field is an int. Will be a tree in the future, to represent
  214. values unknown at compile time. */
  215. int min_profitable_iters;
  216. /* Threshold of number of iterations below which vectorzation will not be
  217. performed. It is calculated from MIN_PROFITABLE_ITERS and
  218. PARAM_MIN_VECT_LOOP_BOUND. */
  219. unsigned int th;
  220. /* Is the loop vectorizable? */
  221. bool vectorizable;
  222. /* Unrolling factor */
  223. int vectorization_factor;
  224. /* Unknown DRs according to which loop was peeled. */
  225. struct data_reference *unaligned_dr;
  226. /* peeling_for_alignment indicates whether peeling for alignment will take
  227. place, and what the peeling factor should be:
  228. peeling_for_alignment = X means:
  229. If X=0: Peeling for alignment will not be applied.
  230. If X>0: Peel first X iterations.
  231. If X=-1: Generate a runtime test to calculate the number of iterations
  232. to be peeled, using the dataref recorded in the field
  233. unaligned_dr. */
  234. int peeling_for_alignment;
  235. /* The mask used to check the alignment of pointers or arrays. */
  236. int ptr_mask;
  237. /* The loop nest in which the data dependences are computed. */
  238. vec<loop_p> loop_nest;
  239. /* All data references in the loop. */
  240. vec<data_reference_p> datarefs;
  241. /* All data dependences in the loop. */
  242. vec<ddr_p> ddrs;
  243. /* Data Dependence Relations defining address ranges that are candidates
  244. for a run-time aliasing check. */
  245. vec<ddr_p> may_alias_ddrs;
  246. /* Data Dependence Relations defining address ranges together with segment
  247. lengths from which the run-time aliasing check is built. */
  248. vec<dr_with_seg_len_pair_t> comp_alias_ddrs;
  249. /* Statements in the loop that have data references that are candidates for a
  250. runtime (loop versioning) misalignment check. */
  251. vec<gimple> may_misalign_stmts;
  252. /* All interleaving chains of stores in the loop, represented by the first
  253. stmt in the chain. */
  254. vec<gimple> grouped_stores;
  255. /* All SLP instances in the loop. This is a subset of the set of GROUP_STORES
  256. of the loop. */
  257. vec<slp_instance> slp_instances;
  258. /* The unrolling factor needed to SLP the loop. In case of that pure SLP is
  259. applied to the loop, i.e., no unrolling is needed, this is 1. */
  260. unsigned slp_unrolling_factor;
  261. /* Reduction cycles detected in the loop. Used in loop-aware SLP. */
  262. vec<gimple> reductions;
  263. /* All reduction chains in the loop, represented by the first
  264. stmt in the chain. */
  265. vec<gimple> reduction_chains;
  266. /* Hash table used to choose the best peeling option. */
  267. hash_table<peel_info_hasher> *peeling_htab;
  268. /* Cost data used by the target cost model. */
  269. void *target_cost_data;
  270. /* When we have grouped data accesses with gaps, we may introduce invalid
  271. memory accesses. We peel the last iteration of the loop to prevent
  272. this. */
  273. 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;
  277. /* Reductions are canonicalized so that the last operand is the reduction
  278. operand. If this places a constant into RHS1, this decanonicalizes
  279. GIMPLE for other phases, so we must track when this has occurred and
  280. fix it up. */
  281. bool operands_swapped;
  282. /* True if there are no loop carried data dependencies in the loop.
  283. If loop->safelen <= 1, then this is always true, either the loop
  284. didn't have any loop carried data dependencies, or the loop is being
  285. vectorized guarded with some runtime alias checks, or couldn't
  286. be vectorized at all, but then this field shouldn't be used.
  287. For loop->safelen >= 2, the user has asserted that there are no
  288. backward dependencies, but there still could be loop carried forward
  289. dependencies in such loops. This flag will be false if normal
  290. vectorizer data dependency analysis would fail or require versioning
  291. for alias, but because of loop->safelen >= 2 it has been vectorized
  292. even without versioning for alias. E.g. in:
  293. #pragma omp simd
  294. for (int i = 0; i < m; i++)
  295. a[i] = a[i + k] * c;
  296. (or #pragma simd or #pragma ivdep) we can vectorize this and it will
  297. DTRT even for k > 0 && k < m, but without safelen we would not
  298. vectorize this, so this field would be false. */
  299. bool no_data_dependencies;
  300. /* If if-conversion versioned this loop before conversion, this is the
  301. loop version without if-conversion. */
  302. struct loop *scalar_loop;
  303. } *loop_vec_info;
  304. /* Access Functions. */
  305. #define LOOP_VINFO_LOOP(L) (L)->loop
  306. #define LOOP_VINFO_BBS(L) (L)->bbs
  307. #define LOOP_VINFO_NITERSM1(L) (L)->num_itersm1
  308. #define LOOP_VINFO_NITERS(L) (L)->num_iters
  309. /* Since LOOP_VINFO_NITERS and LOOP_VINFO_NITERSM1 can change after
  310. prologue peeling retain total unchanged scalar loop iterations for
  311. cost model. */
  312. #define LOOP_VINFO_NITERS_UNCHANGED(L) (L)->num_iters_unchanged
  313. #define LOOP_VINFO_COST_MODEL_MIN_ITERS(L) (L)->min_profitable_iters
  314. #define LOOP_VINFO_COST_MODEL_THRESHOLD(L) (L)->th
  315. #define LOOP_VINFO_VECTORIZABLE_P(L) (L)->vectorizable
  316. #define LOOP_VINFO_VECT_FACTOR(L) (L)->vectorization_factor
  317. #define LOOP_VINFO_PTR_MASK(L) (L)->ptr_mask
  318. #define LOOP_VINFO_LOOP_NEST(L) (L)->loop_nest
  319. #define LOOP_VINFO_DATAREFS(L) (L)->datarefs
  320. #define LOOP_VINFO_DDRS(L) (L)->ddrs
  321. #define LOOP_VINFO_INT_NITERS(L) (TREE_INT_CST_LOW ((L)->num_iters))
  322. #define LOOP_VINFO_PEELING_FOR_ALIGNMENT(L) (L)->peeling_for_alignment
  323. #define LOOP_VINFO_UNALIGNED_DR(L) (L)->unaligned_dr
  324. #define LOOP_VINFO_MAY_MISALIGN_STMTS(L) (L)->may_misalign_stmts
  325. #define LOOP_VINFO_MAY_ALIAS_DDRS(L) (L)->may_alias_ddrs
  326. #define LOOP_VINFO_COMP_ALIAS_DDRS(L) (L)->comp_alias_ddrs
  327. #define LOOP_VINFO_GROUPED_STORES(L) (L)->grouped_stores
  328. #define LOOP_VINFO_SLP_INSTANCES(L) (L)->slp_instances
  329. #define LOOP_VINFO_SLP_UNROLLING_FACTOR(L) (L)->slp_unrolling_factor
  330. #define LOOP_VINFO_REDUCTIONS(L) (L)->reductions
  331. #define LOOP_VINFO_REDUCTION_CHAINS(L) (L)->reduction_chains
  332. #define LOOP_VINFO_PEELING_HTAB(L) (L)->peeling_htab
  333. #define LOOP_VINFO_TARGET_COST_DATA(L) (L)->target_cost_data
  334. #define LOOP_VINFO_PEELING_FOR_GAPS(L) (L)->peeling_for_gaps
  335. #define LOOP_VINFO_OPERANDS_SWAPPED(L) (L)->operands_swapped
  336. #define LOOP_VINFO_PEELING_FOR_NITER(L) (L)->peeling_for_niter
  337. #define LOOP_VINFO_NO_DATA_DEPENDENCIES(L) (L)->no_data_dependencies
  338. #define LOOP_VINFO_SCALAR_LOOP(L) (L)->scalar_loop
  339. #define LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT(L) \
  340. ((L)->may_misalign_stmts.length () > 0)
  341. #define LOOP_REQUIRES_VERSIONING_FOR_ALIAS(L) \
  342. ((L)->may_alias_ddrs.length () > 0)
  343. #define LOOP_VINFO_NITERS_KNOWN_P(L) \
  344. (tree_fits_shwi_p ((L)->num_iters) && tree_to_shwi ((L)->num_iters) > 0)
  345. static inline loop_vec_info
  346. loop_vec_info_for_loop (struct loop *loop)
  347. {
  348. return (loop_vec_info) loop->aux;
  349. }
  350. static inline bool
  351. nested_in_vect_loop_p (struct loop *loop, gimple stmt)
  352. {
  353. return (loop->inner
  354. && (loop->inner == (gimple_bb (stmt))->loop_father));
  355. }
  356. typedef struct _bb_vec_info {
  357. basic_block bb;
  358. /* All interleaving chains of stores in the basic block, represented by the
  359. first stmt in the chain. */
  360. vec<gimple> grouped_stores;
  361. /* All SLP instances in the basic block. This is a subset of the set of
  362. GROUP_STORES of the basic block. */
  363. vec<slp_instance> slp_instances;
  364. /* All data references in the basic block. */
  365. vec<data_reference_p> datarefs;
  366. /* All data dependences in the basic block. */
  367. vec<ddr_p> ddrs;
  368. /* Cost data used by the target cost model. */
  369. void *target_cost_data;
  370. } *bb_vec_info;
  371. #define BB_VINFO_BB(B) (B)->bb
  372. #define BB_VINFO_GROUPED_STORES(B) (B)->grouped_stores
  373. #define BB_VINFO_SLP_INSTANCES(B) (B)->slp_instances
  374. #define BB_VINFO_DATAREFS(B) (B)->datarefs
  375. #define BB_VINFO_DDRS(B) (B)->ddrs
  376. #define BB_VINFO_TARGET_COST_DATA(B) (B)->target_cost_data
  377. static inline bb_vec_info
  378. vec_info_for_bb (basic_block bb)
  379. {
  380. return (bb_vec_info) bb->aux;
  381. }
  382. /*-----------------------------------------------------------------*/
  383. /* Info on vectorized defs. */
  384. /*-----------------------------------------------------------------*/
  385. enum stmt_vec_info_type {
  386. undef_vec_info_type = 0,
  387. load_vec_info_type,
  388. store_vec_info_type,
  389. shift_vec_info_type,
  390. op_vec_info_type,
  391. call_vec_info_type,
  392. call_simd_clone_vec_info_type,
  393. assignment_vec_info_type,
  394. condition_vec_info_type,
  395. reduc_vec_info_type,
  396. induc_vec_info_type,
  397. type_promotion_vec_info_type,
  398. type_demotion_vec_info_type,
  399. type_conversion_vec_info_type,
  400. loop_exit_ctrl_vec_info_type
  401. };
  402. /* Indicates whether/how a variable is used in the scope of loop/basic
  403. block. */
  404. enum vect_relevant {
  405. vect_unused_in_scope = 0,
  406. /* The def is in the inner loop, and the use is in the outer loop, and the
  407. use is a reduction stmt. */
  408. vect_used_in_outer_by_reduction,
  409. /* The def is in the inner loop, and the use is in the outer loop (and is
  410. not part of reduction). */
  411. vect_used_in_outer,
  412. /* defs that feed computations that end up (only) in a reduction. These
  413. defs may be used by non-reduction stmts, but eventually, any
  414. computations/values that are affected by these defs are used to compute
  415. a reduction (i.e. don't get stored to memory, for example). We use this
  416. to identify computations that we can change the order in which they are
  417. computed. */
  418. vect_used_by_reduction,
  419. vect_used_in_scope
  420. };
  421. /* The type of vectorization that can be applied to the stmt: regular loop-based
  422. vectorization; pure SLP - the stmt is a part of SLP instances and does not
  423. have uses outside SLP instances; or hybrid SLP and loop-based - the stmt is
  424. a part of SLP instance and also must be loop-based vectorized, since it has
  425. uses outside SLP sequences.
  426. In the loop context the meanings of pure and hybrid SLP are slightly
  427. different. By saying that pure SLP is applied to the loop, we mean that we
  428. exploit only intra-iteration parallelism in the loop; i.e., the loop can be
  429. vectorized without doing any conceptual unrolling, cause we don't pack
  430. together stmts from different iterations, only within a single iteration.
  431. Loop hybrid SLP means that we exploit both intra-iteration and
  432. inter-iteration parallelism (e.g., number of elements in the vector is 4
  433. and the slp-group-size is 2, in which case we don't have enough parallelism
  434. within an iteration, so we obtain the rest of the parallelism from subsequent
  435. iterations by unrolling the loop by 2). */
  436. enum slp_vect_type {
  437. loop_vect = 0,
  438. pure_slp,
  439. hybrid
  440. };
  441. typedef struct data_reference *dr_p;
  442. typedef struct _stmt_vec_info {
  443. enum stmt_vec_info_type type;
  444. /* Indicates whether this stmts is part of a computation whose result is
  445. used outside the loop. */
  446. bool live;
  447. /* Stmt is part of some pattern (computation idiom) */
  448. bool in_pattern_p;
  449. /* The stmt to which this info struct refers to. */
  450. gimple stmt;
  451. /* The loop_vec_info with respect to which STMT is vectorized. */
  452. loop_vec_info loop_vinfo;
  453. /* The vector type to be used for the LHS of this statement. */
  454. tree vectype;
  455. /* The vectorized version of the stmt. */
  456. gimple vectorized_stmt;
  457. /** The following is relevant only for stmts that contain a non-scalar
  458. data-ref (array/pointer/struct access). A GIMPLE stmt is expected to have
  459. at most one such data-ref. **/
  460. /* Information about the data-ref (access function, etc),
  461. relative to the inner-most containing loop. */
  462. struct data_reference *data_ref_info;
  463. /* Information about the data-ref relative to this loop
  464. nest (the loop that is being considered for vectorization). */
  465. tree dr_base_address;
  466. tree dr_init;
  467. tree dr_offset;
  468. tree dr_step;
  469. tree dr_aligned_to;
  470. /* For loop PHI nodes, the evolution part of it. This makes sure
  471. this information is still available in vect_update_ivs_after_vectorizer
  472. where we may not be able to re-analyze the PHI nodes evolution as
  473. peeling for the prologue loop can make it unanalyzable. The evolution
  474. part is still correct though. */
  475. tree loop_phi_evolution_part;
  476. /* Used for various bookkeeping purposes, generally holding a pointer to
  477. some other stmt S that is in some way "related" to this stmt.
  478. Current use of this field is:
  479. If this stmt is part of a pattern (i.e. the field 'in_pattern_p' is
  480. true): S is the "pattern stmt" that represents (and replaces) the
  481. sequence of stmts that constitutes the pattern. Similarly, the
  482. related_stmt of the "pattern stmt" points back to this stmt (which is
  483. the last stmt in the original sequence of stmts that constitutes the
  484. pattern). */
  485. gimple related_stmt;
  486. /* Used to keep a sequence of def stmts of a pattern stmt if such exists. */
  487. gimple_seq pattern_def_seq;
  488. /* List of datarefs that are known to have the same alignment as the dataref
  489. of this stmt. */
  490. vec<dr_p> same_align_refs;
  491. /* Selected SIMD clone's function info. First vector element
  492. is SIMD clone's function decl, followed by a pair of trees (base + step)
  493. for linear arguments (pair of NULLs for other arguments). */
  494. vec<tree> simd_clone_info;
  495. /* Classify the def of this stmt. */
  496. enum vect_def_type def_type;
  497. /* Whether the stmt is SLPed, loop-based vectorized, or both. */
  498. enum slp_vect_type slp_type;
  499. /* Interleaving and reduction chains info. */
  500. /* First element in the group. */
  501. gimple first_element;
  502. /* Pointer to the next element in the group. */
  503. gimple next_element;
  504. /* For data-refs, in case that two or more stmts share data-ref, this is the
  505. pointer to the previously detected stmt with the same dr. */
  506. gimple same_dr_stmt;
  507. /* The size of the group. */
  508. unsigned int size;
  509. /* For stores, number of stores from this group seen. We vectorize the last
  510. one. */
  511. unsigned int store_count;
  512. /* For loads only, the gap from the previous load. For consecutive loads, GAP
  513. is 1. */
  514. unsigned int gap;
  515. /* The minimum negative dependence distance this stmt participates in
  516. or zero if none. */
  517. unsigned int min_neg_dist;
  518. /* Not all stmts in the loop need to be vectorized. e.g, the increment
  519. of the loop induction variable and computation of array indexes. relevant
  520. indicates whether the stmt needs to be vectorized. */
  521. enum vect_relevant relevant;
  522. /* The bb_vec_info with respect to which STMT is vectorized. */
  523. bb_vec_info bb_vinfo;
  524. /* Is this statement vectorizable or should it be skipped in (partial)
  525. vectorization. */
  526. bool vectorizable;
  527. /* For loads only, true if this is a gather load. */
  528. bool gather_p;
  529. bool stride_load_p;
  530. /* For both loads and stores. */
  531. bool simd_lane_access_p;
  532. } *stmt_vec_info;
  533. /* Access Functions. */
  534. #define STMT_VINFO_TYPE(S) (S)->type
  535. #define STMT_VINFO_STMT(S) (S)->stmt
  536. #define STMT_VINFO_LOOP_VINFO(S) (S)->loop_vinfo
  537. #define STMT_VINFO_BB_VINFO(S) (S)->bb_vinfo
  538. #define STMT_VINFO_RELEVANT(S) (S)->relevant
  539. #define STMT_VINFO_LIVE_P(S) (S)->live
  540. #define STMT_VINFO_VECTYPE(S) (S)->vectype
  541. #define STMT_VINFO_VEC_STMT(S) (S)->vectorized_stmt
  542. #define STMT_VINFO_VECTORIZABLE(S) (S)->vectorizable
  543. #define STMT_VINFO_DATA_REF(S) (S)->data_ref_info
  544. #define STMT_VINFO_GATHER_P(S) (S)->gather_p
  545. #define STMT_VINFO_STRIDE_LOAD_P(S) (S)->stride_load_p
  546. #define STMT_VINFO_SIMD_LANE_ACCESS_P(S) (S)->simd_lane_access_p
  547. #define STMT_VINFO_DR_BASE_ADDRESS(S) (S)->dr_base_address
  548. #define STMT_VINFO_DR_INIT(S) (S)->dr_init
  549. #define STMT_VINFO_DR_OFFSET(S) (S)->dr_offset
  550. #define STMT_VINFO_DR_STEP(S) (S)->dr_step
  551. #define STMT_VINFO_DR_ALIGNED_TO(S) (S)->dr_aligned_to
  552. #define STMT_VINFO_IN_PATTERN_P(S) (S)->in_pattern_p
  553. #define STMT_VINFO_RELATED_STMT(S) (S)->related_stmt
  554. #define STMT_VINFO_PATTERN_DEF_SEQ(S) (S)->pattern_def_seq
  555. #define STMT_VINFO_SAME_ALIGN_REFS(S) (S)->same_align_refs
  556. #define STMT_VINFO_SIMD_CLONE_INFO(S) (S)->simd_clone_info
  557. #define STMT_VINFO_DEF_TYPE(S) (S)->def_type
  558. #define STMT_VINFO_GROUP_FIRST_ELEMENT(S) (S)->first_element
  559. #define STMT_VINFO_GROUP_NEXT_ELEMENT(S) (S)->next_element
  560. #define STMT_VINFO_GROUP_SIZE(S) (S)->size
  561. #define STMT_VINFO_GROUP_STORE_COUNT(S) (S)->store_count
  562. #define STMT_VINFO_GROUP_GAP(S) (S)->gap
  563. #define STMT_VINFO_GROUP_SAME_DR_STMT(S) (S)->same_dr_stmt
  564. #define STMT_VINFO_GROUPED_ACCESS(S) ((S)->first_element != NULL && (S)->data_ref_info)
  565. #define STMT_VINFO_LOOP_PHI_EVOLUTION_PART(S) (S)->loop_phi_evolution_part
  566. #define STMT_VINFO_MIN_NEG_DIST(S) (S)->min_neg_dist
  567. #define GROUP_FIRST_ELEMENT(S) (S)->first_element
  568. #define GROUP_NEXT_ELEMENT(S) (S)->next_element
  569. #define GROUP_SIZE(S) (S)->size
  570. #define GROUP_STORE_COUNT(S) (S)->store_count
  571. #define GROUP_GAP(S) (S)->gap
  572. #define GROUP_SAME_DR_STMT(S) (S)->same_dr_stmt
  573. #define STMT_VINFO_RELEVANT_P(S) ((S)->relevant != vect_unused_in_scope)
  574. #define HYBRID_SLP_STMT(S) ((S)->slp_type == hybrid)
  575. #define PURE_SLP_STMT(S) ((S)->slp_type == pure_slp)
  576. #define STMT_SLP_TYPE(S) (S)->slp_type
  577. struct dataref_aux {
  578. int misalignment;
  579. /* If true the alignment of base_decl needs to be increased. */
  580. bool base_misaligned;
  581. /* If true we know the base is at least vector element alignment aligned. */
  582. bool base_element_aligned;
  583. tree base_decl;
  584. };
  585. #define DR_VECT_AUX(dr) ((dataref_aux *)(dr)->aux)
  586. #define VECT_MAX_COST 1000
  587. /* The maximum number of intermediate steps required in multi-step type
  588. conversion. */
  589. #define MAX_INTERM_CVT_STEPS 3
  590. /* The maximum vectorization factor supported by any target (V64QI). */
  591. #define MAX_VECTORIZATION_FACTOR 64
  592. /* Avoid GTY(()) on stmt_vec_info. */
  593. typedef void *vec_void_p;
  594. extern vec<vec_void_p> stmt_vec_info_vec;
  595. void init_stmt_vec_info_vec (void);
  596. void free_stmt_vec_info_vec (void);
  597. /* Return a stmt_vec_info corresponding to STMT. */
  598. static inline stmt_vec_info
  599. vinfo_for_stmt (gimple stmt)
  600. {
  601. unsigned int uid = gimple_uid (stmt);
  602. if (uid == 0)
  603. return NULL;
  604. return (stmt_vec_info) stmt_vec_info_vec[uid - 1];
  605. }
  606. /* Set vectorizer information INFO for STMT. */
  607. static inline void
  608. set_vinfo_for_stmt (gimple stmt, stmt_vec_info info)
  609. {
  610. unsigned int uid = gimple_uid (stmt);
  611. if (uid == 0)
  612. {
  613. gcc_checking_assert (info);
  614. uid = stmt_vec_info_vec.length () + 1;
  615. gimple_set_uid (stmt, uid);
  616. stmt_vec_info_vec.safe_push ((vec_void_p) info);
  617. }
  618. else
  619. stmt_vec_info_vec[uid - 1] = (vec_void_p) info;
  620. }
  621. /* Return the earlier statement between STMT1 and STMT2. */
  622. static inline gimple
  623. get_earlier_stmt (gimple stmt1, gimple stmt2)
  624. {
  625. unsigned int uid1, uid2;
  626. if (stmt1 == NULL)
  627. return stmt2;
  628. if (stmt2 == NULL)
  629. return stmt1;
  630. uid1 = gimple_uid (stmt1);
  631. uid2 = gimple_uid (stmt2);
  632. if (uid1 == 0 || uid2 == 0)
  633. return NULL;
  634. gcc_checking_assert (uid1 <= stmt_vec_info_vec.length ()
  635. && uid2 <= stmt_vec_info_vec.length ());
  636. if (uid1 < uid2)
  637. return stmt1;
  638. else
  639. return stmt2;
  640. }
  641. /* Return the later statement between STMT1 and STMT2. */
  642. static inline gimple
  643. get_later_stmt (gimple stmt1, gimple stmt2)
  644. {
  645. unsigned int uid1, uid2;
  646. if (stmt1 == NULL)
  647. return stmt2;
  648. if (stmt2 == NULL)
  649. return stmt1;
  650. uid1 = gimple_uid (stmt1);
  651. uid2 = gimple_uid (stmt2);
  652. if (uid1 == 0 || uid2 == 0)
  653. return NULL;
  654. gcc_assert (uid1 <= stmt_vec_info_vec.length ());
  655. gcc_assert (uid2 <= stmt_vec_info_vec.length ());
  656. if (uid1 > uid2)
  657. return stmt1;
  658. else
  659. return stmt2;
  660. }
  661. /* Return TRUE if a statement represented by STMT_INFO is a part of a
  662. pattern. */
  663. static inline bool
  664. is_pattern_stmt_p (stmt_vec_info stmt_info)
  665. {
  666. gimple related_stmt;
  667. stmt_vec_info related_stmt_info;
  668. related_stmt = STMT_VINFO_RELATED_STMT (stmt_info);
  669. if (related_stmt
  670. && (related_stmt_info = vinfo_for_stmt (related_stmt))
  671. && STMT_VINFO_IN_PATTERN_P (related_stmt_info))
  672. return true;
  673. return false;
  674. }
  675. /* Return true if BB is a loop header. */
  676. static inline bool
  677. is_loop_header_bb_p (basic_block bb)
  678. {
  679. if (bb == (bb->loop_father)->header)
  680. return true;
  681. gcc_checking_assert (EDGE_COUNT (bb->preds) == 1);
  682. return false;
  683. }
  684. /* Return pow2 (X). */
  685. static inline int
  686. vect_pow2 (int x)
  687. {
  688. int i, res = 1;
  689. for (i = 0; i < x; i++)
  690. res *= 2;
  691. return res;
  692. }
  693. /* Alias targetm.vectorize.builtin_vectorization_cost. */
  694. static inline int
  695. builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost,
  696. tree vectype, int misalign)
  697. {
  698. return targetm.vectorize.builtin_vectorization_cost (type_of_cost,
  699. vectype, misalign);
  700. }
  701. /* Get cost by calling cost target builtin. */
  702. static inline
  703. int vect_get_stmt_cost (enum vect_cost_for_stmt type_of_cost)
  704. {
  705. return builtin_vectorization_cost (type_of_cost, NULL, 0);
  706. }
  707. /* Alias targetm.vectorize.init_cost. */
  708. static inline void *
  709. init_cost (struct loop *loop_info)
  710. {
  711. return targetm.vectorize.init_cost (loop_info);
  712. }
  713. /* Alias targetm.vectorize.add_stmt_cost. */
  714. static inline unsigned
  715. add_stmt_cost (void *data, int count, enum vect_cost_for_stmt kind,
  716. stmt_vec_info stmt_info, int misalign,
  717. enum vect_cost_model_location where)
  718. {
  719. return targetm.vectorize.add_stmt_cost (data, count, kind,
  720. stmt_info, misalign, where);
  721. }
  722. /* Alias targetm.vectorize.finish_cost. */
  723. static inline void
  724. finish_cost (void *data, unsigned *prologue_cost,
  725. unsigned *body_cost, unsigned *epilogue_cost)
  726. {
  727. targetm.vectorize.finish_cost (data, prologue_cost, body_cost, epilogue_cost);
  728. }
  729. /* Alias targetm.vectorize.destroy_cost_data. */
  730. static inline void
  731. destroy_cost_data (void *data)
  732. {
  733. targetm.vectorize.destroy_cost_data (data);
  734. }
  735. /*-----------------------------------------------------------------*/
  736. /* Info on data references alignment. */
  737. /*-----------------------------------------------------------------*/
  738. inline void
  739. set_dr_misalignment (struct data_reference *dr, int val)
  740. {
  741. dataref_aux *data_aux = DR_VECT_AUX (dr);
  742. if (!data_aux)
  743. {
  744. data_aux = XCNEW (dataref_aux);
  745. dr->aux = data_aux;
  746. }
  747. data_aux->misalignment = val;
  748. }
  749. inline int
  750. dr_misalignment (struct data_reference *dr)
  751. {
  752. return DR_VECT_AUX (dr)->misalignment;
  753. }
  754. /* Reflects actual alignment of first access in the vectorized loop,
  755. taking into account peeling/versioning if applied. */
  756. #define DR_MISALIGNMENT(DR) dr_misalignment (DR)
  757. #define SET_DR_MISALIGNMENT(DR, VAL) set_dr_misalignment (DR, VAL)
  758. /* Return TRUE if the data access is aligned, and FALSE otherwise. */
  759. static inline bool
  760. aligned_access_p (struct data_reference *data_ref_info)
  761. {
  762. return (DR_MISALIGNMENT (data_ref_info) == 0);
  763. }
  764. /* Return TRUE if the alignment of the data access is known, and FALSE
  765. otherwise. */
  766. static inline bool
  767. known_alignment_for_access_p (struct data_reference *data_ref_info)
  768. {
  769. return (DR_MISALIGNMENT (data_ref_info) != -1);
  770. }
  771. /* Return true if the vect cost model is unlimited. */
  772. static inline bool
  773. unlimited_cost_model (loop_p loop)
  774. {
  775. if (loop != NULL && loop->force_vectorize
  776. && flag_simd_cost_model != VECT_COST_MODEL_DEFAULT)
  777. return flag_simd_cost_model == VECT_COST_MODEL_UNLIMITED;
  778. return (flag_vect_cost_model == VECT_COST_MODEL_UNLIMITED);
  779. }
  780. /* Source location */
  781. extern source_location vect_location;
  782. /*-----------------------------------------------------------------*/
  783. /* Function prototypes. */
  784. /*-----------------------------------------------------------------*/
  785. /* Simple loop peeling and versioning utilities for vectorizer's purposes -
  786. in tree-vect-loop-manip.c. */
  787. extern void slpeel_make_loop_iterate_ntimes (struct loop *, tree);
  788. extern bool slpeel_can_duplicate_loop_p (const struct loop *, const_edge);
  789. struct loop *slpeel_tree_duplicate_loop_to_edge_cfg (struct loop *,
  790. struct loop *, edge);
  791. extern void vect_loop_versioning (loop_vec_info, unsigned int, bool);
  792. extern void vect_do_peeling_for_loop_bound (loop_vec_info, tree, tree,
  793. unsigned int, bool);
  794. extern void vect_do_peeling_for_alignment (loop_vec_info, tree,
  795. unsigned int, bool);
  796. extern source_location find_loop_location (struct loop *);
  797. extern bool vect_can_advance_ivs_p (loop_vec_info);
  798. /* In tree-vect-stmts.c. */
  799. extern unsigned int current_vector_size;
  800. extern tree get_vectype_for_scalar_type (tree);
  801. extern tree get_same_sized_vectype (tree, tree);
  802. extern bool vect_is_simple_use (tree, gimple, loop_vec_info,
  803. bb_vec_info, gimple *,
  804. tree *, enum vect_def_type *);
  805. extern bool vect_is_simple_use_1 (tree, gimple, loop_vec_info,
  806. bb_vec_info, gimple *,
  807. tree *, enum vect_def_type *, tree *);
  808. extern bool supportable_widening_operation (enum tree_code, gimple, tree, tree,
  809. enum tree_code *, enum tree_code *,
  810. int *, vec<tree> *);
  811. extern bool supportable_narrowing_operation (enum tree_code, tree, tree,
  812. enum tree_code *,
  813. int *, vec<tree> *);
  814. extern stmt_vec_info new_stmt_vec_info (gimple stmt, loop_vec_info,
  815. bb_vec_info);
  816. extern void free_stmt_vec_info (gimple stmt);
  817. extern tree vectorizable_function (gcall *, tree, tree);
  818. extern void vect_model_simple_cost (stmt_vec_info, int, enum vect_def_type *,
  819. stmt_vector_for_cost *,
  820. stmt_vector_for_cost *);
  821. extern void vect_model_store_cost (stmt_vec_info, int, bool,
  822. enum vect_def_type, slp_tree,
  823. stmt_vector_for_cost *,
  824. stmt_vector_for_cost *);
  825. extern void vect_model_load_cost (stmt_vec_info, int, bool, slp_tree,
  826. stmt_vector_for_cost *,
  827. stmt_vector_for_cost *);
  828. extern unsigned record_stmt_cost (stmt_vector_for_cost *, int,
  829. enum vect_cost_for_stmt, stmt_vec_info,
  830. int, enum vect_cost_model_location);
  831. extern void vect_finish_stmt_generation (gimple, gimple,
  832. gimple_stmt_iterator *);
  833. extern bool vect_mark_stmts_to_be_vectorized (loop_vec_info);
  834. extern tree vect_get_vec_def_for_operand (tree, gimple, tree *);
  835. extern tree vect_init_vector (gimple, tree, tree,
  836. gimple_stmt_iterator *);
  837. extern tree vect_get_vec_def_for_stmt_copy (enum vect_def_type, tree);
  838. extern bool vect_transform_stmt (gimple, gimple_stmt_iterator *,
  839. bool *, slp_tree, slp_instance);
  840. extern void vect_remove_stores (gimple);
  841. extern bool vect_analyze_stmt (gimple, bool *, slp_tree);
  842. extern bool vectorizable_condition (gimple, gimple_stmt_iterator *, gimple *,
  843. tree, int, slp_tree);
  844. extern void vect_get_load_cost (struct data_reference *, int, bool,
  845. unsigned int *, unsigned int *,
  846. stmt_vector_for_cost *,
  847. stmt_vector_for_cost *, bool);
  848. extern void vect_get_store_cost (struct data_reference *, int,
  849. unsigned int *, stmt_vector_for_cost *);
  850. extern bool vect_supportable_shift (enum tree_code, tree);
  851. extern void vect_get_vec_defs (tree, tree, gimple, vec<tree> *,
  852. vec<tree> *, slp_tree, int);
  853. extern tree vect_gen_perm_mask_any (tree, const unsigned char *);
  854. extern tree vect_gen_perm_mask_checked (tree, const unsigned char *);
  855. /* In tree-vect-data-refs.c. */
  856. extern bool vect_can_force_dr_alignment_p (const_tree, unsigned int);
  857. extern enum dr_alignment_support vect_supportable_dr_alignment
  858. (struct data_reference *, bool);
  859. extern tree vect_get_smallest_scalar_type (gimple, HOST_WIDE_INT *,
  860. HOST_WIDE_INT *);
  861. extern bool vect_analyze_data_ref_dependences (loop_vec_info, int *);
  862. extern bool vect_slp_analyze_data_ref_dependences (bb_vec_info);
  863. extern bool vect_enhance_data_refs_alignment (loop_vec_info);
  864. extern bool vect_analyze_data_refs_alignment (loop_vec_info, bb_vec_info);
  865. extern bool vect_verify_datarefs_alignment (loop_vec_info, bb_vec_info);
  866. extern bool vect_analyze_data_ref_accesses (loop_vec_info, bb_vec_info);
  867. extern bool vect_prune_runtime_alias_test_list (loop_vec_info);
  868. extern tree vect_check_gather (gimple, loop_vec_info, tree *, tree *,
  869. int *);
  870. extern bool vect_analyze_data_refs (loop_vec_info, bb_vec_info, int *,
  871. unsigned *);
  872. extern tree vect_create_data_ref_ptr (gimple, tree, struct loop *, tree,
  873. tree *, gimple_stmt_iterator *,
  874. gimple *, bool, bool *,
  875. tree = NULL_TREE);
  876. extern tree bump_vector_ptr (tree, gimple, gimple_stmt_iterator *, gimple, tree);
  877. extern tree vect_create_destination_var (tree, tree);
  878. extern bool vect_grouped_store_supported (tree, unsigned HOST_WIDE_INT);
  879. extern bool vect_store_lanes_supported (tree, unsigned HOST_WIDE_INT);
  880. extern bool vect_grouped_load_supported (tree, unsigned HOST_WIDE_INT);
  881. extern bool vect_load_lanes_supported (tree, unsigned HOST_WIDE_INT);
  882. extern void vect_permute_store_chain (vec<tree> ,unsigned int, gimple,
  883. gimple_stmt_iterator *, vec<tree> *);
  884. extern tree vect_setup_realignment (gimple, gimple_stmt_iterator *, tree *,
  885. enum dr_alignment_support, tree,
  886. struct loop **);
  887. extern void vect_transform_grouped_load (gimple, vec<tree> , int,
  888. gimple_stmt_iterator *);
  889. extern void vect_record_grouped_load_vectors (gimple, vec<tree> );
  890. extern tree vect_get_new_vect_var (tree, enum vect_var_kind, const char *);
  891. extern tree vect_create_addr_base_for_vector_ref (gimple, gimple_seq *,
  892. tree, struct loop *,
  893. tree = NULL_TREE);
  894. /* In tree-vect-loop.c. */
  895. /* FORNOW: Used in tree-parloops.c. */
  896. extern void destroy_loop_vec_info (loop_vec_info, bool);
  897. extern gimple vect_force_simple_reduction (loop_vec_info, gimple, bool, bool *);
  898. /* Drive for loop analysis stage. */
  899. extern loop_vec_info vect_analyze_loop (struct loop *);
  900. /* Drive for loop transformation stage. */
  901. extern void vect_transform_loop (loop_vec_info);
  902. extern loop_vec_info vect_analyze_loop_form (struct loop *);
  903. extern bool vectorizable_live_operation (gimple, gimple_stmt_iterator *,
  904. gimple *);
  905. extern bool vectorizable_reduction (gimple, gimple_stmt_iterator *, gimple *,
  906. slp_tree);
  907. extern bool vectorizable_induction (gimple, gimple_stmt_iterator *, gimple *);
  908. extern tree get_initial_def_for_reduction (gimple, tree, tree *);
  909. extern int vect_min_worthwhile_factor (enum tree_code);
  910. extern int vect_get_known_peeling_cost (loop_vec_info, int, int *,
  911. stmt_vector_for_cost *,
  912. stmt_vector_for_cost *,
  913. stmt_vector_for_cost *);
  914. extern int vect_get_single_scalar_iteration_cost (loop_vec_info,
  915. stmt_vector_for_cost *);
  916. /* In tree-vect-slp.c. */
  917. extern void vect_free_slp_instance (slp_instance);
  918. extern bool vect_transform_slp_perm_load (slp_tree, vec<tree> ,
  919. gimple_stmt_iterator *, int,
  920. slp_instance, bool);
  921. extern bool vect_schedule_slp (loop_vec_info, bb_vec_info);
  922. extern void vect_update_slp_costs_according_to_vf (loop_vec_info);
  923. extern bool vect_analyze_slp (loop_vec_info, bb_vec_info, unsigned);
  924. extern bool vect_make_slp_decision (loop_vec_info);
  925. extern void vect_detect_hybrid_slp (loop_vec_info);
  926. extern void vect_get_slp_defs (vec<tree> , slp_tree,
  927. vec<vec<tree> > *, int);
  928. extern source_location find_bb_location (basic_block);
  929. extern bb_vec_info vect_slp_analyze_bb (basic_block);
  930. extern void vect_slp_transform_bb (basic_block);
  931. /* In tree-vect-patterns.c. */
  932. /* Pattern recognition functions.
  933. Additional pattern recognition functions can (and will) be added
  934. in the future. */
  935. typedef gimple (* vect_recog_func_ptr) (vec<gimple> *, tree *, tree *);
  936. #define NUM_PATTERNS 12
  937. void vect_pattern_recog (loop_vec_info, bb_vec_info);
  938. /* In tree-vectorizer.c. */
  939. unsigned vectorize_loops (void);
  940. void vect_destroy_datarefs (loop_vec_info, bb_vec_info);
  941. #endif /* GCC_TREE_VECTORIZER_H */