12#include "mlir/IR/Builders.h"
13#include "llvm/ADT/STLExtras.h"
14#include "llvm/Support/Debug.h"
16#define DEBUG_TYPE "arc-reductions"
29 LogicalResult
rewrite(StateOp stateOp)
override {
30 OpBuilder builder(stateOp);
32 arc::CallOp::create(builder, stateOp.getLoc(),
33 stateOp->getResultTypes(), stateOp.getArcAttr(),
36 stateOp.replaceAllUsesWith(results);
41 std::string
getName()
const override {
return "arc-state-elimination"; }
48void ArcReducePatternDialectInterface::populateReducePatterns(
60 arc::createArcCanonicalizerPass());
63void arc::registerReducePatternDialectInterface(
64 mlir::DialectRegistry ®istry) {
65 registry.addExtension(+[](MLIRContext *ctx, ArcDialect *dialect) {
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
A sample reduction pattern that converts arc.state operations to the simpler arc.call operation and r...
LogicalResult rewrite(StateOp stateOp) override
std::string getName() const override
Return a human-readable name for this reduction pattern.
A reduction pattern for a specific operation.
A reduction pattern that applies an mlir::Pass.
A dialect interface to provide reduction patterns to a reducer tool.