MLIR 22.0.0git
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"
18
19namespace 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.
35 RewriterBase::Listener *listener = nullptr);
36
37} // namespace mlir
38
39#endif // MLIR_TRANSFORMS_WALKPATTERNREWRITEDRIVER_H_
This class represents a frozen set of patterns that can be processed by a pattern applicator.
Operation is the basic unit of execution within MLIR.
Definition Operation.h:88
Include the generated interface declarations.
const FrozenRewritePatternSet & patterns
void walkAndApplyPatterns(Operation *op, const FrozenRewritePatternSet &patterns, RewriterBase::Listener *listener=nullptr)
A fast walk-based pattern rewrite driver.