mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Provide the callee expression to the Call node. (#3291)
Track the callee expression in full, instead of only tracking the callee's FunctionId. This results in the `name_reference` denoting the function actually being used. Lowering now propagates a `llvm::Function*` as the value associated with expressions of type `<function>`. We were not creating `NameReference` node for names produced by member access into a namespace, such as the second name in `Namespace.Function`, which caused lowering of calls to such names to fail. This is now fixed, but the resulting `NameReference` node only refers to the name and the lookup result, not to the `Namespace.` qualifier. We'll need to decide how to fit a third operand into that node (perhaps we can stop storing the `name_id`, since it can be derived from the lookup result) but for now the qualifier is not tracked.
This commit is contained in:
+2
-2
@@ -28,13 +28,13 @@ fn G() {
|
||||
// CHECK:STDOUT: %.loc10_42.1: i32 = int_literal 0
|
||||
// CHECK:STDOUT: %.loc10_42.2: ref (i32, i32, i32) = array_index %v, %.loc10_42.1
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc10_35: init (i32, i32, i32) = call @F() to %.loc10_42.3
|
||||
// CHECK:STDOUT: %.loc10_35: init (i32, i32, i32) = call %F.ref.loc10_34() to %.loc10_42.3
|
||||
// CHECK:STDOUT: %F.ref.loc10_39: <function> = name_reference "F", package.%F
|
||||
// CHECK:STDOUT: %.loc10_42.6: ref (i32, i32, i32) = splice_block %.loc10_42.5 {
|
||||
// CHECK:STDOUT: %.loc10_42.4: i32 = int_literal 1
|
||||
// CHECK:STDOUT: %.loc10_42.5: ref (i32, i32, i32) = array_index %v, %.loc10_42.4
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc10_40: init (i32, i32, i32) = call @F() to %.loc10_42.6
|
||||
// CHECK:STDOUT: %.loc10_40: init (i32, i32, i32) = call %F.ref.loc10_39() to %.loc10_42.6
|
||||
// CHECK:STDOUT: %.loc10_42.7: type = tuple_type ((i32, i32, i32), (i32, i32, i32))
|
||||
// CHECK:STDOUT: %.loc10_42.8: ((i32, i32, i32), (i32, i32, i32)) = tuple_literal (%.loc10_35, %.loc10_40)
|
||||
// CHECK:STDOUT: %.loc10_42.9: init [(i32, i32, i32); 2] = array_init %.loc10_42.8, (%.loc10_35, %.loc10_40) to %v
|
||||
|
||||
@@ -29,7 +29,7 @@ fn Run() {
|
||||
// CHECK:STDOUT: %.loc10_17: type = array_type %.loc10_16, i32
|
||||
// CHECK:STDOUT: %t: ref [i32; 1] = var "t"
|
||||
// CHECK:STDOUT: %F.ref: <function> = name_reference "F", package.%F
|
||||
// CHECK:STDOUT: %.loc10_22.1: init (i32,) = call @F()
|
||||
// CHECK:STDOUT: %.loc10_22.1: init (i32,) = call %F.ref()
|
||||
// CHECK:STDOUT: %.loc10_22.2: ref (i32,) = temporary_storage
|
||||
// CHECK:STDOUT: %.loc10_22.3: ref (i32,) = temporary %.loc10_22.2, %.loc10_22.1
|
||||
// CHECK:STDOUT: %.loc10_22.4: ref i32 = tuple_access %.loc10_22.3, member0
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ fn G() -> i32 {
|
||||
// CHECK:STDOUT: %.loc12_20.13: init [i32; 3] = array_init %.loc12_20.2, (%.loc12_20.6, %.loc12_20.9, %.loc12_20.12) to %.loc12_20.3
|
||||
// CHECK:STDOUT: %.loc12_20.14: ref [i32; 3] = temporary %.loc12_20.3, %.loc12_20.13
|
||||
// CHECK:STDOUT: %.loc12_20.15: [i32; 3] = bind_value %.loc12_20.14
|
||||
// CHECK:STDOUT: %.loc12_11.1: init i32 = call @F(%.loc12_20.15, %.loc12_23)
|
||||
// CHECK:STDOUT: %.loc12_11.1: init i32 = call %F.ref(%.loc12_20.15, %.loc12_23)
|
||||
// CHECK:STDOUT: %.loc12_11.2: ref i32 = temporary_storage
|
||||
// CHECK:STDOUT: %.loc12_11.3: ref i32 = temporary %.loc12_11.2, %.loc12_11.1
|
||||
// CHECK:STDOUT: %.loc12_11.4: i32 = bind_value %.loc12_11.3
|
||||
|
||||
Reference in New Issue
Block a user