File: witness_protocol_from_import.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 (48 lines) | stat: -rw-r--r-- 1,702 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
// RUN: %target-swift-frontend %s -emit-silgen | %FileCheck %s

sil_stage raw

import Builtin
import Swift

enum X {
  case onetransp
  case twotransp
}

sil @_TTWO5test21Xs9EquatableS_FS1_oi2eeUS1___fMQPS1_FT3lhsS2_3rhsS2__Sb : $@convention(witness_method: Equatable) (@in X, @in X, @thick X.Type) -> Bool {
bb0(%0 : $*X, %1 : $*X, %2 : $@thick X.Type):
  %3 = load %0 : $*X
  %4 = load %1 : $*X

  %5 = function_ref @_TF5test2oi2eeFTOS_1XS0__Sb : $@convention(thin) (X, X) -> Bool
  %6 = apply %5(%3, %4) : $@convention(thin) (X, X) -> Bool
  return %6 : $Bool
}


sil @_TTWO5test21Xs8HashableS_FS1_g9hashValueSi : $@convention(witness_method: Hashable) (@inout X) -> Int {
bb0(%0 : $*X):
  %1 = load %0 : $*X

  %2 = function_ref @_TFO5test21Xg9hashValueSi : $@convention(method) (X) -> Int
  %3 = apply %2(%1) : $@convention(method) (X) -> Int
  return %3 : $Int
}

sil @_TF5test2oi2eeFTOS_1XS0__Sb : $@convention(thin) (X, X) -> Bool
sil @_TFO5test21Xg9hashValueSi : $@convention(method) (X) -> Int

// CHECK-LABEL: sil_witness_table X: Equatable module
// CHECK: method #Equatable."==": {{.*}} : @_TTWO5test21Xs9EquatableS_FS1_oi2eeUS1___fMQPS1_FT3lhsS2_3rhsS2__Sb
sil_witness_table X: Equatable module test2 {
  method #Equatable."==": @_TTWO5test21Xs9EquatableS_FS1_oi2eeUS1___fMQPS1_FT3lhsS2_3rhsS2__Sb
}

// CHECK-LABEL: sil_witness_table X: Hashable module
// CHECK: base_protocol Equatable: X: Equatable module
// CHECK: method #Hashable.hashValue!getter: {{.*}} : @_TTWO5test21Xs8HashableS_FS1_g9hashValueSi
sil_witness_table X: Hashable module test2 {
  base_protocol Equatable: X: Equatable module test2
  method #Hashable.hashValue!getter: @_TTWO5test21Xs8HashableS_FS1_g9hashValueSi
}