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