Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Handshake] Expose pass options in pass constructor #3963

Merged
merged 2 commits into from
Sep 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion include/circt/Dialect/Handshake/HandshakePasses.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ std::unique_ptr<mlir::Pass> createHandshakeDematerializeForksSinksPass();
std::unique_ptr<mlir::Pass> createHandshakeRemoveBuffersPass();
std::unique_ptr<mlir::Pass> createHandshakeAddIDsPass();
std::unique_ptr<mlir::OperationPass<handshake::FuncOp>>
createHandshakeInsertBuffersPass();
createHandshakeInsertBuffersPass(const std::string &strategy = "all",
unsigned bufferSize = 2);
std::unique_ptr<mlir::Pass> createHandshakeLockFunctionsPass();

/// Iterates over the handshake::FuncOp's in the program to build an instance
Expand Down
9 changes: 7 additions & 2 deletions lib/Dialect/Handshake/Transforms/Buffers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ struct HandshakeRemoveBuffersPass

struct HandshakeInsertBuffersPass
: public HandshakeInsertBuffersBase<HandshakeInsertBuffersPass> {
HandshakeInsertBuffersPass(const std::string &strategy, unsigned bufferSize) {
this->strategy = strategy;
this->bufferSize = bufferSize;
}

// Returns true if a block argument should have buffers added to its uses.
static bool shouldBufferArgument(BlockArgument arg) {
Expand Down Expand Up @@ -224,6 +228,7 @@ circt::handshake::createHandshakeRemoveBuffersPass() {
}

std::unique_ptr<mlir::OperationPass<handshake::FuncOp>>
circt::handshake::createHandshakeInsertBuffersPass() {
return std::make_unique<HandshakeInsertBuffersPass>();
circt::handshake::createHandshakeInsertBuffersPass(const std::string &strategy,
unsigned bufferSize) {
return std::make_unique<HandshakeInsertBuffersPass>(strategy, bufferSize);
}