• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===------------ SCFToSPIRV.h - Pass entrypoint ----------------*- 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 // Provides patterns for lowering SCF ops to SPIR-V dialect.
10 //
11 //===----------------------------------------------------------------------===//
12 #ifndef MLIR_CONVERSION_SCFTOSPIRV_SCFTOSPIRV_H_
13 #define MLIR_CONVERSION_SCFTOSPIRV_SCFTOSPIRV_H_
14 
15 #include <memory>
16 
17 namespace mlir {
18 class MLIRContext;
19 class Pass;
20 
21 // Owning list of rewriting patterns.
22 class OwningRewritePatternList;
23 class SPIRVTypeConverter;
24 struct ScfToSPIRVContextImpl;
25 
26 struct ScfToSPIRVContext {
27   ScfToSPIRVContext();
28   ~ScfToSPIRVContext();
29 
getImplScfToSPIRVContext30   ScfToSPIRVContextImpl *getImpl() { return impl.get(); }
31 
32 private:
33   std::unique_ptr<ScfToSPIRVContextImpl> impl;
34 };
35 
36 /// Collects a set of patterns to lower from scf.for, scf.if, and
37 /// loop.terminator to CFG operations within the SPIR-V dialect.
38 void populateSCFToSPIRVPatterns(MLIRContext *context,
39                                 SPIRVTypeConverter &typeConverter,
40                                 ScfToSPIRVContext &scfToSPIRVContext,
41                                 OwningRewritePatternList &patterns);
42 } // namespace mlir
43 
44 #endif // MLIR_CONVERSION_SCFTOSPIRV_SCFTOSPIRV_H_
45