Debian Codegraph @

llvm/utils/gn/secondary/compiler-rt/lib/builtins/sources.gni

raw
1 declare_args() {
2 # Skip the atomic builtin (should normally be provided by a shared library).
3 compiler_rt_exclude_atomic_builtin = true
4 }
5
6 if (current_cpu == "x86" || current_cpu == "x64") {
7 # long double is not 80 bits on Android or MSVC.
8 long_double_is_80_bits = current_os != "android" && current_os != "win"
9 }
10
11 builtins_defines = []
12
13 # This is based on who sets HasFloat16 to true in clang/lib/Basic/Targets.
14 if (current_cpu == "arm" || current_cpu == "arm64" ||
15 current_cpu == "hexagon" || current_cpu == "riscv" ||
16 current_cpu == "riscv64" || current_cpu == "x64") {
17 builtins_defines += [ "COMPILER_RT_HAS_FLOAT16" ]
18 }
19
20 builtins_sources = [
21 "absvdi2.c",
22 "absvsi2.c",
23 "absvti2.c",
24 "adddf3.c",
25 "addsf3.c",
26 "addvdi3.c",
27 "addvsi3.c",
28 "addvti3.c",
29 "apple_versioning.c",
30 "ashldi3.c",
31 "ashlti3.c",
32 "ashrdi3.c",
33 "ashrti3.c",
34 "bswapdi2.c",
35 "bswapsi2.c",
36 "clzdi2.c",
37 "clzsi2.c",
38 "clzti2.c",
39 "cmpdi2.c",
40 "cmpti2.c",
41 "comparedf2.c",
42 "comparesf2.c",
43 "ctzdi2.c",
44 "ctzsi2.c",
45 "ctzti2.c",
46 "divdc3.c",
47 "divdf3.c",
48 "divdi3.c",
49 "divmoddi4.c",
50 "divmodsi4.c",
51 "divmodti4.c",
52 "divsc3.c",
53 "divsf3.c",
54 "divsi3.c",
55 "divti3.c",
56 "extendhfsf2.c",
57 "extendsfdf2.c",
58 "extendhfdf2.c",
59 "ffsdi2.c",
60 "ffssi2.c",
61 "ffsti2.c",
62 "fixdfdi.c",
63 "fixdfsi.c",
64 "fixdfti.c",
65 "fixsfdi.c",
66 "fixsfsi.c",
67 "fixsfti.c",
68 "fixunsdfdi.c",
69 "fixunsdfsi.c",
70 "fixunsdfti.c",
71 "fixunssfdi.c",
72 "fixunssfsi.c",
73 "fixunssfti.c",
74 "floatdidf.c",
75 "floatdisf.c",
76 "floatsidf.c",
77 "floatsisf.c",
78 "floattidf.c",
79 "floattisf.c",
80 "floatundidf.c",
81 "floatundisf.c",
82 "floatunsidf.c",
83 "floatunsisf.c",
84 "floatuntidf.c",
85 "floatuntisf.c",
86 "fp_mode.c",
87 "int_util.c",
88 "lshrdi3.c",
89 "lshrti3.c",
90 "moddi3.c",
91 "modsi3.c",
92 "modti3.c",
93 "muldc3.c",
94 "muldf3.c",
95 "muldi3.c",
96 "mulodi4.c",
97 "mulosi4.c",
98 "muloti4.c",
99 "mulsc3.c",
100 "mulsf3.c",
101 "multi3.c",
102 "mulvdi3.c",
103 "mulvsi3.c",
104 "mulvti3.c",
105 "negdf2.c",
106 "negdi2.c",
107 "negsf2.c",
108 "negti2.c",
109 "negvdi2.c",
110 "negvsi2.c",
111 "negvti2.c",
112 "os_version_check.c",
113 "paritydi2.c",
114 "paritysi2.c",
115 "parityti2.c",
116 "popcountdi2.c",
117 "popcountsi2.c",
118 "popcountti2.c",
119 "powidf2.c",
120 "powisf2.c",
121 "subdf3.c",
122 "subsf3.c",
123 "subvdi3.c",
124 "subvsi3.c",
125 "subvti3.c",
126 "trampoline_setup.c",
127 "truncdfhf2.c",
128 "truncdfsf2.c",
129 "truncsfhf2.c",
130 "ucmpdi2.c",
131 "ucmpti2.c",
132 "udivdi3.c",
133 "udivmoddi4.c",
134 "udivmodsi4.c",
135 "udivmodti4.c",
136 "udivsi3.c",
137 "udivti3.c",
138 "umoddi3.c",
139 "umodsi3.c",
140 "umodti3.c",
141
142 # This depends on unwind.h which is present in Clang headers. We should
143 # reconsider this if we ever decide to support building builtins with
144 # other compilers.
145 "gcc_personality_v0.c",
146 ]
147
148 if (current_os != "fuchsia") {
149 builtins_sources += [ "clear_cache.c" ]
150 }
151
152 if (current_os != "fuchsia" && current_os != "baremetal") {
153 builtins_sources += [
154 "emutls.c",
155 "enable_execute_stack.c",
156 "eprintf.c",
157 ]
158 }
159
160 if (current_os == "mac" || current_os == "ios") {
161 builtins_sources += [
162 "atomic_flag_clear.c",
163 "atomic_flag_clear_explicit.c",
164 "atomic_flag_test_and_set.c",
165 "atomic_flag_test_and_set_explicit.c",
166 "atomic_signal_fence.c",
167 "atomic_thread_fence.c",
168 ]
169 }
170
171 if ((current_cpu == "x64" && current_os != "win") || current_cpu == "arm64") {
172 # GENERIC_TF_SOURCES
173 builtins_sources += [
174 "addtf3.c",
175 "comparetf2.c",
176 "divtc3.c",
177 "divtf3.c",
178 "extenddftf2.c",
179 "extendhftf2.c",
180 "extendsftf2.c",
181 "fixtfdi.c",
182 "fixtfsi.c",
183 "fixtfti.c",
184 "fixunstfdi.c",
185 "fixunstfsi.c",
186 "fixunstfti.c",
187 "floatditf.c",
188 "floatsitf.c",
189 "floattitf.c",
190 "floatunditf.c",
191 "floatunsitf.c",
192 "floatuntitf.c",
193 "multc3.c",
194 "multf3.c",
195 "powitf2.c",
196 "subtf3.c",
197 "trunctfdf2.c",
198 "trunctfhf2.c",
199 "trunctfsf2.c",
200 ]
201 }
202
203 if (current_cpu == "x86" || current_cpu == "x64") {
204 builtins_sources -= [ "fp_mode.c" ]
205 builtins_sources += [
206 "cpu_model/x86.c",
207 "extendbfsf2.c",
208 "i386/fp_mode.c",
209 "truncdfbf2.c",
210 "truncsfbf2.c",
211 "trunctfbf2.c",
212 "truncxfbf2.c",
213 ]
214 if (long_double_is_80_bits) {
215 builtins_sources += [
216 "divxc3.c",
217 "extendhfxf2.c",
218 "extendxftf2.c",
219 "fixunsxfdi.c",
220 "fixunsxfsi.c",
221 "fixunsxfti.c",
222 "fixxfdi.c",
223 "fixxfti.c",
224 "floatdixf.c",
225 "floattixf.c",
226 "floatundixf.c",
227 "floatuntixf.c",
228 "mulxc3.c",
229 "powixf2.c",
230 "trunctfxf2.c",
231 "truncxfhf2.c",
232 ]
233 }
234 }
235 if (current_cpu == "x86") {
236 builtins_sources -= [
237 "ashldi3.c",
238 "ashrdi3.c",
239 "divdi3.c",
240 "floatdidf.c",
241 "floatdisf.c",
242 "floatundidf.c",
243 "floatundisf.c",
244 "lshrdi3.c",
245 "moddi3.c",
246 "muldi3.c",
247 "udivdi3.c",
248 "umoddi3.c",
249 ]
250 builtins_sources += [
251 "i386/ashldi3.S",
252 "i386/ashrdi3.S",
253 "i386/divdi3.S",
254 "i386/floatdidf.S",
255 "i386/floatdisf.S",
256 "i386/floatundidf.S",
257 "i386/floatundisf.S",
258 "i386/lshrdi3.S",
259 "i386/moddi3.S",
260 "i386/muldi3.S",
261 "i386/udivdi3.S",
262 "i386/umoddi3.S",
263 ]
264 if (long_double_is_80_bits) {
265 builtins_sources -= [
266 "floatdixf.c",
267 "floatundixf.c",
268 ]
269 builtins_sources += [
270 "i386/floatdixf.S",
271 "i386/floatundixf.S",
272 ]
273 }
274 if (current_os == "win") {
275 builtins_sources += [ "i386/chkstk.S" ]
276 }
277 } else if (current_cpu == "x64") {
278 builtins_sources -= [
279 "floatdidf.c",
280 "floatdisf.c",
281 "floatundidf.c",
282 "floatundisf.c",
283 ]
284 builtins_sources += [
285 "x86_64/floatdidf.c",
286 "x86_64/floatdisf.c",
287 "x86_64/floatundidf.S",
288 "x86_64/floatundisf.S",
289 ]
290 if (long_double_is_80_bits) {
291 builtins_sources -= [
292 "floatdixf.c",
293 "floatundixf.c",
294 ]
295 builtins_sources += [
296 "x86_64/floatdixf.c",
297 "x86_64/floatundixf.S",
298 ]
299 }
300 if (current_os == "win") {
301 builtins_sources += [ "x86_64/chkstk.S" ]
302 }
303 }
304
305 if (current_cpu == "arm") {
306 if (current_os != "mingw") {
307 builtins_sources -= [
308 "bswapdi2.c",
309 "bswapsi2.c",
310 "clzdi2.c",
311 "clzsi2.c",
312 "comparesf2.c",
313 "divmodsi4.c",
314 "divsi3.c",
315 "fp_mode.c",
316 "modsi3.c",
317 "udivmodsi4.c",
318 "udivsi3.c",
319 "umodsi3.c",
320 ]
321 builtins_sources += [
322 "arm/aeabi_cdcmp.S",
323 "arm/aeabi_cdcmpeq_check_nan.c",
324 "arm/aeabi_cfcmp.S",
325 "arm/aeabi_cfcmpeq_check_nan.c",
326 "arm/aeabi_dcmp.S",
327 "arm/aeabi_div0.c",
328 "arm/aeabi_drsub.c",
329 "arm/aeabi_fcmp.S",
330 "arm/aeabi_frsub.c",
331 "arm/aeabi_idivmod.S",
332 "arm/aeabi_ldivmod.S",
333 "arm/aeabi_memcmp.S",
334 "arm/aeabi_memcpy.S",
335 "arm/aeabi_memmove.S",
336 "arm/aeabi_memset.S",
337 "arm/aeabi_uidivmod.S",
338 "arm/aeabi_uldivmod.S",
339 "arm/bswapdi2.S",
340 "arm/bswapsi2.S",
341 "arm/clzdi2.S",
342 "arm/clzsi2.S",
343 "arm/comparesf2.S",
344 "arm/divmodsi4.S",
345 "arm/divsi3.S",
346 "arm/fp_mode.c",
347 "arm/modsi3.S",
348 "arm/switch16.S",
349 "arm/switch32.S",
350 "arm/switch8.S",
351 "arm/switchu8.S",
352 "arm/sync_fetch_and_add_4.S",
353 "arm/sync_fetch_and_add_8.S",
354 "arm/sync_fetch_and_and_4.S",
355 "arm/sync_fetch_and_and_8.S",
356 "arm/sync_fetch_and_max_4.S",
357 "arm/sync_fetch_and_max_8.S",
358 "arm/sync_fetch_and_min_4.S",
359 "arm/sync_fetch_and_min_8.S",
360 "arm/sync_fetch_and_nand_4.S",
361 "arm/sync_fetch_and_nand_8.S",
362 "arm/sync_fetch_and_or_4.S",
363 "arm/sync_fetch_and_or_8.S",
364 "arm/sync_fetch_and_sub_4.S",
365 "arm/sync_fetch_and_sub_8.S",
366 "arm/sync_fetch_and_umax_4.S",
367 "arm/sync_fetch_and_umax_8.S",
368 "arm/sync_fetch_and_umin_4.S",
369 "arm/sync_fetch_and_umin_8.S",
370 "arm/sync_fetch_and_xor_4.S",
371 "arm/sync_fetch_and_xor_8.S",
372 "arm/sync_synchronize.S",
373 "arm/udivmodsi4.S",
374 "arm/udivsi3.S",
375 "arm/umodsi3.S",
376 ]
377
378 if (current_os == "android") {
379 builtins_sources += [
380 "arm/adddf3vfp.S",
381 "arm/addsf3vfp.S",
382 "arm/divdf3vfp.S",
383 "arm/divsf3vfp.S",
384 "arm/eqdf2vfp.S",
385 "arm/eqsf2vfp.S",
386 "arm/extendsfdf2vfp.S",
387 "arm/fixdfsivfp.S",
388 "arm/fixsfsivfp.S",
389 "arm/fixunsdfsivfp.S",
390 "arm/fixunssfsivfp.S",
391 "arm/floatsidfvfp.S",
392 "arm/floatsisfvfp.S",
393 "arm/floatunssidfvfp.S",
394 "arm/floatunssisfvfp.S",
395 "arm/gedf2vfp.S",
396 "arm/gesf2vfp.S",
397 "arm/gtdf2vfp.S",
398 "arm/gtsf2vfp.S",
399 "arm/ledf2vfp.S",
400 "arm/lesf2vfp.S",
401 "arm/ltdf2vfp.S",
402 "arm/ltsf2vfp.S",
403 "arm/muldf3vfp.S",
404 "arm/mulsf3vfp.S",
405 "arm/nedf2vfp.S",
406 "arm/negdf2vfp.S",
407 "arm/negsf2vfp.S",
408 "arm/nesf2vfp.S",
409 "arm/restore_vfp_d8_d15_regs.S",
410 "arm/save_vfp_d8_d15_regs.S",
411 "arm/subdf3vfp.S",
412 "arm/subsf3vfp.S",
413 "arm/truncdfsf2vfp.S",
414 "arm/unorddf2vfp.S",
415 "arm/unordsf2vfp.S",
416 ]
417 }
418 } else {
419 builtins_sources += [
420 "arm/aeabi_idivmod.S",
421 "arm/aeabi_ldivmod.S",
422 "arm/aeabi_uidivmod.S",
423 "arm/aeabi_uldivmod.S",
424 "arm/chkstk.S",
425 ]
426 }
427 }
428
429 if (current_cpu == "arm64") {
430 builtins_sources -= [ "fp_mode.c" ]
431 builtins_sources += [
432 "aarch64/emupac.cpp",
433 "aarch64/fp_mode.c",
434 "cpu_model/aarch64.c",
435 ]
436 if (current_os == "mingw") {
437 builtins_sources += [ "aarch64/chkstk.S" ]
438 }
439 }
440
441 if (current_cpu == "avr") {
442 builtins_sources += [
443 "avr/divmodhi4.S",
444 "avr/divmodqi4.S",
445 "avr/exit.S",
446 "avr/mulhi3.S",
447 "avr/mulqi3.S",
448 "avr/udivmodhi4.S",
449 "avr/udivmodqi4.S",
450 ]
451 }
452
453 if (current_cpu == "hexagon") {
454 builtins_sources += [
455 "hexagon/common_entry_exit_abi1.S",
456 "hexagon/common_entry_exit_abi2.S",
457 "hexagon/common_entry_exit_legacy.S",
458 "hexagon/dfaddsub.S",
459 "hexagon/dfdiv.S",
460 "hexagon/dffma.S",
461 "hexagon/dfminmax.S",
462 "hexagon/dfmul.S",
463 "hexagon/dfsqrt.S",
464 "hexagon/divdi3.S",
465 "hexagon/divsi3.S",
466 "hexagon/fastmath2_dlib_asm.S",
467 "hexagon/fastmath2_ldlib_asm.S",
468 "hexagon/fastmath_dlib_asm.S",
469 "hexagon/memcpy_forward_vp4cp4n2.S",
470 "hexagon/memcpy_likely_aligned.S",
471 "hexagon/moddi3.S",
472 "hexagon/modsi3.S",
473 "hexagon/sfdiv_opt.S",
474 "hexagon/sfsqrt_opt.S",
475 "hexagon/udivdi3.S",
476 "hexagon/udivmoddi4.S",
477 "hexagon/udivmodsi4.S",
478 "hexagon/udivsi3.S",
479 "hexagon/umoddi3.S",
480 "hexagon/umodsi3.S",
481 ]
482 }
483 if (current_cpu == "loongarch" || current_cpu == "loongarch64") {
484 builtins_sources -= [ "fp_mode.c" ]
485 builtins_sources += [ "loongarch/fp_mode.c" ]
486 }
487
488 if (current_cpu == "ppc64") {
489 builtins_sources += [
490 "ppc/divtc3.c",
491 "ppc/fixtfdi.c",
492 "ppc/fixtfti.c",
493 "ppc/fixunstfdi.c",
494 "ppc/fixunstfti.c",
495 "ppc/floatditf.c",
496 "ppc/floattitf.c",
497 "ppc/floatunditf.c",
498 "ppc/gcc_qadd.c",
499 "ppc/gcc_qdiv.c",
500 "ppc/gcc_qmul.c",
501 "ppc/gcc_qsub.c",
502 "ppc/multc3.c",
503 ]
504 }
505
506 if (current_cpu == "riscv" || current_cpu == "riscv64") {
507 builtins_sources += [
508 "cpu_model/riscv.c",
509 "riscv/fp_mode.c",
510 "riscv/restore.S",
511 "riscv/save.S",
512 ]
513 }
514 if (current_cpu == "riscv") {
515 builtins_sources += [ "riscv/mulsi3.S" ]
516 }
517
518 if (current_cpu == "riscv64") {
519 builtins_sources += [ "riscv/muldi3.S" ]
520 }
521
522 if (current_cpu == "ve") {
523 builtins_sources += [
524 "ve/grow_stack.S",
525 "ve/grow_stack_align.S",
526 ]
527 }
528
529 if (!compiler_rt_exclude_atomic_builtin) {
530 builtins_sources += [ "atomic.c" ]
531 }