File: let_properties_opts_non_trivial.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 (87 lines) | stat: -rw-r--r-- 3,838 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
// RUN: %target-sil-opt -let-properties-opt -enable-sil-verify-all %s | %FileCheck %s

sil_stage canonical

import Builtin
import Swift

class Point {
  let x: Int64 = 0
  let y: Int64 = 0
}

class HasCenter {
  let centerPoint: Point = Point()
  public func getCenter() -> Int64
}

// Point.init()
sil hidden [ossa] @$s19let_properties_opts5PointCACycfc : $@convention(method) (@owned Point) -> @owned Point {
bb0(%0 : @owned $Point):
  %1 = integer_literal $Builtin.Int64, 0
  %2 = struct $Int64 (%1 : $Builtin.Int64)
  
  %3 = begin_borrow %0 : $Point
  %6 = ref_element_addr %3 : $Point, #Point.x
  store %2 to [trivial] %6 : $*Int64
  end_borrow %3 : $Point

  %9 = begin_borrow %0 : $Point
  %12 = ref_element_addr %9 : $Point, #Point.y
  store %2 to [trivial] %12 : $*Int64
  end_borrow %9 : $Point

  %15 = copy_value %0 : $Point
  destroy_value %0 : $Point
  return %15 : $Point
}

// HasCenter.init()
sil hidden [ossa] @$s19let_properties_opts9HasCenterCACycfc : $@convention(method) (@owned HasCenter) -> @owned HasCenter {
// %0                                             // users: %2, %1
bb0(%0 : @owned $HasCenter):
  %1 = alloc_ref $Point
  // function_ref Point.init()
  %2 = function_ref @$s19let_properties_opts5PointCACycfc : $@convention(method) (@owned Point) -> @owned Point
  %3 = apply %2(%1) : $@convention(method) (@owned Point) -> @owned Point

  %5 = begin_borrow %0 : $HasCenter               // users: %8, %6
  %6 = ref_element_addr %5 : $HasCenter, #HasCenter.centerPoint // user: %7
  
  store %3 to [init] %6 : $*Point                       // id: %7
  end_borrow %5 : $HasCenter                      // id: %8
  
  %9 = copy_value %0 : $HasCenter                 // user: %11
  destroy_value %0 : $HasCenter                   // id: %10
  return %9 : $HasCenter                          // id: %11
} // end sil function '$s19let_properties_opts9HasCenterCACycfc'

// HasCenter.centerPoint.getter
sil hidden [transparent] [ossa] @$s19let_properties_opts9HasCenterC11centerPointAA0G0Cvg : $@convention(method) (@guaranteed HasCenter) -> @owned Point {
// %0                                             // users: %2, %1
bb0(%0 : @guaranteed $HasCenter):
  debug_value %0 : $HasCenter, let, name "self", argno 1 // id: %1
  %2 = ref_element_addr %0 : $HasCenter, #HasCenter.centerPoint // user: %3
  %3 = load [copy] %2 : $*Point                   // user: %4
  return %3 : $Point                              // id: %4
} // end sil function '$s19let_properties_opts9HasCenterC11centerPointAA0G0Cvg'

// HasCenter.getCenter()
// CHECK-LABEL: sil hidden [ossa] @$s19let_properties_opts9HasCenterC03getE0s5Int64VyF : $@convention(method) (@guaranteed HasCenter) -> Int64 {
// CHECK: [[LIT:%.*]] = integer_literal $Builtin.Int64, 0
// CHECK: [[INT:%.*]] = struct $Int64 ([[LIT]] : $Builtin.Int64)
// CHECK: return [[INT]] : $Int64
// CHECK-LABEL: } // end sil function '$s19let_properties_opts9HasCenterC03getE0s5Int64VyF'
sil hidden [ossa] @$s19let_properties_opts9HasCenterC03getE0s5Int64VyF : $@convention(method) (@guaranteed HasCenter) -> Int64 {
// %0                                             // users: %2, %1
bb0(%0 : @guaranteed $HasCenter):
  debug_value %0 : $HasCenter, let, name "self", argno 1 // id: %1
  %2 = ref_element_addr %0 : $HasCenter, #HasCenter.centerPoint // user: %3
  %3 = load [copy] %2 : $*Point                   // users: %8, %4
  %4 = begin_borrow %3 : $Point                   // users: %7, %5
  %5 = ref_element_addr %4 : $Point, #Point.x     // user: %6
  %6 = load [trivial] %5 : $*Int64                // user: %9
  end_borrow %4 : $Point                          // id: %7
  destroy_value %3 : $Point                       // id: %8
  return %6 : $Int64                              // id: %9
} // end sil function '$s19let_properties_opts9HasCenterC03getE0s5Int64VyF'