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
18namespace mlir {
19class Pass;
20
21namespace toy {
22std::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).
26std::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.
30std::unique_ptr<mlir::Pass> createLowerToLLVMPass();
31
32} // namespace toy
33} // namespace mlir
34
35#endif // TOY_PASSES_H
36

source code of mlir/examples/toy/Ch7/include/toy/Passes.h