Skip to content

Commit

Permalink
[CFToHandshake] Move Transforms dependency to implementation (#6889)
Browse files Browse the repository at this point in the history
Fixes #6693
  • Loading branch information
mortbopet authored Apr 2, 2024
1 parent d84cf8c commit 562f4d7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
9 changes: 7 additions & 2 deletions include/circt/Conversion/CFToHandshake.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "circt/Dialect/Handshake/HandshakeOps.h"
#include "circt/Dialect/Handshake/HandshakePasses.h"
#include "circt/Support/BackedgeBuilder.h"
#include "circt/Transforms/Passes.h"
#include "mlir/Transforms/DialectConversion.h"

#include <memory>
Expand Down Expand Up @@ -95,7 +94,7 @@ class HandshakeLowering {
// Apply SSA maximization on the newly added entry block argument to
// propagate it explicitly between the start-point of the control-only
// network and the function's terminators
if (failed(maximizeSSA(entryCtrl, rewriter)))
if (failed(runSSAMaximization(rewriter, entryCtrl)))
return failure();

// Identify all block arguments belonging to the control-only network
Expand Down Expand Up @@ -145,6 +144,12 @@ class HandshakeLowering {
MLIRContext *getContext() { return r.getContext(); }

protected:
// SSA maximization dispatch, to avoid an inclusion of
// "circt/Transforms/Passes.h" in this header file (which itself is in the
// Converisons library). Instead, move this dependency to CFToHandshake.cpp.
LogicalResult runSSAMaximization(ConversionPatternRewriter &rewriter,
Value entryCtrl);

Region &r;

/// Start point of the control-only network
Expand Down
7 changes: 7 additions & 0 deletions lib/Conversion/CFToHandshake/CFToHandshake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "circt/Dialect/Handshake/HandshakeOps.h"
#include "circt/Dialect/Handshake/HandshakePasses.h"
#include "circt/Support/BackedgeBuilder.h"
#include "circt/Transforms/Passes.h"
#include "mlir/Analysis/CFGLoopInfo.h"
#include "mlir/Conversion/AffineToStandard/AffineToStandard.h"
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
Expand Down Expand Up @@ -247,6 +248,12 @@ void handshake::removeBasicBlocks(Region &r) {
}
}

LogicalResult
HandshakeLowering::runSSAMaximization(ConversionPatternRewriter &rewriter,
Value entryCtrl) {
return maximizeSSA(entryCtrl, rewriter);
}

void removeBasicBlocks(handshake::FuncOp funcOp) {
if (funcOp.isExternal())
return; // nothing to do, external funcOp.
Expand Down
1 change: 1 addition & 0 deletions lib/Conversion/CFToHandshake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ add_circt_library(CIRCTCFToHandshake
DEPENDS
CIRCTConversionPassIncGen
MLIRArithDialect
CIRCTTransforms

LINK_LIBS PUBLIC
CIRCTHandshake
Expand Down

0 comments on commit 562f4d7

Please sign in to comment.