MLIR  20.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 
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 /// Note: Does not apply patterns to the given operation itself.
31 void walkAndApplyPatterns(Operation *op,
32  const FrozenRewritePatternSet &patterns,
33  RewriterBase::Listener *listener = nullptr);
34 
35 } // namespace mlir
36 
37 #endif // MLIR_TRANSFORMS_WALKPATTERNREWRITEDRIVER_H_
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.