1 //===- SeedCollection.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 // The seed-collection pass of the bottom-up vectorizer.
10 //
11 
12 #ifndef LLVM_TRANSFORMS_VECTORIZE_SANDBOXVECTORIZER_PASSES_SEEDCOLLECTION_H
13 #define LLVM_TRANSFORMS_VECTORIZE_SANDBOXVECTORIZER_PASSES_SEEDCOLLECTION_H
14 
15 #include "llvm/SandboxIR/Pass.h"
16 #include "llvm/SandboxIR/PassManager.h"
17 
18 namespace llvm::sandboxir {
19 
20 /// This pass collects the instructions that can become vectorization "seeds",
21 /// like stores to consecutive memory addresses. It then goes over the collected
22 /// seeds, slicing them into appropriately sized chunks, creating a Region with
23 /// the seed slice as the Auxiliary vector and runs the region pass pipeline.
24 class SeedCollection final : public FunctionPass {
25 
26   /// The PM containing the pipeline of region passes.
27   RegionPassManager RPM;
28 
29 public:
30   SeedCollection(StringRef Pipeline);
31   bool runOnFunction(Function &F, const Analyses &A) final;
printPipeline(raw_ostream & OS)32   void printPipeline(raw_ostream &OS) const final {
33     OS << getName() << "\n";
34     RPM.printPipeline(OS);
35   }
36 };
37 
38 } // namespace llvm::sandboxir
39 
40 #endif // LLVM_TRANSFORMS_VECTORIZE_SANDBOXVECTORIZER_PASSES_SEEDCOLLECTION_H
41