MLIR
22.0.0git
include
mlir
Transforms
WalkPatternRewriteDriver.h
Go to the documentation of this file.
1
//===- WALKPATTERNREWRITEDRIVER.h - Walk Pattern Rewrite Driver -*- 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
// Declares a helper function to walk the given op and apply rewrite patterns.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#ifndef MLIR_TRANSFORMS_WALKPATTERNREWRITEDRIVER_H_
14
#define MLIR_TRANSFORMS_WALKPATTERNREWRITEDRIVER_H_
15
16
#include "
mlir/IR/Visitors.h
"
17
#include "
mlir/Rewrite/FrozenRewritePatternSet.h
"
18
19
namespace
mlir
{
20
21
/// A fast walk-based pattern rewrite driver. Rewrites ops nested under the
22
/// given operation by walking it and applying the highest benefit patterns.
23
/// This rewriter *does not* wait until a fixpoint is reached and *does not*
24
/// visit modified or newly replaced ops. Also *does not* perform folding or
25
/// dead-code elimination.
26
///
27
/// This is intended as the simplest and most lightweight pattern rewriter in
28
/// cases when a simple walk gets the job done.
29
///
30
/// The driver will skip unreachable blocks.
31
///
32
/// Note: Does not apply patterns to the given operation itself.
33
void
walkAndApplyPatterns
(
Operation
*op,
34
const
FrozenRewritePatternSet
&
patterns
,
35
RewriterBase::Listener
*listener =
nullptr
);
36
37
}
// namespace mlir
38
39
#endif
// MLIR_TRANSFORMS_WALKPATTERNREWRITEDRIVER_H_
FrozenRewritePatternSet.h
Visitors.h
mlir::FrozenRewritePatternSet
This class represents a frozen set of patterns that can be processed by a pattern applicator.
Definition
FrozenRewritePatternSet.h:24
mlir::Operation
Operation is the basic unit of execution within MLIR.
Definition
Operation.h:88
mlir
Include the generated interface declarations.
Definition
AliasAnalysis.h:19
mlir::patterns
const FrozenRewritePatternSet & patterns
Definition
GreedyPatternRewriteDriver.h:283
mlir::walkAndApplyPatterns
void walkAndApplyPatterns(Operation *op, const FrozenRewritePatternSet &patterns, RewriterBase::Listener *listener=nullptr)
A fast walk-based pattern rewrite driver.
Definition
WalkPatternRewriteDriver.cpp:93
mlir::RewriterBase::Listener
Definition
PatternMatch.h:370
Generated on
for MLIR by
1.14.0