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 tensor constant bufferization pass.
39 std::unique_ptr<Pass> createTensorConstantBufferizePass();
40 
41 /// Creates an instance of the StdExpand pass that legalizes Std
42 /// dialect ops to be convertible to LLVM. For example,
43 /// `std.ceildivi_signed` gets transformed to a number of std operations,
44 /// which can be lowered to LLVM; `memref_reshape` gets converted to
45 /// `memref_reinterpret_cast`.
46 std::unique_ptr<Pass> createStdExpandOpsPass();
47 
48 /// Collects a set of patterns to rewrite ops within the Std dialect.
49 void populateStdExpandOpsPatterns(MLIRContext *context,
50                                   OwningRewritePatternList &patterns);
51 
52 //===----------------------------------------------------------------------===//
53 // Registration
54 //===----------------------------------------------------------------------===//
55 
56 /// Generate the code for registering passes.
57 #define GEN_PASS_REGISTRATION
58 #include "mlir/Dialect/StandardOps/Transforms/Passes.h.inc"
59 
60 } // end namespace mlir
61 
62 #endif // MLIR_DIALECT_STANDARD_TRANSFORMS_PASSES_H_
63