File: sil_combine_simp_enum_ossa.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 (53 lines) | stat: -rw-r--r-- 2,124 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
// RUN: %target-sil-opt -enable-sil-verify-all %s -sil-combine | %FileCheck %s

sil_stage canonical

import Builtin
import Swift

enum SimpleEnum {
  case Empty
  case HasInt(Int)
  case HasInt2(Int)
}

//CHECK: _TF4main12test_union_1FT1EOS_10SimpleEnum_S0_
//CHECK: switch_enum
//CHECK: bb2
//CHECK: enum $SimpleEnum, #SimpleEnum.HasInt2!enumelt, %{{[0-9]+}} : $Int
//CHECK: bb3
//CHECK: enum $SimpleEnum, #SimpleEnum.HasInt!enumelt, %{{[0-9]+}} : $Int
//CHECK: bb4
//CHECK: return

// main.test_union_1 (E : main.SimpleEnum) -> main.SimpleEnum
sil [ossa] @_TF4main12test_union_1FT1EOS_10SimpleEnum_S0_ : $@convention(thin) (SimpleEnum) -> SimpleEnum {
bb0(%0 : $SimpleEnum):
  %1 = alloc_stack $SimpleEnum, var, name "E"          // users: %16, %2
  store %0 to [trivial] %1 : $*SimpleEnum                 // id: %2
  %3 = tuple ()
  switch_enum %0 : $SimpleEnum, case #SimpleEnum.Empty!enumelt: bb1, case #SimpleEnum.HasInt!enumelt: bb3, case #SimpleEnum.HasInt2!enumelt:bb4 // id: %4

bb1:                                              // Preds: bb0
  %6 = enum $SimpleEnum, #SimpleEnum.Empty!enumelt // user: %7
  br bb5(%6 : $SimpleEnum)                        // id: %7

bb3(%8 : $Int):                                 // Preds: bb0
  %9 = alloc_stack $Int, var, name "N"               // users: %13, %10
  store %8 to [trivial] %9 : $*Int                      // id: %10
  %12 = enum $SimpleEnum, #SimpleEnum.HasInt2!enumelt, %8 : $Int // user: %14
  dealloc_stack %9 : $*Int     // id: %13
  br bb5(%12 : $SimpleEnum)                       // id: %14

bb4(%13 : $Int):                                 // Preds: bb0
  %14 = alloc_stack $Int, var, name "N"               // users: %13, %10
  store %13 to [trivial] %14 : $*Int                     // id: %10
  %15 = enum $SimpleEnum, #SimpleEnum.HasInt!enumelt, %13 : $Int // user: %14
  dealloc_stack %14 : $*Int     // id: %13
  br bb5(%15 : $SimpleEnum)                       // id: %14

bb5(%16 : $SimpleEnum):                           // Preds: bb2 bb4
  dealloc_stack %1 : $*SimpleEnum // id: %16
  return %16 : $SimpleEnum                        // id: %17
}