circt
circt copied to clipboard
[Handshake] Remove StandardToHandshake-specific builders, cleanup
trafficstars
Currently, multiple builder function of the Handshake dialect operations are tightly coupled with how the StandardToHandshake maintains intermediate state during its run. I attribute this to the fact that StandardToHandshake is rather "old" (CIRCT-relative) and could use some love with respect to some of the lessons we've learnt over the course of the project maturing.
Some examples, with varying degrees of severity:
- Ops which places assumptions on external state, and instead should have their builder take an extra argument:
- https://github.com/llvm/circt/blob/main/lib/Dialect/Handshake/HandshakeOps.cpp#L232-L233 (should be a builder parameter)
- https://github.com/llvm/circt/blob/main/lib/Dialect/Handshake/HandshakeOps.cpp#L742
- https://github.com/llvm/circt/blob/main/lib/Dialect/Handshake/HandshakeOps.cpp#L835
- Mux ops being built with invalid inputs, which only later are resolved https://github.com/llvm/circt/blob/main/lib/Dialect/Handshake/HandshakeOps.cpp#L347-L348. I suspect this could be solved by use of the
BackedgeBuilderinStandardToHandshake. - As above, but with
ControlMergeOphttps://github.com/llvm/circt/blob/main/lib/Dialect/Handshake/HandshakeOps.cpp#L444-L445 - A weird builder (why have those arguments if some of them are expected to be empty?) https://github.com/llvm/circt/blob/main/lib/Dialect/Handshake/HandshakeOps.cpp#L924-L931
- Memory ops aren't necessarily connected to LSQs, so this is a stale comment https://github.com/llvm/circt/blob/main/lib/Dialect/Handshake/HandshakeOps.cpp#L1410-L1411