File: bridge_object_arm64.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 (55 lines) | stat: -rw-r--r-- 2,176 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
// RUN: %swift -module-name bridge_object -emit-ir -disable-legacy-type-info -target arm64-apple-ios8.0 %s | %FileCheck %s

// REQUIRES: CODEGENERATOR=AArch64

sil_stage canonical

import Builtin

class C {}
sil_vtable C {}

@objc protocol ObjC {}

sil @retain_release_bridge_object : $(Builtin.BridgeObject) -> () {
entry(%b : $Builtin.BridgeObject):
  strong_retain %b : $Builtin.BridgeObject
  strong_release %b : $Builtin.BridgeObject
  return undef : $()
}

sil @convert_to_bridge_object : $(C, Builtin.Word) -> Builtin.BridgeObject {
entry(%c : $C, %w : $Builtin.Word):
  %b = ref_to_bridge_object %c : $C, %w : $Builtin.Word
  return %b : $Builtin.BridgeObject
}


// CHECK-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc { ptr, i64 } @convert_from_bridge_object
// CHECK:         [[BOBITS:%.*]] = ptrtoint ptr %0 to i64
// --                                                     0x8000_0000_0000_0000
// CHECK:         [[TAGBITS:%.*]] = and i64 [[BOBITS]], -9223372036854775808
// CHECK:         [[TAGGED:%.*]] = icmp eq i64 [[TAGBITS]], 0
// CHECK:         br i1 [[TAGGED]], label %not-tagged-pointer, label %tagged-pointer
// CHECK:       tagged-pointer:
// CHECK:         br label %tagged-cont
// CHECK:       not-tagged-pointer:
// --                                                     0x0fff_ffff_ffff_fff8
// CHECK:         [[MASKED_BITS:%.*]] = and i64 [[BOBITS]], 1152921504606846968
// CHECK:         [[MASKED_RESULT:%.*]] = inttoptr i64 [[MASKED_BITS]] to ptr
// CHECK:         br label %tagged-cont
// CHECK:      tagged-cont:
// CHECK:         phi ptr [ %0, %tagged-pointer ], [ [[MASKED_RESULT]], %not-tagged-pointer ]
sil @convert_from_bridge_object : $(Builtin.BridgeObject) -> (ObjC, Builtin.Word) {
entry(%b : $Builtin.BridgeObject):
  %c = bridge_object_to_ref %b : $Builtin.BridgeObject to $ObjC
  %w = bridge_object_to_word %b : $Builtin.BridgeObject to $Builtin.Word
  %t = tuple (%c : $ObjC, %w : $Builtin.Word)
  return %t : $(ObjC, Builtin.Word)
}

sil @convert_from_native_bridge_object : $(Builtin.BridgeObject) -> C {
entry(%b : $Builtin.BridgeObject):
  %c = bridge_object_to_ref %b : $Builtin.BridgeObject to $C
  return %c : $C
}