1 
2 //===- Passes.h - Pass Entrypoints ------------------------------*- C++ -*-===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This header file defines prototypes that expose pass constructors in the loop
11 // transformation library.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef MLIR_DIALECT_STANDARD_TRANSFORMS_PASSES_H_
16 #define MLIR_DIALECT_STANDARD_TRANSFORMS_PASSES_H_
17 
18 #include "mlir/Pass/Pass.h"
19 #include "mlir/Transforms/Bufferize.h"
20 
21 namespace mlir {
22 
23 class OwningRewritePatternList;
24 
25 void populateExpandTanhPattern(OwningRewritePatternList &patterns,
26                                MLIRContext *ctx);
27 
28 void populateStdBufferizePatterns(MLIRContext *context,
29                                   BufferizeTypeConverter &typeConverter,
30                                   OwningRewritePatternList &patterns);
31 
32 /// Creates an instance of std bufferization pass.
33 std::unique_ptr<Pass> createStdBufferizePass();
34 
35 /// Creates an instance of func bufferization pass.
36 std::unique_ptr<Pass> createFuncBufferizePass();
37 
38 /// Creates an instance of the StdExpand pass that legalizes Std
39 /// dialect ops to be convertible to LLVM. For example,
40 /// `std.ceildivi_signed` gets transformed to a number of std operations,
41 /// which can be lowered to LLVM; `memref_reshape` gets converted to
42 /// `memref_reinterpret_cast`.
43 std::unique_ptr<Pass> createStdExpandOpsPass();
44 
45 /// Collects a set of patterns to rewrite ops within the Std dialect.
46 void populateStdExpandOpsPatterns(MLIRContext *context,
47                                   OwningRewritePatternList &patterns);
48 
49 //===----------------------------------------------------------------------===//
50 // Registration
51 //===----------------------------------------------------------------------===//
52 
53 /// Generate the code for registering passes.
54 #define GEN_PASS_REGISTRATION
55 #include "mlir/Dialect/StandardOps/Transforms/Passes.h.inc"
56 
57 } // end namespace mlir
58 
59 #endif // MLIR_DIALECT_STANDARD_TRANSFORMS_PASSES_H_
60