Generate parameter pattern-match IR from pattern IR (#4388)

Also propagate the pattern IR along with the pattern-match IR, and use
it where appropriate.

Strictly speaking, some parts of the pattern-match IR are allocated
eagerly, while traversing the pattern's parse tree, but they still
aren't actually emitted until we traverse the associated pattern insts.

---------

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
Geoff Romer
2024-10-16 19:15:29 +00:00
committed by GitHub
co-authored by Jon Ross-Perkins
parent 4a73b36688
commit 9d942f4633
347 changed files with 9148 additions and 5802 deletions
@@ -76,18 +76,19 @@ fn Deref(n: i32) {
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: %Deref.decl: %Deref.type = fn_decl @Deref [template = constants.%Deref] {
// CHECK:STDOUT: %n.patt: i32 = binding_pattern n
// CHECK:STDOUT: %n.param_patt: i32 = param_pattern %n.patt, runtime_param0
// CHECK:STDOUT: } {
// CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc11_13.1: type = value_of_initializer %int.make_type_32 [template = i32]
// CHECK:STDOUT: %.loc11_13.2: type = converted %int.make_type_32, %.loc11_13.1 [template = i32]
// CHECK:STDOUT: %n.param: i32 = param n, runtime_param0
// CHECK:STDOUT: %n: i32 = bind_name n, %n.param
// CHECK:STDOUT: %param: i32 = param runtime_param0
// CHECK:STDOUT: %n: i32 = bind_name n, %param
// CHECK:STDOUT: }
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Deref(%n: i32) {
// CHECK:STDOUT: fn @Deref(%n.param_patt: i32) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %n.ref.loc16: i32 = name_ref n, %n
// CHECK:STDOUT: %.loc16: ref <error> = deref %n.ref.loc16