Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//===- HandshakeRewriteTerms.h - Rewrite Terms in Handshake Operation Sequences
//-----*- C++ -*-===//
//
// Dynamatic is under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file declares the --handshake-rewrite-terms pass.
//
//===----------------------------------------------------------------------===//

#ifndef EXPERIMENTAL_TRANSFORMS_HANDSHAKEREWRITETERMS_H
#define EXPERIMENTAL_TRANSFORMS_HANDSHAKEREWRITETERMS_H

#include "dynamatic/Support/DynamaticPass.h"
#include "dynamatic/Support/LLVM.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/IR/DialectRegistry.h"
#include "mlir/Pass/Pass.h"

namespace dynamatic {
namespace experimental {

#define GEN_PASS_DECL_HANDSHAKEREWRITETERMS
#define GEN_PASS_DEF_HANDSHAKEREWRITETERMS
#include "experimental/Transforms/Passes.h.inc"

std::unique_ptr<dynamatic::DynamaticPass> rewriteHandshakeTerms();

} // namespace experimental
} // namespace dynamatic

#endif // EXPERIMENTAL_TRANSFORMS_HANDSHAKEREWRITETERMS_H
2 changes: 2 additions & 0 deletions experimental/include/experimental/Transforms/Passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include "dynamatic/Support/LLVM.h"
#include "mlir/Pass/Pass.h"

#include "experimental/Transforms/HandshakeRewriteTerms.h"

namespace dynamatic {
namespace experimental {
/// Generate the code for registering passes.
Expand Down
12 changes: 12 additions & 0 deletions experimental/include/experimental/Transforms/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@
include "dynamatic/Support/Passes.td"
include "mlir/Pass/PassBase.td"

def HandshakeRewriteTerms : DynamaticPass< "handshake-rewrite-terms"> {
let summary = "Rewrite terms in Handshake operation sequences.";
let description = [{
Removes redundant operations and simplifies the IR by applying a series
of optimizations. The pass uses a greedy pattern rewriter to apply the
optimizations, which are based on the specific semantics of Handshake
operations. The pass is conservative and does not perform any aggressive
transformations that could potentially change the behavior of the circuit.
}];
let constructor = "dynamatic::experimental::rewriteHandshakeTerms()";
}

def HandshakeCombineSteeringLogic : DynamaticPass< "handshake-combine-steering-logic"> {
let summary = "Combine common steering logic between different handshake operations.";
let description = [{
Expand Down
1 change: 1 addition & 0 deletions experimental/lib/Transforms/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
add_dynamatic_library(DynamaticExperimentalTransforms
HandshakePlaceBuffersCustom.cpp
HandshakeCombineSteeringLogic.cpp
HandshakeRewriteTerms.cpp
HandshakeStraightToQueue.cpp

DEPENDS
Expand Down
Loading
Loading