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 loop 10 // transformation library. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #ifndef MLIR_DIALECT_STANDARD_TRANSFORMS_PASSES_H_ 15 #define MLIR_DIALECT_STANDARD_TRANSFORMS_PASSES_H_ 16 17 #include "mlir/Pass/Pass.h" 18 #include "mlir/Transforms/Bufferize.h" 19 20 namespace mlir { 21 22 class GlobalCreator; 23 class RewritePatternSet; 24 using OwningRewritePatternList = RewritePatternSet; 25 26 void populateStdBufferizePatterns(BufferizeTypeConverter &typeConverter, 27 RewritePatternSet &patterns); 28 29 /// Creates an instance of std bufferization pass. 30 std::unique_ptr<Pass> createStdBufferizePass(); 31 32 /// Creates an instance of func bufferization pass. 33 std::unique_ptr<Pass> createFuncBufferizePass(); 34 35 /// Add patterns to bufferize tensor constants into global memrefs to the given 36 /// pattern list. 37 void populateTensorConstantBufferizePatterns( 38 GlobalCreator &globalCreator, BufferizeTypeConverter &typeConverter, 39 RewritePatternSet &patterns); 40 41 /// Creates an instance of tensor constant bufferization pass. 42 std::unique_ptr<Pass> createTensorConstantBufferizePass(); 43 44 /// Creates an instance of the StdExpand pass that legalizes Std 45 /// dialect ops to be convertible to LLVM. For example, 46 /// `std.ceildivi_signed` gets transformed to a number of std operations, 47 /// which can be lowered to LLVM; `memref.reshape` gets converted to 48 /// `memref_reinterpret_cast`. 49 std::unique_ptr<Pass> createStdExpandOpsPass(); 50 51 /// Collects a set of patterns to rewrite ops within the Std dialect. 52 void populateStdExpandOpsPatterns(RewritePatternSet &patterns); 53 54 //===----------------------------------------------------------------------===// 55 // Registration 56 //===----------------------------------------------------------------------===// 57 58 /// Generate the code for registering passes. 59 #define GEN_PASS_REGISTRATION 60 #include "mlir/Dialect/StandardOps/Transforms/Passes.h.inc" 61 62 } // end namespace mlir 63 64 #endif // MLIR_DIALECT_STANDARD_TRANSFORMS_PASSES_H_ 65