CIRCT 22.0.0git
|
A reduction pattern for a specific operation. More...
#include <Reduction.h>
Public Member Functions | |
void | matches (Operation *op, llvm::function_ref< void(uint64_t, uint64_t)> addMatch) override |
Collect all ways how this reduction can apply to a specific operation. | |
LogicalResult | rewriteMatches (Operation *op, ArrayRef< uint64_t > matches) override |
Apply a set of matches of this reduction to a specific operation. | |
virtual uint64_t | match (OpTy op) |
virtual void | matches (OpTy op, llvm::function_ref< void(uint64_t, uint64_t)> addMatch) |
virtual LogicalResult | rewrite (OpTy op) |
virtual LogicalResult | rewriteMatches (OpTy op, ArrayRef< uint64_t > matches) |
![]() | |
virtual | ~Reduction () |
virtual void | beforeReduction (mlir::ModuleOp) |
Called before the reduction is applied to a new subset of operations. | |
virtual void | afterReduction (mlir::ModuleOp) |
Called after the reduction has been applied to a subset of operations. | |
virtual std::string | getName () const =0 |
Return a human-readable name for this reduction pattern. | |
virtual bool | acceptSizeIncrease () const |
Return true if the tool should accept the transformation this reduction performs on the module even if the overall size of the output increases. | |
virtual bool | isOneShot () const |
Return true if the tool should not try to reapply this reduction after it has been successful. | |
void | notifyOpErased (Operation *op) |
Private Member Functions | |
virtual uint64_t | match (Operation *op) |
Hide the base class match/rewrite functions to prevent compiler warnings about the OpTy -specific ones hiding the base class functions. | |
virtual LogicalResult | rewrite (Operation *op) |
Apply the reduction to a specific operation. | |
Additional Inherited Members | |
![]() | |
std::function< void(Operation *)> | notifyOpErasedCallback = nullptr |
An optional callback for reductions to communicate removal of operations. | |
A reduction pattern for a specific operation.
Only matches on operations of type OpTy
, and calls corresponding match and rewrite functions with the operation cast to this type, for convenience.
Definition at line 112 of file Reduction.h.
|
inlineprivatevirtual |
Hide the base class match/rewrite functions to prevent compiler warnings about the OpTy
-specific ones hiding the base class functions.
Reimplemented from circt::Reduction.
Definition at line 41 of file Reduction.h.
|
inlinevirtual |
Definition at line 123 of file Reduction.h.
Referenced by circt::OpReduction< OpTy >::matches().
|
inlineoverridevirtual |
Collect all ways how this reduction can apply to a specific operation.
If a reduction can apply to an operation in different ways, for example deleting different operands, it should call addMatch
multiple times with the expected benefit of the match, as well as an integer identifying one of the different ways it can match.
Calls match(op)
by default.
Reimplemented from circt::Reduction.
Definition at line 113 of file Reduction.h.
References circt::OpReduction< OpTy >::matches().
Referenced by circt::OpReduction< OpTy >::matches(), circt::OpReduction< OpTy >::rewriteMatches(), and circt::OpReduction< OpTy >::rewriteMatches().
|
inlinevirtual |
Definition at line 124 of file Reduction.h.
References circt::OpReduction< OpTy >::match().
|
inlineprivatevirtual |
Apply the reduction to a specific operation.
If the returned result indicates that the application failed, the resulting module is treated the same as if the tester marked it as uninteresting.
Reimplemented from circt::Reduction.
Definition at line 58 of file Reduction.h.
|
inlinevirtual |
Reimplemented in StateElimination.
Definition at line 128 of file Reduction.h.
Referenced by circt::OpReduction< OpTy >::rewriteMatches().
|
inlineoverridevirtual |
Apply a set of matches of this reduction to a specific operation.
If the reduction registered multiple matches for an operation, a subset of the integer identifiers of those matches will be passed to this function again. If the returned result indicates that the application failed, the resulting module is treated the same as if the tester marked it as uninteresting.
Reimplemented from circt::Reduction.
Definition at line 118 of file Reduction.h.
References circt::OpReduction< OpTy >::matches(), and circt::OpReduction< OpTy >::rewriteMatches().
Referenced by circt::OpReduction< OpTy >::rewriteMatches().
|
inlinevirtual |
Definition at line 129 of file Reduction.h.
References assert(), circt::OpReduction< OpTy >::matches(), and circt::OpReduction< OpTy >::rewrite().