MLIR  19.0.0git
Passes.h
Go to the documentation of this file.
1 //===- Passes.h - MemRef Patterns and Passes --------------------*- 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 // This header declares patterns and passes on MemRef operations.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef MLIR_DIALECT_MEMREF_TRANSFORMS_PASSES_H
14 #define MLIR_DIALECT_MEMREF_TRANSFORMS_PASSES_H
15 
16 #include "mlir/Pass/Pass.h"
17 
18 namespace mlir {
19 
20 class AffineDialect;
21 class ModuleOp;
22 
23 namespace func {
24 namespace arith {
25 class ArithDialect;
26 } // namespace arith
27 class FuncDialect;
28 } // namespace func
29 namespace scf {
30 class SCFDialect;
31 } // namespace scf
32 namespace tensor {
33 class TensorDialect;
34 } // namespace tensor
35 namespace vector {
36 class VectorDialect;
37 } // namespace vector
38 
39 namespace memref {
40 //===----------------------------------------------------------------------===//
41 // Passes
42 //===----------------------------------------------------------------------===//
43 
44 #define GEN_PASS_DECL
45 #include "mlir/Dialect/MemRef/Transforms/Passes.h.inc"
46 
47 /// Creates an instance of the ExpandOps pass that legalizes memref dialect ops
48 /// to be convertible to LLVM. For example, `memref.reshape` gets converted to
49 /// `memref_reinterpret_cast`.
50 std::unique_ptr<Pass> createExpandOpsPass();
51 
52 /// Creates an operation pass to fold memref aliasing ops into consumer
53 /// load/store ops into `patterns`.
54 std::unique_ptr<Pass> createFoldMemRefAliasOpsPass();
55 
56 /// Creates an interprocedural pass to normalize memrefs to have a trivial
57 /// (identity) layout map.
58 std::unique_ptr<OperationPass<ModuleOp>> createNormalizeMemRefsPass();
59 
60 /// Creates an operation pass to resolve `memref.dim` operations with values
61 /// that are defined by operations that implement the
62 /// `ReifyRankedShapedTypeOpInterface`, in terms of shapes of its input
63 /// operands.
64 std::unique_ptr<Pass> createResolveRankedShapeTypeResultDimsPass();
65 
66 /// Creates an operation pass to resolve `memref.dim` operations with values
67 /// that are defined by operations that implement the
68 /// `InferShapedTypeOpInterface` or the `ReifyRankedShapedTypeOpInterface`,
69 /// in terms of shapes of its input operands.
70 std::unique_ptr<Pass> createResolveShapedTypeResultDimsPass();
71 
72 /// Creates an operation pass to expand some memref operation into
73 /// easier to reason about operations.
74 std::unique_ptr<Pass> createExpandStridedMetadataPass();
75 
76 /// Creates an operation pass to expand `memref.realloc` operations into their
77 /// components.
78 std::unique_ptr<Pass> createExpandReallocPass(bool emitDeallocs = true);
79 
80 //===----------------------------------------------------------------------===//
81 // Registration
82 //===----------------------------------------------------------------------===//
83 
84 #define GEN_PASS_REGISTRATION
85 #include "mlir/Dialect/MemRef/Transforms/Passes.h.inc"
86 
87 } // namespace memref
88 } // namespace mlir
89 
90 #endif // MLIR_DIALECT_MEMREF_TRANSFORMS_PASSES_H
std::unique_ptr< Pass > createFoldMemRefAliasOpsPass()
Creates an operation pass to fold memref aliasing ops into consumer load/store ops into patterns.
std::unique_ptr< Pass > createResolveShapedTypeResultDimsPass()
Creates an operation pass to resolve memref.dim operations with values that are defined by operations...
std::unique_ptr< Pass > createExpandStridedMetadataPass()
Creates an operation pass to expand some memref operation into easier to reason about operations.
std::unique_ptr< Pass > createExpandReallocPass(bool emitDeallocs=true)
Creates an operation pass to expand memref.realloc operations into their components.
std::unique_ptr< Pass > createResolveRankedShapeTypeResultDimsPass()
Creates an operation pass to resolve memref.dim operations with values that are defined by operations...
std::unique_ptr< OperationPass< ModuleOp > > createNormalizeMemRefsPass()
Creates an interprocedural pass to normalize memrefs to have a trivial (identity) layout map.
std::unique_ptr< Pass > createExpandOpsPass()
Creates an instance of the ExpandOps pass that legalizes memref dialect ops to be convertible to LLVM...
Definition: ExpandOps.cpp:151
Include the generated interface declarations.