| 1 | //===----------------------------------------------------------------------===// |
| 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 | #ifndef LLVM_LIB_TRANSFORMS_VECTORIZE_VECTORIZEOPTIONS_H |
| 10 | #define LLVM_LIB_TRANSFORMS_VECTORIZE_VECTORIZEOPTIONS_H |
| 11 | |
| 12 | #include "llvm/IR/Function.h" |
| 13 | #include "llvm/IR/LLVMContext.h" |
| 14 | #include "llvm/Transforms/Vectorize/LoopVectorizationLegality.h" |
| 15 | #include <optional> |
| 16 | |
| 17 | namespace llvm { |
| 18 | enum class LoopIdiomVectorizeStyle; |
| 19 | enum class TailFoldingStyle; |
| 20 | |
| 21 | /// Option tail-folding-policy controls the tail-folding strategy and lists all |
| 22 | /// available options. The vectorizer will attempt to fold the tail-loop into |
| 23 | /// the vector loop (main/epilogue loops) and predicate the instructions |
| 24 | /// accordingly. If tail-folding fails, there are different fallback strategies |
| 25 | /// depending on these values: |
| 26 | enum class TailFoldingPolicyTy { None = 0, PreferFoldTail, MustFoldTail }; |
| 27 | |
| 28 | // The -sbvec-stop-at and -sbvec-stop-bndl value that disables the limit. |
| 29 | constexpr unsigned long SBVecStopDisabled = ~0UL; |
| 30 | |
| 31 | #ifdef EXPENSIVE_CHECKS |
| 32 | constexpr bool VPlanVerifyEachDefault = true; |
| 33 | #else |
| 34 | constexpr bool VPlanVerifyEachDefault = false; |
| 35 | #endif |
| 36 | } // namespace llvm |
| 37 | |
| 38 | #define OPTIONS_STRUCT_DECL |
| 39 | #include "VectorizeOptions.inc" |
| 40 | |
| 41 | namespace llvm { |
| 42 | |
| 43 | class Loop; |
| 44 | namespace sandboxir { |
| 45 | class Context; |
| 46 | } // namespace sandboxir |
| 47 | |
| 48 | inline const VectorizeOptions &getVectorizeOptions(const LLVMContext &C) { |
| 49 | return C.getLibraryOptions().get<VectorizeOptions>(); |
| 50 | } |
| 51 | |
| 52 | inline const VectorizeOptions &getVectorizeOptions(const Function &F) { |
| 53 | return getVectorizeOptions(C: F.getContext()); |
| 54 | } |
| 55 | |
| 56 | const VectorizeOptions &getVectorizeOptions(const Loop &L); |
| 57 | const VectorizeOptions &getVectorizeOptions(const sandboxir::Context &C); |
| 58 | |
| 59 | } // namespace llvm |
| 60 | |
| 61 | #endif // LLVM_LIB_TRANSFORMS_VECTORIZE_VECTORIZEOPTIONS_H |
| 62 | |