mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 09:34:42 +01:00
Model the return slot as an output parameter (#4432)
Also fix `Param` insts to have meaningful names in pretty-printing, to help clarify relationship with return slot.
This commit is contained in:
@@ -178,8 +178,8 @@ class C {
|
||||
// CHECK:STDOUT: %self.param_patt: %C = param_pattern %self.patt, runtime_param0
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [template = constants.%C]
|
||||
// CHECK:STDOUT: %param: %C = param runtime_param0
|
||||
// CHECK:STDOUT: %self: %C = bind_name self, %param
|
||||
// CHECK:STDOUT: %self.param: %C = param runtime_param0
|
||||
// CHECK:STDOUT: %self: %C = bind_name self, %self.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc14: <witness> = complete_type_witness %.2 [template = constants.%.3]
|
||||
// CHECK:STDOUT:
|
||||
|
||||
Vendored
+29
-13
@@ -115,21 +115,37 @@ fn CallFAndGIncomplete() {
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
|
||||
// CHECK:STDOUT: %D.decl.loc5: type = class_decl @D [template = constants.%D] {} {}
|
||||
// CHECK:STDOUT: %ReturnCUnused.decl: %ReturnCUnused.type = fn_decl @ReturnCUnused [template = constants.%ReturnCUnused] {} {
|
||||
// CHECK:STDOUT: %ReturnCUnused.decl: %ReturnCUnused.type = fn_decl @ReturnCUnused [template = constants.%ReturnCUnused] {
|
||||
// CHECK:STDOUT: %return.patt: %C = return_slot_pattern
|
||||
// CHECK:STDOUT: %return.param_patt: %C = param_pattern %return.patt, runtime_param0
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
|
||||
// CHECK:STDOUT: %return: ref %C = var <return slot>
|
||||
// CHECK:STDOUT: %return.param: %C = param runtime_param0
|
||||
// CHECK:STDOUT: %return: ref %C = return_slot %return.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %ReturnCUsed.decl: %ReturnCUsed.type = fn_decl @ReturnCUsed [template = constants.%ReturnCUsed] {} {
|
||||
// CHECK:STDOUT: %ReturnCUsed.decl: %ReturnCUsed.type = fn_decl @ReturnCUsed [template = constants.%ReturnCUsed] {
|
||||
// CHECK:STDOUT: %return.patt: %C = return_slot_pattern
|
||||
// CHECK:STDOUT: %return.param_patt: %C = param_pattern %return.patt, runtime_param0
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
|
||||
// CHECK:STDOUT: %return: ref %C = var <return slot>
|
||||
// CHECK:STDOUT: %return.param: %C = param runtime_param0
|
||||
// CHECK:STDOUT: %return: ref %C = return_slot %return.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %ReturnDUnused.decl: %ReturnDUnused.type = fn_decl @ReturnDUnused [template = constants.%ReturnDUnused] {} {
|
||||
// CHECK:STDOUT: %ReturnDUnused.decl: %ReturnDUnused.type = fn_decl @ReturnDUnused [template = constants.%ReturnDUnused] {
|
||||
// CHECK:STDOUT: %return.patt: %D = return_slot_pattern
|
||||
// CHECK:STDOUT: %return.param_patt: %D = param_pattern %return.patt, runtime_param0
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl.loc5 [template = constants.%D]
|
||||
// CHECK:STDOUT: %return: ref %D = var <return slot>
|
||||
// CHECK:STDOUT: %return.param: %D = param runtime_param0
|
||||
// CHECK:STDOUT: %return: ref %D = return_slot %return.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %ReturnDUsed.decl: %ReturnDUsed.type = fn_decl @ReturnDUsed [template = constants.%ReturnDUsed] {} {
|
||||
// CHECK:STDOUT: %ReturnDUsed.decl: %ReturnDUsed.type = fn_decl @ReturnDUsed [template = constants.%ReturnDUsed] {
|
||||
// CHECK:STDOUT: %return.patt: %D = return_slot_pattern
|
||||
// CHECK:STDOUT: %return.param_patt: %D = param_pattern %return.patt, runtime_param0
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl.loc5 [template = constants.%D]
|
||||
// CHECK:STDOUT: %return: ref %D = var <return slot>
|
||||
// CHECK:STDOUT: %return.param: %D = param runtime_param0
|
||||
// CHECK:STDOUT: %return: ref %D = return_slot %return.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Call.decl: %Call.type = fn_decl @Call [template = constants.%Call] {} {}
|
||||
// CHECK:STDOUT: %D.decl.loc37: type = class_decl @D [template = constants.%D] {} {}
|
||||
@@ -185,11 +201,11 @@ fn CallFAndGIncomplete() {
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %import_ref.1 = import_ref Main//incomplete_return, inst+1, unloaded
|
||||
// CHECK:STDOUT: %import_ref.2 = import_ref Main//incomplete_return, inst+3, unloaded
|
||||
// CHECK:STDOUT: %import_ref.3: %ReturnCUnused.type = import_ref Main//incomplete_return, inst+7, loaded [template = constants.%ReturnCUnused]
|
||||
// CHECK:STDOUT: %import_ref.4: %ReturnCUsed.type = import_ref Main//incomplete_return, inst+13, loaded [template = constants.%ReturnCUsed]
|
||||
// CHECK:STDOUT: %import_ref.5: %ReturnDUnused.type = import_ref Main//incomplete_return, inst+18, loaded [template = constants.%ReturnDUnused]
|
||||
// CHECK:STDOUT: %import_ref.6: %ReturnDUsed.type = import_ref Main//incomplete_return, inst+23, loaded [template = constants.%ReturnDUsed]
|
||||
// CHECK:STDOUT: %import_ref.7 = import_ref Main//incomplete_return, inst+26, unloaded
|
||||
// CHECK:STDOUT: %import_ref.3: %ReturnCUnused.type = import_ref Main//incomplete_return, inst+10, loaded [template = constants.%ReturnCUnused]
|
||||
// CHECK:STDOUT: %import_ref.4: %ReturnCUsed.type = import_ref Main//incomplete_return, inst+19, loaded [template = constants.%ReturnCUsed]
|
||||
// CHECK:STDOUT: %import_ref.5: %ReturnDUnused.type = import_ref Main//incomplete_return, inst+27, loaded [template = constants.%ReturnDUnused]
|
||||
// CHECK:STDOUT: %import_ref.6: %ReturnDUsed.type = import_ref Main//incomplete_return, inst+35, loaded [template = constants.%ReturnDUsed]
|
||||
// CHECK:STDOUT: %import_ref.7 = import_ref Main//incomplete_return, inst+38, unloaded
|
||||
// CHECK:STDOUT: %import_ref.8 = import_ref Main//incomplete_return, inst+4, unloaded
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
+6
-6
@@ -91,8 +91,8 @@ fn E() {}
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %.loc21_10.1: %.1 = tuple_literal ()
|
||||
// CHECK:STDOUT: %.loc21_10.2: type = converted %.loc21_10.1, constants.%.1 [template = constants.%.1]
|
||||
// CHECK:STDOUT: %param.loc21: %.1 = param runtime_param0
|
||||
// CHECK:STDOUT: %x.loc21: %.1 = bind_name x, %param.loc21
|
||||
// CHECK:STDOUT: %x.param.loc21: %.1 = param runtime_param0
|
||||
// CHECK:STDOUT: %x.loc21: %.1 = bind_name x, %x.param.loc21
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %B.decl.loc29: %B.type = fn_decl @B [template = constants.%B] {
|
||||
// CHECK:STDOUT: %x.patt: %.1 = binding_pattern x
|
||||
@@ -100,8 +100,8 @@ fn E() {}
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %.loc29_10.1: %.1 = tuple_literal ()
|
||||
// CHECK:STDOUT: %.loc29_10.2: type = converted %.loc29_10.1, constants.%.1 [template = constants.%.1]
|
||||
// CHECK:STDOUT: %param.loc29: %.1 = param runtime_param0
|
||||
// CHECK:STDOUT: %x.loc29: %.1 = bind_name x, %param.loc29
|
||||
// CHECK:STDOUT: %x.param.loc29: %.1 = param runtime_param0
|
||||
// CHECK:STDOUT: %x.loc29: %.1 = bind_name x, %x.param.loc29
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %C.decl: %C.type = fn_decl @C [template = constants.%C] {} {}
|
||||
// CHECK:STDOUT: %.decl: %.type = fn_decl @.1 [template = constants.%.2] {
|
||||
@@ -110,8 +110,8 @@ fn E() {}
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %.loc39_10.1: %.1 = tuple_literal ()
|
||||
// CHECK:STDOUT: %.loc39_10.2: type = converted %.loc39_10.1, constants.%.1 [template = constants.%.1]
|
||||
// CHECK:STDOUT: %param: %.1 = param runtime_param0
|
||||
// CHECK:STDOUT: %x: %.1 = bind_name x, %param
|
||||
// CHECK:STDOUT: %x.param: %.1 = param runtime_param0
|
||||
// CHECK:STDOUT: %x: %.1 = bind_name x, %x.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %D.decl.loc41: %D.type = fn_decl @D [template = constants.%D] {} {}
|
||||
// CHECK:STDOUT: %D.decl.loc49: %D.type = fn_decl @D [template = constants.%D] {} {}
|
||||
|
||||
Reference in New Issue
Block a user