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
@@ -109,27 +109,30 @@ fn Main() {
// CHECK:STDOUT: %Run0.decl: %Run0.type = fn_decl @Run0 [template = constants.%Run0] {} {}
// CHECK:STDOUT: %Run1.decl: %Run1.type = fn_decl @Run1 [template = constants.%Run1] {
// CHECK:STDOUT: %a.patt: i32 = binding_pattern a
// CHECK:STDOUT: %a.param_patt: i32 = param_pattern %a.patt, runtime_param0
// CHECK:STDOUT: } {
// CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc12_12.1: type = value_of_initializer %int.make_type_32 [template = i32]
// CHECK:STDOUT: %.loc12_12.2: type = converted %int.make_type_32, %.loc12_12.1 [template = i32]
// CHECK:STDOUT: %a.param: i32 = param a, runtime_param0
// CHECK:STDOUT: %a: i32 = bind_name a, %a.param
// CHECK:STDOUT: %param: i32 = param runtime_param0
// CHECK:STDOUT: %a: i32 = bind_name a, %param
// CHECK:STDOUT: }
// CHECK:STDOUT: %Run2.decl: %Run2.type = fn_decl @Run2 [template = constants.%Run2] {
// CHECK:STDOUT: %a.patt: i32 = binding_pattern a
// CHECK:STDOUT: %a.param_patt: i32 = param_pattern %a.patt, runtime_param0
// CHECK:STDOUT: %b.patt: i32 = binding_pattern b
// CHECK:STDOUT: %b.param_patt: i32 = param_pattern %b.patt, runtime_param1
// CHECK:STDOUT: } {
// CHECK:STDOUT: %int.make_type_32.loc13_12: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc13_12.1: type = value_of_initializer %int.make_type_32.loc13_12 [template = i32]
// CHECK:STDOUT: %.loc13_12.2: type = converted %int.make_type_32.loc13_12, %.loc13_12.1 [template = i32]
// CHECK:STDOUT: %a.param: i32 = param a, runtime_param0
// CHECK:STDOUT: %a: i32 = bind_name a, %a.param
// CHECK:STDOUT: %int.make_type_32.loc13_20: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc13_20.1: type = value_of_initializer %int.make_type_32.loc13_20 [template = i32]
// CHECK:STDOUT: %.loc13_20.2: type = converted %int.make_type_32.loc13_20, %.loc13_20.1 [template = i32]
// CHECK:STDOUT: %b.param: i32 = param b, runtime_param1
// CHECK:STDOUT: %b: i32 = bind_name b, %b.param
// CHECK:STDOUT: %param.loc13_9: i32 = param runtime_param0
// CHECK:STDOUT: %a: i32 = bind_name a, %param.loc13_9
// CHECK:STDOUT: %param.loc13_17: i32 = param runtime_param1
// CHECK:STDOUT: %b: i32 = bind_name b, %param.loc13_17
// CHECK:STDOUT: }
// CHECK:STDOUT: %Main.decl: %Main.type = fn_decl @Main [template = constants.%Main] {} {}
// CHECK:STDOUT: }
@@ -141,12 +144,12 @@ fn Main() {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Run1(%a: i32) {
// CHECK:STDOUT: fn @Run1(%a.param_patt: i32) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Run2(%a: i32, %b: i32) {
// CHECK:STDOUT: fn @Run2(%a.param_patt: i32, %b.param_patt: i32) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: return
// CHECK:STDOUT: }
+25 -18
View File
@@ -11,12 +11,12 @@
fn G(a: i32) {}
fn F() {
// CHECK:STDERR: fail_param_type.carbon:[[@LINE+9]]:3: error: cannot implicitly convert from `f64` to `i32`
// CHECK:STDERR: fail_param_type.carbon:[[@LINE+9]]:5: error: cannot implicitly convert from `f64` to `i32`
// CHECK:STDERR: G(1.0);
// CHECK:STDERR: ^~
// CHECK:STDERR: fail_param_type.carbon:[[@LINE+6]]:3: note: type `f64` does not implement interface `ImplicitAs`
// CHECK:STDERR: ^~~
// CHECK:STDERR: fail_param_type.carbon:[[@LINE+6]]:5: note: type `f64` does not implement interface `ImplicitAs`
// CHECK:STDERR: G(1.0);
// CHECK:STDERR: ^~
// CHECK:STDERR: ^~~
// CHECK:STDERR: fail_param_type.carbon:[[@LINE-9]]:1: note: initializing parameter 1 of function declared here
// CHECK:STDERR: fn G(a: i32) {}
// CHECK:STDERR: ^~~~~~~~~~~~~~
@@ -39,6 +39,7 @@ fn F() {
// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic]
// CHECK:STDOUT: %ImplicitAs.type.2: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic]
// CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2) = bind_symbolic_name Self, 1 [symbolic]
// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic]
// CHECK:STDOUT: %Self.2: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic]
// CHECK:STDOUT: %Convert.type.1: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic]
// CHECK:STDOUT: %Convert.1: %Convert.type.1 = struct_value () [symbolic]
@@ -66,12 +67,12 @@ fn F() {
// CHECK:STDOUT: import Core//prelude/types/bool
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.1: %Int32.type = import_ref Core//prelude/types, inst+4, loaded [template = constants.%Int32]
// CHECK:STDOUT: %import_ref.2: %ImplicitAs.type.1 = import_ref Core//prelude/operators/as, inst+40, loaded [template = constants.%ImplicitAs]
// CHECK:STDOUT: %import_ref.3 = import_ref Core//prelude/operators/as, inst+45, unloaded
// CHECK:STDOUT: %import_ref.4: @ImplicitAs.%.1 (%.3) = import_ref Core//prelude/operators/as, inst+63, loaded [symbolic = @ImplicitAs.%.2 (constants.%.7)]
// CHECK:STDOUT: %import_ref.5 = import_ref Core//prelude/operators/as, inst+56, unloaded
// CHECK:STDOUT: %import_ref.6 = import_ref Core//prelude/operators/as, inst+56, unloaded
// CHECK:STDOUT: %import_ref.7 = import_ref Core//prelude/operators/as, inst+56, unloaded
// CHECK:STDOUT: %import_ref.2: %ImplicitAs.type.1 = import_ref Core//prelude/operators/as, inst+46, loaded [template = constants.%ImplicitAs]
// CHECK:STDOUT: %import_ref.3 = import_ref Core//prelude/operators/as, inst+52, unloaded
// CHECK:STDOUT: %import_ref.4: @ImplicitAs.%.1 (%.3) = import_ref Core//prelude/operators/as, inst+71, loaded [symbolic = @ImplicitAs.%.2 (constants.%.7)]
// CHECK:STDOUT: %import_ref.5 = import_ref Core//prelude/operators/as, inst+64, unloaded
// CHECK:STDOUT: %import_ref.6 = import_ref Core//prelude/operators/as, inst+64, unloaded
// CHECK:STDOUT: %import_ref.7 = import_ref Core//prelude/operators/as, inst+64, unloaded
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -83,18 +84,20 @@ fn F() {
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
// CHECK:STDOUT: %a.patt: i32 = binding_pattern a
// CHECK:STDOUT: %a.param_patt: i32 = param_pattern %a.patt, runtime_param0
// CHECK:STDOUT: } {
// CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc11_9.1: type = value_of_initializer %int.make_type_32 [template = i32]
// CHECK:STDOUT: %.loc11_9.2: type = converted %int.make_type_32, %.loc11_9.1 [template = i32]
// CHECK:STDOUT: %a.param: i32 = param a, runtime_param0
// CHECK:STDOUT: %a: i32 = bind_name a, %a.param
// CHECK:STDOUT: %param: i32 = param runtime_param0
// CHECK:STDOUT: %a: i32 = bind_name a, %param
// CHECK:STDOUT: }
// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: generic interface @ImplicitAs(constants.%Dest: type) {
// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)]
// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)]
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)]
@@ -114,7 +117,7 @@ fn F() {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @G(%a: i32) {
// CHECK:STDOUT: fn @G(%a.param_patt: i32) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: return
// CHECK:STDOUT: }
@@ -122,11 +125,11 @@ fn F() {
// CHECK:STDOUT: fn @F() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %G.ref: %G.type = name_ref G, file.%G.decl [template = constants.%G]
// CHECK:STDOUT: %.loc23_5: f64 = float_literal 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc23_5.1: f64 = float_literal 1 [template = constants.%.2]
// CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(i32) [template = constants.%ImplicitAs.type.3]
// CHECK:STDOUT: %.loc23_4.1: %.5 = specific_constant imports.%import_ref.4, @ImplicitAs(i32) [template = constants.%.6]
// CHECK:STDOUT: %Convert.ref: %.5 = name_ref Convert, %.loc23_4.1 [template = constants.%.6]
// CHECK:STDOUT: %.loc23_4.2: i32 = converted %.loc23_5, <error> [template = <error>]
// CHECK:STDOUT: %.loc23_5.2: %.5 = specific_constant imports.%import_ref.4, @ImplicitAs(i32) [template = constants.%.6]
// CHECK:STDOUT: %Convert.ref: %.5 = name_ref Convert, %.loc23_5.2 [template = constants.%.6]
// CHECK:STDOUT: %.loc23_5.3: i32 = converted %.loc23_5.1, <error> [template = <error>]
// CHECK:STDOUT: %G.call: init %.1 = call %G.ref(<invalid>) [template = <error>]
// CHECK:STDOUT: return
// CHECK:STDOUT: }
@@ -136,19 +139,22 @@ fn F() {
// CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)]
// CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)]
// CHECK:STDOUT:
// CHECK:STDOUT: fn[%self: @Convert.%Self (%Self.2)]() -> @Convert.%Dest (%Dest);
// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self (%Self.2)]() -> @Convert.%Dest (%Dest);
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) {
// CHECK:STDOUT: %Dest => constants.%Dest
// CHECK:STDOUT: %Dest.patt => constants.%Dest
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @ImplicitAs(@ImplicitAs.%Dest) {
// CHECK:STDOUT: %Dest => constants.%Dest
// CHECK:STDOUT: %Dest.patt => constants.%Dest
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {
// CHECK:STDOUT: %Dest => constants.%Dest
// CHECK:STDOUT: %Dest.patt => constants.%Dest
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @Convert(constants.%Dest, constants.%Self.1) {
@@ -159,6 +165,7 @@ fn F() {
// CHECK:STDOUT:
// CHECK:STDOUT: specific @ImplicitAs(i32) {
// CHECK:STDOUT: %Dest => i32
// CHECK:STDOUT: %Dest.patt => i32
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3
@@ -39,6 +39,7 @@ fn Run() {
// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic]
// CHECK:STDOUT: %ImplicitAs.type.2: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic]
// CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2) = bind_symbolic_name Self, 1 [symbolic]
// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic]
// CHECK:STDOUT: %Self.2: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic]
// CHECK:STDOUT: %Convert.type.1: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic]
// CHECK:STDOUT: %Convert.1: %Convert.type.1 = struct_value () [symbolic]
@@ -66,14 +67,14 @@ fn Run() {
// CHECK:STDOUT: import Core//prelude/operators/comparison
// CHECK:STDOUT: import Core//prelude/types/bool
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.1: %Float.type = import_ref Core//prelude/types, inst+35, loaded [template = constants.%Float]
// CHECK:STDOUT: %import_ref.1: %Float.type = import_ref Core//prelude/types, inst+38, loaded [template = constants.%Float]
// CHECK:STDOUT: %import_ref.2: %Int32.type = import_ref Core//prelude/types, inst+4, loaded [template = constants.%Int32]
// CHECK:STDOUT: %import_ref.3: %ImplicitAs.type.1 = import_ref Core//prelude/operators/as, inst+40, loaded [template = constants.%ImplicitAs]
// CHECK:STDOUT: %import_ref.4 = import_ref Core//prelude/operators/as, inst+45, unloaded
// CHECK:STDOUT: %import_ref.5: @ImplicitAs.%.1 (%.4) = import_ref Core//prelude/operators/as, inst+63, loaded [symbolic = @ImplicitAs.%.2 (constants.%.8)]
// CHECK:STDOUT: %import_ref.6 = import_ref Core//prelude/operators/as, inst+56, unloaded
// CHECK:STDOUT: %import_ref.7 = import_ref Core//prelude/operators/as, inst+56, unloaded
// CHECK:STDOUT: %import_ref.8 = import_ref Core//prelude/operators/as, inst+56, unloaded
// CHECK:STDOUT: %import_ref.3: %ImplicitAs.type.1 = import_ref Core//prelude/operators/as, inst+46, loaded [template = constants.%ImplicitAs]
// CHECK:STDOUT: %import_ref.4 = import_ref Core//prelude/operators/as, inst+52, unloaded
// CHECK:STDOUT: %import_ref.5: @ImplicitAs.%.1 (%.4) = import_ref Core//prelude/operators/as, inst+71, loaded [symbolic = @ImplicitAs.%.2 (constants.%.8)]
// CHECK:STDOUT: %import_ref.6 = import_ref Core//prelude/operators/as, inst+64, unloaded
// CHECK:STDOUT: %import_ref.7 = import_ref Core//prelude/operators/as, inst+64, unloaded
// CHECK:STDOUT: %import_ref.8 = import_ref Core//prelude/operators/as, inst+64, unloaded
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -95,6 +96,7 @@ fn Run() {
// CHECK:STDOUT:
// CHECK:STDOUT: generic interface @ImplicitAs(constants.%Dest: type) {
// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)]
// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)]
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)]
@@ -112,7 +114,7 @@ fn Run() {
// CHECK:STDOUT: }
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Float(%size: i32) -> type = "float.make_type";
// CHECK:STDOUT: fn @Float(%size.param_patt: i32) -> type = "float.make_type";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Foo() -> f64 {
// CHECK:STDOUT: !entry:
@@ -146,19 +148,22 @@ fn Run() {
// CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)]
// CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)]
// CHECK:STDOUT:
// CHECK:STDOUT: fn[%self: @Convert.%Self (%Self.2)]() -> @Convert.%Dest (%Dest);
// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self (%Self.2)]() -> @Convert.%Dest (%Dest);
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) {
// CHECK:STDOUT: %Dest => constants.%Dest
// CHECK:STDOUT: %Dest.patt => constants.%Dest
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @ImplicitAs(@ImplicitAs.%Dest) {
// CHECK:STDOUT: %Dest => constants.%Dest
// CHECK:STDOUT: %Dest.patt => constants.%Dest
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {
// CHECK:STDOUT: %Dest => constants.%Dest
// CHECK:STDOUT: %Dest.patt => constants.%Dest
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: specific @Convert(constants.%Dest, constants.%Self.1) {
@@ -169,6 +174,7 @@ fn Run() {
// CHECK:STDOUT:
// CHECK:STDOUT: specific @ImplicitAs(i32) {
// CHECK:STDOUT: %Dest => i32
// CHECK:STDOUT: %Dest.patt => i32
// CHECK:STDOUT:
// CHECK:STDOUT: !definition:
// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3
+4 -3
View File
@@ -53,23 +53,24 @@ fn Main() {
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: %Echo.decl: %Echo.type = fn_decl @Echo [template = constants.%Echo] {
// CHECK:STDOUT: %a.patt: i32 = binding_pattern a
// CHECK:STDOUT: %a.param_patt: i32 = param_pattern %a.patt, runtime_param0
// CHECK:STDOUT: } {
// CHECK:STDOUT: %int.make_type_32.loc11_12: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc11_12.1: type = value_of_initializer %int.make_type_32.loc11_12 [template = i32]
// CHECK:STDOUT: %.loc11_12.2: type = converted %int.make_type_32.loc11_12, %.loc11_12.1 [template = i32]
// CHECK:STDOUT: %a.param: i32 = param a, runtime_param0
// CHECK:STDOUT: %a: i32 = bind_name a, %a.param
// CHECK:STDOUT: %int.make_type_32.loc11_20: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc11_20.1: type = value_of_initializer %int.make_type_32.loc11_20 [template = i32]
// CHECK:STDOUT: %.loc11_20.2: type = converted %int.make_type_32.loc11_20, %.loc11_20.1 [template = i32]
// CHECK:STDOUT: %return: ref i32 = var <return slot>
// CHECK:STDOUT: %param: i32 = param runtime_param0
// CHECK:STDOUT: %a: i32 = bind_name a, %param
// CHECK:STDOUT: }
// CHECK:STDOUT: %Main.decl: %Main.type = fn_decl @Main [template = constants.%Main] {} {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Echo(%a: i32) -> i32 {
// CHECK:STDOUT: fn @Echo(%a.param_patt: i32) -> i32 {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %a.ref: i32 = name_ref a, %a
// CHECK:STDOUT: return %a.ref
@@ -58,25 +58,27 @@ fn Main() {
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: %Foo.decl: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
// CHECK:STDOUT: %a.patt: i32 = binding_pattern a
// CHECK:STDOUT: %a.param_patt: i32 = param_pattern %a.patt, runtime_param0
// CHECK:STDOUT: %b.patt: i32 = binding_pattern b
// CHECK:STDOUT: %b.param_patt: i32 = param_pattern %b.patt, runtime_param1
// CHECK:STDOUT: } {
// CHECK:STDOUT: %int.make_type_32.loc11_11: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %int.make_type_32.loc11_11 [template = i32]
// CHECK:STDOUT: %.loc11_11.2: type = converted %int.make_type_32.loc11_11, %.loc11_11.1 [template = i32]
// CHECK:STDOUT: %a.param: i32 = param a, runtime_param0
// CHECK:STDOUT: %a: i32 = bind_name a, %a.param
// CHECK:STDOUT: %int.make_type_32.loc11_19: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc11_19.1: type = value_of_initializer %int.make_type_32.loc11_19 [template = i32]
// CHECK:STDOUT: %.loc11_19.2: type = converted %int.make_type_32.loc11_19, %.loc11_19.1 [template = i32]
// CHECK:STDOUT: %b.param: i32 = param b, runtime_param1
// CHECK:STDOUT: %b: i32 = bind_name b, %b.param
// CHECK:STDOUT: %param.loc11_8: i32 = param runtime_param0
// CHECK:STDOUT: %a: i32 = bind_name a, %param.loc11_8
// CHECK:STDOUT: %param.loc11_16: i32 = param runtime_param1
// CHECK:STDOUT: %b: i32 = bind_name b, %param.loc11_16
// CHECK:STDOUT: }
// CHECK:STDOUT: %Main.decl: %Main.type = fn_decl @Main [template = constants.%Main] {} {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Foo(%a: i32, %b: i32) {
// CHECK:STDOUT: fn @Foo(%a.param_patt: i32, %b.param_patt: i32) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: return
// CHECK:STDOUT: }
@@ -35,19 +35,20 @@ fn Main() {
// CHECK:STDOUT: }
// CHECK:STDOUT: %Echo.decl: %Echo.type = fn_decl @Echo [template = constants.%Echo] {
// CHECK:STDOUT: %a.patt: %.1 = binding_pattern a
// CHECK:STDOUT: %a.param_patt: %.1 = param_pattern %a.patt, runtime_param0
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc11_13.1: %.1 = struct_literal ()
// CHECK:STDOUT: %.loc11_13.2: type = converted %.loc11_13.1, constants.%.1 [template = constants.%.1]
// CHECK:STDOUT: %a.param: %.1 = param a, runtime_param0
// CHECK:STDOUT: %a: %.1 = bind_name a, %a.param
// CHECK:STDOUT: %.loc11_20.1: %.1 = struct_literal ()
// CHECK:STDOUT: %.loc11_20.2: type = converted %.loc11_20.1, constants.%.1 [template = constants.%.1]
// CHECK:STDOUT: %return: ref %.1 = var <return slot>
// CHECK:STDOUT: %param: %.1 = param runtime_param0
// CHECK:STDOUT: %a: %.1 = bind_name a, %param
// CHECK:STDOUT: }
// CHECK:STDOUT: %Main.decl: %Main.type = fn_decl @Main [template = constants.%Main] {} {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Echo(%a: %.1) -> %.1 {
// CHECK:STDOUT: fn @Echo(%a.param_patt: %.1) -> %.1 {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %a.ref: %.1 = name_ref a, %a
// CHECK:STDOUT: return %a.ref
@@ -56,10 +57,10 @@ fn Main() {
// CHECK:STDOUT: fn @Main() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %Echo.ref: %Echo.type = name_ref Echo, file.%Echo.decl [template = constants.%Echo]
// CHECK:STDOUT: %.loc16_9: %.1 = struct_literal ()
// CHECK:STDOUT: %.loc16_9.1: %.1 = struct_literal ()
// CHECK:STDOUT: %struct: %.1 = struct_value () [template = constants.%struct]
// CHECK:STDOUT: %.loc16_7: %.1 = converted %.loc16_9, %struct [template = constants.%struct]
// CHECK:STDOUT: %Echo.call: init %.1 = call %Echo.ref(%.loc16_7)
// CHECK:STDOUT: %.loc16_9.2: %.1 = converted %.loc16_9.1, %struct [template = constants.%struct]
// CHECK:STDOUT: %Echo.call: init %.1 = call %Echo.ref(%.loc16_9.2)
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -34,19 +34,20 @@ fn Main() {
// CHECK:STDOUT: }
// CHECK:STDOUT: %Echo.decl: %Echo.type = fn_decl @Echo [template = constants.%Echo] {
// CHECK:STDOUT: %a.patt: %.1 = binding_pattern a
// CHECK:STDOUT: %a.param_patt: %.1 = param_pattern %a.patt, runtime_param0
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc11_13.1: %.1 = tuple_literal ()
// CHECK:STDOUT: %.loc11_13.2: type = converted %.loc11_13.1, constants.%.1 [template = constants.%.1]
// CHECK:STDOUT: %a.param: %.1 = param a, runtime_param0
// CHECK:STDOUT: %a: %.1 = bind_name a, %a.param
// CHECK:STDOUT: %.loc11_20.1: %.1 = tuple_literal ()
// CHECK:STDOUT: %.loc11_20.2: type = converted %.loc11_20.1, constants.%.1 [template = constants.%.1]
// CHECK:STDOUT: %return: ref %.1 = var <return slot>
// CHECK:STDOUT: %param: %.1 = param runtime_param0
// CHECK:STDOUT: %a: %.1 = bind_name a, %param
// CHECK:STDOUT: }
// CHECK:STDOUT: %Main.decl: %Main.type = fn_decl @Main [template = constants.%Main] {} {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Echo(%a: %.1) -> %.1 {
// CHECK:STDOUT: fn @Echo(%a.param_patt: %.1) -> %.1 {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %a.ref: %.1 = name_ref a, %a
// CHECK:STDOUT: return %a.ref
@@ -55,10 +56,10 @@ fn Main() {
// CHECK:STDOUT: fn @Main() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %Echo.ref: %Echo.type = name_ref Echo, file.%Echo.decl [template = constants.%Echo]
// CHECK:STDOUT: %.loc16_9: %.1 = tuple_literal ()
// CHECK:STDOUT: %.loc16_9.1: %.1 = tuple_literal ()
// CHECK:STDOUT: %tuple: %.1 = tuple_value () [template = constants.%tuple]
// CHECK:STDOUT: %.loc16_7: %.1 = converted %.loc16_9, %tuple [template = constants.%tuple]
// CHECK:STDOUT: %Echo.call: init %.1 = call %Echo.ref(%.loc16_7)
// CHECK:STDOUT: %.loc16_9.2: %.1 = converted %.loc16_9.1, %tuple [template = constants.%tuple]
// CHECK:STDOUT: %Echo.call: init %.1 = call %Echo.ref(%.loc16_9.2)
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -35,24 +35,25 @@ fn Run() {
// CHECK:STDOUT: }
// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
// CHECK:STDOUT: %self.patt: %.1 = binding_pattern self
// CHECK:STDOUT: %self.param_patt: %.1 = param_pattern %self.patt, runtime_param0
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc14_13.1: %.1 = tuple_literal ()
// CHECK:STDOUT: %.loc14_13.2: type = converted %.loc14_13.1, constants.%.1 [template = constants.%.1]
// CHECK:STDOUT: %self.param: %.1 = param self, runtime_param0
// CHECK:STDOUT: %self: %.1 = bind_name self, %self.param
// CHECK:STDOUT: %param: %.1 = param runtime_param0
// CHECK:STDOUT: %self: %.1 = bind_name self, %param
// CHECK:STDOUT: }
// CHECK:STDOUT: %Run.decl: %Run.type = fn_decl @Run [template = constants.%Run] {} {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F(%self: %.1);
// CHECK:STDOUT: fn @F(%self.param_patt: %.1);
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Run() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F]
// CHECK:STDOUT: %.loc17_6: %.1 = tuple_literal ()
// CHECK:STDOUT: %.loc17_6.1: %.1 = tuple_literal ()
// CHECK:STDOUT: %tuple: %.1 = tuple_value () [template = constants.%tuple]
// CHECK:STDOUT: %.loc17_4: %.1 = converted %.loc17_6, %tuple [template = constants.%tuple]
// CHECK:STDOUT: %F.call: init %.1 = call %F.ref(%.loc17_4)
// CHECK:STDOUT: %.loc17_6.2: %.1 = converted %.loc17_6.1, %tuple [template = constants.%tuple]
// CHECK:STDOUT: %F.call: init %.1 = call %F.ref(%.loc17_6.2)
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -34,16 +34,17 @@ fn Run() {
// CHECK:STDOUT: }
// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
// CHECK:STDOUT: %s.patt: %.1 = binding_pattern s
// CHECK:STDOUT: %s.param_patt: %.1 = param_pattern %s.patt, runtime_param<invalid>
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc14_10.1: %.1 = tuple_literal ()
// CHECK:STDOUT: %.loc14_10.2: type = converted %.loc14_10.1, constants.%.1 [template = constants.%.1]
// CHECK:STDOUT: %s.param: %.1 = param s, runtime_param<invalid>
// CHECK:STDOUT: %s: %.1 = bind_name s, %s.param
// CHECK:STDOUT: %param: %.1 = param runtime_param<invalid>
// CHECK:STDOUT: %s: %.1 = bind_name s, %param
// CHECK:STDOUT: }
// CHECK:STDOUT: %Run.decl: %Run.type = fn_decl @Run [template = constants.%Run] {} {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F[%base.param: <error>]();
// CHECK:STDOUT: fn @F[%s.param_patt: %.1]();
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Run() {
// CHECK:STDOUT: !entry:
+4 -3
View File
@@ -51,19 +51,20 @@ fn Main() {
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: %Foo.decl: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
// CHECK:STDOUT: %a.patt: i32 = binding_pattern a
// CHECK:STDOUT: %a.param_patt: i32 = param_pattern %a.patt, runtime_param0
// CHECK:STDOUT: } {
// CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %int.make_type_32 [template = i32]
// CHECK:STDOUT: %.loc11_11.2: type = converted %int.make_type_32, %.loc11_11.1 [template = i32]
// CHECK:STDOUT: %a.param: i32 = param a, runtime_param0
// CHECK:STDOUT: %a: i32 = bind_name a, %a.param
// CHECK:STDOUT: %param: i32 = param runtime_param0
// CHECK:STDOUT: %a: i32 = bind_name a, %param
// CHECK:STDOUT: }
// CHECK:STDOUT: %Main.decl: %Main.type = fn_decl @Main [template = constants.%Main] {} {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Foo(%a: i32) {
// CHECK:STDOUT: fn @Foo(%a.param_patt: i32) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: return
// CHECK:STDOUT: }
@@ -52,19 +52,20 @@ fn Main() {
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: %Foo.decl: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
// CHECK:STDOUT: %a.patt: i32 = binding_pattern a
// CHECK:STDOUT: %a.param_patt: i32 = param_pattern %a.patt, runtime_param0
// CHECK:STDOUT: } {
// CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %int.make_type_32 [template = i32]
// CHECK:STDOUT: %.loc11_11.2: type = converted %int.make_type_32, %.loc11_11.1 [template = i32]
// CHECK:STDOUT: %a.param: i32 = param a, runtime_param0
// CHECK:STDOUT: %a: i32 = bind_name a, %a.param
// CHECK:STDOUT: %param: i32 = param runtime_param0
// CHECK:STDOUT: %a: i32 = bind_name a, %param
// CHECK:STDOUT: }
// CHECK:STDOUT: %Main.decl: %Main.type = fn_decl @Main [template = constants.%Main] {} {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Foo(%a: i32) {
// CHECK:STDOUT: fn @Foo(%a.param_patt: i32) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: return
// CHECK:STDOUT: }
+7 -5
View File
@@ -52,25 +52,27 @@ fn Main() {
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: %Foo.decl: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
// CHECK:STDOUT: %a.patt: i32 = binding_pattern a
// CHECK:STDOUT: %a.param_patt: i32 = param_pattern %a.patt, runtime_param0
// CHECK:STDOUT: %b.patt: i32 = binding_pattern b
// CHECK:STDOUT: %b.param_patt: i32 = param_pattern %b.patt, runtime_param1
// CHECK:STDOUT: } {
// CHECK:STDOUT: %int.make_type_32.loc11_11: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %int.make_type_32.loc11_11 [template = i32]
// CHECK:STDOUT: %.loc11_11.2: type = converted %int.make_type_32.loc11_11, %.loc11_11.1 [template = i32]
// CHECK:STDOUT: %a.param: i32 = param a, runtime_param0
// CHECK:STDOUT: %a: i32 = bind_name a, %a.param
// CHECK:STDOUT: %int.make_type_32.loc11_19: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc11_19.1: type = value_of_initializer %int.make_type_32.loc11_19 [template = i32]
// CHECK:STDOUT: %.loc11_19.2: type = converted %int.make_type_32.loc11_19, %.loc11_19.1 [template = i32]
// CHECK:STDOUT: %b.param: i32 = param b, runtime_param1
// CHECK:STDOUT: %b: i32 = bind_name b, %b.param
// CHECK:STDOUT: %param.loc11_8: i32 = param runtime_param0
// CHECK:STDOUT: %a: i32 = bind_name a, %param.loc11_8
// CHECK:STDOUT: %param.loc11_16: i32 = param runtime_param1
// CHECK:STDOUT: %b: i32 = bind_name b, %param.loc11_16
// CHECK:STDOUT: }
// CHECK:STDOUT: %Main.decl: %Main.type = fn_decl @Main [template = constants.%Main] {} {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Foo(%a: i32, %b: i32) {
// CHECK:STDOUT: fn @Foo(%a.param_patt: i32, %b.param_patt: i32) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: return
// CHECK:STDOUT: }
@@ -53,25 +53,27 @@ fn Main() {
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: %Foo.decl: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
// CHECK:STDOUT: %a.patt: i32 = binding_pattern a
// CHECK:STDOUT: %a.param_patt: i32 = param_pattern %a.patt, runtime_param0
// CHECK:STDOUT: %b.patt: i32 = binding_pattern b
// CHECK:STDOUT: %b.param_patt: i32 = param_pattern %b.patt, runtime_param1
// CHECK:STDOUT: } {
// CHECK:STDOUT: %int.make_type_32.loc11_11: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %int.make_type_32.loc11_11 [template = i32]
// CHECK:STDOUT: %.loc11_11.2: type = converted %int.make_type_32.loc11_11, %.loc11_11.1 [template = i32]
// CHECK:STDOUT: %a.param: i32 = param a, runtime_param0
// CHECK:STDOUT: %a: i32 = bind_name a, %a.param
// CHECK:STDOUT: %int.make_type_32.loc11_19: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc11_19.1: type = value_of_initializer %int.make_type_32.loc11_19 [template = i32]
// CHECK:STDOUT: %.loc11_19.2: type = converted %int.make_type_32.loc11_19, %.loc11_19.1 [template = i32]
// CHECK:STDOUT: %b.param: i32 = param b, runtime_param1
// CHECK:STDOUT: %b: i32 = bind_name b, %b.param
// CHECK:STDOUT: %param.loc11_8: i32 = param runtime_param0
// CHECK:STDOUT: %a: i32 = bind_name a, %param.loc11_8
// CHECK:STDOUT: %param.loc11_16: i32 = param runtime_param1
// CHECK:STDOUT: %b: i32 = bind_name b, %param.loc11_16
// CHECK:STDOUT: }
// CHECK:STDOUT: %Main.decl: %Main.type = fn_decl @Main [template = constants.%Main] {} {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Foo(%a: i32, %b: i32) {
// CHECK:STDOUT: fn @Foo(%a.param_patt: i32, %b.param_patt: i32) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: return
// CHECK:STDOUT: }