| 1 | //===- Passes.h - Toy Passes Definition -----------------------------------===// |
| 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 file exposes the entry points to create compiler passes for Toy. |
| 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | #ifndef TOY_PASSES_H |
| 14 | #define TOY_PASSES_H |
| 15 | |
| 16 | #include <memory> |
| 17 | |
| 18 | namespace mlir { |
| 19 | class Pass; |
| 20 | |
| 21 | namespace toy { |
| 22 | std::unique_ptr<Pass> createShapeInferencePass(); |
| 23 | |
| 24 | /// Create a pass for lowering to operations in the `Affine` and `Std` dialects, |
| 25 | /// for a subset of the Toy IR (e.g. matmul). |
| 26 | std::unique_ptr<mlir::Pass> createLowerToAffinePass(); |
| 27 | |
| 28 | /// Create a pass for lowering operations the remaining `Toy` operations, as |
| 29 | /// well as `Affine` and `Std`, to the LLVM dialect for codegen. |
| 30 | std::unique_ptr<mlir::Pass> createLowerToLLVMPass(); |
| 31 | |
| 32 | } // namespace toy |
| 33 | } // namespace mlir |
| 34 | |
| 35 | #endif // TOY_PASSES_H |
| 36 | |