[LLHD] teach Deseq about projected fields via ValueField keys #9588
+312
−32
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request significantly enhances the LLHD "Deseq" transformation to support projected clocks—cases where a single-bit clock is extracted from a multi-bit bus (such as
comb.extract %bus from N). The changes introduce a newValueFieldabstraction to accurately track and reason about subfields of values, enabling the pass to identify and rematerialize extracted clock bits outside of processes. This improves support for hardware designs that use bus projections as clocks and fixes previous limitations in the analysis and lowering pipeline.Key changes include:
Support for Projected Clocks and Value Subfields:
ValueFieldstruct inDeseqUtils.hto represent a value and a subfield (via HW field ID), along with DenseMap support for use as a key. This enables precise tracking of projections such as struct fields, array elements, and extracted bits. [1] [2]getValueFieldhelper and related logic inDeseq.cppto analyze and canonicalize projections, allowing the pass to recognize when a trigger is a subfield of an observed value.Process Analysis and Trigger Handling:
booleanLattice,valueLattice) to useValueFieldas the key, ensuring correct handling of projections throughout the analysis. [1] [2] [3] [4] [5] [6] [7]Code Generation Improvements:
Testing Enhancements:
deseq.mlir, verifying that the pass correctly identifies and rematerializes extracted clock bits.These improvements make the Deseq pass more robust and capable of handling a wider range of hardware descriptions, particularly those using clock projections from buses.