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
18namespace mlir {
19
20class AffineDialect;
21class ModuleOp;
22
23namespace func {
24namespace arith {
25class ArithDialect;
26} // namespace arith
27class FuncDialect;
28} // namespace func
29namespace scf {
30class SCFDialect;
31} // namespace scf
32namespace tensor {
33class TensorDialect;
34} // namespace tensor
35namespace vector {
36class VectorDialect;
37} // namespace vector
38
39namespace 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`.
50std::unique_ptr<Pass> createExpandOpsPass();
51
52/// Creates an operation pass to fold memref aliasing ops into consumer
53/// load/store ops into `patterns`.
54std::unique_ptr<Pass> createFoldMemRefAliasOpsPass();
55
56/// Creates an interprocedural pass to normalize memrefs to have a trivial
57/// (identity) layout map.
58std::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.
64std::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.
70std::unique_ptr<Pass> createResolveShapedTypeResultDimsPass();
71
72/// Creates an operation pass to expand some memref operation into
73/// easier to reason about operations.
74std::unique_ptr<Pass> createExpandStridedMetadataPass();
75
76/// Creates an operation pass to expand `memref.realloc` operations into their
77/// components.
78std::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
91

source code of mlir/include/mlir/Dialect/MemRef/Transforms/Passes.h