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
+4 -3
View File
@@ -51,6 +51,7 @@ fn F(p: const (const (const i32*)*)) -> const i32 {
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
// CHECK:STDOUT: %p.patt: %.6 = binding_pattern p
// CHECK:STDOUT: %p.param_patt: %.6 = param_pattern %p.patt, runtime_param0
// CHECK:STDOUT: } {
// CHECK:STDOUT: %int.make_type_32.loc12_29: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc12_23.1: type = value_of_initializer %int.make_type_32.loc12_29 [template = i32]
@@ -60,19 +61,19 @@ fn F(p: const (const (const i32*)*)) -> const i32 {
// CHECK:STDOUT: %.loc12_16: type = const_type %.3 [template = constants.%.4]
// CHECK:STDOUT: %.loc12_34: type = ptr_type %.4 [template = constants.%.5]
// CHECK:STDOUT: %.loc12_9: type = const_type %.5 [template = constants.%.6]
// CHECK:STDOUT: %p.param: %.6 = param p, runtime_param0
// CHECK:STDOUT: %p: %.6 = bind_name p, %p.param
// CHECK:STDOUT: %int.make_type_32.loc12_47: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc12_41.1: type = value_of_initializer %int.make_type_32.loc12_47 [template = i32]
// CHECK:STDOUT: %.loc12_41.2: type = converted %int.make_type_32.loc12_47, %.loc12_41.1 [template = i32]
// CHECK:STDOUT: %.loc12_41.3: type = const_type i32 [template = constants.%.2]
// CHECK:STDOUT: %return: ref %.2 = var <return slot>
// CHECK:STDOUT: %param: %.6 = param runtime_param0
// CHECK:STDOUT: %p: %.6 = bind_name p, %param
// CHECK:STDOUT: }
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F(%p: %.6) -> %.2 {
// CHECK:STDOUT: fn @F(%p.param_patt: %.6) -> %.2 {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %p.ref: %.6 = name_ref p, %p
// CHECK:STDOUT: %.loc13_11.1: ref %.4 = deref %p.ref