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 /// Vectorize configuration.
25 struct VectorizeConfig {
26 //===--------------------------------------------------------------------===//
27 // Target architecture related parameters
29 /// The size of the native vector registers.
32 /// Vectorize boolean values.
35 /// Vectorize integer values.
38 /// Vectorize floating-point values.
41 /// Vectorize pointer values.
42 bool VectorizePointers;
44 /// Vectorize casting (conversion) operations.
47 /// Vectorize floating-point math intrinsics.
50 /// Vectorize bit intrinsics.
51 bool VectorizeBitManipulations;
53 /// Vectorize the fused-multiply-add intrinsic.
56 /// Vectorize select instructions.
59 /// Vectorize comparison instructions.
62 /// Vectorize getelementptr instructions.
65 /// Vectorize loads and stores.
68 /// Only generate aligned loads and stores.
71 //===--------------------------------------------------------------------===//
74 /// The required chain depth for vectorization.
75 unsigned ReqChainDepth;
77 /// The maximum search distance for instruction pairs.
80 /// The maximum number of candidate pairs with which to use a full
82 unsigned MaxCandPairsForCycleCheck;
84 /// Replicating one element to a pair breaks the chain.
85 bool SplatBreaksChain;
87 /// The maximum number of pairable instructions per group.
90 /// The maximum number of candidate instruction pairs per group.
93 /// The maximum number of pairing iterations.
96 /// Don't try to form odd-length vectors.
99 /// Don't boost the chain-depth contribution of loads and stores.
102 /// Use a fast instruction dependency analysis.
105 /// Initialize the VectorizeConfig from command line options.
109 //===----------------------------------------------------------------------===//
111 // LoopVectorize - Create a loop vectorization pass.
113 Pass *createLoopVectorizePass(bool InterleaveOnlyWhenForced = false,
114 bool VectorizeOnlyWhenForced = false);
116 //===----------------------------------------------------------------------===//
118 // SLPVectorizer - Create a bottom-up SLP vectorizer pass.
120 Pass *createSLPVectorizerPass();
122 //===----------------------------------------------------------------------===//
123 /// Vectorize the BasicBlock.
125 /// @param BB The BasicBlock to be vectorized
126 /// @param P The current running pass, should require AliasAnalysis and
127 /// ScalarEvolution. After the vectorization, AliasAnalysis,
128 /// ScalarEvolution and CFG are preserved.
130 /// @return True if the BB is changed, false otherwise.
132 bool vectorizeBasicBlock(Pass *P, BasicBlock &BB,
133 const VectorizeConfig &C = VectorizeConfig());
135 //===----------------------------------------------------------------------===//
137 // LoadStoreVectorizer - Create vector loads and stores, but leave scalar
140 Pass *createLoadStoreVectorizerPass();
142 } // End llvm namespace