1 //===-- Vectorize.h - Vectorization Transformations -------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This header file defines prototypes for accessor functions that expose passes
11 // in the Vectorize transformations library.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_TRANSFORMS_VECTORIZE_H
16 #define LLVM_TRANSFORMS_VECTORIZE_H
23 //===----------------------------------------------------------------------===//
24 /// @brief Vectorize configuration.
25 struct VectorizeConfig {
26 //===--------------------------------------------------------------------===//
27 // Target architecture related parameters
29 /// @brief The size of the native vector registers.
32 /// @brief Vectorize boolean values.
35 /// @brief Vectorize integer values.
38 /// @brief Vectorize floating-point values.
41 /// @brief Vectorize pointer values.
42 bool VectorizePointers;
44 /// @brief Vectorize casting (conversion) operations.
47 /// @brief Vectorize floating-point math intrinsics.
50 /// @brief Vectorize bit intrinsics.
51 bool VectorizeBitManipulations;
53 /// @brief Vectorize the fused-multiply-add intrinsic.
56 /// @brief Vectorize select instructions.
59 /// @brief Vectorize comparison instructions.
62 /// @brief Vectorize getelementptr instructions.
65 /// @brief Vectorize loads and stores.
68 /// @brief Only generate aligned loads and stores.
71 //===--------------------------------------------------------------------===//
74 /// @brief The required chain depth for vectorization.
75 unsigned ReqChainDepth;
77 /// @brief The maximum search distance for instruction pairs.
80 /// @brief The maximum number of candidate pairs with which to use a full
82 unsigned MaxCandPairsForCycleCheck;
84 /// @brief Replicating one element to a pair breaks the chain.
85 bool SplatBreaksChain;
87 /// @brief The maximum number of pairable instructions per group.
90 /// @brief The maximum number of candidate instruction pairs per group.
93 /// @brief The maximum number of pairing iterations.
96 /// @brief Don't try to form odd-length vectors.
99 /// @brief Don't boost the chain-depth contribution of loads and stores.
102 /// @brief Use a fast instruction dependency analysis.
105 /// @brief Initialize the VectorizeConfig from command line options.
109 //===----------------------------------------------------------------------===//
111 // BBVectorize - A basic-block vectorization pass.
114 createBBVectorizePass(const VectorizeConfig &C = VectorizeConfig());
116 //===----------------------------------------------------------------------===//
118 // LoopVectorize - Create a loop vectorization pass.
120 Pass *createLoopVectorizePass(bool NoUnrolling = false,
121 bool AlwaysVectorize = true);
123 //===----------------------------------------------------------------------===//
125 // SLPVectorizer - Create a bottom-up SLP vectorizer pass.
127 Pass *createSLPVectorizerPass();
129 //===----------------------------------------------------------------------===//
130 /// @brief Vectorize the BasicBlock.
132 /// @param BB The BasicBlock to be vectorized
133 /// @param P The current running pass, should require AliasAnalysis and
134 /// ScalarEvolution. After the vectorization, AliasAnalysis,
135 /// ScalarEvolution and CFG are preserved.
137 /// @return True if the BB is changed, false otherwise.
139 bool vectorizeBasicBlock(Pass *P, BasicBlock &BB,
140 const VectorizeConfig &C = VectorizeConfig());
142 } // End llvm namespace