|
| 1 | +//===--- LLVMSwift.def ----------------------------------------------------===// |
| 2 | +// |
| 3 | +// This source file is part of the Swift.org open source project |
| 4 | +// |
| 5 | +// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors |
| 6 | +// Licensed under Apache License v2.0 with Runtime Library Exception |
| 7 | +// |
| 8 | +// See http://swift.org/LICENSE.txt for license information |
| 9 | +// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors |
| 10 | +// |
| 11 | +//===----------------------------------------------------------------------===// |
| 12 | + |
| 13 | +// KIND(Name, MemBehavior) |
| 14 | +// |
| 15 | +// This represents a specific equivalence class of LLVM instructions that have a |
| 16 | +// Name and the same MemBehavior from a ModRef perspective. |
| 17 | +// |
| 18 | +// Name - The name of the kind. |
| 19 | +// MemBehavior - One of NoModRef or ModRef. |
| 20 | +// |
| 21 | +#ifndef KIND |
| 22 | +#define KIND(Name, MemBehavior) |
| 23 | +#endif |
| 24 | + |
| 25 | +// SWIFT_FUNC(Name, MemBehavior, TextualName) |
| 26 | +// |
| 27 | +// This defines a special swift function known to the optimizer that may be |
| 28 | +// present in either atomic or nonatomic form. |
| 29 | +// |
| 30 | +// Name - The name of the function |
| 31 | +// MemBehavior - The MemBehavior of the instruction that can be known at compile time |
| 32 | +// TextualName - The name of the function in the final binary. |
| 33 | +#ifndef SWIFT_FUNC |
| 34 | +#define SWIFT_FUNC(Name, MemBehavior, TextualName) KIND(Name, MemBehavior) |
| 35 | +#endif |
| 36 | + |
| 37 | +// SWIFT_NEVER_NONATOMIC_FUNC(Name, MemBehavior, TextualName) |
| 38 | +// |
| 39 | +// This defines a special swift function known to the optimizer that does not |
| 40 | +// have a nonatomic form. |
| 41 | +// |
| 42 | +// Name - The name of the function |
| 43 | +// MemBehavior - The MemBehavior of the instruction that can be known at compile time |
| 44 | +// TextualName - The name of the function in the final binary. |
| 45 | +#ifndef SWIFT_NEVER_NONATOMIC_FUNC |
| 46 | +#define SWIFT_NEVER_NONATOMIC_FUNC(Name, MemBehavior, TextualName) SWIFT_FUNC(Name, MemBehavior, TextualName) |
| 47 | +#endif |
| 48 | + |
| 49 | +// SWIFT_INTERNAL_NEVER_NONATOMIC_FUNC(Name, MemBehavior, TextualName) |
| 50 | +// |
| 51 | +// This defines a special swift function known to the optimizer that does not |
| 52 | +// have a nonatomic form and has an internal prefix (i.e. '__'). |
| 53 | +// |
| 54 | +// Name - The name of the function |
| 55 | +// MemBehavior - The MemBehavior of the instruction that can be known at compile time |
| 56 | +// TextualName - The name of the function in the final binary. |
| 57 | +#ifndef SWIFT_INTERNAL_FUNC_NEVER_NONATOMIC |
| 58 | +#define SWIFT_INTERNAL_FUNC_NEVER_NONATOMIC(Name, MemBehavior, TextualName) SWIFT_FUNC(Name, MemBehavior, TextualName) |
| 59 | +#endif |
| 60 | + |
| 61 | +// OBJC_FUNC(Name, MemBehavior, TextualName) |
| 62 | +// |
| 63 | +// This defines a special objc function known to the optimizer that may have an |
| 64 | +// atomic and nonatomic form. |
| 65 | +// |
| 66 | +// Name - The name of the function |
| 67 | +// MemBehavior - The MemBehavior of the instruction that can be known at compile time |
| 68 | +// TextualName - The name of the function in the final binary. |
| 69 | +#ifndef OBJC_FUNC |
| 70 | +#define OBJC_FUNC(Name, MemBehavior, TextualName) KIND(Name, MemBehavior) |
| 71 | +#endif |
| 72 | + |
| 73 | +/// An instruction with this classification is known to not access (read or |
| 74 | +/// write) memory. |
| 75 | +KIND(NoMemoryAccessed, NoModRef) |
| 76 | + |
| 77 | +/// void swift_retain(SwiftHeapObject *object) |
| 78 | +SWIFT_FUNC(Retain, NoModRef, retain) |
| 79 | + |
| 80 | +/// void swift_retain_n(SwiftHeapObject *object) |
| 81 | +SWIFT_FUNC(RetainN, NoModRef, retain_n) |
| 82 | + |
| 83 | +/// void swift::swift_retainUnowned(HeapObject *object) |
| 84 | +SWIFT_FUNC(RetainUnowned, NoModRef, retainUnowned) |
| 85 | + |
| 86 | +/// void swift_checkUnowned(HeapObject *object) |
| 87 | +SWIFT_FUNC(CheckUnowned, NoModRef, checkUnowned) |
| 88 | + |
| 89 | +/// void swift_release(SwiftHeapObject *object) |
| 90 | +SWIFT_FUNC(Release, ModRef, release) |
| 91 | + |
| 92 | +/// void swift_release_n(SwiftHeapObject *object) |
| 93 | +SWIFT_FUNC(ReleaseN, ModRef, release_n) |
| 94 | + |
| 95 | +/// SwiftHeapObject *swift_allocObject(SwiftHeapMetadata *metadata, |
| 96 | +/// size_t size, size_t alignment) |
| 97 | +SWIFT_NEVER_NONATOMIC_FUNC(AllocObject, NoModRef, allocObject) |
| 98 | + |
| 99 | +/// void objc_release(%objc_object* %P) |
| 100 | +OBJC_FUNC(ObjCRelease, ModRef, release) |
| 101 | + |
| 102 | +/// %objc_object* objc_retain(%objc_object* %P) |
| 103 | +OBJC_FUNC(ObjCRetain, NoModRef, retain) |
| 104 | + |
| 105 | +/// void swift_unknownRetain(%swift.refcounted* %P) |
| 106 | +SWIFT_FUNC(UnknownRetain, NoModRef, unknownRetain) |
| 107 | + |
| 108 | +/// void swift_unknownRetain_n(%swift.refcounted* %P) |
| 109 | +SWIFT_FUNC(UnknownRetainN, NoModRef, unknownRetain_n) |
| 110 | + |
| 111 | +/// void swift_unknownRelease(%swift.refcounted* %P) |
| 112 | +SWIFT_FUNC(UnknownRelease, ModRef, unknownRelease) |
| 113 | + |
| 114 | +/// void swift_unknownRelease_n(%swift.refcounted* %P) |
| 115 | +SWIFT_FUNC(UnknownReleaseN, ModRef, unknownRelease_n) |
| 116 | + |
| 117 | +/// void __swift_fixLifetime(%swift.refcounted* %P) |
| 118 | +SWIFT_INTERNAL_FUNC_NEVER_NONATOMIC(FixLifetime, NoModRef, fixLifetime) |
| 119 | + |
| 120 | +/// void swift_bridgeObjectRetain(%swift.refcounted* %P) |
| 121 | +SWIFT_FUNC(BridgeRetain, NoModRef, bridgeObjectRetain) |
| 122 | + |
| 123 | +/// void swift_bridgeObjectRetain_n(%swift.refcounted* %P) |
| 124 | +SWIFT_FUNC(BridgeRetainN, NoModRef, bridgeObjectRetain_n) |
| 125 | + |
| 126 | +/// void swift_bridgeObjectRelease(%swift.refcounted* %P) |
| 127 | +SWIFT_FUNC(BridgeRelease, ModRef, bridgeObjectRelease) |
| 128 | + |
| 129 | +/// void swift_bridgeObjectRelease_n(%swift.refcounted* %P) |
| 130 | +SWIFT_FUNC(BridgeReleaseN, ModRef, bridgeObjectRelease_n) |
| 131 | + |
| 132 | +/// This is not a runtime function that we support. Maybe it is not a call, |
| 133 | +/// or is a call to something we don't care about. |
| 134 | +KIND(Unknown, ModRef) |
| 135 | + |
| 136 | +#undef OBJC_NEVER_NONATOMIC_FUNC |
| 137 | +#undef SWIFT_INTERNAL_FUNC_NEVER_NONATOMIC |
| 138 | +#undef SWIFT_NEVER_NONATOMIC_FUNC |
| 139 | +#undef OBJC_FUNC |
| 140 | +#undef SWIFT_FUNC |
| 141 | +#undef KIND |
0 commit comments