LLVM API Documentation

Transforms/Vectorize.h
Go to the documentation of this file.
00001 //===-- Vectorize.h - Vectorization Transformations -------------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This header file defines prototypes for accessor functions that expose passes
00011 // in the Vectorize transformations library.
00012 //
00013 //===----------------------------------------------------------------------===//
00014 
00015 #ifndef LLVM_TRANSFORMS_VECTORIZE_H
00016 #define LLVM_TRANSFORMS_VECTORIZE_H
00017 
00018 namespace llvm {
00019 class BasicBlock;
00020 class BasicBlockPass;
00021 class Pass;
00022 
00023 //===----------------------------------------------------------------------===//
00024 /// @brief Vectorize configuration.
00025 struct VectorizeConfig {
00026   //===--------------------------------------------------------------------===//
00027   // Target architecture related parameters
00028 
00029   /// @brief The size of the native vector registers.
00030   unsigned VectorBits;
00031 
00032   /// @brief Vectorize boolean values.
00033   bool VectorizeBools;
00034 
00035   /// @brief Vectorize integer values.
00036   bool VectorizeInts;
00037 
00038   /// @brief Vectorize floating-point values.
00039   bool VectorizeFloats;
00040 
00041   /// @brief Vectorize pointer values.
00042   bool VectorizePointers;
00043 
00044   /// @brief Vectorize casting (conversion) operations.
00045   bool VectorizeCasts;
00046 
00047   /// @brief Vectorize floating-point math intrinsics.
00048   bool VectorizeMath;
00049 
00050   /// @brief Vectorize bit intrinsics.
00051   bool VectorizeBitManipulations;
00052 
00053   /// @brief Vectorize the fused-multiply-add intrinsic.
00054   bool VectorizeFMA;
00055 
00056   /// @brief Vectorize select instructions.
00057   bool VectorizeSelect;
00058 
00059   /// @brief Vectorize comparison instructions.
00060   bool VectorizeCmp;
00061 
00062   /// @brief Vectorize getelementptr instructions.
00063   bool VectorizeGEP;
00064 
00065   /// @brief Vectorize loads and stores.
00066   bool VectorizeMemOps;
00067 
00068   /// @brief Only generate aligned loads and stores.
00069   bool AlignedOnly;
00070 
00071   //===--------------------------------------------------------------------===//
00072   // Misc parameters
00073 
00074   /// @brief The required chain depth for vectorization.
00075   unsigned ReqChainDepth;
00076 
00077   /// @brief The maximum search distance for instruction pairs.
00078   unsigned SearchLimit;
00079 
00080   /// @brief The maximum number of candidate pairs with which to use a full
00081   ///        cycle check.
00082   unsigned MaxCandPairsForCycleCheck;
00083 
00084   /// @brief Replicating one element to a pair breaks the chain.
00085   bool SplatBreaksChain;
00086 
00087   /// @brief The maximum number of pairable instructions per group.
00088   unsigned MaxInsts;
00089 
00090   /// @brief The maximum number of candidate instruction pairs per group.
00091   unsigned MaxPairs;
00092 
00093   /// @brief The maximum number of pairing iterations.
00094   unsigned MaxIter;
00095 
00096   /// @brief Don't try to form odd-length vectors.
00097   bool Pow2LenOnly;
00098 
00099   /// @brief Don't boost the chain-depth contribution of loads and stores.
00100   bool NoMemOpBoost;
00101 
00102   /// @brief Use a fast instruction dependency analysis.
00103   bool FastDep;
00104 
00105   /// @brief Initialize the VectorizeConfig from command line options.
00106   VectorizeConfig();
00107 };
00108 
00109 //===----------------------------------------------------------------------===//
00110 //
00111 // BBVectorize - A basic-block vectorization pass.
00112 //
00113 BasicBlockPass *
00114 createBBVectorizePass(const VectorizeConfig &C = VectorizeConfig());
00115 
00116 //===----------------------------------------------------------------------===//
00117 //
00118 // LoopVectorize - Create a loop vectorization pass.
00119 //
00120 Pass *createLoopVectorizePass(bool NoUnrolling = false,
00121                               bool AlwaysVectorize = true);
00122 
00123 //===----------------------------------------------------------------------===//
00124 //
00125 // SLPVectorizer - Create a bottom-up SLP vectorizer pass.
00126 //
00127 Pass *createSLPVectorizerPass();
00128 
00129 //===----------------------------------------------------------------------===//
00130 /// @brief Vectorize the BasicBlock.
00131 ///
00132 /// @param BB The BasicBlock to be vectorized
00133 /// @param P  The current running pass, should require AliasAnalysis and
00134 ///           ScalarEvolution. After the vectorization, AliasAnalysis,
00135 ///           ScalarEvolution and CFG are preserved.
00136 ///
00137 /// @return True if the BB is changed, false otherwise.
00138 ///
00139 bool vectorizeBasicBlock(Pass *P, BasicBlock &BB,
00140                          const VectorizeConfig &C = VectorizeConfig());
00141 
00142 } // End llvm namespace
00143 
00144 #endif