File: exactcast.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 (122 lines) | stat: -rw-r--r-- 4,958 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
// RUN: %target-swift-frontend -enable-objc-interop -emit-ir %s | %FileCheck %s -check-prefix CHECK -check-prefix CHECK-%target-import-type

// REQUIRES: CPU=x86_64

sil_stage canonical

import Builtin
import Swift
import SwiftShims

class Node {
  @_hasStorage var index: Int { get set }
  init(index: Int)
  func check() -> Int
  @objc deinit
}

class ParentNode : Node {
  init(left: Node, right: Node, index: Int)
  @objc deinit
  override init(index: Int)
}

sil @_test_exact_checked_cast_branch : $@convention(method) (@guaranteed Node) -> Int {
bb0(%0 : $Node):
//CHECK-LABEL: define{{.*}}@_test_exact_checked_cast_branch
//CHECK:       [[LOAD:%.*]] = load ptr
//CHECK-DIRECT-NEXT:  = icmp eq ptr
//CHECK-INDIRECT-NEXT:  = icmp eq ptr
//CHECK-NEXT:  br i1
  checked_cast_br [exact] Node in %0 : $Node to ParentNode, bb2, bb3 // id: %2

bb1:                                   // Preds: bb2 bb3
  return undef : $Int

bb2(%5 : $ParentNode):                            // Preds: bb0
  br bb1                               // id: %10

bb3:                                              // Preds: bb0
  br bb1                              // id: %12
}

class BaseBase {
  @inline(never) func foo()
  init()
  deinit
}

class Base<T> : BaseBase {
  override init()
  deinit
}

final class DerivedInt : Base<Int> {
  @inline(never) override final func foo()
  override init()
  deinit
}

sil @test_exact_checked_cast_branch_dynamic_init : $@convention(thin) (@guaranteed BaseBase) -> Int {
bb0(%0 : $BaseBase):
//CHECK-LABEL: define{{.*}}@test_exact_checked_cast_branch_dynamic_init
//CHECK: call swiftcc {{.*}}@"$s9exactcast10DerivedIntCMa"({{.*}})
//CHECK: load
//CHECK: icmp eq ptr
//CHECK: br
  checked_cast_br [exact] BaseBase in %0 : $BaseBase to DerivedInt, bb2, bb3 // id: %2

bb1:
  return undef : $Int

bb2(%5 : $DerivedInt):
  br bb1

bb3:
  br bb1
}

sil @_TFC9pic_crash4NodecfMS0_FT5indexSi_S0_ : $@convention(method) (Int, @owned Node) -> @owned Node
sil @_TFC9pic_crash4NodeCfMS0_FT5indexSi_S0_ : $@convention(thin) (Int, @thick Node.Type) -> @owned Node
sil [transparent] @_TFC9pic_crash4Nodeg5indexSi : $@convention(method) (@guaranteed Node) -> Int
sil [transparent] @_TFC9pic_crash4Nodes5indexSi : $@convention(method) (Int, @guaranteed Node) -> ()
sil @_TFC9pic_crash10ParentNodecfMS0_FT4leftCS_4Node5rightS1_5indexSi_S0_ : $@convention(method) (@owned Node, @owned Node, Int, @owned ParentNode) -> @owned ParentNode
sil @_TFC9pic_crash10ParentNodeCfMS0_FT4leftCS_4Node5rightS1_5indexSi_S0_ : $@convention(thin) (@owned Node, @owned Node, Int, @thick ParentNode.Type) -> @owned ParentNode
sil @_TFC9pic_crash10ParentNodecfMS0_FT5indexSi_S0_ : $@convention(method) (Int, @owned ParentNode) -> @owned ParentNode
sil @_TFC9pic_crash10ParentNodeCfMS0_FT5indexSi_S0_ : $@convention(thin) (Int, @thick ParentNode.Type) -> @owned ParentNode

sil_vtable Node {
  #Node.init!initializer: @_TFC9pic_crash4NodecfMS0_FT5indexSi_S0_	// pic_crash.Node.init (pic_crash.Node.Type)(index : Swift.Int) -> pic_crash.Node
  #Node.check: @_test_exact_checked_cast_branch	// pic_crash.Node.check (pic_crash.Node)() -> Swift.Int
  #Node.index!getter: @_TFC9pic_crash4Nodeg5indexSi	// pic_crash.Node.index.getter : Swift.Int
  #Node.index!setter: @_TFC9pic_crash4Nodes5indexSi	// pic_crash.Node.index.setter : Swift.Int
}

sil_vtable ParentNode {
  #Node.init!initializer: @_TFC9pic_crash10ParentNodecfMS0_FT5indexSi_S0_ [override]	// pic_crash.ParentNode.init (pic_crash.ParentNode.Type)(index : Swift.Int) -> pic_crash.ParentNode
  #Node.check: @_test_exact_checked_cast_branch [override]	// pic_crash.Node.check (pic_crash.Node)() -> Swift.Int
  #Node.index!getter: @_TFC9pic_crash4Nodeg5indexSi [override]	// pic_crash.Node.index.getter : Swift.Int
  #Node.index!setter: @_TFC9pic_crash4Nodes5indexSi [override]	// pic_crash.Node.index.setter : Swift.Int
  #ParentNode.init!initializer: @_TFC9pic_crash10ParentNodecfMS0_FT4leftCS_4Node5rightS1_5indexSi_S0_ 	// pic_crash.ParentNode.init (pic_crash.ParentNode.Type)(left : pic_crash.Node, right : pic_crash.Node, index : Swift.Int) -> pic_crash.ParentNode
}

sil @$s5test104BaseB0C3fooyyF : $@convention(method) (@guaranteed BaseBase) -> ()
sil @$s5test104BaseB0CfD : $@convention(method) (@owned BaseBase) -> ()
sil @$s5test14BaseCfD : $@convention(method) (@owned BaseBase) -> ()
sil @$s5test110DerivedIntC3fooyyF : $@convention(method) (@guaranteed DerivedInt) -> ()
sil @$s5test110DerivedIntCfD : $@convention(method) (@owned DerivedInt) -> ()

sil_vtable BaseBase {
  #BaseBase.foo: (BaseBase) -> () -> () : @$s5test104BaseB0C3fooyyF
  #BaseBase.deinit!deallocator: @$s5test104BaseB0CfD
}

sil_vtable Base {
  #BaseBase.foo: (BaseBase) -> () -> () : @$s5test104BaseB0C3fooyyF [inherited]
  #Base.deinit!deallocator: @$s5test14BaseCfD
}

sil_vtable DerivedInt {
  #BaseBase.foo: (BaseBase) -> () -> () : @$s5test110DerivedIntC3fooyyF [override]
  #DerivedInt.deinit!deallocator: @$s5test110DerivedIntCfD
}