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 the fused-multiply-add intrinsic.
00051   bool VectorizeFMA;
00052 
00053   /// @brief Vectorize select instructions.
00054   bool VectorizeSelect;
00055 
00056   /// @brief Vectorize comparison instructions.
00057   bool VectorizeCmp;
00058 
00059   /// @brief Vectorize getelementptr instructions.
00060   bool VectorizeGEP;
00061 
00062   /// @brief Vectorize loads and stores.
00063   bool VectorizeMemOps;
00064 
00065   /// @brief Only generate aligned loads and stores.
00066   bool AlignedOnly;
00067 
00068   //===--------------------------------------------------------------------===//
00069   // Misc parameters
00070 
00071   /// @brief The required chain depth for vectorization.
00072   unsigned ReqChainDepth;
00073 
00074   /// @brief The maximum search distance for instruction pairs.
00075   unsigned SearchLimit;
00076 
00077   /// @brief The maximum number of candidate pairs with which to use a full
00078   ///        cycle check.
00079   unsigned MaxCandPairsForCycleCheck;
00080 
00081   /// @brief Replicating one element to a pair breaks the chain.
00082   bool SplatBreaksChain;
00083 
00084   /// @brief The maximum number of pairable instructions per group.
00085   unsigned MaxInsts;
00086 
00087   /// @brief The maximum number of candidate instruction pairs per group.
00088   unsigned MaxPairs;
00089 
00090   /// @brief The maximum number of pairing iterations.
00091   unsigned MaxIter;
00092 
00093   /// @brief Don't try to form odd-length vectors.
00094   bool Pow2LenOnly;
00095 
00096   /// @brief Don't boost the chain-depth contribution of loads and stores.
00097   bool NoMemOpBoost;
00098 
00099   /// @brief Use a fast instruction dependency analysis.
00100   bool FastDep;
00101 
00102   /// @brief Initialize the VectorizeConfig from command line options.
00103   VectorizeConfig();
00104 };
00105 
00106 //===----------------------------------------------------------------------===//
00107 //
00108 // BBVectorize - A basic-block vectorization pass.
00109 //
00110 BasicBlockPass *
00111 createBBVectorizePass(const VectorizeConfig &C = VectorizeConfig());
00112 
00113 //===----------------------------------------------------------------------===//
00114 //
00115 // LoopVectorize - Create a loop vectorization pass.
00116 //
00117 Pass *createLoopVectorizePass(bool NoUnrolling = false,
00118                               bool AlwaysVectorize = true);
00119 
00120 //===----------------------------------------------------------------------===//
00121 //
00122 // SLPVectorizer - Create a bottom-up SLP vectorizer pass.
00123 //
00124 Pass *createSLPVectorizerPass();
00125 
00126 //===----------------------------------------------------------------------===//
00127 /// @brief Vectorize the BasicBlock.
00128 ///
00129 /// @param BB The BasicBlock to be vectorized
00130 /// @param P  The current running pass, should require AliasAnalysis and
00131 ///           ScalarEvolution. After the vectorization, AliasAnalysis,
00132 ///           ScalarEvolution and CFG are preserved.
00133 ///
00134 /// @return True if the BB is changed, false otherwise.
00135 ///
00136 bool vectorizeBasicBlock(Pass *P, BasicBlock &BB,
00137                          const VectorizeConfig &C = VectorizeConfig());
00138 
00139 } // End llvm namespace
00140 
00141 #endif