File: function_uses.sil

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (220 lines) | stat: -rw-r--r-- 5,909 bytes parent folder | download
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
// RUN: %target-sil-opt -wmo -dump-function-uses %s -o /dev/null | %FileCheck %s

// REQUIRES: swift_in_compiler

sil_stage canonical

import Builtin
import Swift
import SwiftShims

// CHECK-LABEL: Uses of public_func
// CHECK-NEXT:  [
// CHECK-NEXT:  <unknown uses>
// CHECK-NEXT:  @other_public_func:
// CHECK-NEXT:    %0 = function_ref @public_func
// CHECK-NEXT:  @internal_func:
// CHECK-NEXT:    %1 = function_ref @public_func
// CHECK-NEXT:  @internal_func:
// CHECK-NEXT:    %0 = function_ref @public_func
// CHECK-NEXT:  ]
// CHECK-NEXT:  End function public_func
sil @public_func : $@convention(thin) () -> ()

// CHECK-LABEL: Uses of internal_func
// CHECK-NEXT:  [
// CHECK-NEXT:  @other_public_func:
// CHECK-NEXT:    %1 = dynamic_function_ref @internal_func
// CHECK-NEXT:  ]
// CHECK-NEXT:  End function internal_func
sil hidden [dynamically_replacable] @internal_func : $@convention(thin) () -> () {
bb0:
  %0 = function_ref @public_func : $@convention(thin) () -> ()
  %1 = function_ref @public_func : $@convention(thin) () -> ()
  %7 = tuple ()
  return %7 : $()
}

// CHECK-LABEL: Uses of other_public_func
// CHECK-NEXT:  [
// CHECK-NEXT:  <unknown uses>
// CHECK-NEXT:  ]
// CHECK-NEXT:  End function other_public_func
sil @other_public_func : $@convention(thin) () -> () {
bb0:
  %0 = function_ref @public_func : $@convention(thin) () -> ()
  %1 = dynamic_function_ref @internal_func : $@convention(thin) () -> ()
  %7 = tuple ()
  return %7 : $()
}

struct S: Hashable {
  var x: Int
  let y: String
  var z: C

  func hash(into hasher: inout Hasher)
  static func ==(x: S, y: S) -> Bool
}

class C: Hashable {
  final var x: Int
  final let y: String
  final var z: S

  init()
  var overridable: Int {
    get set
  }

  func hash(into hasher: inout Hasher)
  static func ==(x: C, y: C) -> Bool
}

// CHECK-LABEL: Uses of id_a
// CHECK-NEXT:  [
// CHECK-NEXT:  @test_keypath: %2 = keypath {{.*}}
// CHECK-NEXT:  ]
// CHECK-NEXT:  End function id_a
sil hidden @id_a : $@convention(thin) () -> () {
bb0:
  unreachable
}

// CHECK-LABEL: Uses of get_s_int_subs
// CHECK-NEXT:  [
// CHECK-NEXT:  @test_keypath: %2 = keypath {{.*}}
// CHECK-NEXT:  ]
// CHECK-NEXT:  End function get_s_int_subs
sil hidden @get_s_int_subs : $@convention(keypath_accessor_getter) (@in_guaranteed S, @in_guaranteed (S, C)) -> @out Int {
bb0(%0 : $*Int, %1 : $*S, %2 : $*(S, C)):
  unreachable
}

// CHECK-LABEL: Uses of set_s_int_subs
// CHECK-NEXT:  [
// CHECK-NEXT:  @test_keypath: %2 = keypath {{.*}}
// CHECK-NEXT:  ]
// CHECK-NEXT:  End function set_s_int_subs

sil hidden @set_s_int_subs : $@convention(keypath_accessor_setter) (@in_guaranteed Int, @in_guaranteed S, @in_guaranteed (S, C)) -> () {
bb0(%0 : $*Int, %1 : $*S, %2 : $*(S, C)):
  unreachable
}

// CHECK-LABEL: Uses of subs_eq
// CHECK-NEXT:  [
// CHECK-NEXT:  @test_keypath: %2 = keypath {{.*}}
// CHECK-NEXT:  ]
// CHECK-NEXT:  End function subs_eq
sil hidden @subs_eq : $@convention(keypath_accessor_equals) (@in_guaranteed (S, C), @in_guaranteed (S, C)) -> Bool {
bb0(%0 : $*(S, C), %1 : $*(S, C)):
  unreachable
}

// CHECK-LABEL: Uses of subs_hash
// CHECK-NEXT:  [
// CHECK-NEXT:  @test_keypath: %2 = keypath {{.*}}
// CHECK-NEXT:  ]
// CHECK-NEXT:  End function subs_hash
sil hidden @subs_hash : $@convention(keypath_accessor_hash) (@in_guaranteed (S, C)) -> Int {
bb0(%0 : $*(S, C)):
  unreachable
}

// CHECK-LABEL: Uses of test_keypath
// CHECK-NEXT:  [
// CHECK-NEXT:  <unknown uses>
// CHECK-NEXT:  ]
// CHECK-NEXT:  End function test_keypath
sil @test_keypath : $@convention(thin) (S, C) -> () {
bb0(%0 : $S, %1 : $C):
  %2 = keypath $KeyPath<S, Int>, (root $S; settable_property $Int, id @id_a : $@convention(thin) () -> (), getter @get_s_int_subs : $@convention(keypath_accessor_getter) (@in_guaranteed S, @in_guaranteed (S, C)) -> @out Int, setter @set_s_int_subs : $@convention(keypath_accessor_setter) (@in_guaranteed Int, @in_guaranteed S, @in_guaranteed (S, C)) -> (), indices [%$0 : $S : $S, %$1 : $C : $C], indices_equals @subs_eq : $@convention(keypath_accessor_equals) (@in_guaranteed (S, C), @in_guaranteed (S, C)) -> Bool, indices_hash @subs_hash : $@convention(keypath_accessor_hash) (@in_guaranteed (S, C)) -> Int) (%0, %1)
  %7 = tuple ()
  return %7 : $()
}

public protocol RP {
  func default_witness()
}

// CHECK-LABEL: Uses of default_witness
// CHECK-NEXT:  [
// CHECK-NEXT:  <unknown uses>
// CHECK-NEXT:  ]
// CHECK-NEXT:  End function default_witness
sil hidden @default_witness : $@convention(witness_method: RP) <Self where Self : RP> (@in_guaranteed Self) -> () {
bb0(%0 : $*Self):
  %7 = tuple ()
  return %7 : $()
}

sil_default_witness_table RP {
  method #RP.default_witness: @default_witness
}

public protocol RP2 {
}

sil_default_witness_table RP2 {
  no_default
}

protocol P {
  func witness()
  func witness2()
}

struct SP : P {
  func witness()
  func witness2()
}

struct SP2 : P {
  func witness()
  func witness2()
}

// CHECK-LABEL: Uses of witness
// CHECK-NEXT:  [
// CHECK-NEXT:  <unknown uses>
// CHECK-NEXT:  ]
// CHECK-NEXT:  End function witness
sil @witness : $@convention(witness_method: P) (@inout SP) -> () {
bb0(%0 : $*SP):
  %7 = tuple ()
  return %7 : $()
}

sil @witness2 : $@convention(witness_method: P) (@inout SP) -> () {
bb0(%0 : $*SP):
  %7 = tuple ()
  return %7 : $()
}

sil_witness_table SP: P module witness_tables {
  method #P.witness: @witness
  method #P.witness2: @witness2
}

sil_witness_table SP2: P module witness_tables {
  method #P.witness: @witness
  method #P.witness2: @witness2
}

// CHECK-LABEL: Uses of hash_func
// CHECK-NEXT:  [
// CHECK-NEXT:  <unknown uses>
// CHECK-NEXT:  ]
// CHECK-NEXT:  End function hash_func
sil hidden @hash_func : $@convention(method) (@inout Hasher, @guaranteed C) -> () {
bb0(%0 : $*Hasher, %1 : $C):
  %4 = tuple ()
  return %4 : $()
}

sil_vtable C {
  #C.hash: (C) -> (inout Hasher) -> () : @hash_func
}