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 the fused-multiply-add intrinsic.
53 /// @brief Vectorize select instructions.
56 /// @brief Vectorize comparison instructions.
59 /// @brief Vectorize getelementptr instructions.
62 /// @brief Vectorize loads and stores.
65 /// @brief Only generate aligned loads and stores.
68 //===--------------------------------------------------------------------===//
71 /// @brief The required chain depth for vectorization.
72 unsigned ReqChainDepth;
74 /// @brief The maximum search distance for instruction pairs.
77 /// @brief The maximum number of candidate pairs with which to use a full
79 unsigned MaxCandPairsForCycleCheck;
81 /// @brief Replicating one element to a pair breaks the chain.
82 bool SplatBreaksChain;
84 /// @brief The maximum number of pairable instructions per group.
87 /// @brief The maximum number of candidate instruction pairs per group.
90 /// @brief The maximum number of pairing iterations.
93 /// @brief Don't try to form odd-length vectors.
96 /// @brief Don't boost the chain-depth contribution of loads and stores.
99 /// @brief Use a fast instruction dependency analysis.
102 /// @brief Initialize the VectorizeConfig from command line options.
106 //===----------------------------------------------------------------------===//
108 // BBVectorize - A basic-block vectorization pass.
111 createBBVectorizePass(const VectorizeConfig &C = VectorizeConfig());
113 //===----------------------------------------------------------------------===//
115 // LoopVectorize - Create a loop vectorization pass.
117 Pass *createLoopVectorizePass(bool NoUnrolling = false);
119 //===----------------------------------------------------------------------===//
121 // SLPVectorizer - Create a bottom-up SLP vectorizer pass.
123 Pass *createSLPVectorizerPass();
125 //===----------------------------------------------------------------------===//
126 /// @brief Vectorize the BasicBlock.
128 /// @param BB The BasicBlock to be vectorized
129 /// @param P The current running pass, should require AliasAnalysis and
130 /// ScalarEvolution. After the vectorization, AliasAnalysis,
131 /// ScalarEvolution and CFG are preserved.
133 /// @return True if the BB is changed, false otherwise.
135 bool vectorizeBasicBlock(Pass *P, BasicBlock &BB,
136 const VectorizeConfig &C = VectorizeConfig());
138 } // End llvm namespace