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

[LLHD] Add TemporalCodeMotionPass #7381

Merged
merged 2 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 2 additions & 0 deletions include/circt/Dialect/LLHD/Transforms/Passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ createMemoryToBlockArgumentPass();

std::unique_ptr<OperationPass<hw::HWModuleOp>> createEarlyCodeMotionPass();

std::unique_ptr<OperationPass<hw::HWModuleOp>> createTemporalCodeMotionPass();

/// Register the LLHD Transformation passes.
void initLLHDTransformationPasses();

Expand Down
17 changes: 17 additions & 0 deletions include/circt/Dialect/LLHD/Transforms/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,21 @@ def EarlyCodeMotion : Pass<"llhd-early-code-motion", "hw::HWModuleOp"> {
let constructor = "circt::llhd::createEarlyCodeMotionPass()";
}

def TemporalCodeMotion : Pass<"llhd-temporal-code-motion", "hw::HWModuleOp"> {
let summary = "move drive operations to the exit basic block in processes";
let description = [{
This pass uses the temporal region analysis to transform the IR such that
every temporal region has a unique exit block and moves all 'llhd.drv'
operations in a temporal region into its exit block by adjusting the
enable operand.
Furthermore, it combines 'llhd.drv' operations driving the same signal with
with the same delay by multiplexing the driven value according to their
maerhart marked this conversation as resolved.
Show resolved Hide resolved
enable operands.
This pass assumes that the early code motion pass has been run beforehand.
Otherwise, dominance errors are to be expected.
}];

let constructor = "circt::llhd::createTemporalCodeMotionPass()";
}

#endif // CIRCT_DIALECT_LLHD_TRANSFORMS_PASSES
2 changes: 2 additions & 0 deletions lib/Dialect/LLHD/Transforms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ add_circt_dialect_library(CIRCTLLHDTransforms
FunctionEliminationPass.cpp
MemoryToBlockArgumentPass.cpp
EarlyCodeMotionPass.cpp
TemporalCodeMotionPass.cpp

DEPENDS
CIRCTLLHDTransformsIncGen

LINK_LIBS PUBLIC
CIRCTComb
CIRCTHW
CIRCTLLHD
MLIRIR
Expand Down
Loading
Loading