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

[FIRRTL] Add FIRRTLTypeSwitch #5456

Merged
merged 10 commits into from
Jun 29, 2023
Merged

[FIRRTL] Add FIRRTLTypeSwitch #5456

merged 10 commits into from
Jun 29, 2023

Conversation

uenoku
Copy link
Member

@uenoku uenoku commented Jun 22, 2023

This PR implements FIRRTLTypeSwitch which extends TypeSwitch so that we can use firrtl::type_{cast, dyn_cast, isa} when matching types. Currently llvm::TypeSwitch is not extensible so the code is duplicated to FIRRTLTypes.h.

This commit adds minimal changes BaseTypeAliasType for base type alias.
 Implement storage and methods for FIRRTLBaseType and FieldIDTypeInterface.

This doesn't include recursive property chagnes and
`FIRRTLBaseType::getAnonnymousType` whcih requires more broader changes.
This implements `type_isa/type_cast/type_dyn_cast/type_dyn_cast_or_null`.
When a given type is an alias, these casts will visit its inner type recursively.
These type casts can be used anywhere and if the requested type is
non-base type or FIRRTLBaseType itself, then it will optimized in the
compile time,
@dtzSiFive dtzSiFive added the FIRRTL Involving the `firrtl` dialect label Jun 22, 2023
Base automatically changed from dev/uenoku/implement-type-cast to main June 22, 2023 17:29
@uenoku uenoku requested a review from prithayan June 28, 2023 17:45
Copy link
Contributor

@prithayan prithayan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

include/circt/Dialect/FIRRTL/FIRRTLTypes.h Outdated Show resolved Hide resolved
include/circt/Dialect/FIRRTL/FIRRTLTypes.h Outdated Show resolved Hide resolved
include/circt/Dialect/FIRRTL/FIRRTLTypes.h Outdated Show resolved Hide resolved
include/circt/Dialect/FIRRTL/FIRRTLTypes.h Outdated Show resolved Hide resolved
include/circt/Dialect/FIRRTL/FIRRTLTypes.h Outdated Show resolved Hide resolved
Co-authored-by: Prithayan Barua <prithayan@gmail.com>
@uenoku uenoku merged commit 94af741 into main Jun 29, 2023
5 checks passed
@uenoku uenoku deleted the dev/uenoku/implement-type-switch branch June 29, 2023 00:06
calebmkim pushed a commit to andrewb1999/circt that referenced this pull request Jul 12, 2023
This PR implements FIRRTLTypeSwitch which extends TypeSwitch so that we can use firrtl::type_{cast, dyn_cast, isa} when matching types. Currently llvm::TypeSwitch is not extensible so the code is duplicated to FIRRTLTypes.h.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FIRRTL Involving the `firrtl` dialect
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants