14#include "mlir/IR/SymbolTable.h"
15#include "llvm/Support/Debug.h"
17#define DEBUG_TYPE "emit-reductions"
34 uint64_t
match(Operation *op)
override {
35 if (!isa<emit::EmitDialect>(op->getDialect()))
37 if (innerSymUses.hasRef(op))
42 LogicalResult
rewrite(Operation *op)
override {
47 std::string
getName()
const override {
return "emit-op-eraser"; }
61struct EmitReducePatternDialectInterface
70void emit::registerReducePatternDialectInterface(
71 mlir::DialectRegistry ®istry) {
72 registry.addExtension(+[](MLIRContext *ctx, EmitDialect *dialect) {
73 dialect->addInterfaces<EmitReducePatternDialectInterface>();
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
A dialect interface to provide reduction patterns to a reducer tool.
ReducePatternDialectInterface(Dialect *dialect)
virtual void populateReducePatterns(ReducePatternSet &patterns) const =0
An abstract reduction pattern.
virtual LogicalResult rewrite(Operation *op)
Apply the reduction to a specific operation.
virtual bool acceptSizeIncrease() const
Return true if the tool should accept the transformation this reduction performs on the module even i...
virtual uint64_t match(Operation *op)
Check if the reduction can apply to a specific operation.
virtual std::string getName() const =0
Return a human-readable name for this reduction pattern.
virtual void beforeReduction(mlir::ModuleOp)
Called before the reduction is applied to a new subset of operations.
A helper struct that scans a root operation and all its nested operations for InnerRefAttrs.