Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / cmake / crt-config-ix.cmake
blobebc7d671e74ee6593cb7338f55a25cda6a8c1813
1 include(BuiltinTests)
2 include(CheckCSourceCompiles)
4 # Make all the tests only check the compiler
5 set(TEST_COMPILE_ONLY On)
7 builtin_check_c_compiler_flag(-fPIC                 COMPILER_RT_HAS_FPIC_FLAG)
8 builtin_check_c_compiler_flag(-std=c11              COMPILER_RT_HAS_STD_C11_FLAG)
9 builtin_check_c_compiler_flag(-Wno-pedantic         COMPILER_RT_HAS_WNO_PEDANTIC)
10 builtin_check_c_compiler_flag(-fno-lto              COMPILER_RT_HAS_FNO_LTO_FLAG)
11 builtin_check_c_compiler_flag(-fno-profile-generate COMPILER_RT_HAS_FNO_PROFILE_GENERATE_FLAG)
12 builtin_check_c_compiler_flag(-fno-profile-instr-generate COMPILER_RT_HAS_FNO_PROFILE_INSTR_GENERATE_FLAG)
13 builtin_check_c_compiler_flag(-fno-profile-instr-use COMPILER_RT_HAS_FNO_PROFILE_INSTR_USE_FLAG)
15 if(ANDROID)
16   set(OS_NAME "Android")
17 else()
18   set(OS_NAME "${CMAKE_SYSTEM_NAME}")
19 endif()
21 set(ARM64 aarch64)
22 set(ARM32 arm armhf)
23 set(HEXAGON hexagon)
24 set(X86 i386)
25 set(X86_64 x86_64)
26 set(LOONGARCH64 loongarch64)
27 set(MIPS32 mips mipsel)
28 set(MIPS64 mips64 mips64el)
29 set(PPC32 powerpc powerpcspe)
30 set(PPC64 powerpc64 powerpc64le)
31 set(RISCV32 riscv32)
32 set(RISCV64 riscv64)
33 set(VE ve)
35 set(ALL_CRT_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${PPC32}
36     ${PPC64} ${RISCV32} ${RISCV64} ${VE} ${HEXAGON} ${LOONGARCH64}
37     ${MIPS32} ${MIPS64} ${SPARC} ${SPARCV9})
39 include(CompilerRTUtils)
41 if(NOT APPLE)
42   if(COMPILER_RT_CRT_STANDALONE_BUILD)
43     test_targets()
44   endif()
45   # Architectures supported by compiler-rt crt library.
46   filter_available_targets(CRT_SUPPORTED_ARCH ${ALL_CRT_SUPPORTED_ARCH})
47   message(STATUS "Supported architectures for crt: ${CRT_SUPPORTED_ARCH}")
48 endif()
50 if (CRT_SUPPORTED_ARCH AND OS_NAME MATCHES "Linux|SerenityOS" AND NOT LLVM_USE_SANITIZER)
51   set(COMPILER_RT_HAS_CRT TRUE)
52 else()
53   set(COMPILER_RT_HAS_CRT FALSE)
54 endif()