1 //===-- Vectorize.h - Vectorization Transformations -------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This header file defines prototypes for accessor functions that expose passes
10 // in the Vectorize transformations library.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_TRANSFORMS_VECTORIZE_H
15 #define LLVM_TRANSFORMS_VECTORIZE_H
22 //===----------------------------------------------------------------------===//
23 /// Vectorize configuration.
24 struct VectorizeConfig
{
25 //===--------------------------------------------------------------------===//
26 // Target architecture related parameters
28 /// The size of the native vector registers.
31 /// Vectorize boolean values.
34 /// Vectorize integer values.
37 /// Vectorize floating-point values.
40 /// Vectorize pointer values.
41 bool VectorizePointers
;
43 /// Vectorize casting (conversion) operations.
46 /// Vectorize floating-point math intrinsics.
49 /// Vectorize bit intrinsics.
50 bool VectorizeBitManipulations
;
52 /// Vectorize the fused-multiply-add intrinsic.
55 /// Vectorize select instructions.
58 /// Vectorize comparison instructions.
61 /// Vectorize getelementptr instructions.
64 /// Vectorize loads and stores.
67 /// Only generate aligned loads and stores.
70 //===--------------------------------------------------------------------===//
73 /// The required chain depth for vectorization.
74 unsigned ReqChainDepth
;
76 /// The maximum search distance for instruction pairs.
79 /// The maximum number of candidate pairs with which to use a full
81 unsigned MaxCandPairsForCycleCheck
;
83 /// Replicating one element to a pair breaks the chain.
84 bool SplatBreaksChain
;
86 /// The maximum number of pairable instructions per group.
89 /// The maximum number of candidate instruction pairs per group.
92 /// The maximum number of pairing iterations.
95 /// Don't try to form odd-length vectors.
98 /// Don't boost the chain-depth contribution of loads and stores.
101 /// Use a fast instruction dependency analysis.
104 /// Initialize the VectorizeConfig from command line options.
108 //===----------------------------------------------------------------------===//
110 // LoopVectorize - Create a loop vectorization pass.
112 Pass
*createLoopVectorizePass();
113 Pass
*createLoopVectorizePass(bool InterleaveOnlyWhenForced
,
114 bool VectorizeOnlyWhenForced
);
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