|
67 | 67 | // Annotation for specifying a calling convention of
|
68 | 68 | // a runtime function. It should be used with declarations
|
69 | 69 | // of runtime functions like this:
|
70 |
| -// void runtime_function_name() CALLING_CONVENTION(RegisterPreservingCC) |
71 |
| -#define CALLING_CONVENTION(CC) CALLING_CONVENTION_##CC |
| 70 | +// void runtime_function_name() SWIFT_CC(RegisterPreservingCC) |
| 71 | +#define SWIFT_CC(CC) SWIFT_CC_##CC |
72 | 72 |
|
73 |
| -#define CALLING_CONVENTION_preserve_most __attribute__((preserve_most)) |
74 |
| -#define CALLING_CONVENTION_preserve_all __attribute__((preserve_all)) |
75 |
| -#define CALLING_CONVENTION_c |
| 73 | +#define SWIFT_CC_preserve_most __attribute__((preserve_most)) |
| 74 | +#define SWIFT_CC_preserve_all __attribute__((preserve_all)) |
| 75 | +#define SWIFT_CC_c |
76 | 76 |
|
77 | 77 | // Map a logical calling convention (e.g. RegisterPreservingCC) to LLVM calling
|
78 | 78 | // convention.
|
79 |
| -#define LLVM_CC(CC) LLVM_CC_##CC |
| 79 | +#define SWIFT_LLVM_CC(CC) SWIFT_LLVM_CC_##CC |
80 | 80 |
|
81 | 81 | // Currently, RuntimeFunction.def uses the following calling conventions:
|
82 | 82 | // DefaultCC, RegisterPreservingCC.
|
83 | 83 | // If new runtime calling conventions are added later, they need to be mapped
|
84 | 84 | // here to something appropriate.
|
85 | 85 |
|
86 | 86 | // DefaultCC is usually the standard C calling convention.
|
87 |
| -#define CALLING_CONVENTION_DefaultCC CALLING_CONVENTION_c |
88 |
| -#define CALLING_CONVENTION_DefaultCC_IMPL CALLING_CONVENTION_c |
89 |
| -#define LLVM_CC_DefaultCC llvm::CallingConv::C |
| 87 | +#define SWIFT_CC_DefaultCC SWIFT_CC_c |
| 88 | +#define SWIFT_CC_DefaultCC_IMPL SWIFT_CC_c |
| 89 | +#define SWIFT_LLVM_CC_DefaultCC llvm::CallingConv::C |
90 | 90 |
|
91 | 91 | // If defined, it indicates that runtime function wrappers
|
92 | 92 | // should be used on all platforms, even they do not support
|
93 | 93 | // the new calling convention which requires this.
|
94 |
| -#define RT_USE_WRAPPERS_ALWAYS 1 |
| 94 | +#define SWIFT_RT_USE_WRAPPERS_ALWAYS 1 |
95 | 95 |
|
96 | 96 | // If defined, it indicates that this calling convention is
|
97 | 97 | // supported by the currnet target.
|
|
114 | 114 | // linker may clobber some of the callee-saved registers defined by
|
115 | 115 | // this new calling convention when it performs lazy binding of
|
116 | 116 | // runtime functions using this new calling convention.
|
117 |
| -#define CALLING_CONVENTION_RegisterPreservingCC CALLING_CONVENTION_preserve_most |
118 |
| -#define CALLING_CONVENTION_RegisterPreservingCC_IMPL \ |
119 |
| - CALLING_CONVENTION_preserve_most |
120 |
| -#define LLVM_CC_RegisterPreservingCC llvm::CallingConv::PreserveMost |
| 117 | +#define SWIFT_CC_RegisterPreservingCC \ |
| 118 | + SWIFT_CC_preserve_most |
| 119 | +#define SWIFT_CC_RegisterPreservingCC_IMPL \ |
| 120 | + SWIFT_CC_preserve_most |
| 121 | +#define SWIFT_LLVM_CC_RegisterPreservingCC llvm::CallingConv::PreserveMost |
121 | 122 |
|
122 | 123 | // Indicate that wrappers should be used, because it is required
|
123 | 124 | // for the calling convention to get around dynamic linking issues.
|
124 |
| -#define RT_USE_WRAPPERS 1 |
| 125 | +#define SWIFT_RT_USE_WRAPPERS 1 |
125 | 126 |
|
126 | 127 | #else
|
127 | 128 |
|
128 | 129 | // Targets not supporting the dedicated runtime calling convention
|
129 | 130 | // should use the standard calling convention instead.
|
130 | 131 | // No wrappers are required in this case by the calling convention.
|
131 |
| -#define CALLING_CONVENTION_RegisterPreservingCC CALLING_CONVENTION_c |
132 |
| -#define CALLING_CONVENTION_RegisterPreservingCC_IMPL CALLING_CONVENTION_c |
133 |
| -#define LLVM_CC_RegisterPreservingCC llvm::CallingConv::C |
| 132 | +#define SWIFT_CC_RegisterPreservingCC SWIFT_CC_c |
| 133 | +#define SWIFT_CC_RegisterPreservingCC_IMPL SWIFT_CC_c |
| 134 | +#define SWIFT_LLVM_CC_RegisterPreservingCC llvm::CallingConv::C |
134 | 135 |
|
135 | 136 | #endif
|
136 | 137 |
|
|
139 | 140 |
|
140 | 141 | // Generates a name of the runtime enrty's implementation by
|
141 | 142 | // adding an underscore as a prefix and a suffix.
|
142 |
| -#define RT_ENTRY_IMPL(Name) _##Name##_ |
| 143 | +#define SWIFT_RT_ENTRY_IMPL(Name) _##Name##_ |
143 | 144 |
|
144 | 145 | // Library internal way to invoke the implementation of a runtime entry.
|
145 | 146 | // E.g. a runtime function may be called internally via its public API
|
146 | 147 | // or via the function pointer.
|
147 |
| -#define RT_ENTRY_CALL(Name) Name |
| 148 | +#define SWIFT_RT_ENTRY_CALL(Name) Name |
148 | 149 |
|
149 | 150 | // Name of the symbol holding a reference to the
|
150 | 151 | // implementation of a runtime entry.
|
151 |
| -#define RT_ENTRY_REF(Name) _##Name |
| 152 | +#define SWIFT_RT_ENTRY_REF(Name) _##Name |
152 | 153 |
|
153 | 154 | // String representation of the symbol's name.
|
154 |
| -#define RT_ENTRY_REF_AS_STR(Name) "_" #Name |
| 155 | +#define SWIFT_RT_ENTRY_REF_AS_STR(Name) "_" #Name |
155 | 156 |
|
156 |
| -#if defined(RT_USE_WRAPPERS_ALWAYS) |
157 |
| -#define RT_USE_WRAPPERS |
| 157 | +#if defined(SWIFT_RT_USE_WRAPPERS_ALWAYS) |
| 158 | +#define SWIFT_RT_USE_WRAPPERS |
158 | 159 | #endif
|
159 | 160 |
|
160 |
| -#if defined(RT_USE_WRAPPERS) |
| 161 | +#if defined(SWIFT_RT_USE_WRAPPERS) |
161 | 162 |
|
162 | 163 | // Both the runtime functions and their implementation are hidden and
|
163 | 164 | // can be directly referenced only inside the runtime library.
|
164 | 165 | // User code can access these runtime entries only indirectly
|
165 | 166 | // via a global function pointer.
|
166 |
| -#define RT_ENTRY_VISIBILITY LLVM_LIBRARY_VISIBILITY |
167 |
| -#define RT_ENTRY_IMPL_VISIBILITY LLVM_LIBRARY_VISIBILITY |
| 167 | +#define SWIFT_RT_ENTRY_VISIBILITY LLVM_LIBRARY_VISIBILITY |
| 168 | +#define SWIFT_RT_ENTRY_IMPL_VISIBILITY LLVM_LIBRARY_VISIBILITY |
168 | 169 |
|
169 | 170 | #else
|
170 | 171 |
|
171 | 172 | // Runtime functions are exported, because it should be possible
|
172 | 173 | // to invoke them directly from the user code. But internal
|
173 | 174 | // implementations of runtime functions do not need to be exported.
|
174 |
| -#define RT_ENTRY_VISIBILITY SWIFT_RUNTIME_EXPORT |
175 |
| -#define RT_ENTRY_IMPL_VISIBILITY LLVM_LIBRARY_VISIBILITY |
| 175 | +#define SWIFT_RT_ENTRY_VISIBILITY SWIFT_RUNTIME_EXPORT |
| 176 | +#define SWIFT_RT_ENTRY_IMPL_VISIBILITY LLVM_LIBRARY_VISIBILITY |
176 | 177 |
|
177 | 178 | #endif
|
178 | 179 |
|
|
0 commit comments