Subversion Repositories QNX 8.QNX8 LLVM/Clang compiler suite

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. //===-- Vectorize.h - Vectorization Transformations -------------*- C++ -*-===//
  2. //
  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
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // This header file defines prototypes for accessor functions that expose passes
  10. // in the Vectorize transformations library.
  11. //
  12. //===----------------------------------------------------------------------===//
  13.  
  14. #ifndef LLVM_TRANSFORMS_VECTORIZE_H
  15. #define LLVM_TRANSFORMS_VECTORIZE_H
  16.  
  17. namespace llvm {
  18. class BasicBlock;
  19. class Pass;
  20.  
  21. //===----------------------------------------------------------------------===//
  22. /// Vectorize configuration.
  23. struct VectorizeConfig {
  24.   //===--------------------------------------------------------------------===//
  25.   // Target architecture related parameters
  26.  
  27.   /// The size of the native vector registers.
  28.   unsigned VectorBits;
  29.  
  30.   /// Vectorize boolean values.
  31.   bool VectorizeBools;
  32.  
  33.   /// Vectorize integer values.
  34.   bool VectorizeInts;
  35.  
  36.   /// Vectorize floating-point values.
  37.   bool VectorizeFloats;
  38.  
  39.   /// Vectorize pointer values.
  40.   bool VectorizePointers;
  41.  
  42.   /// Vectorize casting (conversion) operations.
  43.   bool VectorizeCasts;
  44.  
  45.   /// Vectorize floating-point math intrinsics.
  46.   bool VectorizeMath;
  47.  
  48.   /// Vectorize bit intrinsics.
  49.   bool VectorizeBitManipulations;
  50.  
  51.   /// Vectorize the fused-multiply-add intrinsic.
  52.   bool VectorizeFMA;
  53.  
  54.   /// Vectorize select instructions.
  55.   bool VectorizeSelect;
  56.  
  57.   /// Vectorize comparison instructions.
  58.   bool VectorizeCmp;
  59.  
  60.   /// Vectorize getelementptr instructions.
  61.   bool VectorizeGEP;
  62.  
  63.   /// Vectorize loads and stores.
  64.   bool VectorizeMemOps;
  65.  
  66.   /// Only generate aligned loads and stores.
  67.   bool AlignedOnly;
  68.  
  69.   //===--------------------------------------------------------------------===//
  70.   // Misc parameters
  71.  
  72.   /// The required chain depth for vectorization.
  73.   unsigned ReqChainDepth;
  74.  
  75.   /// The maximum search distance for instruction pairs.
  76.   unsigned SearchLimit;
  77.  
  78.   /// The maximum number of candidate pairs with which to use a full
  79.   ///        cycle check.
  80.   unsigned MaxCandPairsForCycleCheck;
  81.  
  82.   /// Replicating one element to a pair breaks the chain.
  83.   bool SplatBreaksChain;
  84.  
  85.   /// The maximum number of pairable instructions per group.
  86.   unsigned MaxInsts;
  87.  
  88.   /// The maximum number of candidate instruction pairs per group.
  89.   unsigned MaxPairs;
  90.  
  91.   /// The maximum number of pairing iterations.
  92.   unsigned MaxIter;
  93.  
  94.   /// Don't try to form odd-length vectors.
  95.   bool Pow2LenOnly;
  96.  
  97.   /// Don't boost the chain-depth contribution of loads and stores.
  98.   bool NoMemOpBoost;
  99.  
  100.   /// Use a fast instruction dependency analysis.
  101.   bool FastDep;
  102.  
  103.   /// Initialize the VectorizeConfig from command line options.
  104.   VectorizeConfig();
  105. };
  106.  
  107. //===----------------------------------------------------------------------===//
  108. //
  109. // LoopVectorize - Create a loop vectorization pass.
  110. //
  111. Pass *createLoopVectorizePass();
  112. Pass *createLoopVectorizePass(bool InterleaveOnlyWhenForced,
  113.                               bool VectorizeOnlyWhenForced);
  114.  
  115. //===----------------------------------------------------------------------===//
  116. //
  117. // SLPVectorizer - Create a bottom-up SLP vectorizer pass.
  118. //
  119. Pass *createSLPVectorizerPass();
  120.  
  121. //===----------------------------------------------------------------------===//
  122. /// Vectorize the BasicBlock.
  123. ///
  124. /// @param BB The BasicBlock to be vectorized
  125. /// @param P  The current running pass, should require AliasAnalysis and
  126. ///           ScalarEvolution. After the vectorization, AliasAnalysis,
  127. ///           ScalarEvolution and CFG are preserved.
  128. ///
  129. /// @return True if the BB is changed, false otherwise.
  130. ///
  131. bool vectorizeBasicBlock(Pass *P, BasicBlock &BB,
  132.                          const VectorizeConfig &C = VectorizeConfig());
  133.  
  134. //===----------------------------------------------------------------------===//
  135. //
  136. // LoadStoreVectorizer - Create vector loads and stores, but leave scalar
  137. // operations.
  138. //
  139. Pass *createLoadStoreVectorizerPass();
  140.  
  141. //===----------------------------------------------------------------------===//
  142. //
  143. // Optimize partial vector operations using target cost models.
  144. //
  145. Pass *createVectorCombinePass();
  146.  
  147. } // End llvm namespace
  148.  
  149. #endif
  150.