Skip to content

Conversation

@Scheremo
Copy link
Contributor

  • Add support for lowering specialized (instantiated) generic classes by embedding actual parameter values into the fully-qualified class symbol, e.g. @"pkg::MyClass#(.P(1),.Q(8))".
  • Explicitly skip GenericClassDefSymbol (unspecialized templates) per IEEE 1800-2023 §8.25; only specialized ClassType symbols are lowered.
  • Ensure class bodies are emitted once.
  • Make type lowering declare/convert the class declaration eagerly to keep symbol references consistent.

@Scheremo Scheremo marked this pull request as ready for review October 30, 2025 17:00
Copy link
Contributor

@TaoBi22 TaoBi22 left a comment

Choose a reason for hiding this comment

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

LGTM modulo nits, super cool how clean a diff this is!

Copy link
Contributor

@fabianschuiki fabianschuiki left a comment

Choose a reason for hiding this comment

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

LGTM! I'm wondering if we should even include the parameters in the class name at all. Modules had a similar monomorphization going on, and we decided to not have the parameters in the name to keep things at least somewhat readable when parameters get out of hand. It's okay to pick the same class name multiple times -- symbolTable.insert(...) will uniquify the classes to ensure they are distinct. We could always add a dbg.variable "WIDTH", %constWidth op to the class body to capture the values of the parameters.

@Scheremo Scheremo force-pushed the pr-classes-generic-definition branch from 9fe1597 to f0c92d4 Compare October 31, 2025 06:54
@Scheremo
Copy link
Contributor Author

LGTM! I'm wondering if we should even include the parameters in the class name at all. Modules had a similar monomorphization going on, and we decided to not have the parameters in the name to keep things at least somewhat readable when parameters get out of hand. It's okay to pick the same class name multiple times -- symbolTable.insert(...) will uniquify the classes to ensure they are distinct. We could always add a dbg.variable "WIDTH", %constWidth op to the class body to capture the values of the parameters.

Fair enough. If we change our minds it'll be very easy to add it back.

@Scheremo Scheremo force-pushed the pr-classes-generic-definition branch 3 times, most recently from db02fc0 to 5e37f1a Compare October 31, 2025 07:10
- Add support for lowering **specialized** (instantiated) generic classes by
  embedding actual parameter values into the fully-qualified class symbol, e.g.
  `@"pkg::MyClass#(.P(1),.Q(8))"`.
- Explicitly **skip** `GenericClassDefSymbol` (unspecialized templates) per IEEE 1800-2023 §8.25; only specialized `ClassType` symbols are lowered.
- Ensure class bodies are emitted **once**.
- Make type lowering declare/convert the class declaration eagerly to keep symbol references consistent.
@Scheremo Scheremo force-pushed the pr-classes-generic-definition branch from 5e37f1a to c4478c9 Compare October 31, 2025 07:12
@Scheremo Scheremo merged commit e727789 into llvm:main Oct 31, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants