]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/blob - contrib/llvm/include/llvm/Transforms/Vectorize.h
MFC r234353:
[FreeBSD/stable/9.git] / contrib / llvm / include / llvm / Transforms / Vectorize.h
1 //===-- Vectorize.h - Vectorization Transformations -------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This header file defines prototypes for accessor functions that expose passes
11 // in the Vectorize transformations library.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_TRANSFORMS_VECTORIZE_H
16 #define LLVM_TRANSFORMS_VECTORIZE_H
17
18 namespace llvm {
19 class BasicBlock;
20 class BasicBlockPass;
21
22 //===----------------------------------------------------------------------===//
23 /// @brief Vectorize configuration.
24 struct VectorizeConfig {
25   //===--------------------------------------------------------------------===//
26   // Target architecture related parameters
27
28   /// @brief The size of the native vector registers.
29   unsigned VectorBits;
30
31   /// @brief Vectorize integer values.
32   bool VectorizeInts;
33
34   /// @brief Vectorize floating-point values.
35   bool VectorizeFloats;
36
37   /// @brief Vectorize pointer values.
38   bool VectorizePointers;
39
40   /// @brief Vectorize casting (conversion) operations.
41   bool VectorizeCasts;
42
43   /// @brief Vectorize floating-point math intrinsics.
44   bool VectorizeMath;
45
46   /// @brief Vectorize the fused-multiply-add intrinsic.
47   bool VectorizeFMA;
48
49   /// @brief Vectorize select instructions.
50   bool VectorizeSelect;
51
52   /// @brief Vectorize getelementptr instructions.
53   bool VectorizeGEP;
54
55   /// @brief Vectorize loads and stores.
56   bool VectorizeMemOps;
57
58   /// @brief Only generate aligned loads and stores.
59   bool AlignedOnly;
60
61   //===--------------------------------------------------------------------===//
62   // Misc parameters
63
64   /// @brief The required chain depth for vectorization.
65   unsigned ReqChainDepth;
66
67   /// @brief The maximum search distance for instruction pairs.
68   unsigned SearchLimit;
69
70   /// @brief The maximum number of candidate pairs with which to use a full
71   ///        cycle check.
72   unsigned MaxCandPairsForCycleCheck;
73
74   /// @brief Replicating one element to a pair breaks the chain.
75   bool SplatBreaksChain;
76
77   /// @brief The maximum number of pairable instructions per group.
78   unsigned MaxInsts;
79
80   /// @brief The maximum number of pairing iterations.
81   unsigned MaxIter;
82
83   /// @brief Don't boost the chain-depth contribution of loads and stores.
84   bool NoMemOpBoost;
85
86   /// @brief Use a fast instruction dependency analysis.
87   bool FastDep;
88
89   /// @brief Initialize the VectorizeConfig from command line options.
90   VectorizeConfig();
91 };
92
93 //===----------------------------------------------------------------------===//
94 //
95 // BBVectorize - A basic-block vectorization pass.
96 //
97 BasicBlockPass *
98 createBBVectorizePass(const VectorizeConfig &C = VectorizeConfig());
99
100 //===----------------------------------------------------------------------===//
101 /// @brief Vectorize the BasicBlock.
102 ///
103 /// @param BB The BasicBlock to be vectorized
104 /// @param P  The current running pass, should require AliasAnalysis and
105 ///           ScalarEvolution. After the vectorization, AliasAnalysis,
106 ///           ScalarEvolution and CFG are preserved.
107 ///
108 /// @return True if the BB is changed, false otherwise.
109 ///
110 bool vectorizeBasicBlock(Pass *P, BasicBlock &BB,
111                          const VectorizeConfig &C = VectorizeConfig());
112
113 } // End llvm namespace
114
115 #endif