1 | #ifdef GET_ATTR_NAMES |
2 | #undef GET_ATTR_NAMES |
3 | #ifndef ATTRIBUTE_ALL |
4 | #define ATTRIBUTE_ALL(FIRST, SECOND) |
5 | #endif |
6 | |
7 | #ifndef ATTRIBUTE_ENUM |
8 | #define ATTRIBUTE_ENUM(FIRST, SECOND) ATTRIBUTE_ALL(FIRST, SECOND) |
9 | #endif |
10 | |
11 | ATTRIBUTE_ENUM(AllocAlign,allocalign) |
12 | ATTRIBUTE_ENUM(AllocatedPointer,allocptr) |
13 | ATTRIBUTE_ENUM(AlwaysInline,alwaysinline) |
14 | ATTRIBUTE_ENUM(Builtin,builtin) |
15 | ATTRIBUTE_ENUM(Cold,cold) |
16 | ATTRIBUTE_ENUM(Convergent,convergent) |
17 | ATTRIBUTE_ENUM(CoroDestroyOnlyWhenComplete,coro_only_destroy_when_complete) |
18 | ATTRIBUTE_ENUM(DeadOnUnwind,dead_on_unwind) |
19 | ATTRIBUTE_ENUM(DisableSanitizerInstrumentation,disable_sanitizer_instrumentation) |
20 | ATTRIBUTE_ENUM(FnRetThunkExtern,fn_ret_thunk_extern) |
21 | ATTRIBUTE_ENUM(Hot,hot) |
22 | ATTRIBUTE_ENUM(HybridPatchable,hybrid_patchable) |
23 | ATTRIBUTE_ENUM(ImmArg,immarg) |
24 | ATTRIBUTE_ENUM(InReg,inreg) |
25 | ATTRIBUTE_ENUM(InlineHint,inlinehint) |
26 | ATTRIBUTE_ENUM(JumpTable,jumptable) |
27 | ATTRIBUTE_ENUM(MinSize,minsize) |
28 | ATTRIBUTE_ENUM(MustProgress,mustprogress) |
29 | ATTRIBUTE_ENUM(Naked,naked) |
30 | ATTRIBUTE_ENUM(Nest,nest) |
31 | ATTRIBUTE_ENUM(NoAlias,noalias) |
32 | ATTRIBUTE_ENUM(NoBuiltin,nobuiltin) |
33 | ATTRIBUTE_ENUM(NoCallback,nocallback) |
34 | ATTRIBUTE_ENUM(NoCapture,nocapture) |
35 | ATTRIBUTE_ENUM(NoCfCheck,nocf_check) |
36 | ATTRIBUTE_ENUM(NoDuplicate,noduplicate) |
37 | ATTRIBUTE_ENUM(NoFree,nofree) |
38 | ATTRIBUTE_ENUM(NoImplicitFloat,noimplicitfloat) |
39 | ATTRIBUTE_ENUM(NoInline,noinline) |
40 | ATTRIBUTE_ENUM(NoMerge,nomerge) |
41 | ATTRIBUTE_ENUM(NoProfile,noprofile) |
42 | ATTRIBUTE_ENUM(NoRecurse,norecurse) |
43 | ATTRIBUTE_ENUM(NoRedZone,noredzone) |
44 | ATTRIBUTE_ENUM(NoReturn,noreturn) |
45 | ATTRIBUTE_ENUM(NoSanitizeBounds,nosanitize_bounds) |
46 | ATTRIBUTE_ENUM(NoSanitizeCoverage,nosanitize_coverage) |
47 | ATTRIBUTE_ENUM(NoSync,nosync) |
48 | ATTRIBUTE_ENUM(NoUndef,noundef) |
49 | ATTRIBUTE_ENUM(NoUnwind,nounwind) |
50 | ATTRIBUTE_ENUM(NonLazyBind,nonlazybind) |
51 | ATTRIBUTE_ENUM(NonNull,nonnull) |
52 | ATTRIBUTE_ENUM(NullPointerIsValid,null_pointer_is_valid) |
53 | ATTRIBUTE_ENUM(OptForFuzzing,optforfuzzing) |
54 | ATTRIBUTE_ENUM(OptimizeForDebugging,optdebug) |
55 | ATTRIBUTE_ENUM(OptimizeForSize,optsize) |
56 | ATTRIBUTE_ENUM(OptimizeNone,optnone) |
57 | ATTRIBUTE_ENUM(PresplitCoroutine,presplitcoroutine) |
58 | ATTRIBUTE_ENUM(ReadNone,readnone) |
59 | ATTRIBUTE_ENUM(ReadOnly,readonly) |
60 | ATTRIBUTE_ENUM(Returned,returned) |
61 | ATTRIBUTE_ENUM(ReturnsTwice,returns_twice) |
62 | ATTRIBUTE_ENUM(SExt,signext) |
63 | ATTRIBUTE_ENUM(SafeStack,safestack) |
64 | ATTRIBUTE_ENUM(SanitizeAddress,sanitize_address) |
65 | ATTRIBUTE_ENUM(SanitizeHWAddress,sanitize_hwaddress) |
66 | ATTRIBUTE_ENUM(SanitizeMemTag,sanitize_memtag) |
67 | ATTRIBUTE_ENUM(SanitizeMemory,sanitize_memory) |
68 | ATTRIBUTE_ENUM(SanitizeNumericalStability,sanitize_numerical_stability) |
69 | ATTRIBUTE_ENUM(SanitizeThread,sanitize_thread) |
70 | ATTRIBUTE_ENUM(ShadowCallStack,shadowcallstack) |
71 | ATTRIBUTE_ENUM(SkipProfile,skipprofile) |
72 | ATTRIBUTE_ENUM(Speculatable,speculatable) |
73 | ATTRIBUTE_ENUM(SpeculativeLoadHardening,speculative_load_hardening) |
74 | ATTRIBUTE_ENUM(StackProtect,ssp) |
75 | ATTRIBUTE_ENUM(StackProtectReq,sspreq) |
76 | ATTRIBUTE_ENUM(StackProtectStrong,sspstrong) |
77 | ATTRIBUTE_ENUM(StrictFP,strictfp) |
78 | ATTRIBUTE_ENUM(SwiftAsync,swiftasync) |
79 | ATTRIBUTE_ENUM(SwiftError,swifterror) |
80 | ATTRIBUTE_ENUM(SwiftSelf,swiftself) |
81 | ATTRIBUTE_ENUM(WillReturn,willreturn) |
82 | ATTRIBUTE_ENUM(Writable,writable) |
83 | ATTRIBUTE_ENUM(WriteOnly,writeonly) |
84 | ATTRIBUTE_ENUM(ZExt,zeroext) |
85 | ATTRIBUTE_ENUM(ByRef,byref) |
86 | ATTRIBUTE_ENUM(ByVal,byval) |
87 | ATTRIBUTE_ENUM(ElementType,elementtype) |
88 | ATTRIBUTE_ENUM(InAlloca,inalloca) |
89 | ATTRIBUTE_ENUM(Preallocated,preallocated) |
90 | ATTRIBUTE_ENUM(StructRet,sret) |
91 | ATTRIBUTE_ENUM(Alignment,align) |
92 | ATTRIBUTE_ENUM(AllocKind,allockind) |
93 | ATTRIBUTE_ENUM(AllocSize,allocsize) |
94 | ATTRIBUTE_ENUM(Dereferenceable,dereferenceable) |
95 | ATTRIBUTE_ENUM(DereferenceableOrNull,dereferenceable_or_null) |
96 | ATTRIBUTE_ENUM(Memory,memory) |
97 | ATTRIBUTE_ENUM(NoFPClass,nofpclass) |
98 | ATTRIBUTE_ENUM(StackAlignment,alignstack) |
99 | ATTRIBUTE_ENUM(UWTable,uwtable) |
100 | ATTRIBUTE_ENUM(VScaleRange,vscale_range) |
101 | ATTRIBUTE_ENUM(Range,range) |
102 | ATTRIBUTE_ENUM(Initializes,initializes) |
103 | #undef ATTRIBUTE_ENUM |
104 | |
105 | #ifndef ATTRIBUTE_STRBOOL |
106 | #define ATTRIBUTE_STRBOOL(FIRST, SECOND) ATTRIBUTE_ALL(FIRST, SECOND) |
107 | #endif |
108 | |
109 | ATTRIBUTE_STRBOOL(ApproxFuncFPMath,approx-func-fp-math) |
110 | ATTRIBUTE_STRBOOL(LessPreciseFPMAD,less-precise-fpmad) |
111 | ATTRIBUTE_STRBOOL(NoInfsFPMath,no-infs-fp-math) |
112 | ATTRIBUTE_STRBOOL(NoInlineLineTables,no-inline-line-tables) |
113 | ATTRIBUTE_STRBOOL(NoJumpTables,no-jump-tables) |
114 | ATTRIBUTE_STRBOOL(NoNansFPMath,no-nans-fp-math) |
115 | ATTRIBUTE_STRBOOL(NoSignedZerosFPMath,no-signed-zeros-fp-math) |
116 | ATTRIBUTE_STRBOOL(ProfileSampleAccurate,profile-sample-accurate) |
117 | ATTRIBUTE_STRBOOL(UnsafeFPMath,unsafe-fp-math) |
118 | ATTRIBUTE_STRBOOL(UseSampleProfile,use-sample-profile) |
119 | #undef ATTRIBUTE_STRBOOL |
120 | |
121 | #ifndef ATTRIBUTE_COMPLEXSTR |
122 | #define ATTRIBUTE_COMPLEXSTR(FIRST, SECOND) ATTRIBUTE_ALL(FIRST, SECOND) |
123 | #endif |
124 | |
125 | ATTRIBUTE_COMPLEXSTR(DenormalFPMath,denormal-fp-math) |
126 | ATTRIBUTE_COMPLEXSTR(DenormalFPMathF32,denormal-fp-math-f32) |
127 | #undef ATTRIBUTE_COMPLEXSTR |
128 | |
129 | #undef ATTRIBUTE_ALL |
130 | #endif |
131 | |
132 | #ifdef GET_ATTR_ENUM |
133 | #undef GET_ATTR_ENUM |
134 | FirstEnumAttr = 1, |
135 | AllocAlign = 1, |
136 | AllocatedPointer = 2, |
137 | AlwaysInline = 3, |
138 | Builtin = 4, |
139 | Cold = 5, |
140 | Convergent = 6, |
141 | CoroDestroyOnlyWhenComplete = 7, |
142 | DeadOnUnwind = 8, |
143 | DisableSanitizerInstrumentation = 9, |
144 | FnRetThunkExtern = 10, |
145 | Hot = 11, |
146 | HybridPatchable = 12, |
147 | ImmArg = 13, |
148 | InReg = 14, |
149 | InlineHint = 15, |
150 | JumpTable = 16, |
151 | MinSize = 17, |
152 | MustProgress = 18, |
153 | Naked = 19, |
154 | Nest = 20, |
155 | NoAlias = 21, |
156 | NoBuiltin = 22, |
157 | NoCallback = 23, |
158 | NoCapture = 24, |
159 | NoCfCheck = 25, |
160 | NoDuplicate = 26, |
161 | NoFree = 27, |
162 | NoImplicitFloat = 28, |
163 | NoInline = 29, |
164 | NoMerge = 30, |
165 | NoProfile = 31, |
166 | NoRecurse = 32, |
167 | NoRedZone = 33, |
168 | NoReturn = 34, |
169 | NoSanitizeBounds = 35, |
170 | NoSanitizeCoverage = 36, |
171 | NoSync = 37, |
172 | NoUndef = 38, |
173 | NoUnwind = 39, |
174 | NonLazyBind = 40, |
175 | NonNull = 41, |
176 | NullPointerIsValid = 42, |
177 | OptForFuzzing = 43, |
178 | OptimizeForDebugging = 44, |
179 | OptimizeForSize = 45, |
180 | OptimizeNone = 46, |
181 | PresplitCoroutine = 47, |
182 | ReadNone = 48, |
183 | ReadOnly = 49, |
184 | Returned = 50, |
185 | ReturnsTwice = 51, |
186 | SExt = 52, |
187 | SafeStack = 53, |
188 | SanitizeAddress = 54, |
189 | SanitizeHWAddress = 55, |
190 | SanitizeMemTag = 56, |
191 | SanitizeMemory = 57, |
192 | SanitizeNumericalStability = 58, |
193 | SanitizeThread = 59, |
194 | ShadowCallStack = 60, |
195 | SkipProfile = 61, |
196 | Speculatable = 62, |
197 | SpeculativeLoadHardening = 63, |
198 | StackProtect = 64, |
199 | StackProtectReq = 65, |
200 | StackProtectStrong = 66, |
201 | StrictFP = 67, |
202 | SwiftAsync = 68, |
203 | SwiftError = 69, |
204 | SwiftSelf = 70, |
205 | WillReturn = 71, |
206 | Writable = 72, |
207 | WriteOnly = 73, |
208 | ZExt = 74, |
209 | LastEnumAttr = 74, |
210 | FirstTypeAttr = 75, |
211 | ByRef = 75, |
212 | ByVal = 76, |
213 | ElementType = 77, |
214 | InAlloca = 78, |
215 | Preallocated = 79, |
216 | StructRet = 80, |
217 | LastTypeAttr = 80, |
218 | FirstIntAttr = 81, |
219 | Alignment = 81, |
220 | AllocKind = 82, |
221 | AllocSize = 83, |
222 | Dereferenceable = 84, |
223 | DereferenceableOrNull = 85, |
224 | Memory = 86, |
225 | NoFPClass = 87, |
226 | StackAlignment = 88, |
227 | UWTable = 89, |
228 | VScaleRange = 90, |
229 | LastIntAttr = 90, |
230 | FirstConstantRangeAttr = 91, |
231 | Range = 91, |
232 | LastConstantRangeAttr = 91, |
233 | FirstConstantRangeListAttr = 92, |
234 | Initializes = 92, |
235 | LastConstantRangeListAttr = 92, |
236 | #endif |
237 | |
238 | #ifdef GET_ATTR_COMPAT_FUNC |
239 | #undef GET_ATTR_COMPAT_FUNC |
240 | static inline bool hasCompatibleFnAttrs(const Function &Caller, |
241 | const Function &Callee) { |
242 | bool Ret = true; |
243 | |
244 | Ret &= isEqual<SanitizeAddressAttr>(Caller, Callee); |
245 | Ret &= isEqual<SanitizeThreadAttr>(Caller, Callee); |
246 | Ret &= isEqual<SanitizeMemoryAttr>(Caller, Callee); |
247 | Ret &= isEqual<SanitizeHWAddressAttr>(Caller, Callee); |
248 | Ret &= isEqual<SanitizeMemTagAttr>(Caller, Callee); |
249 | Ret &= isEqual<SanitizeNumericalStabilityAttr>(Caller, Callee); |
250 | Ret &= isEqual<SafeStackAttr>(Caller, Callee); |
251 | Ret &= isEqual<ShadowCallStackAttr>(Caller, Callee); |
252 | Ret &= isEqual<UseSampleProfileAttr>(Caller, Callee); |
253 | Ret &= isEqual<NoProfileAttr>(Caller, Callee); |
254 | Ret &= checkDenormMode(Caller, Callee); |
255 | Ret &= checkStrictFP(Caller, Callee); |
256 | Ret &= isEqual(Caller, Callee, "sign-return-address" ); |
257 | Ret &= isEqual(Caller, Callee, "sign-return-address-key" ); |
258 | Ret &= isEqual(Caller, Callee, "branch-protection-pauth-lr" ); |
259 | |
260 | return Ret; |
261 | } |
262 | |
263 | static inline void mergeFnAttrs(Function &Caller, |
264 | const Function &Callee) { |
265 | setAND<LessPreciseFPMADAttr>(Caller, Callee); |
266 | setAND<NoInfsFPMathAttr>(Caller, Callee); |
267 | setAND<NoNansFPMathAttr>(Caller, Callee); |
268 | setAND<ApproxFuncFPMathAttr>(Caller, Callee); |
269 | setAND<NoSignedZerosFPMathAttr>(Caller, Callee); |
270 | setAND<UnsafeFPMathAttr>(Caller, Callee); |
271 | setOR<NoImplicitFloatAttr>(Caller, Callee); |
272 | setOR<NoJumpTablesAttr>(Caller, Callee); |
273 | setOR<ProfileSampleAccurateAttr>(Caller, Callee); |
274 | setOR<SpeculativeLoadHardeningAttr>(Caller, Callee); |
275 | adjustCallerSSPLevel(Caller, Callee); |
276 | adjustCallerStackProbes(Caller, Callee); |
277 | adjustCallerStackProbeSize(Caller, Callee); |
278 | adjustMinLegalVectorWidth(Caller, Callee); |
279 | adjustNullPointerValidAttr(Caller, Callee); |
280 | setAND<MustProgressAttr>(Caller, Callee); |
281 | } |
282 | |
283 | #endif |
284 | #ifdef GET_ATTR_PROP_TABLE |
285 | #undef GET_ATTR_PROP_TABLE |
286 | static const uint8_t AttrPropTable[] = { |
287 | 0 | AttributeProperty::ParamAttr, |
288 | 0 | AttributeProperty::ParamAttr, |
289 | 0 | AttributeProperty::FnAttr, |
290 | 0 | AttributeProperty::FnAttr, |
291 | 0 | AttributeProperty::FnAttr, |
292 | 0 | AttributeProperty::FnAttr, |
293 | 0 | AttributeProperty::FnAttr, |
294 | 0 | AttributeProperty::ParamAttr, |
295 | 0 | AttributeProperty::FnAttr, |
296 | 0 | AttributeProperty::FnAttr, |
297 | 0 | AttributeProperty::FnAttr, |
298 | 0 | AttributeProperty::FnAttr, |
299 | 0 | AttributeProperty::ParamAttr, |
300 | 0 | AttributeProperty::ParamAttr | AttributeProperty::RetAttr, |
301 | 0 | AttributeProperty::FnAttr, |
302 | 0 | AttributeProperty::FnAttr, |
303 | 0 | AttributeProperty::FnAttr, |
304 | 0 | AttributeProperty::FnAttr, |
305 | 0 | AttributeProperty::FnAttr, |
306 | 0 | AttributeProperty::ParamAttr, |
307 | 0 | AttributeProperty::ParamAttr | AttributeProperty::RetAttr, |
308 | 0 | AttributeProperty::FnAttr, |
309 | 0 | AttributeProperty::FnAttr, |
310 | 0 | AttributeProperty::ParamAttr, |
311 | 0 | AttributeProperty::FnAttr, |
312 | 0 | AttributeProperty::FnAttr, |
313 | 0 | AttributeProperty::FnAttr | AttributeProperty::ParamAttr, |
314 | 0 | AttributeProperty::FnAttr, |
315 | 0 | AttributeProperty::FnAttr, |
316 | 0 | AttributeProperty::FnAttr, |
317 | 0 | AttributeProperty::FnAttr, |
318 | 0 | AttributeProperty::FnAttr, |
319 | 0 | AttributeProperty::FnAttr, |
320 | 0 | AttributeProperty::FnAttr, |
321 | 0 | AttributeProperty::FnAttr, |
322 | 0 | AttributeProperty::FnAttr, |
323 | 0 | AttributeProperty::FnAttr, |
324 | 0 | AttributeProperty::ParamAttr | AttributeProperty::RetAttr, |
325 | 0 | AttributeProperty::FnAttr, |
326 | 0 | AttributeProperty::FnAttr, |
327 | 0 | AttributeProperty::ParamAttr | AttributeProperty::RetAttr, |
328 | 0 | AttributeProperty::FnAttr, |
329 | 0 | AttributeProperty::FnAttr, |
330 | 0 | AttributeProperty::FnAttr, |
331 | 0 | AttributeProperty::FnAttr, |
332 | 0 | AttributeProperty::FnAttr, |
333 | 0 | AttributeProperty::FnAttr, |
334 | 0 | AttributeProperty::ParamAttr, |
335 | 0 | AttributeProperty::ParamAttr, |
336 | 0 | AttributeProperty::ParamAttr, |
337 | 0 | AttributeProperty::FnAttr, |
338 | 0 | AttributeProperty::ParamAttr | AttributeProperty::RetAttr, |
339 | 0 | AttributeProperty::FnAttr, |
340 | 0 | AttributeProperty::FnAttr, |
341 | 0 | AttributeProperty::FnAttr, |
342 | 0 | AttributeProperty::FnAttr, |
343 | 0 | AttributeProperty::FnAttr, |
344 | 0 | AttributeProperty::FnAttr, |
345 | 0 | AttributeProperty::FnAttr, |
346 | 0 | AttributeProperty::FnAttr, |
347 | 0 | AttributeProperty::FnAttr, |
348 | 0 | AttributeProperty::FnAttr, |
349 | 0 | AttributeProperty::FnAttr, |
350 | 0 | AttributeProperty::FnAttr, |
351 | 0 | AttributeProperty::FnAttr, |
352 | 0 | AttributeProperty::FnAttr, |
353 | 0 | AttributeProperty::FnAttr, |
354 | 0 | AttributeProperty::ParamAttr, |
355 | 0 | AttributeProperty::ParamAttr, |
356 | 0 | AttributeProperty::ParamAttr, |
357 | 0 | AttributeProperty::FnAttr, |
358 | 0 | AttributeProperty::ParamAttr, |
359 | 0 | AttributeProperty::ParamAttr, |
360 | 0 | AttributeProperty::ParamAttr | AttributeProperty::RetAttr, |
361 | 0 | AttributeProperty::ParamAttr, |
362 | 0 | AttributeProperty::ParamAttr, |
363 | 0 | AttributeProperty::ParamAttr, |
364 | 0 | AttributeProperty::ParamAttr, |
365 | 0 | AttributeProperty::FnAttr | AttributeProperty::ParamAttr, |
366 | 0 | AttributeProperty::ParamAttr, |
367 | 0 | AttributeProperty::ParamAttr | AttributeProperty::RetAttr, |
368 | 0 | AttributeProperty::FnAttr, |
369 | 0 | AttributeProperty::FnAttr, |
370 | 0 | AttributeProperty::ParamAttr | AttributeProperty::RetAttr, |
371 | 0 | AttributeProperty::ParamAttr | AttributeProperty::RetAttr, |
372 | 0 | AttributeProperty::FnAttr, |
373 | 0 | AttributeProperty::ParamAttr | AttributeProperty::RetAttr, |
374 | 0 | AttributeProperty::FnAttr | AttributeProperty::ParamAttr, |
375 | 0 | AttributeProperty::FnAttr, |
376 | 0 | AttributeProperty::FnAttr, |
377 | 0 | AttributeProperty::ParamAttr | AttributeProperty::RetAttr, |
378 | 0 | AttributeProperty::ParamAttr, |
379 | }; |
380 | #endif |
381 | |