mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 19:51:09 +01:00
Initial support for return forms (#6556)
The main changes here are: - Introducing `InitForm` and `RefForm` to represent initializing and reference forms (the two return forms currently supported by the parser). - Introducing the `FormType` singleton inst to represent their type (i.e. `Core.Form`). - Emitting an inst representing a function's declared return form as part of handling the function signature. The return form inst is currently ignored. Subsequent PRs will expose it in `SemIR::Function` and use it to determine the form of call expressions.
This commit is contained in:
@@ -28,6 +28,7 @@ fn F() -> i32 {
|
||||
// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic]
|
||||
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
|
||||
// CHECK:STDOUT: %.941: form = init_form %i32, call_param0 [concrete]
|
||||
// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
|
||||
// CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
|
||||
// CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
|
||||
@@ -109,6 +110,7 @@ fn F() -> i32 {
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %int_32.loc15: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
|
||||
// CHECK:STDOUT: %i32.loc15: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %.loc15: form = init_form %i32.loc15, call_param0 [concrete = constants.%.941]
|
||||
// CHECK:STDOUT: %return.param: ref %i32 = out_param call_param0
|
||||
// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
Reference in New Issue
Block a user