xref: /freebsd/contrib/llvm-project/llvm/include/llvm/Transforms/Vectorize/LoopIdiomVectorize.h (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
1 //===----------LoopIdiomVectorize.h -----------------------------*- 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 #ifndef LLVM_LIB_TRANSFORMS_VECTORIZE_LOOPIDIOMVECTORIZE_H
10 #define LLVM_LIB_TRANSFORMS_VECTORIZE_LOOPIDIOMVECTORIZE_H
11 
12 #include "llvm/IR/PassManager.h"
13 #include "llvm/Transforms/Scalar/LoopPassManager.h"
14 
15 namespace llvm {
16 enum class LoopIdiomVectorizeStyle { Masked, Predicated };
17 
18 class LoopIdiomVectorizePass : public PassInfoMixin<LoopIdiomVectorizePass> {
19   LoopIdiomVectorizeStyle VectorizeStyle = LoopIdiomVectorizeStyle::Masked;
20 
21   // The VF used in vectorizing the byte compare pattern.
22   unsigned ByteCompareVF = 16;
23 
24 public:
25   LoopIdiomVectorizePass() = default;
LoopIdiomVectorizePass(LoopIdiomVectorizeStyle S)26   explicit LoopIdiomVectorizePass(LoopIdiomVectorizeStyle S)
27       : VectorizeStyle(S) {}
28 
LoopIdiomVectorizePass(LoopIdiomVectorizeStyle S,unsigned BCVF)29   LoopIdiomVectorizePass(LoopIdiomVectorizeStyle S, unsigned BCVF)
30       : VectorizeStyle(S), ByteCompareVF(BCVF) {}
31 
32   PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
33                         LoopStandardAnalysisResults &AR, LPMUpdater &U);
34 };
35 } // namespace llvm
36 #endif // LLVM_LIB_TRANSFORMS_VECTORIZE_LOOPIDIOMVECTORIZE_H
37