Skip to content

Commit b0c80f4

Browse files
[LLHD] Hoist drives out of processes (#8302)
Extend the `HoistSignals` pass and hoist drives before halt and wait terminators out of the parent process. All drives that have no side-effecting operations in between them and the block's suspending terminator can be hoisted. If the same signal is driven multiple times in the same block, only the last drive is hoisted. To hoist drives, the pass collects all drives for each driven signal slot and creates new yield operands and process results to carry the drive operands out of the process. Special care is taken to not create unnecessary results for constants that are uniform across all drives.
1 parent 855c7dc commit b0c80f4

File tree

4 files changed

+592
-18
lines changed

4 files changed

+592
-18
lines changed

include/circt/Dialect/LLHD/IR/LLHDStructureOps.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def WaitOp : LLHDOp<"wait", [
116116
);
117117
let successors = (successor AnySuccessor:$dest);
118118
let assemblyFormat = [{
119-
(`yield` `(` $yieldOperands^ `:` type($yieldOperands) `)` `,`)?
119+
(`yield` ` ` `(` $yieldOperands^ `:` type($yieldOperands) `)` `,`)?
120120
(`delay` $delay^ `,`)?
121121
(`(`$observed^ `:` qualified(type($observed))`)` `,`)?
122122
$dest (`(` $destOperands^ `:` qualified(type($destOperands)) `)`)?

include/circt/Dialect/LLHD/IR/LLHDTypes.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,14 @@
2323
#define GET_ATTRDEF_CLASSES
2424
#include "circt/Dialect/LLHD/IR/LLHDAttributes.h.inc"
2525

26+
namespace llvm {
27+
template <>
28+
struct PointerLikeTypeTraits<circt::llhd::TimeAttr>
29+
: public PointerLikeTypeTraits<mlir::Attribute> {
30+
static inline circt::llhd::TimeAttr getFromVoidPointer(void *p) {
31+
return circt::llhd::TimeAttr::getFromOpaquePointer(p);
32+
}
33+
};
34+
} // namespace llvm
35+
2636
#endif // CIRCT_DIALECT_LLHD_IR_LLHDTYPES_H

0 commit comments

Comments
 (0)