MLIR  16.0.0git
Passes.h
Go to the documentation of this file.
1 //===- Passes.h - Pass Entrypoints ------------------------------*- 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 file defines prototypes that expose pass constructors in the
10 // shape transformation library.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef MLIR_DIALECT_SHAPE_TRANSFORMS_PASSES_H_
15 #define MLIR_DIALECT_SHAPE_TRANSFORMS_PASSES_H_
16 
17 #include "mlir/Pass/Pass.h"
18 
19 namespace mlir {
20 class ConversionTarget;
21 class TypeConverter;
22 namespace func {
23 class FuncOp;
24 } // namespace func
25 } // namespace mlir
26 
27 namespace mlir {
28 /// Creates an instance of the ShapeToShapeLowering pass that legalizes Shape
29 /// dialect to be convertible to Arithmetic. For example, `shape.num_elements`
30 /// get transformed to `shape.reduce`, which can be lowered to SCF and
31 /// Arithmetic.
32 std::unique_ptr<Pass> createShapeToShapeLowering();
33 
34 /// Collects a set of patterns to rewrite ops within the Shape dialect.
35 void populateShapeRewritePatterns(RewritePatternSet &patterns);
36 
37 // Collects a set of patterns to replace all constraints with passing witnesses.
38 // This is intended to then allow all ShapeConstraint related ops and data to
39 // have no effects and allow them to be freely removed such as through
40 // canonicalization and dead code elimination.
41 //
42 // After this pass, no cstr_ operations exist.
43 void populateRemoveShapeConstraintsPatterns(RewritePatternSet &patterns);
44 std::unique_ptr<OperationPass<func::FuncOp>> createRemoveShapeConstraintsPass();
45 
46 // Bufferizes shape dialect ops.
47 //
48 // Note that most shape dialect ops must be converted to std before
49 // bufferization happens, as they are intended to be bufferized at the std
50 // level.
51 std::unique_ptr<OperationPass<func::FuncOp>> createShapeBufferizePass();
52 
53 //===----------------------------------------------------------------------===//
54 // Registration
55 //===----------------------------------------------------------------------===//
56 
57 /// Generate the code for registering passes.
58 #define GEN_PASS_REGISTRATION
59 #include "mlir/Dialect/Shape/Transforms/Passes.h.inc"
60 
61 } // namespace mlir
62 
63 #endif // MLIR_DIALECT_SHAPE_TRANSFORMS_PASSES_H_
Include the generated interface declarations.
std::unique_ptr< OperationPass< func::FuncOp > > createShapeBufferizePass()
Definition: Bufferize.cpp:40
std::unique_ptr< Pass > createShapeToShapeLowering()
Creates an instance of the ShapeToShapeLowering pass that legalizes Shape dialect to be convertible t...
void populateShapeRewritePatterns(RewritePatternSet &patterns)
Collects a set of patterns to rewrite ops within the Shape dialect.
std::unique_ptr< OperationPass< func::FuncOp > > createRemoveShapeConstraintsPass()
void populateRemoveShapeConstraintsPatterns(RewritePatternSet &patterns)