Form-aware textual format for return parameters and arguments (#6588)

The key changes are:
- Function output parameters are now prefixed with `out`, and more
consistently formatted as named parameters.
- Function and inst output arguments are now written as part of the inst
form, rather than as one of the inst arguments.

As a drive-by fix, this also changes `Temporary::storage_id` from
`DestInstId` to `InstId`, because it doesn't represent an output
parameter of the `Temporary` inst itself.

See the review of
[#6532](https://github.com/carbon-language/carbon-lang/pull/6532) and
[this Discord
discussion](https://discord.com/channels/655572317891461132/999638000126394370/1458268977020141589)
for additional background.
This commit is contained in:
Geoff Romer
2026-01-14 23:27:21 +00:00
committed by GitHub
parent 9861c31476
commit 4329a83e4c
353 changed files with 1779 additions and 1721 deletions
+3 -3
View File
@@ -135,7 +135,7 @@ fn F(b: bool, n: i32, m: i32) -> i32 {
// CHECK:STDOUT: }
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F(%b.param: bool, %n.param: %i32, %m.param: %i32) -> %i32 {
// CHECK:STDOUT: fn @F(%b.param: bool, %n.param: %i32, %m.param: %i32) -> out %return.param: %i32 {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %x.patt: %pattern_type.a98 = ref_binding_pattern x [concrete]
@@ -152,8 +152,8 @@ fn F(b: bool, n: i32, m: i32) -> i32 {
// CHECK:STDOUT: %.loc16_29.2: init %i32 = converted %int_0.loc16_27, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_0.6a9]
// CHECK:STDOUT: %int_0.loc16_29: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
// CHECK:STDOUT: %.loc16_29.3: ref %i32 = array_index %x.var, %int_0.loc16_29
// CHECK:STDOUT: %.loc16_29.4: init %i32 = initialize_from %.loc16_29.2 to %.loc16_29.3 [concrete = constants.%int_0.6a9]
// CHECK:STDOUT: %.loc16_29.5: init %array_type = array_init (%.loc16_29.4) to %x.var [concrete = constants.%array]
// CHECK:STDOUT: %.loc16_29.4: init %i32 to %.loc16_29.3 = initialize_from %.loc16_29.2 [concrete = constants.%int_0.6a9]
// CHECK:STDOUT: %.loc16_29.5: init %array_type to %x.var = array_init (%.loc16_29.4) [concrete = constants.%array]
// CHECK:STDOUT: %.loc16_3: init %array_type = converted %.loc16_29.1, %.loc16_29.5 [concrete = constants.%array]
// CHECK:STDOUT: assign %x.var, %.loc16_3
// CHECK:STDOUT: %.loc16_22: type = splice_block %array_type [concrete = constants.%array_type] {