1 # core_files list contains the headers shared by all platforms.
2 # Please consider adding new platform specific headers
3 # to platform specific lists below.
16 __stddef_max_align_t.h
25 # Headers shared by Arm and AArch64
34 set(aarch64_only_files
39 __clang_cuda_builtin_vars.h
42 __clang_cuda_complex_builtins.h
43 __clang_cuda_device_functions.h
44 __clang_cuda_intrinsics.h
45 __clang_cuda_texture_intrinsics.h
46 __clang_cuda_libdevice_declares.h
47 __clang_cuda_math_forward_declares.h
48 __clang_cuda_runtime_wrapper.h
52 hexagon_circ_brev_intrinsics.h
59 __clang_hip_libdevice_declares.h
62 __clang_hip_runtime_wrapper.h
67 hlsl/hlsl_basic_types.h
68 hlsl/hlsl_intrinsics.h
100 set(webassembly_files
125 avx512vlbitalgintrin.h
131 avx512vlvbmi2intrin.h
133 avx512vlvp2intersectintrin.h
135 avx512vp2intersectintrin.h
136 avx512vpopcntdqintrin.h
137 avx512vpopcntdqvlintrin.h
205 set(windows_only_files
218 ${aarch64_only_files}
231 ${windows_only_files}
235 set(cuda_wrapper_files
236 cuda_wrappers/algorithm
237 cuda_wrappers/complex
241 set(ppc_wrapper_files
242 ppc_wrappers/mmintrin.h
243 ppc_wrappers/xmmintrin.h
244 ppc_wrappers/mm_malloc.h
245 ppc_wrappers/emmintrin.h
246 ppc_wrappers/pmmintrin.h
247 ppc_wrappers/tmmintrin.h
248 ppc_wrappers/smmintrin.h
249 ppc_wrappers/bmiintrin.h
250 ppc_wrappers/bmi2intrin.h
251 ppc_wrappers/immintrin.h
252 ppc_wrappers/x86intrin.h
253 ppc_wrappers/x86gprintrin.h
256 set(openmp_wrapper_files
257 openmp_wrappers/math.h
258 openmp_wrappers/cmath
259 openmp_wrappers/complex.h
260 openmp_wrappers/complex
261 openmp_wrappers/__clang_openmp_device_functions.h
262 openmp_wrappers/complex_cmath.h
266 set(output_dir ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}/include)
270 set(arm_common_generated_files)
271 set(arm_only_generated_files)
272 set(aarch64_only_generated_files)
273 set(riscv_generated_files)
275 function(copy_header_to_output_dir src_dir file)
276 set(src ${src_dir}/${file})
277 set(dst ${output_dir}/${file})
278 add_custom_command(OUTPUT ${dst}
280 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
281 COMMENT "Copying clang's ${file}...")
282 list(APPEND out_files ${dst})
283 set(out_files ${out_files} PARENT_SCOPE)
284 endfunction(copy_header_to_output_dir)
286 function(clang_generate_header td_option td_file out_file)
287 clang_tablegen(${out_file} ${td_option}
288 -I ${CLANG_SOURCE_DIR}/include/clang/Basic/
289 SOURCE ${CLANG_SOURCE_DIR}/include/clang/Basic/${td_file})
291 copy_header_to_output_dir(${CMAKE_CURRENT_BINARY_DIR} ${out_file})
292 set(out_files ${out_files} PARENT_SCOPE)
293 list(APPEND generated_files "${CMAKE_CURRENT_BINARY_DIR}/${out_file}")
294 set(generated_files ${generated_files} PARENT_SCOPE)
295 endfunction(clang_generate_header)
298 # Copy header files from the source directory to the build directory
299 foreach( f ${files} ${cuda_wrapper_files} ${ppc_wrapper_files} ${openmp_wrapper_files})
300 copy_header_to_output_dir(${CMAKE_CURRENT_SOURCE_DIR} ${f})
303 # Generate header files and copy them to the build directory
304 if(ARM IN_LIST LLVM_TARGETS_TO_BUILD OR AArch64 IN_LIST LLVM_TARGETS_TO_BUILD)
305 # Generate arm_neon.h
306 clang_generate_header(-gen-arm-neon arm_neon.td arm_neon.h)
307 # Generate arm_fp16.h
308 clang_generate_header(-gen-arm-fp16 arm_fp16.td arm_fp16.h)
310 clang_generate_header(-gen-arm-sve-header arm_sve.td arm_sve.h)
311 # Generate arm_bf16.h
312 clang_generate_header(-gen-arm-bf16 arm_bf16.td arm_bf16.h)
314 clang_generate_header(-gen-arm-mve-header arm_mve.td arm_mve.h)
316 clang_generate_header(-gen-arm-cde-header arm_cde.td arm_cde.h)
317 # Copy arm_neon_sve_bridge.h
318 copy_header_to_output_dir(${CMAKE_CURRENT_SOURCE_DIR}
319 arm_neon_sve_bridge.h
322 # Add headers to target specific lists
323 list(APPEND arm_common_generated_files
324 "${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h"
325 "${CMAKE_CURRENT_BINARY_DIR}/arm_fp16.h"
328 list(APPEND arm_only_generated_files
329 "${CMAKE_CURRENT_BINARY_DIR}/arm_mve.h"
330 "${CMAKE_CURRENT_BINARY_DIR}/arm_cde.h"
333 list(APPEND aarch64_only_generated_files
334 "${CMAKE_CURRENT_BINARY_DIR}/arm_sve.h"
335 "${CMAKE_CURRENT_BINARY_DIR}/arm_bf16.h"
336 "${output_dir}/arm_neon_sve_bridge.h"
339 if(RISCV IN_LIST LLVM_TARGETS_TO_BUILD)
340 # Generate riscv_vector.h
341 clang_generate_header(-gen-riscv-vector-header riscv_vector.td riscv_vector.h)
342 list(APPEND riscv_generated_files
343 "${CMAKE_CURRENT_BINARY_DIR}/riscv_vector.h"
348 # Check if the generated headers are included in a target specific lists
349 # Currently, all generated headers are target specific.
350 set(all_target_specific_generated_files
351 ${arm_common_generated_files}
352 ${arm_only_generated_files}
353 ${aarch64_only_generated_files}
354 ${riscv_generated_files})
355 foreach( f ${generated_files} )
356 if (NOT ${f} IN_LIST all_target_specific_generated_files)
357 message(WARNING "${f} is a generated header but it is not included in any "
358 "target specific header lists! The resource-headers "
359 "distribtion target will be incorrect!")
363 function(add_header_target target_name file_list)
364 add_custom_target(${target_name} DEPENDS ${file_list})
365 set_target_properties(${target_name} PROPERTIES
367 RUNTIME_OUTPUT_DIRECTORY "${output_dir}")
370 # The catch-all clang-resource-headers target
371 add_custom_target("clang-resource-headers" ALL DEPENDS ${out_files})
372 set_target_properties("clang-resource-headers" PROPERTIES
374 RUNTIME_OUTPUT_DIRECTORY "${output_dir}")
375 add_dependencies("clang-resource-headers"
376 "core-resource-headers"
377 "arm-common-resource-headers"
378 "arm-resource-headers"
379 "aarch64-resource-headers"
380 "cuda-resource-headers"
381 "hexagon-resource-headers"
382 "hip-resource-headers"
383 "hlsl-resource-headers"
384 "mips-resource-headers"
385 "ppc-resource-headers"
386 "ppc-htm-resource-headers"
387 "riscv-resource-headers"
388 "systemz-resource-headers"
389 "ve-resource-headers"
390 "webassembly-resource-headers"
391 "x86-resource-headers"
392 "opencl-resource-headers"
393 "openmp-resource-headers"
394 "windows-resource-headers"
395 "utility-resource-headers")
397 # Core/common headers
398 add_header_target("core-resource-headers" ${core_files})
399 add_header_target("arm-common-resource-headers" "${arm_common_files};${arm_common_generated_files}")
401 # Architecture/platform specific targets
402 add_header_target("arm-resource-headers" "${arm_only_files};${arm_only_generated_files}")
403 add_header_target("aarch64-resource-headers" "${aarch64_only_files};${aarch64_only_generated_files}")
404 add_header_target("cuda-resource-headers" "${cuda_files};${cuda_wrapper_files}")
405 add_header_target("hexagon-resource-headers" "${hexagon_files}")
406 add_header_target("hip-resource-headers" "${hip_files}")
407 add_header_target("mips-resource-headers" "${mips_msa_files}")
408 add_header_target("ppc-resource-headers" "${ppc_files};${ppc_wrapper_files}")
409 add_header_target("ppc-htm-resource-headers" "${ppc_htm_files}")
410 add_header_target("riscv-resource-headers" "${riscv_generated_files}")
411 add_header_target("systemz-resource-headers" "${systemz_files}")
412 add_header_target("ve-resource-headers" "${ve_files}")
413 add_header_target("webassembly-resource-headers" "${webassembly_files}")
414 add_header_target("x86-resource-headers" "${x86_files}")
416 # Other header groupings
417 add_header_target("hlsl-resource-headers" ${hlsl_files})
418 add_header_target("opencl-resource-headers" ${opencl_files})
419 add_header_target("openmp-resource-headers" ${openmp_wrapper_files})
420 add_header_target("windows-resource-headers" ${windows_only_files})
421 add_header_target("utility-resource-headers" ${utility_files})
423 set(header_install_dir lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
425 #############################################################
426 # Install rules for the catch-all clang-resource-headers target
428 FILES ${files} ${generated_files}
429 DESTINATION ${header_install_dir}
430 COMPONENT clang-resource-headers)
433 FILES ${cuda_wrapper_files}
434 DESTINATION ${header_install_dir}/cuda_wrappers
435 COMPONENT clang-resource-headers)
438 FILES ${ppc_wrapper_files}
439 DESTINATION ${header_install_dir}/ppc_wrappers
440 COMPONENT clang-resource-headers)
443 FILES ${openmp_wrapper_files}
444 DESTINATION ${header_install_dir}/openmp_wrappers
445 COMPONENT clang-resource-headers)
447 #############################################################
448 # Install rules for separate header lists
451 DESTINATION ${header_install_dir}
453 COMPONENT core-resource-headers)
456 FILES ${arm_common_files} ${arm_common_generated_files}
457 DESTINATION ${header_install_dir}
459 COMPONENT arm-common-resource-headers)
462 FILES ${arm_only_files} ${arm_only_generated_files}
463 DESTINATION ${header_install_dir}
465 COMPONENT arm-resource-headers)
468 FILES ${aarch64_only_files} ${aarch64_only_generated_files}
469 DESTINATION ${header_install_dir}
471 COMPONENT aarch64-resource-headers)
474 FILES ${cuda_wrapper_files}
475 DESTINATION ${header_install_dir}/cuda_wrappers
477 COMPONENT cuda-resource-headers)
481 DESTINATION ${header_install_dir}
483 COMPONENT cuda-resource-headers)
486 FILES ${hexagon_files}
487 DESTINATION ${header_install_dir}
489 COMPONENT hexagon-resource-headers)
493 DESTINATION ${header_install_dir}
495 COMPONENT hip-resource-headers)
498 FILES ${mips_msa_files}
499 DESTINATION ${header_install_dir}
501 COMPONENT mips-resource-headers)
504 FILES ${ppc_wrapper_files}
505 DESTINATION ${header_install_dir}/ppc_wrappers
507 COMPONENT ppc-resource-headers)
511 DESTINATION ${header_install_dir}
513 COMPONENT ppc-resource-headers)
516 FILES ${ppc_htm_files}
517 DESTINATION ${header_install_dir}
519 COMPONENT ppc-htm-resource-headers)
522 FILES ${riscv_generated_files}
523 DESTINATION ${header_install_dir}
525 COMPONENT riscv-resource-headers)
528 FILES ${systemz_files}
529 DESTINATION ${header_install_dir}
531 COMPONENT systemz-resource-headers)
535 DESTINATION ${header_install_dir}
537 COMPONENT ve-resource-headers)
540 FILES ${webassembly_files}
541 DESTINATION ${header_install_dir}
543 COMPONENT webassembly-resource-headers)
547 DESTINATION ${header_install_dir}
549 COMPONENT x86-resource-headers)
553 DESTINATION ${header_install_dir}
555 COMPONENT hlsl-resource-headers)
558 FILES ${opencl_files}
559 DESTINATION ${header_install_dir}
561 COMPONENT opencl-resource-headers)
564 FILES ${openmp_wrapper_files}
565 DESTINATION ${header_install_dir}/openmp_wrappers
567 COMPONENT openmp-resource-headers)
570 FILES ${utility_files}
571 DESTINATION ${header_install_dir}
573 COMPONENT utility-resource-headers)
576 FILES ${windows_only_files}
577 DESTINATION ${header_install_dir}
579 COMPONENT windows-resource-headers)
580 #############################################################
582 if (NOT LLVM_ENABLE_IDE)
583 add_llvm_install_targets(install-clang-resource-headers
584 DEPENDS clang-resource-headers
585 COMPONENT clang-resource-headers)
587 add_llvm_install_targets(install-core-resource-headers
588 DEPENDS core-resource-headers
589 COMPONENT core-resource-headers)
590 add_llvm_install_targets(install-arm-common-resource-headers
591 DEPENDS arm-common-resource-headers
592 COMPONENT arm-common-resource-headers)
593 add_llvm_install_targets(install-arm-resource-headers
594 DEPENDS arm-resource-headers
595 COMPONENT arm-resource-headers)
596 add_llvm_install_targets(install-aarch64-resource-headers
597 DEPENDS aarch64-resource-headers
598 COMPONENT aarch64-resource-headers)
599 add_llvm_install_targets(install-cuda-resource-headers
600 DEPENDS cuda-resource-headers
601 COMPONENT cuda-resource-headers)
602 add_llvm_install_targets(install-hexagon-resource-headers
603 DEPENDS hexagon-resource-headers
604 COMPONENT hexagon-resource-headers)
605 add_llvm_install_targets(install-hip-resource-headers
606 DEPENDS hip-resource-headers
607 COMPONENT hip-resource-headers)
608 add_llvm_install_targets(install-mips-resource-headers
609 DEPENDS mips-resource-headers
610 COMPONENT mips-resource-headers)
611 add_llvm_install_targets(install-ppc-resource-headers
612 DEPENDS ppc-resource-headers
613 COMPONENT ppc-resource-headers)
614 add_llvm_install_targets(install-ppc-htm-resource-headers
615 DEPENDS ppc-htm-resource-headers
616 COMPONENT ppc-htm-resource-headers)
617 add_llvm_install_targets(install-riscv-resource-headers
618 DEPENDS riscv-resource-headers
619 COMPONENT riscv-resource-headers)
620 add_llvm_install_targets(install-systemz-resource-headers
621 DEPENDS systemz-resource-headers
622 COMPONENT systemz-resource-headers)
623 add_llvm_install_targets(install-ve-resource-headers
624 DEPENDS ve-resource-headers
625 COMPONENT ve-resource-headers)
626 add_llvm_install_targets(install-x86-resource-headers
627 DEPENDS x86-resource-headers
628 COMPONENT x86-resource-headers)
629 add_llvm_install_targets(install-webassembly-resource-headers
630 DEPENDS webassembly-resource-headers
631 COMPONENT webassembly-resource-headers)
633 add_llvm_install_targets(install-hlsl-resource-headers
634 DEPENDS hlsl-resource-headers
635 COMPONENT hlsl-resource-headers)
636 add_llvm_install_targets(install-opencl-resource-headers
637 DEPENDS opencl-resource-headers
638 COMPONENT opencl-resource-headers)
639 add_llvm_install_targets(install-openmp-resource-headers
640 DEPENDS openmp-resource-headers
641 COMPONENT openmp-resource-headers)
642 add_llvm_install_targets(install-windows-resource-headers
643 DEPENDS windows-resource-headers
644 COMPONENT windows-resource-headers)
645 add_llvm_install_targets(install-utility-resource-headers
646 DEPENDS utility-resource-headers
647 COMPONENT utility-resource-headers)