aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party/llvm
diff options
context:
space:
mode:
authorGravatar Sanjoy Das <sanjoy@google.com>2018-06-27 09:32:33 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-06-27 09:35:30 -0700
commit00d30794b98d13bd341b9da906399123009b9154 (patch)
tree27858dd47cb11a5eddab4b4f14a9e9f8c69a9f0f /third_party/llvm
parent3c121430e66d199e9c56b148482cb598115f8413 (diff)
Move some logic from llvm.autogenerated.BUILD to llvm.bzl
This lets external contributors add or remove compiler flags without having access to the generator script (which isn't open source). E.g. see #18293 PiperOrigin-RevId: 202322000
Diffstat (limited to 'third_party/llvm')
-rw-r--r--third_party/llvm/llvm.autogenerated.BUILD336
-rw-r--r--third_party/llvm/llvm.bzl133
2 files changed, 287 insertions, 182 deletions
diff --git a/third_party/llvm/llvm.autogenerated.BUILD b/third_party/llvm/llvm.autogenerated.BUILD
index 4f645fa260..266c3c3f2c 100644
--- a/third_party/llvm/llvm.autogenerated.BUILD
+++ b/third_party/llvm/llvm.autogenerated.BUILD
@@ -8,10 +8,13 @@ exports_files(["LICENSE.TXT"])
load(
"@org_tensorflow//third_party/llvm:llvm.bzl",
+ "LLVM_COPTS",
+ "LLVM_DEFINES",
+ "LLVM_LINKOPTS",
"cmake_var_string",
"expand_cmake_vars",
"gentbl",
- "llvm_target_cmake_vars",
+ "llvm_all_cmake_vars",
)
load(
"@org_tensorflow//third_party:common.bzl",
@@ -39,147 +42,25 @@ llvm_target_asm_printers = llvm_targets
llvm_target_disassemblers = llvm_targets
-# TODO(phawkins): the set of CMake variables was hardcoded for expediency.
-# However, we should really detect many of these via configure-time tests.
-
-# The set of CMake variables common to all targets.
-cmake_vars = {
- # Headers
- "HAVE_DIRENT_H": 1,
- "HAVE_DLFCN_H": 1,
- "HAVE_ERRNO_H": 1,
- "HAVE_EXECINFO_H": 1,
- "HAVE_FCNTL_H": 1,
- "HAVE_INTTYPES_H": 1,
- "HAVE_PTHREAD_H": 1,
- "HAVE_SIGNAL_H": 1,
- "HAVE_STDINT_H": 1,
- "HAVE_SYS_IOCTL_H": 1,
- "HAVE_SYS_MMAN_H": 1,
- "HAVE_SYS_PARAM_H": 1,
- "HAVE_SYS_RESOURCE_H": 1,
- "HAVE_SYS_STAT_H": 1,
- "HAVE_SYS_TIME_H": 1,
- "HAVE_SYS_TYPES_H": 1,
- "HAVE_TERMIOS_H": 1,
- "HAVE_UNISTD_H": 1,
- "HAVE_ZLIB_H": 1,
-
- # Features
- "HAVE_BACKTRACE": 1,
- "BACKTRACE_HEADER": "execinfo.h",
- "HAVE_DLOPEN": 1,
- "HAVE_FUTIMES": 1,
- "HAVE_GETCWD": 1,
- "HAVE_GETPAGESIZE": 1,
- "HAVE_GETRLIMIT": 1,
- "HAVE_GETRUSAGE": 1,
- "HAVE_GETTIMEOFDAY": 1,
- "HAVE_INT64_T": 1,
- "HAVE_ISATTY": 1,
- "HAVE_LIBEDIT": 1,
- "HAVE_LIBPTHREAD": 1,
- "HAVE_LIBZ": 1,
- "HAVE_MKDTEMP": 1,
- "HAVE_MKSTEMP": 1,
- "HAVE_MKTEMP": 1,
- "HAVE_PREAD": 1,
- "HAVE_PTHREAD_GETSPECIFIC": 1,
- "HAVE_PTHREAD_MUTEX_LOCK": 1,
- "HAVE_PTHREAD_RWLOCK_INIT": 1,
- "HAVE_REALPATH": 1,
- "HAVE_SBRK": 1,
- "HAVE_SETENV": 1,
- "HAVE_SETRLIMIT": 1,
- "HAVE_SIGALTSTACK": 1,
- "HAVE_STRERROR": 1,
- "HAVE_STRERROR_R": 1,
- "HAVE_STRTOLL": 1,
- "HAVE_SYSCONF": 1,
- "HAVE_UINT64_T": 1,
- "HAVE__UNWIND_BACKTRACE": 1,
-
- # LLVM features
- "ENABLE_BACKTRACES": 1,
- "LLVM_BINDIR": "/dev/null",
- "LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING": 0,
- "LLVM_ENABLE_ABI_BREAKING_CHECKS": 0,
- "LLVM_ENABLE_THREADS": 1,
- "LLVM_ENABLE_ZLIB": 1,
- "LLVM_HAS_ATOMICS": 1,
- "LLVM_INCLUDEDIR": "/dev/null",
- "LLVM_INFODIR": "/dev/null",
- "LLVM_MANDIR": "/dev/null",
- "LLVM_NATIVE_TARGET": 1,
- "LLVM_NATIVE_TARGETINFO": 1,
- "LLVM_NATIVE_TARGETMC": 1,
- "LLVM_NATIVE_ASMPRINTER": 1,
- "LLVM_NATIVE_ASMPARSER": 1,
- "LLVM_NATIVE_DISASSEMBLER": 1,
- "LLVM_ON_UNIX": 1,
- "LLVM_PREFIX": "/dev/null",
- "LLVM_VERSION_MAJOR": 0,
- "LLVM_VERSION_MINOR": 0,
- "LLVM_VERSION_PATCH": 0,
- "LTDL_SHLIB_EXT": ".so",
- "PACKAGE_NAME": "llvm",
- "PACKAGE_STRING": "llvm tensorflow-trunk",
- "PACKAGE_VERSION": "tensorflow-trunk",
- "RETSIGTYPE": "void",
-}
-
-# CMake variables specific to the Linux platform
-linux_cmake_vars = {
- "HAVE_MALLOC_H": 1,
- "HAVE_LINK_H": 1,
- "HAVE_MALLINFO": 1,
- "HAVE_FUTIMENS": 1,
-}
-
-# CMake variables specific to the Darwin (Mac OS X) platform.
-darwin_cmake_vars = {
- "HAVE_MALLOC_MALLOC_H": 1,
-}
-
-# Select a set of CMake variables based on the platform.
-# TODO(phawkins): use a better method to select the right host triple, rather
-# than hardcoding x86_64.
-all_cmake_vars = select({
- "@org_tensorflow//tensorflow:darwin": cmake_var_string(
- cmake_vars + llvm_target_cmake_vars("X86", "x86_64-apple-darwin") +
- darwin_cmake_vars,
- ),
- "@org_tensorflow//tensorflow:linux_ppc64le": cmake_var_string(
- cmake_vars +
- llvm_target_cmake_vars("PowerPC", "powerpc64le-unknown-linux_gnu") +
- linux_cmake_vars,
- ),
- "//conditions:default": cmake_var_string(
- cmake_vars +
- llvm_target_cmake_vars("X86", "x86_64-unknown-linux_gnu") +
- linux_cmake_vars,
- ),
-})
-
# Performs CMake variable substitutions on configuration header files.
expand_cmake_vars(
name = "config_gen",
src = "include/llvm/Config/config.h.cmake",
- cmake_vars = all_cmake_vars,
+ cmake_vars = llvm_all_cmake_vars,
dst = "include/llvm/Config/config.h",
)
expand_cmake_vars(
name = "llvm_config_gen",
src = "include/llvm/Config/llvm-config.h.cmake",
- cmake_vars = all_cmake_vars,
+ cmake_vars = llvm_all_cmake_vars,
dst = "include/llvm/Config/llvm-config.h",
)
expand_cmake_vars(
name = "abi_breaking_gen",
src = "include/llvm/Config/abi-breaking.h.cmake",
- cmake_vars = all_cmake_vars,
+ cmake_vars = llvm_all_cmake_vars,
dst = "include/llvm/Config/abi-breaking.h",
)
@@ -240,14 +121,7 @@ cc_library(
"include/llvm/Config/config.h",
"include/llvm/Config/llvm-config.h",
],
- defines = [
- "LLVM_ENABLE_STATS",
- "__STDC_LIMIT_MACROS",
- "__STDC_CONSTANT_MACROS",
- "__STDC_FORMAT_MACROS",
- "_DEBUG",
- "LLVM_BUILD_GLOBAL_ISEL",
- ],
+ defines = LLVM_DEFINES,
includes = ["include"],
)
@@ -313,11 +187,7 @@ cc_binary(
"utils/TableGen/*.cpp",
"utils/TableGen/*.h",
]),
- linkopts = [
- "-lm",
- "-ldl",
- "-lpthread",
- ],
+ linkopts = LLVM_LINKOPTS,
stamp = 0,
deps = [
":config",
@@ -333,11 +203,7 @@ cc_binary(
"utils/FileCheck/*.cpp",
"utils/FileCheck/*.h",
]),
- linkopts = [
- "-ldl",
- "-lm",
- "-lpthread",
- ],
+ linkopts = LLVM_LINKOPTS,
stamp = 0,
deps = [":support"],
)
@@ -508,7 +374,8 @@ cc_library(
"include/llvm/Target/AArch64/AsmParser/*.inc",
"lib/Target/AArch64/AsmParser/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/AArch64"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/AArch64"],
+ defines = LLVM_DEFINES,
deps = [
":aarch64_desc",
":aarch64_info",
@@ -533,7 +400,8 @@ cc_library(
"include/llvm/Target/AArch64/InstPrinter/*.inc",
"lib/Target/AArch64/InstPrinter/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/AArch64"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/AArch64"],
+ defines = LLVM_DEFINES,
deps = [
":aarch64_target_gen",
":aarch64_utils",
@@ -556,7 +424,8 @@ cc_library(
"include/llvm/Target/AArch64/*.inc",
"lib/Target/AArch64/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/AArch64"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/AArch64"],
+ defines = LLVM_DEFINES,
deps = [
":aarch64_asm_printer",
":aarch64_desc",
@@ -589,7 +458,8 @@ cc_library(
"include/llvm/Target/AArch64/MCTargetDesc/*.inc",
"lib/Target/AArch64/MCTargetDesc/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/AArch64"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/AArch64"],
+ defines = LLVM_DEFINES,
deps = [
":aarch64_asm_printer",
":aarch64_info",
@@ -615,7 +485,8 @@ cc_library(
"include/llvm/Target/AArch64/Disassembler/*.inc",
"lib/Target/AArch64/Disassembler/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/AArch64"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/AArch64"],
+ defines = LLVM_DEFINES,
deps = [
":aarch64_desc",
":aarch64_info",
@@ -643,7 +514,8 @@ cc_library(
"lib/Target/AArch64/AArch64*.h",
"lib/Target/AArch64/TargetInfo/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/AArch64"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/AArch64"],
+ defines = LLVM_DEFINES,
deps = [
":code_gen",
":config",
@@ -666,7 +538,8 @@ cc_library(
"include/llvm/Target/AArch64/Utils/*.inc",
"lib/Target/AArch64/Utils/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/AArch64"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/AArch64"],
+ defines = LLVM_DEFINES,
deps = [
":aarch64_target_gen",
":config",
@@ -688,6 +561,8 @@ cc_library(
"include/llvm/Transforms/AggressiveInstCombine/*.def",
"include/llvm/Transforms/AggressiveInstCombine/*.inc",
]),
+ copts = LLVM_COPTS,
+ defines = LLVM_DEFINES,
deps = [
":analysis",
":config",
@@ -712,6 +587,8 @@ cc_library(
"include/llvm/Analysis/*.def",
"include/llvm/Analysis/*.inc",
]),
+ copts = LLVM_COPTS,
+ defines = LLVM_DEFINES,
deps = [
":binary_format",
":config",
@@ -735,7 +612,8 @@ cc_library(
"include/llvm/Target/AMDGPU/MCTargetDesc/*.inc",
"lib/Target/AMDGPU/MCTargetDesc/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/AMDGPU"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/AMDGPU"],
+ defines = LLVM_DEFINES,
deps = [
":amdgpu_asm_printer",
":amdgpu_info",
@@ -760,7 +638,8 @@ cc_library(
"include/llvm/Target/AMDGPU/Disassembler/*.inc",
"lib/Target/AMDGPU/Disassembler/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/AMDGPU"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/AMDGPU"],
+ defines = LLVM_DEFINES,
deps = [
":amdgpu_desc",
":amdgpu_info",
@@ -785,7 +664,8 @@ cc_library(
"include/llvm/Target/AMDGPU/TargetInfo/*.inc",
"lib/Target/AMDGPU/TargetInfo/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/AMDGPU"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/AMDGPU"],
+ defines = LLVM_DEFINES,
deps = [
":amdgpu_target_gen",
":config",
@@ -807,7 +687,8 @@ cc_library(
"include/llvm/Target/AMDGPU/Utils/*.inc",
"lib/Target/AMDGPU/Utils/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/AMDGPU"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/AMDGPU"],
+ defines = LLVM_DEFINES,
deps = [
":amdgpu_target_gen",
":config",
@@ -830,7 +711,8 @@ cc_library(
"include/llvm/Target/AMDGPU/AsmParser/*.inc",
"lib/Target/AMDGPU/AsmParser/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/AMDGPU"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/AMDGPU"],
+ defines = LLVM_DEFINES,
deps = [
":amdgpu_desc",
":amdgpu_info",
@@ -855,7 +737,8 @@ cc_library(
"include/llvm/Target/AMDGPU/InstPrinter/*.inc",
"lib/Target/AMDGPU/InstPrinter/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/AMDGPU"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/AMDGPU"],
+ defines = LLVM_DEFINES,
deps = [
":amdgpu_utils",
":config",
@@ -877,7 +760,8 @@ cc_library(
"include/llvm/Target/AMDGPU/*.inc",
"lib/Target/AMDGPU/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/AMDGPU"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/AMDGPU"],
+ defines = LLVM_DEFINES,
deps = [
":amdgpu_asm_printer",
":amdgpu_desc",
@@ -913,7 +797,8 @@ cc_library(
"include/llvm/Target/ARM/AsmParser/*.inc",
"lib/Target/ARM/AsmParser/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/ARM"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/ARM"],
+ defines = LLVM_DEFINES,
deps = [
":arm_desc",
":arm_info",
@@ -939,7 +824,8 @@ cc_library(
"lib/Target/ARM/*.h",
"lib/Target/ARM/InstPrinter/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/ARM"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/ARM"],
+ defines = LLVM_DEFINES,
deps = [
":arm_info",
":arm_target_gen",
@@ -963,7 +849,8 @@ cc_library(
"include/llvm/Target/ARM/*.inc",
"lib/Target/ARM/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/ARM"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/ARM"],
+ defines = LLVM_DEFINES,
deps = [
":analysis",
":arm_asm_printer",
@@ -998,7 +885,8 @@ cc_library(
"include/llvm/Target/ARM/MCTargetDesc/*.inc",
"lib/Target/ARM/MCTargetDesc/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/ARM"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/ARM"],
+ defines = LLVM_DEFINES,
deps = [
":arm_asm_printer",
":arm_info",
@@ -1025,7 +913,8 @@ cc_library(
"include/llvm/Target/ARM/Disassembler/*.inc",
"lib/Target/ARM/Disassembler/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/ARM"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/ARM"],
+ defines = LLVM_DEFINES,
deps = [
":arm_desc",
":arm_info",
@@ -1050,7 +939,8 @@ cc_library(
"include/llvm/Target/ARM/TargetInfo/*.inc",
"lib/Target/ARM/TargetInfo/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/ARM"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/ARM"],
+ defines = LLVM_DEFINES,
deps = [
":arm_target_gen",
":config",
@@ -1073,7 +963,8 @@ cc_library(
"include/llvm/Target/ARM/Utils/*.inc",
"lib/Target/ARM/Utils/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/ARM"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/ARM"],
+ defines = LLVM_DEFINES,
deps = [
":arm_target_gen",
":config",
@@ -1095,6 +986,8 @@ cc_library(
"include/llvm/AsmParser/*.def",
"include/llvm/AsmParser/*.inc",
]),
+ copts = LLVM_COPTS,
+ defines = LLVM_DEFINES,
deps = [
":binary_format",
":config",
@@ -1117,6 +1010,8 @@ cc_library(
"include/llvm/CodeGen/AsmPrinter/*.inc",
"lib/CodeGen/AsmPrinter/*.def",
]),
+ copts = LLVM_COPTS,
+ defines = LLVM_DEFINES,
deps = [
":analysis",
":binary_format",
@@ -1147,6 +1042,8 @@ cc_library(
"include/llvm/BinaryFormat/ELFRelocs/*.def",
"include/llvm/BinaryFormat/WasmRelocs/*.def",
]),
+ copts = LLVM_COPTS,
+ defines = LLVM_DEFINES,
deps = [
":config",
":support",
@@ -1167,6 +1064,8 @@ cc_library(
"include/llvm/Bitcode/Reader/*.inc",
"include/llvm/Bitcode/BitstreamReader.h",
]),
+ copts = LLVM_COPTS,
+ defines = LLVM_DEFINES,
deps = [
":config",
":core",
@@ -1190,6 +1089,8 @@ cc_library(
"include/llvm/Bitcode/BitcodeWriterPass.h",
"include/llvm/Bitcode/BitstreamWriter.h",
]),
+ copts = LLVM_COPTS,
+ defines = LLVM_DEFINES,
deps = [
":analysis",
":config",
@@ -1214,6 +1115,8 @@ cc_library(
"include/llvm/CodeGen/*.inc",
"include/llvm/CodeGen/**/*.h",
]),
+ copts = LLVM_COPTS,
+ defines = LLVM_DEFINES,
deps = [
":analysis",
":bit_reader",
@@ -1251,6 +1154,8 @@ cc_library(
"include/llvm/*.h",
"include/llvm/Analysis/*.def",
]),
+ copts = LLVM_COPTS,
+ defines = LLVM_DEFINES,
deps = [
":attributes_compat_gen",
":attributes_gen",
@@ -1274,6 +1179,8 @@ cc_library(
"include/llvm/DebugInfo/CodeView/*.def",
"include/llvm/DebugInfo/CodeView/*.inc",
]),
+ copts = LLVM_COPTS,
+ defines = LLVM_DEFINES,
deps = [
":binary_format",
":config",
@@ -1295,6 +1202,8 @@ cc_library(
"include/llvm/DebugInfo/MSF/*.def",
"include/llvm/DebugInfo/MSF/*.inc",
]),
+ copts = LLVM_COPTS,
+ defines = LLVM_DEFINES,
deps = [
":config",
":support",
@@ -1314,6 +1223,8 @@ cc_library(
"include/llvm/Demangle/*.def",
"include/llvm/Demangle/*.inc",
]),
+ copts = LLVM_COPTS,
+ defines = LLVM_DEFINES,
deps = [":config"],
)
@@ -1330,6 +1241,8 @@ cc_library(
"include/llvm/ExecutionEngine/*.def",
"include/llvm/ExecutionEngine/*.inc",
]),
+ copts = LLVM_COPTS,
+ defines = LLVM_DEFINES,
deps = [
":config",
":core",
@@ -1354,6 +1267,8 @@ cc_library(
"include/llvm/CodeGen/GlobalISel/*.def",
"include/llvm/CodeGen/GlobalISel/*.inc",
]),
+ copts = LLVM_COPTS,
+ defines = LLVM_DEFINES,
deps = [
":analysis",
":code_gen",
@@ -1383,6 +1298,8 @@ cc_library(
"include/llvm/Transforms/InstrProfiling.h",
"include/llvm/Transforms/PGOInstrumentation.h",
]),
+ copts = LLVM_COPTS,
+ defines = LLVM_DEFINES,
deps = [
":analysis",
":config",
@@ -1407,6 +1324,8 @@ cc_library(
"include/llvm/Transforms/InstCombine/*.def",
"include/llvm/Transforms/InstCombine/*.inc",
]),
+ copts = LLVM_COPTS,
+ defines = LLVM_DEFINES,
deps = [
":analysis",
":config",
@@ -1433,6 +1352,8 @@ cc_library(
"include/llvm/Transforms/IPO/*.def",
"include/llvm/Transforms/IPO/*.inc",
]),
+ copts = LLVM_COPTS,
+ defines = LLVM_DEFINES,
deps = [
":aggressive_inst_combine",
":analysis",
@@ -1466,6 +1387,8 @@ cc_library(
"include/llvm/IRReader/*.def",
"include/llvm/IRReader/*.inc",
]),
+ copts = LLVM_COPTS,
+ defines = LLVM_DEFINES,
deps = [
":asm_parser",
":bit_reader",
@@ -1488,6 +1411,8 @@ cc_library(
"include/llvm/Linker/*.def",
"include/llvm/Linker/*.inc",
]),
+ copts = LLVM_COPTS,
+ defines = LLVM_DEFINES,
deps = [
":config",
":core",
@@ -1509,6 +1434,8 @@ cc_library(
"include/llvm/MC/*.def",
"include/llvm/MC/*.inc",
]),
+ copts = LLVM_COPTS,
+ defines = LLVM_DEFINES,
deps = [
":binary_format",
":config",
@@ -1530,6 +1457,8 @@ cc_library(
"include/llvm/MC/MCDisassembler/*.def",
"include/llvm/MC/MCDisassembler/*.inc",
]),
+ copts = LLVM_COPTS,
+ defines = LLVM_DEFINES,
deps = [
":config",
":mc",
@@ -1550,6 +1479,8 @@ cc_library(
"include/llvm/MC/MCParser/*.def",
"include/llvm/MC/MCParser/*.inc",
]),
+ copts = LLVM_COPTS,
+ defines = LLVM_DEFINES,
deps = [
":config",
":mc",
@@ -1570,7 +1501,8 @@ cc_library(
"include/llvm/Target/NVPTX/InstPrinter/*.inc",
"lib/Target/NVPTX/InstPrinter/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/NVPTX"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/NVPTX"],
+ defines = LLVM_DEFINES,
deps = [
"nvptx_target_gen",
":attributes_gen",
@@ -1594,7 +1526,8 @@ cc_library(
"include/llvm/Target/NVPTX/*.inc",
"lib/Target/NVPTX/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/NVPTX"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/NVPTX"],
+ defines = LLVM_DEFINES,
deps = [
":analysis",
":asm_printer",
@@ -1628,7 +1561,8 @@ cc_library(
"include/llvm/Target/NVPTX/MCTargetDesc/*.inc",
"lib/Target/NVPTX/MCTargetDesc/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/NVPTX"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/NVPTX"],
+ defines = LLVM_DEFINES,
deps = [
"nvptx_target_gen",
":config",
@@ -1654,7 +1588,8 @@ cc_library(
"lib/Target/NVPTX/NVPTX.h",
"lib/Target/NVPTX/TargetInfo/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/NVPTX"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/NVPTX"],
+ defines = LLVM_DEFINES,
deps = [
"nvptx_target_gen",
":attributes_gen",
@@ -1678,6 +1613,8 @@ cc_library(
"include/llvm/Object/*.def",
"include/llvm/Object/*.inc",
]),
+ copts = LLVM_COPTS,
+ defines = LLVM_DEFINES,
deps = [
":binary_format",
":bit_reader",
@@ -1703,6 +1640,8 @@ cc_library(
"include/llvm/Transforms/ObjCARC/*.def",
"include/llvm/Transforms/ObjCARC/*.inc",
]),
+ copts = LLVM_COPTS,
+ defines = LLVM_DEFINES,
deps = [
":analysis",
":config",
@@ -1725,6 +1664,8 @@ cc_library(
"include/llvm/ExecutionEngine/Orc/*.def",
"include/llvm/ExecutionEngine/Orc/*.inc",
]),
+ copts = LLVM_COPTS,
+ defines = LLVM_DEFINES,
deps = [
":config",
":core",
@@ -1749,7 +1690,8 @@ cc_library(
"include/llvm/Target/PowerPC/AsmParser/*.inc",
"lib/Target/PowerPC/AsmParser/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/PowerPC"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/PowerPC"],
+ defines = LLVM_DEFINES,
deps = [
":config",
":mc",
@@ -1773,7 +1715,8 @@ cc_library(
"include/llvm/Target/PowerPC/InstPrinter/*.inc",
"lib/Target/PowerPC/InstPrinter/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/PowerPC"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/PowerPC"],
+ defines = LLVM_DEFINES,
deps = [
":attributes_gen",
":config",
@@ -1798,7 +1741,8 @@ cc_library(
"include/llvm/Target/PowerPC/*.inc",
"lib/Target/PowerPC/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/PowerPC"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/PowerPC"],
+ defines = LLVM_DEFINES,
deps = [
":analysis",
":asm_printer",
@@ -1830,7 +1774,8 @@ cc_library(
"include/llvm/Target/PowerPC/MCTargetDesc/*.inc",
"lib/Target/PowerPC/MCTargetDesc/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/PowerPC"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/PowerPC"],
+ defines = LLVM_DEFINES,
deps = [
":attributes_gen",
":config",
@@ -1856,7 +1801,8 @@ cc_library(
"include/llvm/Target/PowerPC/Disassembler/*.inc",
"lib/Target/PowerPC/Disassembler/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/PowerPC"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/PowerPC"],
+ defines = LLVM_DEFINES,
deps = [
":config",
":mc_disassembler",
@@ -1880,7 +1826,8 @@ cc_library(
"lib/Target/PowerPC/PPC*.h",
"lib/Target/PowerPC/TargetInfo/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/PowerPC"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/PowerPC"],
+ defines = LLVM_DEFINES,
deps = [
":attributes_gen",
":config",
@@ -1905,6 +1852,8 @@ cc_library(
"include/llvm/ProfileData/*.def",
"include/llvm/ProfileData/*.inc",
]),
+ copts = LLVM_COPTS,
+ defines = LLVM_DEFINES,
deps = [
":config",
":core",
@@ -1933,6 +1882,8 @@ cc_library(
"include/llvm/ExecutionEngine/RTDyldMemoryManager.h",
"include/llvm/ExecutionEngine/RuntimeDyld*.h",
]),
+ copts = LLVM_COPTS,
+ defines = LLVM_DEFINES,
deps = [
":config",
":mc",
@@ -1960,6 +1911,8 @@ cc_library(
"include/llvm/Transforms/IPO.h",
"include/llvm/Transforms/IPO/SCCP.h",
]),
+ copts = LLVM_COPTS,
+ defines = LLVM_DEFINES,
deps = [
":aggressive_inst_combine",
":analysis",
@@ -1985,6 +1938,8 @@ cc_library(
"include/llvm/CodeGen/SelectionDAG/*.def",
"include/llvm/CodeGen/SelectionDAG/*.inc",
]),
+ copts = LLVM_COPTS,
+ defines = LLVM_DEFINES,
deps = [
":analysis",
":code_gen",
@@ -2022,6 +1977,8 @@ cc_library(
"include/llvm/BinaryFormat/MachO.def",
"include/llvm/Support/VCSRevision.h",
],
+ copts = LLVM_COPTS,
+ defines = LLVM_DEFINES,
deps = [
":config",
":demangle",
@@ -2044,6 +2001,8 @@ cc_library(
"include/llvm/TableGen/*.inc",
"include/llvm/Target/*.def",
]),
+ copts = LLVM_COPTS,
+ defines = LLVM_DEFINES,
deps = [
":config",
":mc",
@@ -2069,6 +2028,8 @@ cc_library(
"include/llvm/CodeGen/*.def",
"include/llvm/CodeGen/*.inc",
]),
+ copts = LLVM_COPTS,
+ defines = LLVM_DEFINES,
deps = [
":analysis",
":config",
@@ -2093,6 +2054,8 @@ cc_library(
"include/llvm/Transforms/Utils/*.def",
"include/llvm/Transforms/Utils/*.inc",
]),
+ copts = LLVM_COPTS,
+ defines = LLVM_DEFINES,
deps = [
":analysis",
":config",
@@ -2116,6 +2079,8 @@ cc_library(
"include/llvm/Transforms/Vectorize/*.inc",
"include/llvm/Transforms/Vectorize.h",
]),
+ copts = LLVM_COPTS,
+ defines = LLVM_DEFINES,
deps = [
":analysis",
":config",
@@ -2139,7 +2104,8 @@ cc_library(
"include/llvm/Target/X86/AsmParser/*.inc",
"lib/Target/X86/AsmParser/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/X86"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/X86"],
+ defines = LLVM_DEFINES,
deps = [
":config",
":mc",
@@ -2164,7 +2130,8 @@ cc_library(
"include/llvm/Target/X86/InstPrinter/*.inc",
"lib/Target/X86/InstPrinter/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/X86"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/X86"],
+ defines = LLVM_DEFINES,
deps = [
":config",
":mc",
@@ -2188,7 +2155,8 @@ cc_library(
"include/llvm/Target/X86/*.inc",
"lib/Target/X86/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/X86"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/X86"],
+ defines = LLVM_DEFINES,
deps = [
":analysis",
":asm_printer",
@@ -2221,7 +2189,8 @@ cc_library(
"include/llvm/Target/X86/MCTargetDesc/*.inc",
"lib/Target/X86/MCTargetDesc/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/X86"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/X86"],
+ defines = LLVM_DEFINES,
deps = [
":config",
":mc",
@@ -2246,7 +2215,8 @@ cc_library(
"include/llvm/Target/X86/Disassembler/*.inc",
"lib/Target/X86/Disassembler/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/X86"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/X86"],
+ defines = LLVM_DEFINES,
deps = [
":config",
":mc_disassembler",
@@ -2269,7 +2239,8 @@ cc_library(
"include/llvm/Target/X86/TargetInfo/*.inc",
"lib/Target/X86/TargetInfo/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/X86"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/X86"],
+ defines = LLVM_DEFINES,
deps = [
":config",
":mc",
@@ -2291,7 +2262,8 @@ cc_library(
"include/llvm/Target/X86/Utils/*.inc",
"lib/Target/X86/Utils/*.h",
]),
- copts = ["-Iexternal/llvm/lib/Target/X86"],
+ copts = LLVM_COPTS + ["-Iexternal/llvm/lib/Target/X86"],
+ defines = LLVM_DEFINES,
deps = [
":code_gen",
":config",
diff --git a/third_party/llvm/llvm.bzl b/third_party/llvm/llvm.bzl
index 0efcf319bd..2e809e5f14 100644
--- a/third_party/llvm/llvm.bzl
+++ b/third_party/llvm/llvm.bzl
@@ -105,3 +105,136 @@ def expand_cmake_vars(name, src, dst, cmake_vars):
"< $< > $@")
)
+# TODO(phawkins): the set of CMake variables was hardcoded for expediency.
+# However, we should really detect many of these via configure-time tests.
+
+# The set of CMake variables common to all targets.
+cmake_vars = {
+ # Headers
+ "HAVE_DIRENT_H": 1,
+ "HAVE_DLFCN_H": 1,
+ "HAVE_ERRNO_H": 1,
+ "HAVE_EXECINFO_H": 1,
+ "HAVE_FCNTL_H": 1,
+ "HAVE_INTTYPES_H": 1,
+ "HAVE_PTHREAD_H": 1,
+ "HAVE_SIGNAL_H": 1,
+ "HAVE_STDINT_H": 1,
+ "HAVE_SYS_IOCTL_H": 1,
+ "HAVE_SYS_MMAN_H": 1,
+ "HAVE_SYS_PARAM_H": 1,
+ "HAVE_SYS_RESOURCE_H": 1,
+ "HAVE_SYS_STAT_H": 1,
+ "HAVE_SYS_TIME_H": 1,
+ "HAVE_SYS_TYPES_H": 1,
+ "HAVE_TERMIOS_H": 1,
+ "HAVE_UNISTD_H": 1,
+ "HAVE_ZLIB_H": 1,
+
+ # Features
+ "HAVE_BACKTRACE": 1,
+ "BACKTRACE_HEADER": "execinfo.h",
+ "HAVE_DLOPEN": 1,
+ "HAVE_FUTIMES": 1,
+ "HAVE_GETCWD": 1,
+ "HAVE_GETPAGESIZE": 1,
+ "HAVE_GETRLIMIT": 1,
+ "HAVE_GETRUSAGE": 1,
+ "HAVE_GETTIMEOFDAY": 1,
+ "HAVE_INT64_T": 1,
+ "HAVE_ISATTY": 1,
+ "HAVE_LIBEDIT": 1,
+ "HAVE_LIBPTHREAD": 1,
+ "HAVE_LIBZ": 1,
+ "HAVE_MKDTEMP": 1,
+ "HAVE_MKSTEMP": 1,
+ "HAVE_MKTEMP": 1,
+ "HAVE_PREAD": 1,
+ "HAVE_PTHREAD_GETSPECIFIC": 1,
+ "HAVE_PTHREAD_MUTEX_LOCK": 1,
+ "HAVE_PTHREAD_RWLOCK_INIT": 1,
+ "HAVE_REALPATH": 1,
+ "HAVE_SBRK": 1,
+ "HAVE_SETENV": 1,
+ "HAVE_SETRLIMIT": 1,
+ "HAVE_SIGALTSTACK": 1,
+ "HAVE_STRERROR": 1,
+ "HAVE_STRERROR_R": 1,
+ "HAVE_STRTOLL": 1,
+ "HAVE_SYSCONF": 1,
+ "HAVE_UINT64_T": 1,
+ "HAVE__UNWIND_BACKTRACE": 1,
+
+ # LLVM features
+ "ENABLE_BACKTRACES": 1,
+ "LLVM_BINDIR": "/dev/null",
+ "LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING": 0,
+ "LLVM_ENABLE_ABI_BREAKING_CHECKS": 0,
+ "LLVM_ENABLE_THREADS": 1,
+ "LLVM_ENABLE_ZLIB": 1,
+ "LLVM_HAS_ATOMICS": 1,
+ "LLVM_INCLUDEDIR": "/dev/null",
+ "LLVM_INFODIR": "/dev/null",
+ "LLVM_MANDIR": "/dev/null",
+ "LLVM_NATIVE_TARGET": 1,
+ "LLVM_NATIVE_TARGETINFO": 1,
+ "LLVM_NATIVE_TARGETMC": 1,
+ "LLVM_NATIVE_ASMPRINTER": 1,
+ "LLVM_NATIVE_ASMPARSER": 1,
+ "LLVM_NATIVE_DISASSEMBLER": 1,
+ "LLVM_ON_UNIX": 1,
+ "LLVM_PREFIX": "/dev/null",
+ "LLVM_VERSION_MAJOR": 0,
+ "LLVM_VERSION_MINOR": 0,
+ "LLVM_VERSION_PATCH": 0,
+ "LTDL_SHLIB_EXT": ".so",
+ "PACKAGE_NAME": "llvm",
+ "PACKAGE_STRING": "llvm tensorflow-trunk",
+ "PACKAGE_VERSION": "tensorflow-trunk",
+ "RETSIGTYPE": "void",
+}
+
+# CMake variables specific to the Linux platform
+linux_cmake_vars = {
+ "HAVE_MALLOC_H": 1,
+ "HAVE_LINK_H": 1,
+ "HAVE_MALLINFO": 1,
+ "HAVE_FUTIMENS": 1,
+}
+
+# CMake variables specific to the Darwin (Mac OS X) platform.
+darwin_cmake_vars = {
+ "HAVE_MALLOC_MALLOC_H": 1,
+}
+
+# Select a set of CMake variables based on the platform.
+# TODO(phawkins): use a better method to select the right host triple, rather
+# than hardcoding x86_64.
+llvm_all_cmake_vars = select({
+ "@org_tensorflow//tensorflow:darwin": cmake_var_string(
+ cmake_vars + llvm_target_cmake_vars("X86", "x86_64-apple-darwin") +
+ darwin_cmake_vars),
+ "@org_tensorflow//tensorflow:linux_ppc64le": cmake_var_string(
+ cmake_vars +
+ llvm_target_cmake_vars("PowerPC", "powerpc64le-unknown-linux_gnu") +
+ linux_cmake_vars,
+ ),
+ "//conditions:default": cmake_var_string(
+ cmake_vars +
+ llvm_target_cmake_vars("X86", "x86_64-unknown-linux_gnu") +
+ linux_cmake_vars),
+
+})
+
+LLVM_LINKOPTS = ["-ldl", "-lm", "-lpthread"]
+
+LLVM_DEFINES = [
+ "LLVM_ENABLE_STATS",
+ "__STDC_LIMIT_MACROS",
+ "__STDC_CONSTANT_MACROS",
+ "__STDC_FORMAT_MACROS",
+ "_DEBUG",
+ "LLVM_BUILD_GLOBAL_ISEL",
+]
+
+LLVM_COPTS = []