-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build a list of dependent constants to recompute in each instance of …
…a generic. (#4110) For each generic, build a list of instructions describing the computations we need to do when resolving an instance of the generic: this is a list of the instance-specific constants and types that the generic uses. Another way of viewing this list is as a block of Carbon SemIR code that is evaluated in order to form an instance of the generic -- this is referenced in the code as the "eval block" for the generic. For each instruction in the generic whose type or value is a symbolic constant, replace that type or constant value with a symbolic reference that says "to find the actual type or value, look at index N in the list of values for the generic instance". For an instruction with a symbolic constant value, we can just add that instruction to our list. For an instruction with a symbolic constant type, however, we may not have a corresponding instruction computing the type within the generic and may need to build a new instruction, but will reuse one where possible. In the case where we build a new instruction, we use the existing substitution code to build the type within the eval block. For now, this transformation is only done in the declaration region of the generic, not in the definition region. Also, we map back from the symbolic references to the underlying constant value in a few places where we will eventually need to do a lookup into a generic instance, in order to avoid regressing the tests.
- Loading branch information
Showing
58 changed files
with
848 additions
and
432 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.