mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
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:
co-authored by
Jon Ross-Perkins
parent
4a73b36688
commit
9d942f4633
+10
-7
@@ -56,28 +56,31 @@ fn F(b: bool, n: i32, m: i32) -> i32 {
|
||||
// CHECK:STDOUT: %Core.import = import Core
|
||||
// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
|
||||
// CHECK:STDOUT: %b.patt: bool = binding_pattern b
|
||||
// CHECK:STDOUT: %b.param_patt: bool = param_pattern %b.patt, runtime_param0
|
||||
// CHECK:STDOUT: %n.patt: i32 = binding_pattern n
|
||||
// CHECK:STDOUT: %n.param_patt: i32 = param_pattern %n.patt, runtime_param1
|
||||
// CHECK:STDOUT: %m.patt: i32 = binding_pattern m
|
||||
// CHECK:STDOUT: %m.param_patt: i32 = param_pattern %m.patt, runtime_param2
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool]
|
||||
// CHECK:STDOUT: %.loc11_9.1: type = value_of_initializer %bool.make_type [template = bool]
|
||||
// CHECK:STDOUT: %.loc11_9.2: type = converted %bool.make_type, %.loc11_9.1 [template = bool]
|
||||
// CHECK:STDOUT: %b.param: bool = param b, runtime_param0
|
||||
// CHECK:STDOUT: %b: bool = bind_name b, %b.param
|
||||
// CHECK:STDOUT: %int.make_type_32.loc11_18: init type = call constants.%Int32() [template = i32]
|
||||
// CHECK:STDOUT: %.loc11_18.1: type = value_of_initializer %int.make_type_32.loc11_18 [template = i32]
|
||||
// CHECK:STDOUT: %.loc11_18.2: type = converted %int.make_type_32.loc11_18, %.loc11_18.1 [template = i32]
|
||||
// CHECK:STDOUT: %n.param: i32 = param n, runtime_param1
|
||||
// CHECK:STDOUT: %n: i32 = bind_name n, %n.param
|
||||
// CHECK:STDOUT: %int.make_type_32.loc11_26: init type = call constants.%Int32() [template = i32]
|
||||
// CHECK:STDOUT: %.loc11_26.1: type = value_of_initializer %int.make_type_32.loc11_26 [template = i32]
|
||||
// CHECK:STDOUT: %.loc11_26.2: type = converted %int.make_type_32.loc11_26, %.loc11_26.1 [template = i32]
|
||||
// CHECK:STDOUT: %m.param: i32 = param m, runtime_param2
|
||||
// CHECK:STDOUT: %m: i32 = bind_name m, %m.param
|
||||
// CHECK:STDOUT: %int.make_type_32.loc11_34: init type = call constants.%Int32() [template = i32]
|
||||
// CHECK:STDOUT: %.loc11_34.1: type = value_of_initializer %int.make_type_32.loc11_34 [template = i32]
|
||||
// CHECK:STDOUT: %.loc11_34.2: type = converted %int.make_type_32.loc11_34, %.loc11_34.1 [template = i32]
|
||||
// CHECK:STDOUT: %return: ref i32 = var <return slot>
|
||||
// CHECK:STDOUT: %param.loc11_6: bool = param runtime_param0
|
||||
// CHECK:STDOUT: %b: bool = bind_name b, %param.loc11_6
|
||||
// CHECK:STDOUT: %param.loc11_15: i32 = param runtime_param1
|
||||
// CHECK:STDOUT: %n: i32 = bind_name n, %param.loc11_15
|
||||
// CHECK:STDOUT: %param.loc11_23: i32 = param runtime_param2
|
||||
// CHECK:STDOUT: %m: i32 = bind_name m, %param.loc11_23
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -85,7 +88,7 @@ fn F(b: bool, n: i32, m: i32) -> i32 {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @F(%b: bool, %n: i32, %m: i32) -> i32 {
|
||||
// CHECK:STDOUT: fn @F(%b.param_patt: bool, %n.param_patt: i32, %m.param_patt: i32) -> i32 {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%Int32() [template = i32]
|
||||
// CHECK:STDOUT: %.loc12_16: i32 = int_literal 1 [template = constants.%.2]
|
||||
|
||||
Reference in New Issue
Block a user