OSDN Git Service

Refactor: Use positive field names in VectorizeConfig.
[android-x86/external-llvm.git] / 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 casting (conversion) operations.
38   bool VectorizeCasts;
39
40   /// @brief Vectorize floating-point math intrinsics.
41   bool VectorizeMath;
42
43   /// @brief Vectorize the fused-multiply-add intrinsic.
44   bool VectorizeFMA;
45
46   /// @brief Vectorize loads and stores.
47   bool VectorizeMemOps;
48
49   /// @brief Only generate aligned loads and stores.
50   bool AlignedOnly;
51
52   //===--------------------------------------------------------------------===//
53   // Misc parameters
54
55   /// @brief The required chain depth for vectorization.
56   unsigned ReqChainDepth;
57
58   /// @brief The maximum search distance for instruction pairs.
59   unsigned SearchLimit;
60
61   /// @brief The maximum number of candidate pairs with which to use a full
62   ///        cycle check.
63   unsigned MaxCandPairsForCycleCheck;
64
65   /// @brief Replicating one element to a pair breaks the chain.
66   bool SplatBreaksChain;
67
68   /// @brief The maximum number of pairable instructions per group.
69   unsigned MaxInsts;
70
71   /// @brief The maximum number of pairing iterations.
72   unsigned MaxIter;
73
74   /// @brief Don't boost the chain-depth contribution of loads and stores.
75   bool NoMemOpBoost;
76
77   /// @brief Use a fast instruction dependency analysis.
78   bool FastDep;
79
80   /// @brief Initialize the VectorizeConfig from command line options.
81   VectorizeConfig();
82 };
83
84 //===----------------------------------------------------------------------===//
85 //
86 // BBVectorize - A basic-block vectorization pass.
87 //
88 BasicBlockPass *
89 createBBVectorizePass(const VectorizeConfig &C = VectorizeConfig());
90
91 //===----------------------------------------------------------------------===//
92 /// @brief Vectorize the BasicBlock.
93 ///
94 /// @param BB The BasicBlock to be vectorized
95 /// @param P  The current running pass, should require AliasAnalysis and
96 ///           ScalarEvolution. After the vectorization, AliasAnalysis,
97 ///           ScalarEvolution and CFG are preserved.
98 ///
99 /// @return True if the BB is changed, false otherwise.
100 ///
101 bool vectorizeBasicBlock(Pass *P, BasicBlock &BB,
102                          const VectorizeConfig &C = VectorizeConfig());
103
104 } // End llvm namespace
105
106 #endif