Replace GetCurrentReturnSlot with GetReturnedVarParam (#6571)

Not all functions have a return slot, and once we have composite forms,
functions will be able to have any number of return slots. Obtaining a
unique return slot for a function only makes sense in `returned var`
handling.
This commit is contained in:
Geoff Romer
2026-01-10 01:56:32 +00:00
committed by GitHub
parent 3c70a9f59b
commit 6985ecb1d4
219 changed files with 1097 additions and 1089 deletions
@@ -202,7 +202,7 @@ fn MyF(a: Cpp.X, b: Cpp.X) -> Cpp.X {
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
// CHECK:STDOUT: %bound_method.loc10_13.2: <bound method> = bound_method %.loc10, %specific_fn
// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc10_13.2(%.loc10)
// CHECK:STDOUT: return %Int.as.Copy.impl.Op.call to %return
// CHECK:STDOUT: return %Int.as.Copy.impl.Op.call to %return.param
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: --- extern_c_with_special_name.carbon
@@ -232,9 +232,9 @@ fn MyF(a: Cpp.X, b: Cpp.X) -> Cpp.X {
// CHECK:STDOUT: %addr.loc11_12.1: %ptr.1f9 = addr_of %.loc11_10
// CHECK:STDOUT: %.loc11_14: ref %X = value_as_ref %b.ref
// CHECK:STDOUT: %addr.loc11_12.2: %ptr.1f9 = addr_of %.loc11_14
// CHECK:STDOUT: %addr.loc11_12.3: %ptr.1f9 = addr_of %.loc9_28
// CHECK:STDOUT: %addr.loc11_12.3: %ptr.1f9 = addr_of %.loc9_34.1
// CHECK:STDOUT: %operator+__carbon_thunk.call: init %empty_tuple.type = call imports.%operator+__carbon_thunk.decl(%addr.loc11_12.1, %addr.loc11_12.2, %addr.loc11_12.3)
// CHECK:STDOUT: %.loc11_12: init %X = in_place_init %operator+__carbon_thunk.call, %.loc9_28
// CHECK:STDOUT: return %.loc11_12 to %return
// CHECK:STDOUT: %.loc11_12: init %X = in_place_init %operator+__carbon_thunk.call, %.loc9_34.1
// CHECK:STDOUT: return %.loc11_12 to %return.param
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -400,6 +400,6 @@ fn G() -> i32 {
// CHECK:STDOUT: %.loc14_20.1: %i32 = value_of_initializer %Core.IntLiteral.as.As.impl.Convert.call [concrete = constants.%int_1.5d2]
// CHECK:STDOUT: %.loc14_20.2: %i32 = converted %int_1, %.loc14_20.1 [concrete = constants.%int_1.5d2]
// CHECK:STDOUT: %bar.call: init %i32 = call imports.%bar.decl(%.loc14_20.2)
// CHECK:STDOUT: return %bar.call to %return
// CHECK:STDOUT: return %bar.call to %return.param
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -3070,7 +3070,7 @@ fn F() {
// CHECK:STDOUT: %.loc14_14: ref %B = value_as_ref %x.ref.loc14_14
// CHECK:STDOUT: %addr.loc14_12.2: %ptr.a04 = addr_of %.loc14_14
// CHECK:STDOUT: %operator+__carbon_thunk.call: init %i32 = call imports.%operator+__carbon_thunk.decl(%addr.loc14_12.1, %addr.loc14_12.2)
// CHECK:STDOUT: return %operator+__carbon_thunk.call to %return
// CHECK:STDOUT: return %operator+__carbon_thunk.call to %return.param
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: --- import_overloading.carbon