[AMDGPU] Make v8i16/v8f16 legal
[llvm-project.git] / utils / bazel / llvm-project-overlay / llvm / config.bzl
blob2046b2645362f25e50c3b95e7beb6c57165ef0ac
1 # This file is licensed under the Apache License v2.0 with LLVM Exceptions.
2 # See https://llvm.org/LICENSE.txt for license information.
3 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5 """Defines variables that use selects to configure LLVM based on platform."""
7 def native_arch_defines(arch, triple):
8     return [
9         r'LLVM_NATIVE_ARCH=\"{}\"'.format(arch),
10         "LLVM_NATIVE_ASMPARSER=LLVMInitialize{}AsmParser".format(arch),
11         "LLVM_NATIVE_ASMPRINTER=LLVMInitialize{}AsmPrinter".format(arch),
12         "LLVM_NATIVE_DISASSEMBLER=LLVMInitialize{}Disassembler".format(arch),
13         "LLVM_NATIVE_TARGET=LLVMInitialize{}Target".format(arch),
14         "LLVM_NATIVE_TARGETINFO=LLVMInitialize{}TargetInfo".format(arch),
15         "LLVM_NATIVE_TARGETMC=LLVMInitialize{}TargetMC".format(arch),
16         "LLVM_NATIVE_TARGETMCA=LLVMInitialize{}TargetMCA".format(arch),
17         r'LLVM_HOST_TRIPLE=\"{}\"'.format(triple),
18         r'LLVM_DEFAULT_TARGET_TRIPLE=\"{}\"'.format(triple),
19     ]
21 posix_defines = [
22     "LLVM_ON_UNIX=1",
23     "HAVE_BACKTRACE=1",
24     "BACKTRACE_HEADER=<execinfo.h>",
25     r'LTDL_SHLIB_EXT=\".so\"',
26     r'LLVM_PLUGIN_EXT=\".so\"',
27     "LLVM_ENABLE_THREADS=1",
28     "HAVE_DEREGISTER_FRAME=1",
29     "HAVE_LIBPTHREAD=1",
30     "HAVE_PTHREAD_GETNAME_NP=1",
31     "HAVE_PTHREAD_GETSPECIFIC=1",
32     "HAVE_PTHREAD_H=1",
33     "HAVE_PTHREAD_SETNAME_NP=1",
34     "HAVE_REGISTER_FRAME=1",
35     "HAVE_SETENV_R=1",
36     "HAVE_STRERROR_R=1",
37     "HAVE_SYSEXITS_H=1",
38     "HAVE_UNISTD_H=1",
41 linux_defines = posix_defines + [
42     "_GNU_SOURCE",
43     "HAVE_LINK_H=1",
44     "HAVE_LSEEK64=1",
45     "HAVE_MALLINFO=1",
46     "HAVE_SBRK=1",
47     "HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC=1",
50 macos_defines = posix_defines + [
51     "HAVE_MACH_MACH_H=1",
52     "HAVE_MALLOC_MALLOC_H=1",
53     "HAVE_MALLOC_ZONE_STATISTICS=1",
54     "HAVE_PROC_PID_RUSAGE=1",
55     "HAVE_UNW_ADD_DYNAMIC_FDE=1",
58 win32_defines = [
59     # Windows system library specific defines.
60     "_CRT_SECURE_NO_DEPRECATE",
61     "_CRT_SECURE_NO_WARNINGS",
62     "_CRT_NONSTDC_NO_DEPRECATE",
63     "_CRT_NONSTDC_NO_WARNINGS",
64     "_SCL_SECURE_NO_DEPRECATE",
65     "_SCL_SECURE_NO_WARNINGS",
66     "UNICODE",
67     "_UNICODE",
69     # LLVM features
70     r'LTDL_SHLIB_EXT=\".dll\"',
71     r'LLVM_PLUGIN_EXT=\".dll\"',
74 # TODO: We should switch to platforms-based config settings to make this easier
75 # to express.
76 os_defines = select({
77     "@bazel_tools//src/conditions:windows": win32_defines,
78     "@bazel_tools//src/conditions:darwin": macos_defines,
79     "@bazel_tools//src/conditions:freebsd": posix_defines,
80     "//conditions:default": linux_defines,
83 # TODO: We should split out host vs. target here.
84 llvm_config_defines = os_defines + select({
85     "@bazel_tools//src/conditions:windows": native_arch_defines("X86", "x86_64-pc-win32"),
86     "@bazel_tools//src/conditions:darwin_arm64": native_arch_defines("AArch64", "arm64-apple-darwin"),
87     "@bazel_tools//src/conditions:darwin_x86_64": native_arch_defines("X86", "x86_64-unknown-darwin"),
88     "@bazel_tools//src/conditions:linux_aarch64": native_arch_defines("AArch64", "aarch64-unknown-linux-gnu"),
89     "//conditions:default": native_arch_defines("X86", "x86_64-unknown-linux-gnu"),
90 }) + [
91     # These shouldn't be needed by the C++11 standard, but are for some
92     # platforms (e.g. glibc < 2.18. See
93     # https://sourceware.org/bugzilla/show_bug.cgi?id=15366). These are also
94     # included unconditionally in the CMake build:
95     # https://github.com/llvm/llvm-project/blob/cd0dd8ece8e/llvm/cmake/modules/HandleLLVMOptions.cmake#L907-L909
96     "__STDC_LIMIT_MACROS",
97     "__STDC_CONSTANT_MACROS",
98     "__STDC_FORMAT_MACROS",