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
@@ -49,22 +49,24 @@ fn F(n: i32, n: i32);
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
// CHECK:STDOUT: %n.patt.loc17_6: i32 = binding_pattern n
// CHECK:STDOUT: %n.param_patt.loc17_7: i32 = param_pattern %n.patt.loc17_6, runtime_param0
// CHECK:STDOUT: %n.patt.loc17_14: i32 = binding_pattern n
// CHECK:STDOUT: %n.param_patt.loc17_15: i32 = param_pattern %n.patt.loc17_14, runtime_param1
// CHECK:STDOUT: } {
// CHECK:STDOUT: %int.make_type_32.loc17_9: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc17_9.1: type = value_of_initializer %int.make_type_32.loc17_9 [template = i32]
// CHECK:STDOUT: %.loc17_9.2: type = converted %int.make_type_32.loc17_9, %.loc17_9.1 [template = i32]
// CHECK:STDOUT: %n.param.loc17_6: i32 = param n, runtime_param0
// CHECK:STDOUT: %n.loc17_6: i32 = bind_name n, %n.param.loc17_6
// CHECK:STDOUT: %int.make_type_32.loc17_17: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc17_17.1: type = value_of_initializer %int.make_type_32.loc17_17 [template = i32]
// CHECK:STDOUT: %.loc17_17.2: type = converted %int.make_type_32.loc17_17, %.loc17_17.1 [template = i32]
// CHECK:STDOUT: %n.param.loc17_14: i32 = param n, runtime_param1
// CHECK:STDOUT: %n.loc17_14: i32 = bind_name n, %n.param.loc17_14
// CHECK:STDOUT: %param.loc17_6: i32 = param runtime_param0
// CHECK:STDOUT: %n.loc17_6: i32 = bind_name n, %param.loc17_6
// CHECK:STDOUT: %param.loc17_14: i32 = param runtime_param1
// CHECK:STDOUT: %n.loc17_14: i32 = bind_name n, %param.loc17_14
// CHECK:STDOUT: }
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F(%n.loc17_6: i32, %n.loc17_14: i32);
// CHECK:STDOUT: fn @F(%n.param_patt.loc17_7: i32, %n.param_patt.loc17_15: i32);
// CHECK:STDOUT: