Compute specific constant values. (#4128)

When forming a specific (previously called a generic instance), evaluate
the eval block of the generic to determine the values of any constants
used in that specific. The majority of the work here is updating
eval.cpp so that it can use the results of prior evaluations in the same
block when computing later values.

Include the computed results in the formatted SemIR output.

---------

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
Richard Smith
2024-07-15 23:59:23 +00:00
committed by GitHub
co-authored by Jon Ross-Perkins
parent be94782eda
commit efea072be3
73 changed files with 1429 additions and 272 deletions
@@ -136,3 +136,8 @@ var arr: [i32; 1.(I.F)(2)];
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F.2[@impl.%self.loc16_8.2: i32](@impl.%other.loc16_19.2: i32) -> i32 = "int.sadd";
// CHECK:STDOUT:
// CHECK:STDOUT: specific @I.%F.decl(constants.%Self) {
// CHECK:STDOUT: declaration:
// CHECK:STDOUT: @I.%Self.ref.loc12_14 => constants.%Self
// CHECK:STDOUT: }
// CHECK:STDOUT: