-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add GenericInstance
type to represent instances of generics.
#4085
Add GenericInstance
type to represent instances of generics.
#4085
Conversation
canonicalization to have already been done.
toolchain/sem_ir/generic.h
Outdated
|
||
// Context for hashing keys. | ||
struct KeyContext { | ||
llvm::ArrayRef<GenericInstance> instances; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be private? It doesn't seem like it's part of the public API, so it strikes me as odd to put it first. hashtable_key_context.h's example provides the interface as a class, so would similar work here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a struct; given the limited scope I don't think it makes sense to add encapsulation here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That said... looking at this again, I don't think this needs to be in the header file. Moved to the .cpp
file. Maybe that provides the level of privateness you're looking for?
toolchain/sem_ir/generic.h
Outdated
// entity, this contains the corresponding non-generic value. This includes | ||
// values for the compile-time parameters themselves. | ||
struct GenericInstance : Printable<GenericInstance> { | ||
// Values corresponding to a region of a generic. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's a region of a generic? I don't see the term used in the design.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I'd incompletely removed this. Will be introduced in a future PR, gone for now :)
Also add a corresponding value store and YAML output.
We don't create any generic instances in this change; this is just adding infrastructure for future changes.