12 #include "mlir/IR/Builders.h"
13 #include "llvm/ADT/STLExtras.h"
14 #include "llvm/Support/Debug.h"
16 #define DEBUG_TYPE "arc-reductions"
18 using namespace circt;
29 LogicalResult
rewrite(StateOp stateOp)
override {
30 OpBuilder builder(stateOp);
33 .create<arc::CallOp>(stateOp.getLoc(), stateOp->getResultTypes(),
34 stateOp.getArcAttr(), stateOp.getInputs())
36 stateOp.replaceAllUsesWith(results);
41 std::string
getName()
const override {
return "arc-state-elimination"; }
64 mlir::DialectRegistry ®istry) {
65 registry.addExtension(+[](MLIRContext *ctx, ArcDialect *dialect) {
std::unique_ptr< mlir::Pass > createArcCanonicalizerPass()
void registerReducePatternDialectInterface(mlir::DialectRegistry ®istry)
Register the Arc Reduction pattern dialect interface to the given registry.
std::unique_ptr< mlir::Pass > createDedupPass()
std::unique_ptr< mlir::Pass > createStripSVPass()
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 that applies an mlir::Pass.
A dialect interface to provide reduction patterns to a reducer tool.
void populateReducePatterns(circt::ReducePatternSet &patterns) const override