MLIR 23.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 loop
10// transformation library.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef MLIR_TRANSFORMS_PASSES_H
15#define MLIR_TRANSFORMS_PASSES_H
16
17#include "mlir/Pass/Pass.h"
22#include "llvm/Support/Debug.h"
23#include <limits>
24#include <memory>
25
26namespace mlir {
27
29
30//===----------------------------------------------------------------------===//
31// Passes
32//===----------------------------------------------------------------------===//
33
34#define GEN_PASS_DECL_BUBBLEDOWNMEMORYSPACECASTS
35#define GEN_PASS_DECL_CSEPASS
36#define GEN_PASS_DECL_TRIVIALDEADCODEELIMINATIONPASS
37#define GEN_PASS_DECL_CANONICALIZERPASS
38#define GEN_PASS_DECL_COMPOSITEFIXEDPOINTPASS
39#define GEN_PASS_DECL_CONTROLFLOWSINKPASS
40#define GEN_PASS_DECL_GENERATERUNTIMEVERIFICATIONPASS
41#define GEN_PASS_DECL_LOOPINVARIANTCODEMOTIONPASS
42#define GEN_PASS_DECL_LOOPINVARIANTSUBSETHOISTINGPASS
43#define GEN_PASS_DECL_INLINERPASS
44#define GEN_PASS_DECL_MEM2REG
45#define GEN_PASS_DECL_PRINTIRPASS
46#define GEN_PASS_DECL_PRINTOPSTATSPASS
47#define GEN_PASS_DECL_REMOVEDEADVALUESPASS
48#define GEN_PASS_DECL_SCCPPASS
49#define GEN_PASS_DECL_SROA
50#define GEN_PASS_DECL_STRIPDEBUGINFOPASS
51#define GEN_PASS_DECL_SYMBOLDCEPASS
52#define GEN_PASS_DECL_SYMBOLPRIVATIZEPASS
53#define GEN_PASS_DECL_TOPOLOGICALSORTPASS
54#include "mlir/Transforms/Passes.h.inc"
55
56/// Creates an instance of the Canonicalizer pass with the specified config.
57/// `disabledPatterns` is a set of labels used to filter out input patterns with
58/// a debug label or debug name in this set. `enabledPatterns` is a set of
59/// labels used to filter out input patterns that do not have one of the labels
60/// in this set. Debug labels must be set explicitly on patterns or when adding
61/// them with `RewritePatternSet::addWithLabel`. Debug names may be empty, but
62/// patterns created with `RewritePattern::create` have their default debug name
63/// set to their type name.
64std::unique_ptr<Pass>
65createCanonicalizerPass(const GreedyRewriteConfig &config,
66 ArrayRef<std::string> disabledPatterns = {},
67 ArrayRef<std::string> enabledPatterns = {});
68
69/// Creates an instance of the inliner pass, and use the provided pass managers
70/// when optimizing callable operations with names matching the key type.
71/// Callable operations with a name not within the provided map will use the
72/// default inliner pipeline during optimization.
73std::unique_ptr<Pass>
74createInlinerPass(llvm::StringMap<OpPassManager> opPipelines);
75/// Creates an instance of the inliner pass, and use the provided pass managers
76/// when optimizing callable operations with names matching the key type.
77/// Callable operations with a name not within the provided map will use the
78/// provided default pipeline builder.
79std::unique_ptr<Pass>
80createInlinerPass(llvm::StringMap<OpPassManager> opPipelines,
81 std::function<void(OpPassManager &)> defaultPipelineBuilder);
82
83/// Creates a pass which prints the list of ops and the number of occurrences in
84/// the module.
85std::unique_ptr<Pass> createPrintOpStatsPass(raw_ostream &os);
86
87/// Creates a pass which prints the list of ops and the number of occurrences in
88/// the module with the output format option.
89std::unique_ptr<Pass> createPrintOpStatsPass(raw_ostream &os, bool printAsJSON);
90
91/// Create composite pass, which runs provided set of passes until fixed point
92/// or maximum number of iterations reached.
93std::unique_ptr<Pass> createCompositeFixedPointPass(
94 std::string name, llvm::function_ref<void(OpPassManager &)> populateFunc,
95 int maxIterations = 10);
96
97//===----------------------------------------------------------------------===//
98// Registration
99//===----------------------------------------------------------------------===//
100
101/// Generate the code for registering passes.
102#define GEN_PASS_REGISTRATION
103#include "mlir/Transforms/Passes.h.inc"
104
105} // namespace mlir
106
107#endif // MLIR_TRANSFORMS_PASSES_H
This class allows control over how the GreedyPatternRewriteDriver works.
This class represents a pass manager that runs passes on either a specific operation type,...
Definition PassManager.h:46
Include the generated interface declarations.
std::unique_ptr<::mlir::Pass > createInlinerPass()
std::unique_ptr<::mlir::Pass > createCanonicalizerPass()
std::unique_ptr<::mlir::Pass > createPrintOpStatsPass()
Definition OpStats.cpp:1222
std::unique_ptr<::mlir::Pass > createCompositeFixedPointPass()