Vectorize.h 4.4 KB

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