mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Initial support for binding patterns in SemIR (#4221)
Introduces the `BindingPattern` and `SymbolicBindingPattern` insts, and a separate stack of pattern blocks that they are emitted into. The intent is to generate the corresponding pattern-matching insts (like `BindName`) from them in a separate pass, but that is deferred to future PRs. See [here](https://docs.google.com/document/d/1U_vQH17V893J9aF1LJXUnFYBNSs2MjKl4bJPaWCB2zo/edit?usp=sharing&resourcekey=0-w0xGYZ0An31Kpz-wvzSXwQ) for the design this is based on, but note that during review we have chosen to deviate from that design by putting the patterns in separate blocks, and omitting the "forward references" from a `BindingPattern` to its corresponding `BindName`. This in turn necessitates having separate inst kinds for symbolic and non-symbolic binding patterns. --------- Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
co-authored by
Jon Ross-Perkins
parent
87678cc374
commit
dc32aa2690
@@ -46,11 +46,11 @@ fn F() -> i32 {
|
||||
// CHECK:STDOUT: .F = %F.decl
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.import = import Core
|
||||
// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
|
||||
// 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: @F.%return: ref i32 = var <return slot>
|
||||
// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {
|
||||
// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%Int32() [template = i32]
|
||||
// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32]
|
||||
// CHECK:STDOUT: %.loc11_11.2: type = converted %int.make_type_32.loc11, %.loc11_11.1 [template = i32]
|
||||
// CHECK:STDOUT: %return: ref i32 = var <return slot>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -58,9 +58,9 @@ fn F() -> i32 {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @F() -> i32 {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
|
||||
// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32 [template = i32]
|
||||
// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32, %.loc12_10.1 [template = i32]
|
||||
// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%Int32() [template = i32]
|
||||
// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32]
|
||||
// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32.loc12, %.loc12_10.1 [template = i32]
|
||||
// CHECK:STDOUT: %n.var: ref i32 = var n
|
||||
// CHECK:STDOUT: %n: ref i32 = bind_name n, %n.var
|
||||
// CHECK:STDOUT: %.loc12_16: i32 = int_literal 0 [template = constants.%.2]
|
||||
|
||||
@@ -62,7 +62,7 @@ fn F() {
|
||||
// CHECK:STDOUT: .F = %F.decl
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.import = import Core
|
||||
// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {}
|
||||
// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @F() {
|
||||
|
||||
+11
-7
@@ -59,20 +59,24 @@ fn Foo(ptr: C*) {
|
||||
// CHECK:STDOUT: .Foo = %Foo.decl
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.import = import Core
|
||||
// CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {}
|
||||
// CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
|
||||
// CHECK:STDOUT: %Foo.decl: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
|
||||
// CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C]
|
||||
// CHECK:STDOUT: %ptr.patt: %.2 = binding_pattern ptr
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
|
||||
// CHECK:STDOUT: %.loc16: type = ptr_type %C [template = constants.%.2]
|
||||
// CHECK:STDOUT: %ptr.loc16_8.1: %.2 = param ptr, runtime_param0
|
||||
// CHECK:STDOUT: @Foo.%ptr: %.2 = bind_name ptr, %ptr.loc16_8.1
|
||||
// CHECK:STDOUT: %ptr.param: %.2 = param ptr, runtime_param0
|
||||
// CHECK:STDOUT: %ptr: %.2 = bind_name ptr, %ptr.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: class @C {
|
||||
// CHECK:STDOUT: %Member.decl: %Member.type = fn_decl @Member [template = constants.%Member] {
|
||||
// CHECK:STDOUT: %self.patt: %C = binding_pattern self
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [template = constants.%C]
|
||||
// CHECK:STDOUT: %self.loc12_13.1: %C = param self, runtime_param0
|
||||
// CHECK:STDOUT: %self.loc12_13.2: %C = bind_name self, %self.loc12_13.1
|
||||
// CHECK:STDOUT: %self.param: %C = param self, runtime_param0
|
||||
// CHECK:STDOUT: %self: %C = bind_name self, %self.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
|
||||
// CHECK:STDOUT: %.loc13_15: type = ptr_type %C [template = constants.%.2]
|
||||
@@ -85,7 +89,7 @@ fn Foo(ptr: C*) {
|
||||
// CHECK:STDOUT: .field = %.loc13_12
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Member[@C.%self.loc12_13.2: %C]();
|
||||
// CHECK:STDOUT: fn @Member[%self: %C]();
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Foo(%ptr: %.2) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
|
||||
+5
-5
@@ -48,11 +48,11 @@ fn F() -> i32 {
|
||||
// CHECK:STDOUT: .F = %F.decl
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.import = import Core
|
||||
// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
|
||||
// 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: @F.%return: ref i32 = var <return slot>
|
||||
// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {
|
||||
// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%Int32() [template = i32]
|
||||
// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32]
|
||||
// CHECK:STDOUT: %.loc11_11.2: type = converted %int.make_type_32.loc11, %.loc11_11.1 [template = i32]
|
||||
// CHECK:STDOUT: %return: ref i32 = var <return slot>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
@@ -51,7 +51,7 @@ fn Test() {
|
||||
// CHECK:STDOUT: .Test = %Test.decl
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.import = import Core
|
||||
// CHECK:STDOUT: %Test.decl: %Test.type = fn_decl @Test [template = constants.%Test] {}
|
||||
// CHECK:STDOUT: %Test.decl: %Test.type = fn_decl @Test [template = constants.%Test] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Test() {
|
||||
|
||||
+22
-20
@@ -171,30 +171,32 @@ fn AddressOfParam(param: i32) {
|
||||
// CHECK:STDOUT: .AddressOfParam = %AddressOfParam.decl
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.import = import Core
|
||||
// CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
|
||||
// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%Int32() [template = i32]
|
||||
// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32]
|
||||
// CHECK:STDOUT: %.loc11_11.2: type = converted %int.make_type_32.loc11, %.loc11_11.1 [template = i32]
|
||||
// CHECK:STDOUT: @G.%return: ref i32 = var <return slot>
|
||||
// CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {} {
|
||||
// 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: %return: ref i32 = var <return slot>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %H.decl: %H.type = fn_decl @H [template = constants.%H] {
|
||||
// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%Int32() [template = i32]
|
||||
// CHECK:STDOUT: %.loc13_16.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32]
|
||||
// CHECK:STDOUT: %.loc13_16.2: type = converted %int.make_type_32.loc13, %.loc13_16.1 [template = i32]
|
||||
// CHECK:STDOUT: %H.decl: %H.type = fn_decl @H [template = constants.%H] {} {
|
||||
// CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
|
||||
// CHECK:STDOUT: %.loc13_16.1: type = value_of_initializer %int.make_type_32 [template = i32]
|
||||
// CHECK:STDOUT: %.loc13_16.2: type = converted %int.make_type_32, %.loc13_16.1 [template = i32]
|
||||
// CHECK:STDOUT: %.loc13_19: type = struct_type {.a: i32} [template = constants.%.2]
|
||||
// CHECK:STDOUT: @H.%return: ref %.2 = var <return slot>
|
||||
// CHECK:STDOUT: %return: ref %.2 = var <return slot>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %AddressOfLiteral.decl: %AddressOfLiteral.type = fn_decl @AddressOfLiteral [template = constants.%AddressOfLiteral] {}
|
||||
// CHECK:STDOUT: %AddressOfOperator.decl: %AddressOfOperator.type = fn_decl @AddressOfOperator [template = constants.%AddressOfOperator] {}
|
||||
// CHECK:STDOUT: %AddressOfCall.decl: %AddressOfCall.type = fn_decl @AddressOfCall [template = constants.%AddressOfCall] {}
|
||||
// CHECK:STDOUT: %AddressOfType.decl: %AddressOfType.type = fn_decl @AddressOfType [template = constants.%AddressOfType] {}
|
||||
// CHECK:STDOUT: %AddressOfTupleElementValue.decl: %AddressOfTupleElementValue.type = fn_decl @AddressOfTupleElementValue [template = constants.%AddressOfTupleElementValue] {}
|
||||
// CHECK:STDOUT: %AddressOfLiteral.decl: %AddressOfLiteral.type = fn_decl @AddressOfLiteral [template = constants.%AddressOfLiteral] {} {}
|
||||
// CHECK:STDOUT: %AddressOfOperator.decl: %AddressOfOperator.type = fn_decl @AddressOfOperator [template = constants.%AddressOfOperator] {} {}
|
||||
// CHECK:STDOUT: %AddressOfCall.decl: %AddressOfCall.type = fn_decl @AddressOfCall [template = constants.%AddressOfCall] {} {}
|
||||
// CHECK:STDOUT: %AddressOfType.decl: %AddressOfType.type = fn_decl @AddressOfType [template = constants.%AddressOfType] {} {}
|
||||
// CHECK:STDOUT: %AddressOfTupleElementValue.decl: %AddressOfTupleElementValue.type = fn_decl @AddressOfTupleElementValue [template = constants.%AddressOfTupleElementValue] {} {}
|
||||
// CHECK:STDOUT: %AddressOfParam.decl: %AddressOfParam.type = fn_decl @AddressOfParam [template = constants.%AddressOfParam] {
|
||||
// CHECK:STDOUT: %param.patt: i32 = binding_pattern param
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %int.make_type_32.loc95: init type = call constants.%Int32() [template = i32]
|
||||
// CHECK:STDOUT: %.loc95_26.1: type = value_of_initializer %int.make_type_32.loc95 [template = i32]
|
||||
// CHECK:STDOUT: %.loc95_26.2: type = converted %int.make_type_32.loc95, %.loc95_26.1 [template = i32]
|
||||
// CHECK:STDOUT: %param.loc95_19.1: i32 = param param, runtime_param0
|
||||
// CHECK:STDOUT: @AddressOfParam.%param: i32 = bind_name param, %param.loc95_19.1
|
||||
// CHECK:STDOUT: %param.param: i32 = param param, runtime_param0
|
||||
// CHECK:STDOUT: %param: i32 = bind_name param, %param.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -285,9 +287,9 @@ fn AddressOfParam(param: i32) {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @AddressOfParam(%param: i32) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
|
||||
// CHECK:STDOUT: %.loc99_22.1: type = value_of_initializer %int.make_type_32 [template = i32]
|
||||
// CHECK:STDOUT: %.loc99_22.2: type = converted %int.make_type_32, %.loc99_22.1 [template = i32]
|
||||
// CHECK:STDOUT: %int.make_type_32.loc99: init type = call constants.%Int32() [template = i32]
|
||||
// CHECK:STDOUT: %.loc99_22.1: type = value_of_initializer %int.make_type_32.loc99 [template = i32]
|
||||
// CHECK:STDOUT: %.loc99_22.2: type = converted %int.make_type_32.loc99, %.loc99_22.1 [template = i32]
|
||||
// CHECK:STDOUT: %.loc99_22.3: type = ptr_type i32 [template = constants.%.4]
|
||||
// CHECK:STDOUT: %param_addr.var: ref %.4 = var param_addr
|
||||
// CHECK:STDOUT: %param_addr: ref %.4 = bind_name param_addr, %param_addr.var
|
||||
|
||||
@@ -47,7 +47,7 @@ fn A() {
|
||||
// CHECK:STDOUT: .A = %A.decl
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.import = import Core
|
||||
// CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [template = constants.%A] {}
|
||||
// CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [template = constants.%A] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @A() {
|
||||
|
||||
@@ -51,7 +51,7 @@ fn F() {
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.import = import Core
|
||||
// CHECK:STDOUT: %A: <namespace> = namespace [template] {}
|
||||
// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {}
|
||||
// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @F() {
|
||||
|
||||
@@ -75,11 +75,13 @@ fn Deref(n: i32) {
|
||||
// CHECK:STDOUT: }
|
||||
// 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: } {
|
||||
// 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.loc11_10.1: i32 = param n, runtime_param0
|
||||
// CHECK:STDOUT: @Deref.%n: i32 = bind_name n, %n.loc11_10.1
|
||||
// CHECK:STDOUT: %n.param: i32 = param n, runtime_param0
|
||||
// CHECK:STDOUT: %n: i32 = bind_name n, %n.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
+11
-9
@@ -59,12 +59,12 @@ fn ConstMismatch(p: const {}*) -> const ({}*) {
|
||||
// CHECK:STDOUT: import Core//prelude/operators/comparison
|
||||
// CHECK:STDOUT: import Core//prelude/types/bool
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %import_ref.1: %ImplicitAs.type = import_ref Core//prelude/operators/as, inst+37, loaded [template = constants.%ImplicitAs]
|
||||
// CHECK:STDOUT: %import_ref.2 = import_ref Core//prelude/operators/as, inst+42, unloaded
|
||||
// CHECK:STDOUT: %import_ref.3: @ImplicitAs.%.2 (%.8) = import_ref Core//prelude/operators/as, inst+59, loaded [symbolic = @ImplicitAs.%.3 (constants.%.13)]
|
||||
// CHECK:STDOUT: %import_ref.4 = import_ref Core//prelude/operators/as, inst+52, unloaded
|
||||
// CHECK:STDOUT: %import_ref.5 = import_ref Core//prelude/operators/as, inst+52, unloaded
|
||||
// CHECK:STDOUT: %import_ref.6 = import_ref Core//prelude/operators/as, inst+52, unloaded
|
||||
// CHECK:STDOUT: %import_ref.1: %ImplicitAs.type = import_ref Core//prelude/operators/as, inst+40, loaded [template = constants.%ImplicitAs]
|
||||
// CHECK:STDOUT: %import_ref.2 = import_ref Core//prelude/operators/as, inst+45, unloaded
|
||||
// CHECK:STDOUT: %import_ref.3: @ImplicitAs.%.2 (%.8) = import_ref Core//prelude/operators/as, inst+63, loaded [symbolic = @ImplicitAs.%.3 (constants.%.13)]
|
||||
// CHECK:STDOUT: %import_ref.4 = import_ref Core//prelude/operators/as, inst+56, unloaded
|
||||
// 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: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
@@ -74,17 +74,19 @@ fn ConstMismatch(p: const {}*) -> const ({}*) {
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.import = import Core
|
||||
// CHECK:STDOUT: %ConstMismatch.decl: %ConstMismatch.type = fn_decl @ConstMismatch [template = constants.%ConstMismatch] {
|
||||
// CHECK:STDOUT: %p.patt: %.3 = binding_pattern p
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %.loc11_28: %.1 = struct_literal ()
|
||||
// CHECK:STDOUT: %.loc11_21.1: type = converted %.loc11_28, constants.%.1 [template = constants.%.1]
|
||||
// CHECK:STDOUT: %.loc11_21.2: type = const_type %.1 [template = constants.%.2]
|
||||
// CHECK:STDOUT: %.loc11_29: type = ptr_type %.2 [template = constants.%.3]
|
||||
// CHECK:STDOUT: %p.loc11_18.1: %.3 = param p, runtime_param0
|
||||
// CHECK:STDOUT: @ConstMismatch.%p: %.3 = bind_name p, %p.loc11_18.1
|
||||
// CHECK:STDOUT: %p.param: %.3 = param p, runtime_param0
|
||||
// CHECK:STDOUT: %p: %.3 = bind_name p, %p.param
|
||||
// CHECK:STDOUT: %.loc11_43: %.1 = struct_literal ()
|
||||
// CHECK:STDOUT: %.loc11_44.1: type = converted %.loc11_43, constants.%.1 [template = constants.%.1]
|
||||
// CHECK:STDOUT: %.loc11_44.2: type = ptr_type %.1 [template = constants.%.4]
|
||||
// CHECK:STDOUT: %.loc11_35: type = const_type %.4 [template = constants.%.5]
|
||||
// CHECK:STDOUT: @ConstMismatch.%return: ref %.5 = var <return slot>
|
||||
// CHECK:STDOUT: %return: ref %.5 = var <return slot>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
+5
-3
@@ -50,6 +50,8 @@ fn F(p: const (const (const i32*)*)) -> const i32 {
|
||||
// CHECK:STDOUT: }
|
||||
// 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: } {
|
||||
// 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]
|
||||
// CHECK:STDOUT: %.loc12_23.2: type = converted %int.make_type_32.loc12_29, %.loc12_23.1 [template = i32]
|
||||
@@ -58,13 +60,13 @@ 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.loc12_6.1: %.6 = param p, runtime_param0
|
||||
// CHECK:STDOUT: @F.%p: %.6 = bind_name p, %p.loc12_6.1
|
||||
// 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: @F.%return: ref %.2 = var <return slot>
|
||||
// CHECK:STDOUT: %return: ref %.2 = var <return slot>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
+10
-6
@@ -54,32 +54,36 @@ fn ConstPtr(p: const i32*) -> (const i32)* {
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.import = import Core
|
||||
// CHECK:STDOUT: %Ptr.decl: %Ptr.type = fn_decl @Ptr [template = constants.%Ptr] {
|
||||
// CHECK:STDOUT: %p.patt: %.2 = binding_pattern p
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %int.make_type_32.loc11_11: init type = call constants.%Int32() [template = i32]
|
||||
// CHECK:STDOUT: %.loc11_14.1: type = value_of_initializer %int.make_type_32.loc11_11 [template = i32]
|
||||
// CHECK:STDOUT: %.loc11_14.2: type = converted %int.make_type_32.loc11_11, %.loc11_14.1 [template = i32]
|
||||
// CHECK:STDOUT: %.loc11_14.3: type = ptr_type i32 [template = constants.%.2]
|
||||
// CHECK:STDOUT: %p.loc11_8.1: %.2 = param p, runtime_param0
|
||||
// CHECK:STDOUT: @Ptr.%p: %.2 = bind_name p, %p.loc11_8.1
|
||||
// CHECK:STDOUT: %p.param: %.2 = param p, runtime_param0
|
||||
// CHECK:STDOUT: %p: %.2 = bind_name p, %p.param
|
||||
// CHECK:STDOUT: %int.make_type_32.loc11_20: init type = call constants.%Int32() [template = i32]
|
||||
// CHECK:STDOUT: %.loc11_23.1: type = value_of_initializer %int.make_type_32.loc11_20 [template = i32]
|
||||
// CHECK:STDOUT: %.loc11_23.2: type = converted %int.make_type_32.loc11_20, %.loc11_23.1 [template = i32]
|
||||
// CHECK:STDOUT: %.loc11_23.3: type = ptr_type i32 [template = constants.%.2]
|
||||
// CHECK:STDOUT: @Ptr.%return: ref %.2 = var <return slot>
|
||||
// CHECK:STDOUT: %return: ref %.2 = var <return slot>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %ConstPtr.decl: %ConstPtr.type = fn_decl @ConstPtr [template = constants.%ConstPtr] {
|
||||
// CHECK:STDOUT: %p.patt: %.4 = binding_pattern p
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %int.make_type_32.loc15_22: init type = call constants.%Int32() [template = i32]
|
||||
// CHECK:STDOUT: %.loc15_16.1: type = value_of_initializer %int.make_type_32.loc15_22 [template = i32]
|
||||
// CHECK:STDOUT: %.loc15_16.2: type = converted %int.make_type_32.loc15_22, %.loc15_16.1 [template = i32]
|
||||
// CHECK:STDOUT: %.loc15_16.3: type = const_type i32 [template = constants.%.3]
|
||||
// CHECK:STDOUT: %.loc15_25: type = ptr_type %.3 [template = constants.%.4]
|
||||
// CHECK:STDOUT: %p.loc15_13.1: %.4 = param p, runtime_param0
|
||||
// CHECK:STDOUT: @ConstPtr.%p: %.4 = bind_name p, %p.loc15_13.1
|
||||
// CHECK:STDOUT: %p.param: %.4 = param p, runtime_param0
|
||||
// CHECK:STDOUT: %p: %.4 = bind_name p, %p.param
|
||||
// CHECK:STDOUT: %int.make_type_32.loc15_38: init type = call constants.%Int32() [template = i32]
|
||||
// CHECK:STDOUT: %.loc15_32.1: type = value_of_initializer %int.make_type_32.loc15_38 [template = i32]
|
||||
// CHECK:STDOUT: %.loc15_32.2: type = converted %int.make_type_32.loc15_38, %.loc15_32.1 [template = i32]
|
||||
// CHECK:STDOUT: %.loc15_32.3: type = const_type i32 [template = constants.%.3]
|
||||
// CHECK:STDOUT: %.loc15_42: type = ptr_type %.3 [template = constants.%.4]
|
||||
// CHECK:STDOUT: @ConstPtr.%return: ref %.4 = var <return slot>
|
||||
// CHECK:STDOUT: %return: ref %.4 = var <return slot>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
Reference in New Issue
Block a user