[hls-fuzzer] Add template adaptors for generic type systems - #1024
Open
zero9178 wants to merge 2 commits into
Open
[hls-fuzzer] Add template adaptors for generic type systems#1024zero9178 wants to merge 2 commits into
zero9178 wants to merge 2 commits into
Conversation
zero9178
force-pushed
the
users/zero9178/template-type-system
branch
from
July 29, 2026 19:19
ae2e8c1 to
937d63c
Compare
zero9178
force-pushed
the
users/zero9178/template-type-system
branch
from
August 3, 2026 15:17
937d63c to
ea29177
Compare
Prior to this PR, adding a new AST node required relatively many changes throughout the code base. Besides the obvious cases of the generator and abstract type system, it also required updating the `ConjunctionTypeSystem`, the `OptionalTypeSystem` and the `CounterTypeSystem`. This is despite those 3 being fully generic over `ASTNode`s as can be seen by their body being mere copy-pastes. This PR fixes that issue by introducing C++ template adaptors to both implement and call a type system in a generic way by just giving it an `ASTNode` effectively. The type system implementation side is called `TemplateTypeSystem` which implements all methods of `AbstractTypeSystem` and dispatches to the corresponding generic method in the derived class (e.g. `getTransferFnImpl`). For callers, `TypeSystem` added generic methods such as `getTransferFn` that dispatches to the right concrete method for the given `ASTNode`. This makes it such that only the generic method + `TemplateTypeSystem` need to be updated for new `ASTNode`s in the future and none of the type system. It also substantially reduces the lines of code.
zero9178
force-pushed
the
users/zero9178/template-type-system
branch
from
August 4, 2026 08:52
ea29177 to
4d4c095
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Prior to this PR, adding a new AST node required relatively many changes throughout the code base. Besides the obvious cases of the generator and abstract type system, it also required updating the
ConjunctionTypeSystem, theOptionalTypeSystemand theCounterTypeSystem. This is despite those 3 being fully generic overASTNodes as can be seen by their body being mere copy-pastes.This PR fixes that issue by introducing C++ template adaptors to both implement and call a type system in a generic way by just giving it an
ASTNodeeffectively. The type system implementation side is calledTemplateTypeSystemwhich implements all methods ofAbstractTypeSystemand dispatches to the corresponding generic method in the derived class (e.g.getTransferFnImpl). For callers,TypeSystemadded generic methods such asgetTransferFnthat dispatches to the right concrete method for the givenASTNode.This makes it such that only the generic method +
TemplateTypeSystemneed to be updated for newASTNodes in the future and none of the type system. It also substantially reduces the lines of code.Depends on #1023