File: keypath_accessor.sil

package info (click to toggle)
swiftlang 6.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,791,532 kB
  • sloc: cpp: 9,901,743; ansic: 2,201,431; asm: 1,091,827; python: 308,252; objc: 82,166; f90: 80,126; lisp: 38,358; pascal: 25,559; sh: 20,429; ml: 5,058; perl: 4,745; makefile: 4,484; awk: 3,535; javascript: 3,018; xml: 918; fortran: 664; cs: 573; ruby: 396
file content (59 lines) | stat: -rw-r--r-- 2,297 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s -DINT=i%target-ptrsize

sil_stage canonical
import Swift

public struct Blah {
  public subscript<T>(x: T) -> Int { get set }
  public subscript<T>(x: T, y: T) -> Int { get set }
  public subscript<T, U>(x: T, y: U) -> Int { get set }
}

// CHECK: define{{.*}} swiftcc void @"$simple_getter"(
// CHECK-SAME: ptr{{.*}} sret(%TSi) %0,
// CHECK-SAME: ptr{{.*}} %1,
// CHECK-SAME: ptr{{.*}} %2, [[INT]] %3)
sil @$simple_getter : $@convention(keypath_accessor_getter) (@in_guaranteed Blah) -> @out Int {
bb0(%0 : $*Int, %1 : $*Blah):
  unreachable
}

// CHECK: define{{.*}} swiftcc void @"$generic_indices_getter"(
// CHECK-SAME: ptr{{.*}} {{.*}} %0,
// CHECK-SAME: ptr{{.*}} %1,
// %2 = the key path component buffer pointer and %3 is the size
// CHECK-SAME: ptr{{.*}} %2, [[INT]] %3)
sil @$generic_indices_getter : $@convention(keypath_accessor_getter) <T where T : Hashable> (@in_guaranteed Blah, @in_guaranteed (_: T)) -> @out Int {
bb0(%0 : $*Int, %1 : $*Blah, %2 : $*(_: T)):
  unreachable
}



// CHECK: define{{.*}} swiftcc void @"$generic_indices_setter"(
// CHECK-SAME: ptr{{.*}} %0,
// CHECK-SAME: ptr{{.*}} %1,
// %2 = the key path component buffer pointer and %3 is the size
// CHECK-SAME: ptr{{.*}} %2, [[INT]] %3)
sil @$generic_indices_setter : $@convention(keypath_accessor_setter) <T where T : Hashable> (@in_guaranteed Int, @inout Blah, @in_guaranteed (_: T)) -> () {
bb0(%0 : $*Int, %1 : $*Blah, %2 : $*(_: T)):
  unreachable
}

// CHECK: define{{.*}} swiftcc [[INT]] @"$generic_indices_hash"(
// %0 = the key path component buffer pointer and %1 is the size
// CHECK-SAME: ptr{{.*}} %0, [[INT]] %1)
sil @$generic_indices_hash : $@convention(keypath_accessor_hash) <T where T : Hashable> (@in_guaranteed (_: T)) -> Int {
bb0(%0 : $*(_: T)):
  unreachable
}

// CHECK: define{{.*}} swiftcc i1 @"$generic_indices_equals"(
// %0 = LHS of key path component buffer pointer
// %1 = RHS of key path component buffer pointer
// %2 = the size of the key path component buffers
// CHECK-SAME: ptr{{.*}} %0, ptr{{.*}} %1, [[INT]] %2)
sil @$generic_indices_equals : $@convention(keypath_accessor_equals) <T where T : Hashable> (@in_guaranteed (_: T), @in_guaranteed (_: T)) -> Bool {
bb0(%0 : $*(_: T), %1 : $*(_: T)):
  unreachable
}