Introduce a Bazel build configuration
This patch introduces configuration for a Bazel BUILD in a side directory in the monorepo. This is following the approval of https://github.com/llvm/llvm-www/blob/main/proposals/LP0002-BazelBuildConfiguration.md As detailed in the README, the Bazel BUILD is not supported by the community in general, and is maintained only by interested parties. It follows the requirements of the LLVM peripheral tier: https://llvm.org/docs/SupportPolicy.html#peripheral-tier. This is largely copied from https://github.com/google/llvm-bazel, with a few filepath tweaks and the addition of the README. Reviewed By: echristo, keith, dblaikie, kuhar Differential Revision: https://reviews.llvm.org/D90352
This commit is contained in:
parent
64cf5eba06
commit
4aeb2e60df
1
utils/bazel/.bazelignore
Normal file
1
utils/bazel/.bazelignore
Normal file
@ -0,0 +1 @@
|
|||||||
|
llvm-project-overlay
|
150
utils/bazel/.bazelrc
Normal file
150
utils/bazel/.bazelrc
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
# See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Common flags that apply to all configurations.
|
||||||
|
# Use sparingly for things common to all compilers and platforms.
|
||||||
|
###############################################################################
|
||||||
|
# Prevent invalid caching if input files are modified during a build.
|
||||||
|
build --experimental_guard_against_concurrent_changes
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Options to select different strategies for linking potential dependent
|
||||||
|
# libraries. The default leaves it disabled.
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
build:zlib_external --repo_env=BAZEL_LLVM_ZLIB_STRATEGY=external
|
||||||
|
build:zlib_system --repo_env=BAZEL_LLVM_ZLIB_STRATEGY=system
|
||||||
|
|
||||||
|
build:terminfo_external --repo_env=BAZEL_LLVM_TERMINFO_STRATEGY=external
|
||||||
|
build:terminfo_system --repo_env=BAZEL_LLVM_TERMINFO_STRATEGY=system
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Options for "generic_clang" builds: these options should generally apply to
|
||||||
|
# builds using a Clang-based compiler, and default to the `clang` executable on
|
||||||
|
# the `PATH`. While these are provided for convenience and may serve as a
|
||||||
|
# reference, it would be preferable for users to configure an explicit C++
|
||||||
|
# toolchain instead of relying on `.bazelrc` files.
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
# Set the default compiler to the `clang` binary on the `PATH`.
|
||||||
|
build:generic_clang --repo_env=CC=clang
|
||||||
|
|
||||||
|
# C++14 standard version is required.
|
||||||
|
build:generic_clang --cxxopt=-std=c++14 --host_cxxopt=-std=c++14
|
||||||
|
|
||||||
|
# The Clang available on MacOS has a warning that isn't clean on MLIR code. The
|
||||||
|
# warning doesn't show up with more recent Clangs, so just disable for now.
|
||||||
|
build:generic_clang --cxxopt=-Wno-range-loop-analysis --host_cxxopt=-Wno-range-loop-analysis
|
||||||
|
|
||||||
|
# Use `-Wall` and `-Werror` for Clang.
|
||||||
|
build:generic_clang --copt=-Wall --copt=-Werror --host_copt=-Wall --host_copt=-Werror
|
||||||
|
# This doesn't appear to be enforced by any upstream bot.
|
||||||
|
build:generic_clang --copt=-Wno-unused --host_copt=-Wno-unused
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Options for "generic_gcc" builds: these options should generally apply to
|
||||||
|
# builds using a GCC-based compiler, and default to the `gcc` executable on
|
||||||
|
# the `PATH`. While these are provided for convenience and may serve as a
|
||||||
|
# reference, it would be preferable for users to configure an explicit C++
|
||||||
|
# toolchain instead of relying on `.bazelrc` files.
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
# Set the default compiler to the `gcc` binary on the `PATH`.
|
||||||
|
build:generic_gcc --repo_env=CC=gcc
|
||||||
|
|
||||||
|
# C++14 standard version is required.
|
||||||
|
build:generic_gcc --cxxopt=-std=c++14 --host_cxxopt=-std=c++14
|
||||||
|
|
||||||
|
# Disable GCC warnings that are noisy and/or false positives on LLVM code.
|
||||||
|
# These need to be global as some code triggering these is in header files.
|
||||||
|
build:generic_gcc --copt=-Wno-unused-parameter --host_copt=-Wno-unused-parameter
|
||||||
|
build:generic_gcc --copt=-Wno-comment --host_copt=-Wno-comment
|
||||||
|
build:generic_gcc --cxxopt=-Wno-class-memaccess --host_cxxopt=-Wno-class-memaccess
|
||||||
|
build:generic_gcc --copt=-Wno-maybe-uninitialized --host_copt=-Wno-maybe-uninitialized
|
||||||
|
build:generic_gcc --copt=-Wno-misleading-indentation --host_copt=-Wno-misleading-indentation
|
||||||
|
|
||||||
|
# Use `-Werror` for GCC to make sure warnings don't slip past.
|
||||||
|
build:generic_gcc --copt=-Werror --host_copt=-Werror
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Windows specific flags for building with VC.
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
build:msvc --copt=/WX --host_copt=/WX # Treat warnings as errors...
|
||||||
|
# ...but disable the ones that are violated
|
||||||
|
build:msvc --copt=/wd4141 --host_copt=/wd4141 # inline used more than once
|
||||||
|
build:msvc --copt=/wd4244 --host_copt=/wd4244 # conversion type -> type
|
||||||
|
build:msvc --copt=/wd4267 --host_copt=/wd4267 # conversion size_t -> type
|
||||||
|
build:msvc --copt=/wd4273 --host_copt=/wd4273 # multiple definitions with different dllimport
|
||||||
|
build:msvc --copt=/wd4319 --host_copt=/wd4319 # zero-extending after complement
|
||||||
|
build:msvc --copt=/wd4624 --host_copt=/wd4624 # destructor was implicitly defined as deleted
|
||||||
|
build:msvc --copt=/wd4804 --host_copt=/wd4804 # comparisons between bool and int
|
||||||
|
build:msvc --copt=/wd4805 --host_copt=/wd4805 # comparisons between bool and int
|
||||||
|
|
||||||
|
build:msvc --linkopt=/WX --host_linkopt=/WX # Treat warnings as errors...
|
||||||
|
# ...but disable the ones that are violated.
|
||||||
|
build:msvc --linkopt=/IGNORE:4001 --host_linkopt=/IGNORE:4001 # no object files
|
||||||
|
|
||||||
|
# Yay for security warnings. Boo for non-standard.
|
||||||
|
build:msvc --copt=/D_CRT_SECURE_NO_WARNINGS --host_copt=/D_CRT_SECURE_NO_WARNINGS
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Configuration for building remotely using Remote Build Execution (RBE)
|
||||||
|
# Based on https://github.com/bazelbuild/bazel-toolchains/blob/master/bazelrc/bazel-1.0.0.bazelrc
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
build:rbe --remote_instance_name=projects/llvm-bazel/instances/default_instance
|
||||||
|
|
||||||
|
# Depending on how many machines are in the remote execution instance, setting
|
||||||
|
# this higher can make builds faster by allowing more jobs to run in parallel.
|
||||||
|
# Setting it too high can result in jobs that timeout, however, while waiting
|
||||||
|
# for a remote machine to execute them.
|
||||||
|
build:rbe --jobs=150
|
||||||
|
|
||||||
|
# Set several flags related to specifying the platform, toolchain and java
|
||||||
|
# properties.
|
||||||
|
# These flags should only be used as is for the rbe-ubuntu16-04 container
|
||||||
|
# and need to be adapted to work with other toolchain containers.
|
||||||
|
build:rbe --host_javabase=@rbe_default//java:jdk
|
||||||
|
build:rbe --javabase=@rbe_default//java:jdk
|
||||||
|
build:rbe --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8
|
||||||
|
build:rbe --java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8
|
||||||
|
build:rbe --crosstool_top=@rbe_default//cc:toolchain
|
||||||
|
build:rbe --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
|
||||||
|
# Platform flags:
|
||||||
|
# The toolchain container used for execution is defined in the target indicated
|
||||||
|
# by "extra_execution_platforms", "host_platform" and "platforms".
|
||||||
|
# More about platforms: https://docs.bazel.build/versions/master/platforms.html
|
||||||
|
build:rbe --extra_toolchains=@rbe_default//config:cc-toolchain
|
||||||
|
build:rbe --extra_execution_platforms=@rbe_default//config:platform
|
||||||
|
build:rbe --host_platform=@rbe_default//config:platform
|
||||||
|
build:rbe --platforms=@rbe_default//config:platform
|
||||||
|
|
||||||
|
build:rbe --define=EXECUTOR=remote
|
||||||
|
|
||||||
|
# Enable remote execution so actions are performed on the remote systems.
|
||||||
|
build:rbe --remote_executor=grpcs://remotebuildexecution.googleapis.com
|
||||||
|
|
||||||
|
# Enforce stricter environment rules, which eliminates some non-hermetic
|
||||||
|
# behavior and therefore improves both the remote cache hit rate and the
|
||||||
|
# correctness and repeatability of the build.
|
||||||
|
build:rbe --incompatible_strict_action_env=true
|
||||||
|
|
||||||
|
# Set a higher timeout value, just in case.
|
||||||
|
build:rbe --remote_timeout=3600
|
||||||
|
|
||||||
|
# Local disk cache is incompatible with remote execution (for obvious reasons).
|
||||||
|
build:rbe --disk_cache=""
|
||||||
|
|
||||||
|
# Enable authentication. This will pick up application default credentials by
|
||||||
|
# default. You can use --google_credentials=some_file.json to use a service
|
||||||
|
# account credential instead.
|
||||||
|
build:rbe --google_default_credentials=true
|
||||||
|
|
||||||
|
# The user.bazelrc file is not checked in but available for local mods.
|
||||||
|
# Always keep this at the end of the file so that user flags override.
|
||||||
|
try-import %workspace%/user.bazelrc
|
1
utils/bazel/.bazelversion
Normal file
1
utils/bazel/.bazelversion
Normal file
@ -0,0 +1 @@
|
|||||||
|
4.0.0
|
5
utils/bazel/.gitignore
vendored
Normal file
5
utils/bazel/.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# Bazel artifacts
|
||||||
|
/bazel-*
|
||||||
|
|
||||||
|
# Per-user bazelrc files
|
||||||
|
user.bazelrc
|
5
utils/bazel/BUILD.bazel
Normal file
5
utils/bazel/BUILD.bazel
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
# See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
|
# Required to reference .bzl files in this package
|
130
utils/bazel/README.md
Normal file
130
utils/bazel/README.md
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
# Introduction
|
||||||
|
|
||||||
|
*Warning* The Bazel build is experimental and best-effort, supported in line
|
||||||
|
with the policy for
|
||||||
|
[LLVM's peripheral support tier](https://llvm.org/docs/SupportPolicy.html).
|
||||||
|
LLVM's official build system is CMake. If in doubt use that. If you make changes
|
||||||
|
to LLVM, you're expected to update the CMake build but you don't need to update
|
||||||
|
Bazel build files. Reviewers should not ask authors to update Bazel build files
|
||||||
|
unless the author has opted in to support Bazel. Keeping the Bazel build files
|
||||||
|
up-to-date is on the people who use the Bazel build.
|
||||||
|
|
||||||
|
[Bazel](https://bazel.build/) is a multi-language build system focused on
|
||||||
|
reproducible builds to enable dependency analysis and caching for fast
|
||||||
|
incremental builds.
|
||||||
|
|
||||||
|
The main motivation behind the existence of an LLVM Bazel build is that a number
|
||||||
|
of projects that depend on LLVM use Bazel, and Bazel works best when it knows
|
||||||
|
about the whole source tree (as opposed to installing artifacts coming from
|
||||||
|
another build system). Community members are also welcome to use Bazel for their
|
||||||
|
own development as long as they continue to maintain the official CMake build
|
||||||
|
system. See also, the
|
||||||
|
[proposal](https://github.com/llvm/llvm-www/blob/main/proposals/LP0002-BazelBuildConfiguration.md)
|
||||||
|
for adding this configuration.
|
||||||
|
|
||||||
|
# Quick Start
|
||||||
|
|
||||||
|
1. `git clone https://github.com/llvm/llvm-project.git; cd llvm-project` if
|
||||||
|
you don't have a checkout yet.
|
||||||
|
2. Install Bazel at the version indicated by [.bazelversion](./bazelversion),
|
||||||
|
following the official instructions, if you don't have it installed yet:
|
||||||
|
https://docs.bazel.build/versions/master/install.html.
|
||||||
|
3. `cd utils/bazel`
|
||||||
|
4. `bazel build --config=generic_clang @llvm-project//...` (if building on Unix
|
||||||
|
with Clang). `--config=generic_gcc` and `--config=msvc` are also available.
|
||||||
|
|
||||||
|
|
||||||
|
# Configuration
|
||||||
|
|
||||||
|
The repository `.bazelrc` will import user-specific settings from a
|
||||||
|
`user.bazelrc` file (in addition to the standard locations). Adding your typical
|
||||||
|
config setting is recommended.
|
||||||
|
|
||||||
|
```.bazelrc
|
||||||
|
build --config=generic_clang
|
||||||
|
```
|
||||||
|
|
||||||
|
You can enable
|
||||||
|
[disk caching](https://docs.bazel.build/versions/master/remote-caching.html#disk-cache),
|
||||||
|
which will cache build results
|
||||||
|
|
||||||
|
```.bazelrc
|
||||||
|
build --disk_cache=~/.cache/bazel-disk-cache
|
||||||
|
```
|
||||||
|
|
||||||
|
You can instruct Bazel to use a ramdisk for its sandboxing operations via
|
||||||
|
[--sandbox_base](https://docs.bazel.build/versions/master/command-line-reference.html#flag--sandbox_base),
|
||||||
|
which can help avoid IO bottlenecks for the symlink stragegy used for
|
||||||
|
sandboxing. This is especially important with many inputs and many cores (see
|
||||||
|
https://github.com/bazelbuild/bazel/issues/11868):
|
||||||
|
|
||||||
|
```.bazelrc
|
||||||
|
build --sandbox_base=/dev/shm
|
||||||
|
```
|
||||||
|
|
||||||
|
Bear in mind that this requires that your ramdisk is of sufficient size to hold
|
||||||
|
any temporary files. Anecdotally, 1GB should be sufficient.
|
||||||
|
|
||||||
|
# Coverage
|
||||||
|
|
||||||
|
The LLVM, MLIR, and Clang subprojects have configurations for Linux (Clang and
|
||||||
|
GCC), Mac (Clang and GCC), and Windows (MSVC). Configuration options that are
|
||||||
|
platform-specific are selected for in defines. Many are also hardcoded to the
|
||||||
|
values currently used by all supported configurations. If there is a
|
||||||
|
configuration you'd like to use that isn't supported, please send a patch.
|
||||||
|
|
||||||
|
# Usage
|
||||||
|
|
||||||
|
To use in dependent projects using Bazel, you can import LLVM (e.g. as a
|
||||||
|
submodule or using `http_archive`) and then use the provided configuration rule.
|
||||||
|
|
||||||
|
FIXME: This needs to be updated to a commit that exists once such a commit
|
||||||
|
exists.
|
||||||
|
FIXME: It shouldn't be necessary to configure `http_archive` twice for the same
|
||||||
|
archive (though caching means this isn't too expensive).
|
||||||
|
|
||||||
|
```starlark
|
||||||
|
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||||
|
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
|
||||||
|
|
||||||
|
LLVM_COMMIT = "0a1f0ee78122fc0642e8a1a18e1b2bc89c813387"
|
||||||
|
|
||||||
|
LLVM_SHA256 = "4f59737ccfdad2cfb4587d796ce97c1eb5433de7ea0f57f248554b83e92d81d2"
|
||||||
|
|
||||||
|
http_archive(
|
||||||
|
name = "llvm-project-raw",
|
||||||
|
build_file_content = "#empty",
|
||||||
|
sha256 = LLVM_SHA256,
|
||||||
|
strip_prefix = "llvm-project-" + LLVM_COMMIT,
|
||||||
|
urls = ["https://github.com/llvm/llvm-project/archive/{commit}.tar.gz".format(commit = LLVM_COMMIT)],
|
||||||
|
)
|
||||||
|
|
||||||
|
http_archive(
|
||||||
|
name = "llvm-bazel",
|
||||||
|
sha256 = LLVM_SHA256,
|
||||||
|
strip_prefix = "llvm-project-{}/utils/bazel".format(LLVM_COMMIT),
|
||||||
|
urls = ["https://github.com/llvm/llvm-project/archive/{commit}.tar.gz".format(commit = LLVM_COMMIT)],
|
||||||
|
)
|
||||||
|
|
||||||
|
load("@llvm-bazel//:configure.bzl", "llvm_configure")
|
||||||
|
|
||||||
|
llvm_configure(
|
||||||
|
name = "llvm-project",
|
||||||
|
src_path = ".",
|
||||||
|
src_workspace = "@llvm-project-raw//:WORKSPACE",
|
||||||
|
)
|
||||||
|
|
||||||
|
load("@llvm-bazel//:terminfo.bzl", "llvm_terminfo_system")
|
||||||
|
|
||||||
|
maybe(
|
||||||
|
llvm_terminfo_system,
|
||||||
|
name = "llvm_terminfo",
|
||||||
|
)
|
||||||
|
|
||||||
|
load("@llvm-bazel//:zlib.bzl", "llvm_zlib_system")
|
||||||
|
|
||||||
|
maybe(
|
||||||
|
llvm_zlib_system,
|
||||||
|
name = "llvm_zlib",
|
||||||
|
)
|
||||||
|
```
|
84
utils/bazel/WORKSPACE
Normal file
84
utils/bazel/WORKSPACE
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
# See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
|
load(":configure.bzl", "llvm_configure")
|
||||||
|
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||||
|
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
|
||||||
|
|
||||||
|
llvm_configure(
|
||||||
|
name = "llvm-project",
|
||||||
|
overlay_path = "llvm-project-overlay",
|
||||||
|
src_path = "../..",
|
||||||
|
)
|
||||||
|
|
||||||
|
load(":terminfo.bzl", "llvm_terminfo_from_env")
|
||||||
|
|
||||||
|
maybe(
|
||||||
|
llvm_terminfo_from_env,
|
||||||
|
name = "llvm_terminfo",
|
||||||
|
)
|
||||||
|
|
||||||
|
maybe(
|
||||||
|
http_archive,
|
||||||
|
name = "zlib",
|
||||||
|
build_file = "//third_party_build:zlib.BUILD",
|
||||||
|
sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1",
|
||||||
|
strip_prefix = "zlib-1.2.11",
|
||||||
|
urls = [
|
||||||
|
"https://storage.googleapis.com/mirror.tensorflow.org/zlib.net/zlib-1.2.11.tar.gz",
|
||||||
|
"https://zlib.net/zlib-1.2.11.tar.gz",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
load(":zlib.bzl", "llvm_zlib_from_env")
|
||||||
|
|
||||||
|
maybe(
|
||||||
|
llvm_zlib_from_env,
|
||||||
|
name = "llvm_zlib",
|
||||||
|
external_zlib = "@zlib",
|
||||||
|
)
|
||||||
|
|
||||||
|
maybe(
|
||||||
|
http_archive,
|
||||||
|
name = "vulkan_headers",
|
||||||
|
build_file = "//third_party_build:vulkan_headers.BUILD",
|
||||||
|
sha256 = "19f491784ef0bc73caff877d11c96a48b946b5a1c805079d9006e3fbaa5c1895",
|
||||||
|
strip_prefix = "Vulkan-Headers-9bd3f561bcee3f01d22912de10bb07ce4e23d378",
|
||||||
|
urls = [
|
||||||
|
"https://github.com/KhronosGroup/Vulkan-Headers/archive/9bd3f561bcee3f01d22912de10bb07ce4e23d378.tar.gz",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
load(":vulkan_sdk.bzl", "vulkan_sdk_setup")
|
||||||
|
|
||||||
|
maybe(
|
||||||
|
vulkan_sdk_setup,
|
||||||
|
name = "vulkan_sdk",
|
||||||
|
)
|
||||||
|
|
||||||
|
http_archive(
|
||||||
|
name = "bazel_skylib",
|
||||||
|
sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44",
|
||||||
|
urls = [
|
||||||
|
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
|
||||||
|
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
|
||||||
|
|
||||||
|
bazel_skylib_workspace()
|
||||||
|
|
||||||
|
http_archive(
|
||||||
|
name = "bazel_toolchains",
|
||||||
|
sha256 = "1adf5db506a7e3c465a26988514cfc3971af6d5b3c2218925cd6e71ee443fc3f",
|
||||||
|
strip_prefix = "bazel-toolchains-4.0.0",
|
||||||
|
urls = [
|
||||||
|
"https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/releases/download/4.0.0/bazel-toolchains-4.0.0.tar.gz",
|
||||||
|
"https://github.com/bazelbuild/bazel-toolchains/releases/download/4.0.0/bazel-toolchains-4.0.0.tar.gz",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
load("@bazel_toolchains//rules:rbe_repo.bzl", "rbe_autoconfig")
|
||||||
|
rbe_autoconfig(name = "rbe_default")
|
142
utils/bazel/configure.bzl
Normal file
142
utils/bazel/configure.bzl
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
# See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
|
"""Helper macros to configure the LLVM overlay project."""
|
||||||
|
|
||||||
|
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
|
||||||
|
load(":zlib.bzl", "llvm_zlib_disable", "llvm_zlib_system")
|
||||||
|
load(":terminfo.bzl", "llvm_terminfo_disable", "llvm_terminfo_system")
|
||||||
|
|
||||||
|
# Directory of overlay files relative to WORKSPACE
|
||||||
|
DEFAULT_OVERLAY_PATH = "llvm-project-overlay"
|
||||||
|
|
||||||
|
DEFAULT_TARGETS = [
|
||||||
|
"AArch64",
|
||||||
|
"AMDGPU",
|
||||||
|
"ARM",
|
||||||
|
"BPF",
|
||||||
|
"Hexagon",
|
||||||
|
"Lanai",
|
||||||
|
"NVPTX",
|
||||||
|
"PowerPC",
|
||||||
|
"RISCV",
|
||||||
|
"Sparc",
|
||||||
|
"WebAssembly",
|
||||||
|
"X86",
|
||||||
|
]
|
||||||
|
|
||||||
|
def _is_absolute(path):
|
||||||
|
"""Returns `True` if `path` is an absolute path.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
path: A path (which is a string).
|
||||||
|
Returns:
|
||||||
|
`True` if `path` is an absolute path.
|
||||||
|
"""
|
||||||
|
return path.startswith("/") or (len(path) > 2 and path[1] == ":")
|
||||||
|
|
||||||
|
def _join_path(a, b):
|
||||||
|
if _is_absolute(b):
|
||||||
|
return b
|
||||||
|
return str(a) + "/" + str(b)
|
||||||
|
|
||||||
|
def _overlay_directories(repository_ctx):
|
||||||
|
src_workspace_path = repository_ctx.path(
|
||||||
|
repository_ctx.attr.src_workspace,
|
||||||
|
).dirname
|
||||||
|
|
||||||
|
src_path = _join_path(src_workspace_path, repository_ctx.attr.src_path)
|
||||||
|
|
||||||
|
overlay_workspace_path = repository_ctx.path(
|
||||||
|
repository_ctx.attr.overlay_workspace,
|
||||||
|
).dirname
|
||||||
|
overlay_path = _join_path(
|
||||||
|
overlay_workspace_path,
|
||||||
|
repository_ctx.attr.overlay_path,
|
||||||
|
)
|
||||||
|
|
||||||
|
overlay_script = repository_ctx.path(
|
||||||
|
repository_ctx.attr._overlay_script,
|
||||||
|
)
|
||||||
|
python_bin = repository_ctx.which("python3")
|
||||||
|
if not python_bin:
|
||||||
|
# Windows typically just defines "python" as python3. The script itself
|
||||||
|
# contains a check to ensure python3.
|
||||||
|
python_bin = repository_ctx.which("python")
|
||||||
|
|
||||||
|
if not python_bin:
|
||||||
|
fail("Failed to find python3 binary")
|
||||||
|
|
||||||
|
cmd = [
|
||||||
|
python_bin,
|
||||||
|
overlay_script,
|
||||||
|
"--src",
|
||||||
|
src_path,
|
||||||
|
"--overlay",
|
||||||
|
overlay_path,
|
||||||
|
"--target",
|
||||||
|
".",
|
||||||
|
]
|
||||||
|
exec_result = repository_ctx.execute(cmd, timeout = 20)
|
||||||
|
|
||||||
|
if exec_result.return_code != 0:
|
||||||
|
fail(("Failed to execute overlay script: '{cmd}'\n" +
|
||||||
|
"Exited with code {return_code}\n" +
|
||||||
|
"stdout:\n{stdout}\n" +
|
||||||
|
"stderr:\n{stderr}\n").format(
|
||||||
|
cmd = " ".join([str(arg) for arg in cmd]),
|
||||||
|
return_code = exec_result.return_code,
|
||||||
|
stdout = exec_result.stdout,
|
||||||
|
stderr = exec_result.stderr,
|
||||||
|
))
|
||||||
|
|
||||||
|
def _llvm_configure_impl(repository_ctx):
|
||||||
|
_overlay_directories(repository_ctx)
|
||||||
|
|
||||||
|
# Create a starlark file with the requested LLVM targets.
|
||||||
|
targets = repository_ctx.attr.targets
|
||||||
|
repository_ctx.file(
|
||||||
|
"llvm/targets.bzl",
|
||||||
|
content = "llvm_targets = " + str(targets),
|
||||||
|
executable = False,
|
||||||
|
)
|
||||||
|
|
||||||
|
llvm_configure = repository_rule(
|
||||||
|
implementation = _llvm_configure_impl,
|
||||||
|
local = True,
|
||||||
|
configure = True,
|
||||||
|
attrs = {
|
||||||
|
"_overlay_script": attr.label(
|
||||||
|
default = Label("//:overlay_directories.py"),
|
||||||
|
allow_single_file = True,
|
||||||
|
),
|
||||||
|
"overlay_workspace": attr.label(default = Label("//:WORKSPACE")),
|
||||||
|
"overlay_path": attr.string(default = DEFAULT_OVERLAY_PATH),
|
||||||
|
"src_workspace": attr.label(default = Label("//:WORKSPACE")),
|
||||||
|
"src_path": attr.string(mandatory = True),
|
||||||
|
"targets": attr.string_list(default = DEFAULT_TARGETS),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
def llvm_disable_optional_support_deps():
|
||||||
|
maybe(
|
||||||
|
llvm_zlib_disable,
|
||||||
|
name = "llvm_zlib",
|
||||||
|
)
|
||||||
|
|
||||||
|
maybe(
|
||||||
|
llvm_terminfo_disable,
|
||||||
|
name = "llvm_terminfo",
|
||||||
|
)
|
||||||
|
|
||||||
|
def llvm_use_system_support_deps():
|
||||||
|
maybe(
|
||||||
|
llvm_zlib_system,
|
||||||
|
name = "llvm_zlib",
|
||||||
|
)
|
||||||
|
|
||||||
|
maybe(
|
||||||
|
llvm_terminfo_system,
|
||||||
|
name = "llvm_terminfo",
|
||||||
|
)
|
5
utils/bazel/deps_impl/BUILD.bazel
Normal file
5
utils/bazel/deps_impl/BUILD.bazel
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
# See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
|
# Required to reference files in this package
|
10
utils/bazel/deps_impl/terminfo_disable.BUILD
Normal file
10
utils/bazel/deps_impl/terminfo_disable.BUILD
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
# See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
|
# Empty stub library. This doesn't include any terminfo library and doesn't set
|
||||||
|
# the LLVM `#define`s to enable usage of terminfo.
|
||||||
|
cc_library(
|
||||||
|
name = "terminfo",
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
15
utils/bazel/deps_impl/terminfo_system.BUILD
Normal file
15
utils/bazel/deps_impl/terminfo_system.BUILD
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
# See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
|
# Wrapper library for some system terminfo. Using this only works if the
|
||||||
|
# toolchain already has the relevant library search paths configured. It also
|
||||||
|
# sets the relevant LLVM `#define`s to enoble using terminfo.
|
||||||
|
cc_library(
|
||||||
|
name = "terminfo",
|
||||||
|
defines = ["LLVM_ENABLE_TERMINFO=1"],
|
||||||
|
# Note that we will replace these link options with ones needed to
|
||||||
|
# effectively link against a terminfo providing library on the system.
|
||||||
|
linkopts = {TERMINFO_LINKOPTS},
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
17
utils/bazel/deps_impl/terminfo_test.c
Normal file
17
utils/bazel/deps_impl/terminfo_test.c
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int setupterm(char *term, int filedes, int *errret);
|
||||||
|
extern struct term *set_curterm(struct term *termp);
|
||||||
|
extern int del_curterm(struct term *termp);
|
||||||
|
extern int tigetnum(char *capname);
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
setupterm(0, 0, 0);
|
||||||
|
set_curterm(0);
|
||||||
|
del_curterm(0);
|
||||||
|
tigetnum(0);
|
||||||
|
}
|
10
utils/bazel/deps_impl/zlib_disable.BUILD
Normal file
10
utils/bazel/deps_impl/zlib_disable.BUILD
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
# See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
|
# Empty stub library. This doesn't include zlib and doesn't set the LLVM
|
||||||
|
# `#define`s to enable it.
|
||||||
|
cc_library(
|
||||||
|
name = "zlib",
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
11
utils/bazel/deps_impl/zlib_external.BUILD
Normal file
11
utils/bazel/deps_impl/zlib_external.BUILD
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
# See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
|
# Wrapper around an external zlib library to add the relevant LLVM `#define`s.
|
||||||
|
cc_library(
|
||||||
|
name = "zlib",
|
||||||
|
defines = ["LLVM_ENABLE_ZLIB=1"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
deps = ["@external_zlib_repo//:zlib_rule"],
|
||||||
|
)
|
13
utils/bazel/deps_impl/zlib_system.BUILD
Normal file
13
utils/bazel/deps_impl/zlib_system.BUILD
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
# See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
|
# Wrapper library for the system's zlib. Using this only works if the toolchain
|
||||||
|
# already has the relevant header search and library search paths configured.
|
||||||
|
# It also sets the relevant LLVM `#define`s to enable zlib.
|
||||||
|
cc_library(
|
||||||
|
name = "zlib",
|
||||||
|
defines = ["LLVM_ENABLE_ZLIB=1"],
|
||||||
|
linkopts = ["-lz"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
2
utils/bazel/llvm-project-overlay/.bazelignore
Normal file
2
utils/bazel/llvm-project-overlay/.bazelignore
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Ignore the utils/bazel directory when this is overlayed onto the repo root.
|
||||||
|
utils/bazel
|
2101
utils/bazel/llvm-project-overlay/clang/BUILD.bazel
Normal file
2101
utils/bazel/llvm-project-overlay/clang/BUILD.bazel
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,103 @@
|
|||||||
|
/*===------- clang/Config/config.h - llvm configuration -----------*- C -*-===*/
|
||||||
|
/* */
|
||||||
|
/* Part of the LLVM Project, under the Apache License v2.0 with LLVM */
|
||||||
|
/* Exceptions. */
|
||||||
|
/* See https://llvm.org/LICENSE.txt for license information. */
|
||||||
|
/* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */
|
||||||
|
/* */
|
||||||
|
/*===----------------------------------------------------------------------===*/
|
||||||
|
|
||||||
|
/* This is a manual port of config.h.cmake for the symbols that do not change
|
||||||
|
based on platform. Those that do change should not be defined here and
|
||||||
|
instead use Bazel cc_library defines. Some attempt has been made to extract
|
||||||
|
such symbols that do vary based on platform (for the platforms we care about)
|
||||||
|
into Bazel defines, but it is by no means complete, so if you see something
|
||||||
|
that looks wrong, it probably is. */
|
||||||
|
|
||||||
|
#ifdef CLANG_CONFIG_H
|
||||||
|
#error config.h can only be included once
|
||||||
|
#else
|
||||||
|
#define CLANG_CONFIG_H
|
||||||
|
|
||||||
|
/* Bug report URL. */
|
||||||
|
#define BUG_REPORT_URL "https://bugs.llvm.org/"
|
||||||
|
|
||||||
|
/* Default linker to use. */
|
||||||
|
#define CLANG_DEFAULT_LINKER ""
|
||||||
|
|
||||||
|
/* Default C/ObjC standard to use. */
|
||||||
|
/* #undef CLANG_DEFAULT_STD_C */
|
||||||
|
|
||||||
|
/* Default C++/ObjC++ standard to use. */
|
||||||
|
/* #undef CLANG_DEFAULT_STD_CXX */
|
||||||
|
|
||||||
|
/* Default C++ stdlib to use. */
|
||||||
|
#define CLANG_DEFAULT_CXX_STDLIB ""
|
||||||
|
|
||||||
|
/* Default runtime library to use. */
|
||||||
|
#define CLANG_DEFAULT_RTLIB ""
|
||||||
|
|
||||||
|
/* Default unwind library to use. */
|
||||||
|
#define CLANG_DEFAULT_UNWINDLIB ""
|
||||||
|
|
||||||
|
/* Default objcopy to use */
|
||||||
|
#define CLANG_DEFAULT_OBJCOPY "objcopy"
|
||||||
|
|
||||||
|
/* Default OpenMP runtime used by -fopenmp. */
|
||||||
|
#define CLANG_DEFAULT_OPENMP_RUNTIME "libomp"
|
||||||
|
|
||||||
|
/* Default architecture for OpenMP offloading to Nvidia GPUs. */
|
||||||
|
#define CLANG_OPENMP_NVPTX_DEFAULT_ARCH "sm_35"
|
||||||
|
|
||||||
|
/* Default architecture for SystemZ. */
|
||||||
|
#define CLANG_SYSTEMZ_DEFAULT_ARCH "z10"
|
||||||
|
|
||||||
|
/* Multilib suffix for libdir. */
|
||||||
|
#define CLANG_LIBDIR_SUFFIX ""
|
||||||
|
|
||||||
|
/* Relative directory for resource files */
|
||||||
|
#define CLANG_RESOURCE_DIR ""
|
||||||
|
|
||||||
|
/* Directories clang will search for headers */
|
||||||
|
#define C_INCLUDE_DIRS ""
|
||||||
|
|
||||||
|
/* Directories clang will search for configuration files */
|
||||||
|
/* #undef CLANG_CONFIG_FILE_SYSTEM_DIR */
|
||||||
|
/* #undef CLANG_CONFIG_FILE_USER_DIR */
|
||||||
|
|
||||||
|
/* Default <path> to all compiler invocations for --sysroot=<path>. */
|
||||||
|
#define DEFAULT_SYSROOT ""
|
||||||
|
|
||||||
|
/* Directory where gcc is installed. */
|
||||||
|
#define GCC_INSTALL_PREFIX ""
|
||||||
|
|
||||||
|
/* Define if we have libxml2 */
|
||||||
|
/* #undef CLANG_HAVE_LIBXML */
|
||||||
|
|
||||||
|
/* Define if we have sys/resource.h (rlimits) */
|
||||||
|
#define CLANG_HAVE_RLIMITS 1
|
||||||
|
|
||||||
|
/* The LLVM product name and version */
|
||||||
|
#define BACKEND_PACKAGE_STRING "LLVM 12.0.0git"
|
||||||
|
|
||||||
|
/* Linker version detected at compile time. */
|
||||||
|
/* #undef HOST_LINK_VERSION */
|
||||||
|
|
||||||
|
/* pass --build-id to ld */
|
||||||
|
/* #undef ENABLE_LINKER_BUILD_ID */
|
||||||
|
|
||||||
|
/* enable x86 relax relocations by default */
|
||||||
|
#define ENABLE_X86_RELAX_RELOCATIONS 1
|
||||||
|
|
||||||
|
/* Enable the experimental new pass manager by default */
|
||||||
|
#define ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER 0
|
||||||
|
|
||||||
|
/* Enable each functionality of modules */
|
||||||
|
#define CLANG_ENABLE_ARCMT 1
|
||||||
|
#define CLANG_ENABLE_OBJC_REWRITER 1
|
||||||
|
#define CLANG_ENABLE_STATIC_ANALYZER 1
|
||||||
|
|
||||||
|
/* Spawn a new process clang.exe for the CC1 tool invocation, when necessary */
|
||||||
|
#define CLANG_SPAWN_CC1 0
|
||||||
|
|
||||||
|
#endif
|
487
utils/bazel/llvm-project-overlay/clang/unittests/BUILD.bazel
Normal file
487
utils/bazel/llvm-project-overlay/clang/unittests/BUILD.bazel
Normal file
@ -0,0 +1,487 @@
|
|||||||
|
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
# See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
|
package(
|
||||||
|
default_visibility = ["//visibility:public"],
|
||||||
|
licenses = ["notice"],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "ast_tests",
|
||||||
|
size = "medium",
|
||||||
|
srcs = glob(
|
||||||
|
[
|
||||||
|
"AST/*.cpp",
|
||||||
|
"AST/*.h",
|
||||||
|
],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
shard_count = 20,
|
||||||
|
deps = [
|
||||||
|
"//clang:ast",
|
||||||
|
"//clang:ast_matchers",
|
||||||
|
"//clang:basic",
|
||||||
|
"//clang:frontend",
|
||||||
|
"//clang:lex",
|
||||||
|
"//clang:testing",
|
||||||
|
"//clang:tooling",
|
||||||
|
"//llvm:Core",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:TestingSupport",
|
||||||
|
"//llvm:gmock",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "ast_matchers_tests_hdrs",
|
||||||
|
testonly = 1,
|
||||||
|
hdrs = glob(
|
||||||
|
["ASTMatchers/*.h"],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
deps = [
|
||||||
|
"//clang:ast_matchers",
|
||||||
|
"//clang:frontend",
|
||||||
|
"//clang:testing",
|
||||||
|
"//clang:tooling",
|
||||||
|
"//llvm:gtest",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "ast_matchers_tests",
|
||||||
|
size = "medium",
|
||||||
|
srcs = glob(
|
||||||
|
["ASTMatchers/*.cpp"],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
shard_count = 20,
|
||||||
|
deps = [
|
||||||
|
":ast_matchers_tests_hdrs",
|
||||||
|
"//clang:ast",
|
||||||
|
"//clang:ast_matchers",
|
||||||
|
"//clang:frontend",
|
||||||
|
"//clang:tooling",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:TestingSupport",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "ast_matchers_dynamic_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
["ASTMatchers/Dynamic/*.cpp"],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
deps = [
|
||||||
|
":ast_matchers_tests_hdrs",
|
||||||
|
"//clang:ast_matchers",
|
||||||
|
"//clang:ast_matchers_dynamic",
|
||||||
|
"//clang:frontend",
|
||||||
|
"//clang:tooling",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "analysis_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
[
|
||||||
|
"Analysis/*.cpp",
|
||||||
|
"Analysis/*.h",
|
||||||
|
],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
deps = [
|
||||||
|
"//clang:analysis",
|
||||||
|
"//clang:ast",
|
||||||
|
"//clang:ast_matchers",
|
||||||
|
"//clang:basic",
|
||||||
|
"//clang:lex",
|
||||||
|
"//clang:parse",
|
||||||
|
"//clang:tooling",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:gmock",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "basic_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
["Basic/*.cpp"],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
deps = [
|
||||||
|
"//clang:basic",
|
||||||
|
"//clang:frontend",
|
||||||
|
"//clang:lex",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:config",
|
||||||
|
"//llvm:gmock",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "codegen_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
[
|
||||||
|
"CodeGen/*.cpp",
|
||||||
|
"CodeGen/*.h",
|
||||||
|
],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
deps = [
|
||||||
|
"//clang:ast",
|
||||||
|
"//clang:basic",
|
||||||
|
"//clang:codegen",
|
||||||
|
"//clang:frontend",
|
||||||
|
"//clang:lex",
|
||||||
|
"//clang:parse",
|
||||||
|
"//clang:sema",
|
||||||
|
"//llvm:Core",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "format_tests",
|
||||||
|
size = "medium",
|
||||||
|
srcs = glob(
|
||||||
|
[
|
||||||
|
"Format/*.cpp",
|
||||||
|
"Format/*.h",
|
||||||
|
"Tooling/*.h",
|
||||||
|
],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
copts = ["$(STACK_FRAME_UNLIMITED)"],
|
||||||
|
shard_count = 20,
|
||||||
|
deps = [
|
||||||
|
"//clang:basic",
|
||||||
|
"//clang:format",
|
||||||
|
"//clang:frontend",
|
||||||
|
"//clang:tooling_core",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "frontend_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
["Frontend/*.cpp"],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
deps = [
|
||||||
|
"//clang:ast",
|
||||||
|
"//clang:basic",
|
||||||
|
"//clang:codegen",
|
||||||
|
"//clang:driver_options_inc_gen",
|
||||||
|
"//clang:frontend",
|
||||||
|
"//clang:frontend_tool",
|
||||||
|
"//clang:lex",
|
||||||
|
"//clang:sema",
|
||||||
|
"//clang:serialization",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:gmock",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "lex_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
[
|
||||||
|
"Lex/*.cpp",
|
||||||
|
"Lex/*.h",
|
||||||
|
],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
copts = ["$(STACK_FRAME_UNLIMITED)"],
|
||||||
|
deps = [
|
||||||
|
"//clang:ast",
|
||||||
|
"//clang:basic",
|
||||||
|
"//clang:lex",
|
||||||
|
"//clang:parse",
|
||||||
|
"//clang:sema",
|
||||||
|
"//clang:serialization",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:gmock",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
# A library to carefully expose the tooling headers using the include prefix
|
||||||
|
# expected by the `rename_tests`.
|
||||||
|
cc_library(
|
||||||
|
name = "rename_tests_tooling_hdrs",
|
||||||
|
testonly = 1,
|
||||||
|
hdrs = glob(
|
||||||
|
["Tooling/*.h"],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
include_prefix = "unittests",
|
||||||
|
deps = [
|
||||||
|
"//clang:ast",
|
||||||
|
"//clang:basic",
|
||||||
|
"//clang:frontend",
|
||||||
|
"//clang:rewrite",
|
||||||
|
"//clang:tooling",
|
||||||
|
"//clang:tooling_core",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:gtest",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "rename_tests",
|
||||||
|
size = "small",
|
||||||
|
timeout = "moderate",
|
||||||
|
srcs = glob(
|
||||||
|
[
|
||||||
|
"Rename/*.cpp",
|
||||||
|
"Rename/*.h",
|
||||||
|
],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
shard_count = 20,
|
||||||
|
deps = [
|
||||||
|
":rename_tests_tooling_hdrs",
|
||||||
|
"//clang:ast_matchers",
|
||||||
|
"//clang:basic",
|
||||||
|
"//clang:format",
|
||||||
|
"//clang:frontend",
|
||||||
|
"//clang:tooling",
|
||||||
|
"//clang:tooling_refactoring",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "rewrite_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
["Rewrite/*.cpp"],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
deps = [
|
||||||
|
"//clang:rewrite",
|
||||||
|
"//clang:tooling",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "sema_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
["Sema/*.cpp"],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
deps = [
|
||||||
|
":ast_matchers_tests_hdrs",
|
||||||
|
"//clang:ast",
|
||||||
|
"//clang:ast_matchers",
|
||||||
|
"//clang:frontend",
|
||||||
|
"//clang:lex",
|
||||||
|
"//clang:parse",
|
||||||
|
"//clang:sema",
|
||||||
|
"//clang:tooling",
|
||||||
|
"//llvm:TestingSupport",
|
||||||
|
"//llvm:gmock",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "static_analyzer_test_headers",
|
||||||
|
testonly = 1,
|
||||||
|
hdrs = glob(
|
||||||
|
["StaticAnalyzer/*.h"],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
deps = [
|
||||||
|
"//clang:ast_matchers",
|
||||||
|
"//clang:crosstu",
|
||||||
|
"//clang:frontend",
|
||||||
|
"//clang:static_analyzer_core",
|
||||||
|
"//clang:static_analyzer_frontend",
|
||||||
|
"//clang:tooling",
|
||||||
|
"//llvm:gtest",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "static_analyzer_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
["StaticAnalyzer/*.cpp"],
|
||||||
|
allow_empty = False,
|
||||||
|
exclude = [
|
||||||
|
# New test has unused-variable warnings.
|
||||||
|
"StaticAnalyzer/ParamRegionTest.cpp",
|
||||||
|
],
|
||||||
|
),
|
||||||
|
deps = [
|
||||||
|
":static_analyzer_test_headers",
|
||||||
|
"//clang:basic",
|
||||||
|
"//clang:frontend",
|
||||||
|
"//clang:static_analyzer_core",
|
||||||
|
"//clang:static_analyzer_frontend",
|
||||||
|
"//clang:tooling",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:config",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "tooling_tests",
|
||||||
|
size = "medium",
|
||||||
|
srcs = glob(
|
||||||
|
[
|
||||||
|
"Tooling/*.cpp",
|
||||||
|
"Tooling/*.h",
|
||||||
|
],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
shard_count = 20,
|
||||||
|
deps = [
|
||||||
|
"//clang:ast",
|
||||||
|
"//clang:ast_matchers",
|
||||||
|
"//clang:basic",
|
||||||
|
"//clang:format",
|
||||||
|
"//clang:frontend",
|
||||||
|
"//clang:lex",
|
||||||
|
"//clang:rewrite",
|
||||||
|
"//clang:tooling",
|
||||||
|
"//clang:tooling_core",
|
||||||
|
"//clang:tooling_inclusions",
|
||||||
|
"//clang:tooling_refactoring",
|
||||||
|
"//clang:transformer",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:TestingSupport",
|
||||||
|
"//llvm:gmock",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
# A library to carefully expose the tooling headers using the include prefix
|
||||||
|
# expected by the `tooling_recursive_ast_visitor_tests`.
|
||||||
|
cc_library(
|
||||||
|
name = "tooling_recursive_ast_visitor_tests_tooling_hdrs",
|
||||||
|
testonly = 1,
|
||||||
|
hdrs = glob(
|
||||||
|
["Tooling/*.h"],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
strip_include_prefix = "Tooling",
|
||||||
|
deps = [
|
||||||
|
"//clang:ast",
|
||||||
|
"//clang:basic",
|
||||||
|
"//clang:frontend",
|
||||||
|
"//clang:rewrite",
|
||||||
|
"//clang:tooling",
|
||||||
|
"//clang:tooling_core",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:gtest",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "tooling_recursive_ast_visitor_tests",
|
||||||
|
size = "medium",
|
||||||
|
srcs = glob(
|
||||||
|
["Tooling/RecursiveASTVisitorTests/*.cpp"],
|
||||||
|
allow_empty = False,
|
||||||
|
) + [
|
||||||
|
"Tooling/RecursiveASTVisitorTests/CallbacksCommon.h",
|
||||||
|
],
|
||||||
|
deps = [
|
||||||
|
":tooling_recursive_ast_visitor_tests_tooling_hdrs",
|
||||||
|
"//clang:ast",
|
||||||
|
"//clang:basic",
|
||||||
|
"//clang:frontend",
|
||||||
|
"//clang:lex",
|
||||||
|
"//clang:tooling",
|
||||||
|
"//clang:tooling_syntax",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:TestingSupport",
|
||||||
|
"//llvm:gmock",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "tooling_syntax_tests",
|
||||||
|
size = "medium",
|
||||||
|
srcs = glob(
|
||||||
|
[
|
||||||
|
"Tooling/Syntax/*.cpp",
|
||||||
|
"Tooling/Syntax/*.h",
|
||||||
|
],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
shard_count = 20,
|
||||||
|
deps = [
|
||||||
|
"//clang:ast",
|
||||||
|
"//clang:basic",
|
||||||
|
"//clang:frontend",
|
||||||
|
"//clang:lex",
|
||||||
|
"//clang:testing",
|
||||||
|
"//clang:tooling",
|
||||||
|
"//clang:tooling_core",
|
||||||
|
"//clang:tooling_syntax",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:TestingSupport",
|
||||||
|
"//llvm:gmock",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "libclang_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
["libclang/*.cpp"],
|
||||||
|
allow_empty = False,
|
||||||
|
) + [
|
||||||
|
"libclang/TestUtils.h",
|
||||||
|
],
|
||||||
|
deps = [
|
||||||
|
"//clang:c-bindings",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
4051
utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
Normal file
4051
utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
Normal file
File diff suppressed because it is too large
Load Diff
35
utils/bazel/llvm-project-overlay/llvm/binary_alias.bzl
Normal file
35
utils/bazel/llvm-project-overlay/llvm/binary_alias.bzl
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
# See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
|
"""Creates a copy of a binary, giving it a different basename.
|
||||||
|
|
||||||
|
binary_alias(
|
||||||
|
name = "my_binary_other_name",
|
||||||
|
binary = ":some_cc_binary",
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
|
||||||
|
def _binary_alias_impl(ctx):
|
||||||
|
ctx.actions.symlink(
|
||||||
|
target_file = ctx.executable.binary,
|
||||||
|
output = ctx.outputs.executable,
|
||||||
|
is_executable = True,
|
||||||
|
)
|
||||||
|
|
||||||
|
return [DefaultInfo(
|
||||||
|
executable = ctx.outputs.executable,
|
||||||
|
runfiles = ctx.attr.binary[DefaultInfo].default_runfiles,
|
||||||
|
)]
|
||||||
|
|
||||||
|
binary_alias = rule(
|
||||||
|
_binary_alias_impl,
|
||||||
|
attrs = {
|
||||||
|
"binary": attr.label(
|
||||||
|
mandatory = True,
|
||||||
|
executable = True,
|
||||||
|
cfg = "target",
|
||||||
|
),
|
||||||
|
},
|
||||||
|
executable = True,
|
||||||
|
)
|
54
utils/bazel/llvm-project-overlay/llvm/cc_plugin_library.bzl
Normal file
54
utils/bazel/llvm-project-overlay/llvm/cc_plugin_library.bzl
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
# See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
|
"""A macro to produce a loadable plugin library for the target OS.
|
||||||
|
|
||||||
|
This macro produces a `cc_binary` rule with the name `name + "_impl"`. It
|
||||||
|
forces the rule to statically link in its dependencies but to be linked as a
|
||||||
|
shared "plugin" library. It then creates binary aliases to `.so`, `.dylib`
|
||||||
|
,and `.dll` suffixed names for use on various platforms and selects between
|
||||||
|
these into a filegroup with the exact name passed to the macro.
|
||||||
|
"""
|
||||||
|
|
||||||
|
load("@rules_cc//cc:defs.bzl", "cc_binary")
|
||||||
|
load(":binary_alias.bzl", "binary_alias")
|
||||||
|
|
||||||
|
def cc_plugin_library(name, **kwargs):
|
||||||
|
# Neither the name of the plugin binary nor tags on whether it is built are
|
||||||
|
# configurable. Instead, we build a `cc_binary` that implements the plugin
|
||||||
|
# library using a `_impl` suffix. Bazel will use appropriate flags to cause
|
||||||
|
# this file to be a plugin library regardless of its name. We then create
|
||||||
|
# binary aliases in the different possible platform names, and select
|
||||||
|
# between these different names into a filegroup. The macro's name becomes
|
||||||
|
# the filegroup name and it contains exactly one target that is the target
|
||||||
|
# platform suffixed plugin library.
|
||||||
|
#
|
||||||
|
# All-in-all, this is a pretty poor workaround. I think this is part of the
|
||||||
|
# Bazel issue: https://github.com/bazelbuild/bazel/issues/7538
|
||||||
|
cc_binary(
|
||||||
|
name = name + "_impl",
|
||||||
|
linkshared = True,
|
||||||
|
linkstatic = True,
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
binary_alias(
|
||||||
|
name = name + ".so",
|
||||||
|
binary = ":" + name + "_impl",
|
||||||
|
)
|
||||||
|
binary_alias(
|
||||||
|
name = name + ".dll",
|
||||||
|
binary = ":" + name + "_impl",
|
||||||
|
)
|
||||||
|
binary_alias(
|
||||||
|
name = name + ".dylib",
|
||||||
|
binary = ":" + name + "_impl",
|
||||||
|
)
|
||||||
|
native.filegroup(
|
||||||
|
name = name,
|
||||||
|
srcs = select({
|
||||||
|
"@bazel_tools//src/conditions:windows": [":" + name + ".dll"],
|
||||||
|
"@bazel_tools//src/conditions:darwin": [":" + name + ".dylib"],
|
||||||
|
"//conditions:default": [":" + name + ".so"],
|
||||||
|
}),
|
||||||
|
)
|
77
utils/bazel/llvm-project-overlay/llvm/config.bzl
Normal file
77
utils/bazel/llvm-project-overlay/llvm/config.bzl
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
# See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
|
"""Defines variables that use selects to configure LLVM based on platform."""
|
||||||
|
|
||||||
|
def native_arch_defines(arch, triple):
|
||||||
|
return [
|
||||||
|
"LLVM_NATIVE_ARCH=\\\"{}\\\"".format(arch),
|
||||||
|
"LLVM_NATIVE_ASMPARSER=LLVMInitialize{}AsmParser".format(arch),
|
||||||
|
"LLVM_NATIVE_ASMPRINTER=LLVMInitialize{}AsmPrinter".format(arch),
|
||||||
|
"LLVM_NATIVE_DISASSEMBLER=LLVMInitialize{}Disassembler".format(arch),
|
||||||
|
"LLVM_NATIVE_TARGET=LLVMInitialize{}Target".format(arch),
|
||||||
|
"LLVM_NATIVE_TARGETINFO=LLVMInitialize{}TargetInfo".format(arch),
|
||||||
|
"LLVM_NATIVE_TARGETMC=LLVMInitialize{}TargetMC".format(arch),
|
||||||
|
"LLVM_HOST_TRIPLE=\\\"{}\\\"".format(triple),
|
||||||
|
"LLVM_DEFAULT_TARGET_TRIPLE=\\\"{}\\\"".format(triple),
|
||||||
|
]
|
||||||
|
|
||||||
|
posix_defines = [
|
||||||
|
"LLVM_ON_UNIX=1",
|
||||||
|
"HAVE_BACKTRACE=1",
|
||||||
|
"BACKTRACE_HEADER=<execinfo.h>",
|
||||||
|
"LTDL_SHLIB_EXT=\\\".so\\\"",
|
||||||
|
"LLVM_PLUGIN_EXT=\\\".so\\\"",
|
||||||
|
"LLVM_ENABLE_THREADS=1",
|
||||||
|
"HAVE_SYSEXITS_H=1",
|
||||||
|
"HAVE_UNISTD_H=1",
|
||||||
|
"HAVE_STRERROR_R=1",
|
||||||
|
"HAVE_LIBPTHREAD=1",
|
||||||
|
"HAVE_PTHREAD_GETNAME_NP=1",
|
||||||
|
"HAVE_PTHREAD_SETNAME_NP=1",
|
||||||
|
"HAVE_PTHREAD_GETSPECIFIC=1",
|
||||||
|
]
|
||||||
|
|
||||||
|
linux_defines = posix_defines + [
|
||||||
|
"_GNU_SOURCE",
|
||||||
|
"HAVE_LINK_H=1",
|
||||||
|
"HAVE_LSEEK64=1",
|
||||||
|
"HAVE_MALLINFO=1",
|
||||||
|
"HAVE_POSIX_FALLOCATE=1",
|
||||||
|
"HAVE_SBRK=1",
|
||||||
|
"HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC=1",
|
||||||
|
]
|
||||||
|
|
||||||
|
macos_defines = posix_defines + [
|
||||||
|
"HAVE_MACH_MACH_H=1",
|
||||||
|
"HAVE_MALLOC_MALLOC_H=1",
|
||||||
|
"HAVE_MALLOC_ZONE_STATISTICS=1",
|
||||||
|
"HAVE_PROC_PID_RUSAGE=1",
|
||||||
|
]
|
||||||
|
|
||||||
|
win32_defines = [
|
||||||
|
# MSVC specific
|
||||||
|
"stricmp=_stricmp",
|
||||||
|
"strdup=_strdup",
|
||||||
|
|
||||||
|
# LLVM features
|
||||||
|
"LTDL_SHLIB_EXT=\\\".dll\\\"",
|
||||||
|
"LLVM_PLUGIN_EXT=\\\".dll\\\"",
|
||||||
|
]
|
||||||
|
|
||||||
|
# TODO: We should switch to platforms-based config settings to make this easier
|
||||||
|
# to express.
|
||||||
|
os_defines = select({
|
||||||
|
"@bazel_tools//src/conditions:windows": win32_defines,
|
||||||
|
"@bazel_tools//src/conditions:darwin": macos_defines,
|
||||||
|
"//conditions:default": linux_defines,
|
||||||
|
})
|
||||||
|
|
||||||
|
# TODO: We should split out host vs. target here.
|
||||||
|
llvm_config_defines = os_defines + select({
|
||||||
|
"@bazel_tools//src/conditions:windows": native_arch_defines("X86", "x86_64-pc-win32"),
|
||||||
|
"@bazel_tools//src/conditions:darwin": native_arch_defines("X86", "x86_64-unknown-darwin"),
|
||||||
|
"@bazel_tools//src/conditions:linux_aarch64": native_arch_defines("AArch64", "aarch64-unknown-linux-gnu"),
|
||||||
|
"//conditions:default": native_arch_defines("X86", "x86_64-unknown-linux-gnu"),
|
||||||
|
})
|
@ -0,0 +1,363 @@
|
|||||||
|
/*===------- llvm/Config/config.h - llvm configuration ------------*- C -*-===*/
|
||||||
|
/* */
|
||||||
|
/* Part of the LLVM Project, under the Apache License v2.0 with LLVM */
|
||||||
|
/* Exceptions. */
|
||||||
|
/* See https://llvm.org/LICENSE.txt for license information. */
|
||||||
|
/* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */
|
||||||
|
/* */
|
||||||
|
/*===----------------------------------------------------------------------===*/
|
||||||
|
|
||||||
|
/* This is a manual port of config.h.cmake for the symbols that do not change
|
||||||
|
based on platform. Those that do change should not be defined here and
|
||||||
|
instead use Bazel cc_library defines. Some attempt has been made to extract
|
||||||
|
such symbols that do vary based on platform (for the platforms we care about)
|
||||||
|
into Bazel defines, but it is by no means complete, so if you see something
|
||||||
|
that looks wrong, it probably is. */
|
||||||
|
|
||||||
|
#ifndef CONFIG_H
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
// Include this header only under the llvm source tree.
|
||||||
|
// This is a private header.
|
||||||
|
|
||||||
|
/* Exported configuration */
|
||||||
|
#include "llvm/Config/llvm-config.h"
|
||||||
|
|
||||||
|
/* Bug report URL. */
|
||||||
|
#define BUG_REPORT_URL "https://bugs.llvm.org/"
|
||||||
|
|
||||||
|
/* Define to 1 to enable backtraces, and to 0 otherwise. */
|
||||||
|
#define ENABLE_BACKTRACES 1
|
||||||
|
|
||||||
|
/* Define to 1 to enable crash overrides, and to 0 otherwise. */
|
||||||
|
#define ENABLE_CRASH_OVERRIDES 1
|
||||||
|
|
||||||
|
/* Define to 1 to enable crash memory dumps, and to 0 otherwise. */
|
||||||
|
#define LLVM_ENABLE_CRASH_DUMPS 0
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `backtrace' function. */
|
||||||
|
/* HAVE_BACKTRACE defined in Bazel */
|
||||||
|
|
||||||
|
/* BACKTRACE_HEADER defined in Bazel */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <CrashReporterClient.h> header file. */
|
||||||
|
/* HAVE_CRASHREPORTERCLIENT_H defined in Bazel */
|
||||||
|
|
||||||
|
/* can use __crashreporter_info__ */
|
||||||
|
/* HAVE_CRASHREPORTER_INFO defined in Bazel */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `arc4random', and to 0 if you
|
||||||
|
don't. */
|
||||||
|
#define HAVE_DECL_ARC4RANDOM 0
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `FE_ALL_EXCEPT', and to 0 if you
|
||||||
|
don't. */
|
||||||
|
#define HAVE_DECL_FE_ALL_EXCEPT 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `FE_INEXACT', and to 0 if you
|
||||||
|
don't. */
|
||||||
|
#define HAVE_DECL_FE_INEXACT 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `strerror_s', and to 0 if you
|
||||||
|
don't. */
|
||||||
|
#define HAVE_DECL_STRERROR_S 0
|
||||||
|
|
||||||
|
/* Define to 1 if you have the DIA SDK installed, and to 0 if you don't. */
|
||||||
|
#define LLVM_ENABLE_DIA_SDK 0
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||||
|
#define HAVE_DLFCN_H 1
|
||||||
|
|
||||||
|
/* Define if dlopen() is available on this platform. */
|
||||||
|
#define HAVE_DLOPEN 1
|
||||||
|
|
||||||
|
/* Define if dladdr() is available on this platform. */
|
||||||
|
/* #undef HAVE_DLADDR */
|
||||||
|
|
||||||
|
/* Define to 1 if we can register EH frames on this platform. */
|
||||||
|
#define HAVE_REGISTER_FRAME 1
|
||||||
|
|
||||||
|
/* Define to 1 if we can deregister EH frames on this platform. */
|
||||||
|
#define HAVE_DEREGISTER_FRAME 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <errno.h> header file. */
|
||||||
|
#define HAVE_ERRNO_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||||
|
#define HAVE_FCNTL_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <fenv.h> header file. */
|
||||||
|
#define HAVE_FENV_H 1
|
||||||
|
|
||||||
|
/* Define if libffi is available on this platform. */
|
||||||
|
/* #undef HAVE_FFI_CALL */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <ffi/ffi.h> header file. */
|
||||||
|
/* #undef HAVE_FFI_FFI_H */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <ffi.h> header file. */
|
||||||
|
/* #undef HAVE_FFI_H */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `futimens' function. */
|
||||||
|
#define HAVE_FUTIMENS 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `futimes' function. */
|
||||||
|
#define HAVE_FUTIMES 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getpagesize' function. */
|
||||||
|
#define HAVE_GETPAGESIZE 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getrlimit' function. */
|
||||||
|
#define HAVE_GETRLIMIT 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getrusage' function. */
|
||||||
|
#define HAVE_GETRUSAGE 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `isatty' function. */
|
||||||
|
#define HAVE_ISATTY 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `edit' library (-ledit). */
|
||||||
|
/* #undef HAVE_LIBEDIT */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `pfm' library (-lpfm). */
|
||||||
|
/* #undef HAVE_LIBPFM */
|
||||||
|
|
||||||
|
/* Define to 1 if the `perf_branch_entry' struct has field cycles. */
|
||||||
|
/* #undef LIBPFM_HAS_FIELD_CYCLES */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `psapi' library (-lpsapi). */
|
||||||
|
/* #undef HAVE_LIBPSAPI */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `pthread' library (-lpthread). */
|
||||||
|
#define HAVE_LIBPTHREAD 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `pthread_getname_np' function. */
|
||||||
|
#define HAVE_PTHREAD_GETNAME_NP 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `pthread_setname_np' function. */
|
||||||
|
#define HAVE_PTHREAD_SETNAME_NP 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <link.h> header file. */
|
||||||
|
/* HAVE_LINK_H defined in Bazel */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `lseek64' function. */
|
||||||
|
/* HAVE_LSEEK64 defined in Bazel */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <mach/mach.h> header file. */
|
||||||
|
/* HAVE_MACH_MACH_H defined in Bazel */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `mallctl' function. */
|
||||||
|
/* #undef HAVE_MALLCTL */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `mallinfo' function. */
|
||||||
|
/* HAVE_MALLINFO defined in Bazel */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <malloc/malloc.h> header file. */
|
||||||
|
/* HAVE_MALLOC_MALLOC_H defined in Bazel */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `malloc_zone_statistics' function. */
|
||||||
|
/* HAVE_MALLOC_ZONE_STATISTICS defined in Bazel */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `posix_fallocate' function. */
|
||||||
|
/* HAVE_POSIX_FALLOCATE defined in Bazel */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `posix_spawn' function. */
|
||||||
|
#define HAVE_POSIX_SPAWN 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `pread' function. */
|
||||||
|
#define HAVE_PREAD 1
|
||||||
|
|
||||||
|
/* Have pthread_getspecific */
|
||||||
|
#define HAVE_PTHREAD_GETSPECIFIC 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <pthread.h> header file. */
|
||||||
|
#define HAVE_PTHREAD_H 1
|
||||||
|
|
||||||
|
/* Have pthread_mutex_lock */
|
||||||
|
#define HAVE_PTHREAD_MUTEX_LOCK 1
|
||||||
|
|
||||||
|
/* Have pthread_rwlock_init */
|
||||||
|
#define HAVE_PTHREAD_RWLOCK_INIT 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `sbrk' function. */
|
||||||
|
/* HAVE_SBRK defined in Bazel */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `setenv' function. */
|
||||||
|
#define HAVE_SETENV 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `setrlimit' function. */
|
||||||
|
#define HAVE_SETRLIMIT 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `sigaltstack' function. */
|
||||||
|
#define HAVE_SIGALTSTACK 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <signal.h> header file. */
|
||||||
|
#define HAVE_SIGNAL_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `strerror' function. */
|
||||||
|
#define HAVE_STRERROR 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `strerror_r' function. */
|
||||||
|
/* HAVE_STRERROR_R defined in Bazel */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `sysconf' function. */
|
||||||
|
#define HAVE_SYSCONF 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/ioctl.h> header file. */
|
||||||
|
#define HAVE_SYS_IOCTL_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/mman.h> header file. */
|
||||||
|
#define HAVE_SYS_MMAN_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/param.h> header file. */
|
||||||
|
#define HAVE_SYS_PARAM_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/resource.h> header file. */
|
||||||
|
#define HAVE_SYS_RESOURCE_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||||
|
#define HAVE_SYS_STAT_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||||
|
#define HAVE_SYS_TIME_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if stat struct has st_mtimespec member .*/
|
||||||
|
/* #undef HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC */
|
||||||
|
|
||||||
|
/* Define to 1 if stat struct has st_mtim member. */
|
||||||
|
/* HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC defined in Bazel */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||||
|
#define HAVE_SYS_TYPES_H 1
|
||||||
|
|
||||||
|
/* Define if the setupterm() function is supported this platform. */
|
||||||
|
/* LLVM_ENABLE_TERMINFO defined in Bazel */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <termios.h> header file. */
|
||||||
|
#define HAVE_TERMIOS_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <unistd.h> header file. */
|
||||||
|
/* HAVE_UNISTD_H defined in Bazel */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <valgrind/valgrind.h> header file. */
|
||||||
|
/* #undef HAVE_VALGRIND_VALGRIND_H */
|
||||||
|
|
||||||
|
/* Have host's _alloca */
|
||||||
|
/* #undef HAVE__ALLOCA */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `_chsize_s' function. */
|
||||||
|
/* #undef HAVE__CHSIZE_S */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `_Unwind_Backtrace' function. */
|
||||||
|
#define HAVE__UNWIND_BACKTRACE 1
|
||||||
|
|
||||||
|
/* Have host's __alloca */
|
||||||
|
/* #undef HAVE___ALLOCA */
|
||||||
|
|
||||||
|
/* Have host's __ashldi3 */
|
||||||
|
/* #undef HAVE___ASHLDI3 */
|
||||||
|
|
||||||
|
/* Have host's __ashrdi3 */
|
||||||
|
/* #undef HAVE___ASHRDI3 */
|
||||||
|
|
||||||
|
/* Have host's __chkstk */
|
||||||
|
/* #undef HAVE___CHKSTK */
|
||||||
|
|
||||||
|
/* Have host's __chkstk_ms */
|
||||||
|
/* #undef HAVE___CHKSTK_MS */
|
||||||
|
|
||||||
|
/* Have host's __cmpdi2 */
|
||||||
|
/* #undef HAVE___CMPDI2 */
|
||||||
|
|
||||||
|
/* Have host's __divdi3 */
|
||||||
|
/* #undef HAVE___DIVDI3 */
|
||||||
|
|
||||||
|
/* Have host's __fixdfdi */
|
||||||
|
/* #undef HAVE___FIXDFDI */
|
||||||
|
|
||||||
|
/* Have host's __fixsfdi */
|
||||||
|
/* #undef HAVE___FIXSFDI */
|
||||||
|
|
||||||
|
/* Have host's __floatdidf */
|
||||||
|
/* #undef HAVE___FLOATDIDF */
|
||||||
|
|
||||||
|
/* Have host's __lshrdi3 */
|
||||||
|
/* #undef HAVE___LSHRDI3 */
|
||||||
|
|
||||||
|
/* Have host's __main */
|
||||||
|
/* #undef HAVE___MAIN */
|
||||||
|
|
||||||
|
/* Have host's __moddi3 */
|
||||||
|
/* #undef HAVE___MODDI3 */
|
||||||
|
|
||||||
|
/* Have host's __udivdi3 */
|
||||||
|
/* #undef HAVE___UDIVDI3 */
|
||||||
|
|
||||||
|
/* Have host's __umoddi3 */
|
||||||
|
/* #undef HAVE___UMODDI3 */
|
||||||
|
|
||||||
|
/* Have host's ___chkstk */
|
||||||
|
/* #undef HAVE____CHKSTK */
|
||||||
|
|
||||||
|
/* Have host's ___chkstk_ms */
|
||||||
|
/* #undef HAVE____CHKSTK_MS */
|
||||||
|
|
||||||
|
/* Linker version detected at compile time. */
|
||||||
|
/* #undef HOST_LINK_VERSION */
|
||||||
|
|
||||||
|
/* Target triple LLVM will generate code for by default */
|
||||||
|
/* Doesn't use `cmakedefine` because it is allowed to be empty. */
|
||||||
|
/* LLVM_DEFAULT_TARGET_TRIPLE defined in Bazel */
|
||||||
|
|
||||||
|
/* Define if zlib compression is available */
|
||||||
|
/* LLVM_ENABLE_ZLIB defined in Bazel */
|
||||||
|
|
||||||
|
/* Define if overriding target triple is enabled */
|
||||||
|
/* #undef LLVM_TARGET_TRIPLE_ENV */
|
||||||
|
|
||||||
|
/* LLVM version information */
|
||||||
|
/* #undef LLVM_VERSION_INFO */
|
||||||
|
|
||||||
|
/* Whether tools show host and target info when invoked with --version */
|
||||||
|
#define LLVM_VERSION_PRINTER_SHOW_HOST_TARGET_INFO 1
|
||||||
|
|
||||||
|
/* Define if libxml2 is supported on this platform. */
|
||||||
|
/* #undef LLVM_ENABLE_LIBXML2 */
|
||||||
|
|
||||||
|
/* Define to the extension used for shared libraries, say, ".so". */
|
||||||
|
/* LTDL_SHLIB_EXT defined in Bazel */
|
||||||
|
|
||||||
|
/* Define to the address where bug reports for this package should be sent. */
|
||||||
|
#define PACKAGE_BUGREPORT "https://bugs.llvm.org/"
|
||||||
|
|
||||||
|
/* Define to the full name of this package. */
|
||||||
|
#define PACKAGE_NAME "LLVM"
|
||||||
|
|
||||||
|
/* Define to the full name and version of this package. */
|
||||||
|
#define PACKAGE_STRING PACKAGE_NAME " " LLVM_VERSION_STRING
|
||||||
|
|
||||||
|
/* Define to the version of this package. */
|
||||||
|
#define PACKAGE_VERSION LLVM_VERSION_STRING
|
||||||
|
|
||||||
|
/* Define to the vendor of this package. */
|
||||||
|
/* #undef PACKAGE_VENDOR */
|
||||||
|
|
||||||
|
/* Define as the return type of signal handlers (`int' or `void'). */
|
||||||
|
#define RETSIGTYPE void
|
||||||
|
|
||||||
|
/* Define if std::is_trivially_copyable is supported */
|
||||||
|
#define HAVE_STD_IS_TRIVIALLY_COPYABLE 1
|
||||||
|
|
||||||
|
/* Define to a function implementing stricmp */
|
||||||
|
/* stricmp defined in Bazel */
|
||||||
|
|
||||||
|
/* Define to a function implementing strdup */
|
||||||
|
/* strdup defined in Bazel */
|
||||||
|
|
||||||
|
/* Whether GlobalISel rule coverage is being collected */
|
||||||
|
#define LLVM_GISEL_COV_ENABLED 0
|
||||||
|
|
||||||
|
/* Define to the default GlobalISel coverage file prefix */
|
||||||
|
/* #undef LLVM_GISEL_COV_PREFIX */
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,111 @@
|
|||||||
|
/*===------- llvm/Config/llvm-config.h - llvm configuration -------*- C -*-===*/
|
||||||
|
/* */
|
||||||
|
/* Part of the LLVM Project, under the Apache License v2.0 with LLVM */
|
||||||
|
/* Exceptions. */
|
||||||
|
/* See https://llvm.org/LICENSE.txt for license information. */
|
||||||
|
/* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */
|
||||||
|
/* */
|
||||||
|
/*===----------------------------------------------------------------------===*/
|
||||||
|
|
||||||
|
/* This is a manual port of config.h.cmake for the symbols that do not change
|
||||||
|
based on platform. Those that do change should not be defined here and
|
||||||
|
instead use Bazel cc_library defines. Some attempt has been made to extract
|
||||||
|
such symbols that do vary based on platform (for the platforms we care about)
|
||||||
|
into Bazel defines, but it is by no means complete, so if you see something
|
||||||
|
that looks wrong, it probably is. */
|
||||||
|
|
||||||
|
|
||||||
|
/* This file enumerates variables from the LLVM configuration so that they
|
||||||
|
can be in exported headers and won't override package specific directives.
|
||||||
|
This is a C header that can be included in the llvm-c headers. */
|
||||||
|
|
||||||
|
#ifndef LLVM_CONFIG_H
|
||||||
|
#define LLVM_CONFIG_H
|
||||||
|
|
||||||
|
/* Define if LLVM_ENABLE_DUMP is enabled */
|
||||||
|
/* #undef LLVM_ENABLE_DUMP */
|
||||||
|
|
||||||
|
/* Target triple LLVM will generate code for by default */
|
||||||
|
/* LLVM_DEFAULT_TARGET_TRIPLE defined in Bazel */
|
||||||
|
|
||||||
|
/* Define if threads enabled */
|
||||||
|
#define LLVM_ENABLE_THREADS 1
|
||||||
|
|
||||||
|
/* Has gcc/MSVC atomic intrinsics */
|
||||||
|
#define LLVM_HAS_ATOMICS 1
|
||||||
|
|
||||||
|
/* Host triple LLVM will be executed on */
|
||||||
|
/* LLVM_HOST_TRIPLE defined in Bazel */
|
||||||
|
|
||||||
|
/* LLVM architecture name for the native architecture, if available */
|
||||||
|
/* LLVM_NATIVE_ARCH defined in Bazel */
|
||||||
|
|
||||||
|
/* LLVM name for the native AsmParser init function, if available */
|
||||||
|
/* LLVM_NATIVE_ASMPARSER defined in Bazel */
|
||||||
|
|
||||||
|
/* LLVM name for the native AsmPrinter init function, if available */
|
||||||
|
/* LLVM_NATIVE_ASMPRINTER defined in Bazel */
|
||||||
|
|
||||||
|
/* LLVM name for the native Disassembler init function, if available */
|
||||||
|
/* LLVM_NATIVE_DISASSEMBLER defined in Bazel */
|
||||||
|
|
||||||
|
/* LLVM name for the native Target init function, if available */
|
||||||
|
/* LLVM_NATIVE_TARGET defined in Bazel */
|
||||||
|
|
||||||
|
/* LLVM name for the native TargetInfo init function, if available */
|
||||||
|
/* LLVM_NATIVE_TARGETINFO defined in Bazel */
|
||||||
|
|
||||||
|
/* LLVM name for the native target MC init function, if available */
|
||||||
|
/* LLVM_NATIVE_TARGETMC defined in Bazel */
|
||||||
|
|
||||||
|
/* Define if this is Unixish platform */
|
||||||
|
/* LLVM_ON_UNIX defined in Bazel */
|
||||||
|
|
||||||
|
/* Define if we have the Intel JIT API runtime support library */
|
||||||
|
#define LLVM_USE_INTEL_JITEVENTS 0
|
||||||
|
|
||||||
|
/* Define if we have the oprofile JIT-support library */
|
||||||
|
#define LLVM_USE_OPROFILE 0
|
||||||
|
|
||||||
|
/* Define if we have the perf JIT-support library */
|
||||||
|
#define LLVM_USE_PERF 0
|
||||||
|
|
||||||
|
/* Major version of the LLVM API */
|
||||||
|
#define LLVM_VERSION_MAJOR 13
|
||||||
|
|
||||||
|
/* Minor version of the LLVM API */
|
||||||
|
#define LLVM_VERSION_MINOR 0
|
||||||
|
|
||||||
|
/* Patch version of the LLVM API */
|
||||||
|
#define LLVM_VERSION_PATCH 0
|
||||||
|
|
||||||
|
/* LLVM version string */
|
||||||
|
#define LLVM_VERSION_STRING "13.0.0git"
|
||||||
|
|
||||||
|
/* Whether LLVM records statistics for use with GetStatistics(),
|
||||||
|
* PrintStatistics() or PrintStatisticsJSON()
|
||||||
|
*/
|
||||||
|
#define LLVM_FORCE_ENABLE_STATS 0
|
||||||
|
|
||||||
|
/* Define if we have z3 and want to build it */
|
||||||
|
/* #undef LLVM_WITH_Z3 */
|
||||||
|
|
||||||
|
/* Define if LLVM was built with a dependency to the libtensorflow dynamic library */
|
||||||
|
/* #undef LLVM_HAVE_TF_API */
|
||||||
|
|
||||||
|
/* Define if LLVM was built with a dependency to the tensorflow compiler */
|
||||||
|
/* #undef LLVM_HAVE_TF_AOT */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sysexits.h> header file. */
|
||||||
|
/* HAVE_SYSEXITS_H defined in Bazel */
|
||||||
|
|
||||||
|
/* Define to 1 to enable the experimental new pass manager by default */
|
||||||
|
#define LLVM_ENABLE_NEW_PASS_MANAGER 0
|
||||||
|
|
||||||
|
/* Define if the xar_open() function is supported this platform. */
|
||||||
|
/* #undef HAVE_LIBXAR */
|
||||||
|
|
||||||
|
/* Whether Timers signpost passes in Xcode Instruments */
|
||||||
|
#define LLVM_SUPPORT_XCODE_SIGNPOSTS 0
|
||||||
|
|
||||||
|
#endif
|
81
utils/bazel/llvm-project-overlay/llvm/tblgen.bzl
Normal file
81
utils/bazel/llvm-project-overlay/llvm/tblgen.bzl
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
# See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
|
"""This file contains BUILD extensions for generating source code from LLVM's
|
||||||
|
table definition files using the TableGen tool.
|
||||||
|
|
||||||
|
See http://llvm.org/cmds/tblgen.html for more information on the TableGen
|
||||||
|
tool.
|
||||||
|
TODO(chandlerc): Currently this expresses include-based dependencies as
|
||||||
|
"sources", and has no transitive understanding due to these files not being
|
||||||
|
correctly understood by the build system.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def gentbl(
|
||||||
|
name,
|
||||||
|
tblgen,
|
||||||
|
td_file,
|
||||||
|
td_srcs,
|
||||||
|
tbl_outs,
|
||||||
|
library = True,
|
||||||
|
tblgen_args = "",
|
||||||
|
**kwargs):
|
||||||
|
"""gentbl() generates tabular code from a table definition file.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
name: The name of the build rule for use in dependencies.
|
||||||
|
tblgen: The binary used to produce the output.
|
||||||
|
td_file: The primary table definitions file.
|
||||||
|
td_srcs: A list of table definition files included transitively.
|
||||||
|
tbl_outs: A list of tuples (opts, out), where each opts is a string of
|
||||||
|
options passed to tblgen, and the out is the corresponding output file
|
||||||
|
produced.
|
||||||
|
library: Whether to bundle the generated files into a library.
|
||||||
|
tblgen_args: Extra arguments string to pass to the tblgen binary.
|
||||||
|
**kwargs: Keyword arguments to pass to subsidiary cc_library() rule.
|
||||||
|
"""
|
||||||
|
llvm_project_execroot_path = Label("//llvm:tblgen.bzl", relative_to_caller_repository = False).workspace_root
|
||||||
|
|
||||||
|
if td_file not in td_srcs:
|
||||||
|
td_srcs += [td_file]
|
||||||
|
for (opts, out) in tbl_outs:
|
||||||
|
rule_suffix = "_".join(opts.replace("-", "_").replace("=", "_").split(" "))
|
||||||
|
native.genrule(
|
||||||
|
name = "%s_%s_genrule" % (name, rule_suffix),
|
||||||
|
srcs = td_srcs,
|
||||||
|
outs = [out],
|
||||||
|
tools = [tblgen],
|
||||||
|
message = "Generating code from table: %s" % td_file,
|
||||||
|
cmd = (("$(location %s) -I %s/llvm/include " +
|
||||||
|
"-I %s/clang/include " +
|
||||||
|
"-I $$(dirname $(location %s)) " +
|
||||||
|
"%s $(location %s) %s -o $@") % (
|
||||||
|
tblgen,
|
||||||
|
llvm_project_execroot_path,
|
||||||
|
llvm_project_execroot_path,
|
||||||
|
td_file,
|
||||||
|
opts,
|
||||||
|
td_file,
|
||||||
|
tblgen_args,
|
||||||
|
)),
|
||||||
|
)
|
||||||
|
|
||||||
|
# For now, all generated files can be assumed to comprise public interfaces.
|
||||||
|
# If this is not true, you should specify library = False
|
||||||
|
# and list the generated '.inc' files in "srcs".
|
||||||
|
if library:
|
||||||
|
native.cc_library(
|
||||||
|
name = name,
|
||||||
|
# FIXME: This should be `textual_hdrs` instead of `hdrs`, but
|
||||||
|
# unfortunately that doesn't work with `strip_include_prefix`:
|
||||||
|
# https://github.com/bazelbuild/bazel/issues/12424
|
||||||
|
#
|
||||||
|
# Once that issue is fixed and released, we can switch this to
|
||||||
|
# `textual_hdrs` and remove the feature disabling the various Bazel
|
||||||
|
# features (both current and under-development) that motivated the
|
||||||
|
# distinction between these two.
|
||||||
|
hdrs = [f for (_, f) in tbl_outs],
|
||||||
|
features = ["-parse_headers", "-header_modules"],
|
||||||
|
**kwargs
|
||||||
|
)
|
46
utils/bazel/llvm-project-overlay/llvm/template_rule.bzl
Normal file
46
utils/bazel/llvm-project-overlay/llvm/template_rule.bzl
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
# See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
|
# Rule for simple expansion of template files. This performs a simple
|
||||||
|
# search over the template file for the keys in substitutions,
|
||||||
|
# and replaces them with the corresponding values.
|
||||||
|
#
|
||||||
|
# Typical usage:
|
||||||
|
# load("/tools/build_rules/template_rule", "expand_header_template")
|
||||||
|
# template_rule(
|
||||||
|
# name = "ExpandMyTemplate",
|
||||||
|
# src = "my.template",
|
||||||
|
# out = "my.txt",
|
||||||
|
# substitutions = {
|
||||||
|
# "$VAR1": "foo",
|
||||||
|
# "$VAR2": "bar",
|
||||||
|
# }
|
||||||
|
# )
|
||||||
|
#
|
||||||
|
# Args:
|
||||||
|
# name: The name of the rule.
|
||||||
|
# template: The template file to expand
|
||||||
|
# out: The destination of the expanded file
|
||||||
|
# substitutions: A dictionary mapping strings to their substitutions
|
||||||
|
|
||||||
|
def template_rule_impl(ctx):
|
||||||
|
ctx.actions.expand_template(
|
||||||
|
template = ctx.file.src,
|
||||||
|
output = ctx.outputs.out,
|
||||||
|
substitutions = ctx.attr.substitutions,
|
||||||
|
)
|
||||||
|
|
||||||
|
template_rule = rule(
|
||||||
|
attrs = {
|
||||||
|
"src": attr.label(
|
||||||
|
mandatory = True,
|
||||||
|
allow_single_file = True,
|
||||||
|
),
|
||||||
|
"substitutions": attr.string_dict(mandatory = True),
|
||||||
|
"out": attr.output(mandatory = True),
|
||||||
|
},
|
||||||
|
# output_to_genfiles is required for header files.
|
||||||
|
output_to_genfiles = True,
|
||||||
|
implementation = template_rule_impl,
|
||||||
|
)
|
670
utils/bazel/llvm-project-overlay/llvm/unittests/BUILD.bazel
Normal file
670
utils/bazel/llvm-project-overlay/llvm/unittests/BUILD.bazel
Normal file
@ -0,0 +1,670 @@
|
|||||||
|
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
# See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
|
load("//llvm:tblgen.bzl", "gentbl")
|
||||||
|
|
||||||
|
package(
|
||||||
|
default_visibility = ["//visibility:public"],
|
||||||
|
licenses = ["notice"],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "adt_tests",
|
||||||
|
size = "medium",
|
||||||
|
srcs = glob(
|
||||||
|
[
|
||||||
|
"ADT/*.cpp",
|
||||||
|
"ADT/*.h",
|
||||||
|
],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
shard_count = 20,
|
||||||
|
deps = [
|
||||||
|
"//llvm:Core",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:TestingSupport",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "analysis_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
["Analysis/*.cpp"],
|
||||||
|
allow_empty = False,
|
||||||
|
exclude = [
|
||||||
|
# TODO: Add this file to the build.
|
||||||
|
"Analysis/TFUtilsTest.cpp",
|
||||||
|
],
|
||||||
|
),
|
||||||
|
deps = [
|
||||||
|
"//llvm:Analysis",
|
||||||
|
"//llvm:AsmParser",
|
||||||
|
"//llvm:Core",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:TestingSupport",
|
||||||
|
"//llvm:TransformUtils",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "asm_parser_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
["AsmParser/*.cpp"],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
deps = [
|
||||||
|
"//llvm:AsmParser",
|
||||||
|
"//llvm:Core",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "bitcode_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
["Bitcode/*.cpp"],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
deps = [
|
||||||
|
"//llvm:AsmParser",
|
||||||
|
"//llvm:BitReader",
|
||||||
|
"//llvm:BitWriter",
|
||||||
|
"//llvm:Core",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "bitstream_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
["Bitstream/*.cpp"],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
deps = [
|
||||||
|
"//llvm:BitstreamReader",
|
||||||
|
"//llvm:BitstreamWriter",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "codegen_tests_includes",
|
||||||
|
textual_hdrs = glob(
|
||||||
|
["CodeGen/*.inc"],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "codegen_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
[
|
||||||
|
"CodeGen/*.cpp",
|
||||||
|
"CodeGen/*.h",
|
||||||
|
],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
deps = [
|
||||||
|
":codegen_tests_includes",
|
||||||
|
"//llvm:AllTargetsAsmParsers",
|
||||||
|
"//llvm:AllTargetsCodeGens",
|
||||||
|
"//llvm:Analysis",
|
||||||
|
"//llvm:AsmParser",
|
||||||
|
"//llvm:BinaryFormat",
|
||||||
|
"//llvm:CodeGen",
|
||||||
|
"//llvm:Core",
|
||||||
|
"//llvm:MC",
|
||||||
|
"//llvm:Passes",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:Target",
|
||||||
|
"//llvm:TestingSupport",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "codegen_globalisel_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
[
|
||||||
|
"CodeGen/GlobalISel/*.cpp",
|
||||||
|
"CodeGen/GlobalISel/*.h",
|
||||||
|
],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
copts = [
|
||||||
|
"$(STACK_FRAME_UNLIMITED)",
|
||||||
|
],
|
||||||
|
deps = [
|
||||||
|
"//llvm:AllTargetsAsmParsers",
|
||||||
|
"//llvm:AllTargetsCodeGens",
|
||||||
|
"//llvm:CodeGen",
|
||||||
|
"//llvm:Core",
|
||||||
|
"//llvm:FileCheckLib",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:Target",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "debuginfo_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
[
|
||||||
|
"DebugInfo/DWARF/*.cpp",
|
||||||
|
"DebugInfo/DWARF/*.h",
|
||||||
|
# TODO: Re-enable these when they stop crashing.
|
||||||
|
#"DebugInfo/PDB/*.cpp",
|
||||||
|
#"DebugInfo/PDB/*.h",
|
||||||
|
],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
args = [
|
||||||
|
# Skip a test that relies on reading files in a way that doesn't easily
|
||||||
|
# work with Bazel.
|
||||||
|
"--gtest_filter=-NativeSymbolReuseTest.*",
|
||||||
|
],
|
||||||
|
deps = [
|
||||||
|
"//llvm:AllTargetsAsmParsers",
|
||||||
|
"//llvm:AllTargetsCodeGens",
|
||||||
|
"//llvm:CodeGen",
|
||||||
|
"//llvm:Core",
|
||||||
|
"//llvm:DebugInfoDWARF",
|
||||||
|
"//llvm:DebugInfoPDB",
|
||||||
|
"//llvm:ObjectYAML",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:TestingSupport",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "execution_engine_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
["ExecutionEngine/*.cpp"],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
deps = [
|
||||||
|
"//llvm:AllTargetsCodeGens",
|
||||||
|
"//llvm:AsmParser",
|
||||||
|
"//llvm:Core",
|
||||||
|
"//llvm:ExecutionEngine",
|
||||||
|
"//llvm:Interpreter",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "execution_engine_mcjit_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
[
|
||||||
|
"ExecutionEngine/MCJIT/*.cpp",
|
||||||
|
"ExecutionEngine/MCJIT/*.h",
|
||||||
|
],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
copts = [
|
||||||
|
"$(STACK_FRAME_UNLIMITED)",
|
||||||
|
],
|
||||||
|
deps = [
|
||||||
|
"//llvm:AllTargetsCodeGens",
|
||||||
|
"//llvm:AsmParser",
|
||||||
|
"//llvm:Core",
|
||||||
|
"//llvm:ExecutionEngine",
|
||||||
|
"//llvm:MCJIT",
|
||||||
|
"//llvm:Passes",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "execution_engine_orc_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
[
|
||||||
|
"ExecutionEngine/Orc/*.cpp",
|
||||||
|
"ExecutionEngine/Orc/*.h",
|
||||||
|
],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
args = ["--gtest_filter=-ObjectLinkingLayerTest.TestSetProcessAllSections"],
|
||||||
|
deps = [
|
||||||
|
"//llvm:AllTargetsAsmParsers",
|
||||||
|
"//llvm:AllTargetsCodeGens",
|
||||||
|
"//llvm:AsmParser",
|
||||||
|
"//llvm:Core",
|
||||||
|
"//llvm:ExecutionEngine",
|
||||||
|
"//llvm:OrcJIT",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:TestingSupport",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "filecheck_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
["FileCheck/*.cpp"],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
deps = [
|
||||||
|
"//llvm:FileCheckLib",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:TestingSupport",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "ir_tests",
|
||||||
|
size = "medium", # ConstantRangeTest cases may take several seconds each.
|
||||||
|
srcs = glob(
|
||||||
|
[
|
||||||
|
"IR/*.cpp",
|
||||||
|
"IR/*.h",
|
||||||
|
"Support/KnownBitsTest.h",
|
||||||
|
],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
shard_count = 20,
|
||||||
|
deps = [
|
||||||
|
"//llvm:Analysis",
|
||||||
|
"//llvm:AsmParser",
|
||||||
|
"//llvm:BinaryFormat",
|
||||||
|
"//llvm:Core",
|
||||||
|
"//llvm:Passes",
|
||||||
|
"//llvm:Scalar",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:TestingSupport",
|
||||||
|
"//llvm:config",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "line_editor_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
["LineEditor/*.cpp"],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
deps = [
|
||||||
|
"//llvm:LineEditor",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "frontend_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
["Frontend/*.cpp"],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
deps = [
|
||||||
|
"//llvm:Analysis",
|
||||||
|
"//llvm:FrontendOpenACC",
|
||||||
|
"//llvm:FrontendOpenMP",
|
||||||
|
"//llvm:Passes",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "linker_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
["Linker/*.cpp"],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
deps = [
|
||||||
|
"//llvm:AsmParser",
|
||||||
|
"//llvm:Core",
|
||||||
|
"//llvm:Linker",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "mc_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
["MC/*.cpp"],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
deps = [
|
||||||
|
"//llvm:AllTargetsCodeGens",
|
||||||
|
"//llvm:AllTargetsDisassemblers",
|
||||||
|
"//llvm:MC",
|
||||||
|
"//llvm:MCDisassembler",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "mi_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
["MI/*.cpp"],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
deps = [
|
||||||
|
"//llvm:AllTargetsAsmParsers",
|
||||||
|
"//llvm:AllTargetsCodeGens",
|
||||||
|
"//llvm:CodeGen",
|
||||||
|
"//llvm:Core",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:Target",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "object_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
["Object/*.cpp"],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
deps = [
|
||||||
|
"//llvm:Object",
|
||||||
|
"//llvm:ObjectYAML",
|
||||||
|
"//llvm:TestingSupport",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "object_yaml_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
["ObjectYAML/*.cpp"],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
deps = [
|
||||||
|
"//llvm:DebugInfoCodeView",
|
||||||
|
"//llvm:Object",
|
||||||
|
"//llvm:ObjectYAML",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:TestingSupport",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
gentbl(
|
||||||
|
name = "option_tests_gen",
|
||||||
|
strip_include_prefix = "Option",
|
||||||
|
tbl_outs = [(
|
||||||
|
"-gen-opt-parser-defs",
|
||||||
|
"Option/Opts.inc",
|
||||||
|
)],
|
||||||
|
tblgen = "//llvm:llvm-tblgen",
|
||||||
|
td_file = "Option/Opts.td",
|
||||||
|
td_srcs = [
|
||||||
|
"//llvm:include/llvm/Option/OptParser.td",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
gentbl(
|
||||||
|
name = "automata_automata_gen",
|
||||||
|
strip_include_prefix = "TableGen",
|
||||||
|
tbl_outs = [(
|
||||||
|
"-gen-automata",
|
||||||
|
"TableGen/AutomataAutomata.inc",
|
||||||
|
)],
|
||||||
|
tblgen = "//llvm:llvm-tblgen",
|
||||||
|
td_file = "TableGen/Automata.td",
|
||||||
|
td_srcs = ["//llvm:common_target_td_sources"] + [
|
||||||
|
"TableGen/Automata.td",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
gentbl(
|
||||||
|
name = "automata_tables_gen",
|
||||||
|
strip_include_prefix = "TableGen",
|
||||||
|
tbl_outs = [(
|
||||||
|
"-gen-searchable-tables",
|
||||||
|
"TableGen/AutomataTables.inc",
|
||||||
|
)],
|
||||||
|
tblgen = "//llvm:llvm-tblgen",
|
||||||
|
td_file = "TableGen/Automata.td",
|
||||||
|
td_srcs = ["//llvm:common_target_td_sources"] + [
|
||||||
|
"TableGen/Automata.td",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "option_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
["Option/*.cpp"],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
deps = [
|
||||||
|
":option_tests_gen",
|
||||||
|
"//llvm:Option",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "remarks_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
["Remarks/*.cpp"],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
deps = [
|
||||||
|
"//llvm:BitReader",
|
||||||
|
"//llvm:Remarks",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
"//llvm:remark_linker",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "profile_data_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
["ProfileData/*.cpp"],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
deps = [
|
||||||
|
"//llvm:Core",
|
||||||
|
"//llvm:Coverage",
|
||||||
|
"//llvm:ProfileData",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:TestingSupport",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "support_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
[
|
||||||
|
"Support/*.cpp",
|
||||||
|
"Support/*.h",
|
||||||
|
],
|
||||||
|
allow_empty = False,
|
||||||
|
exclude = [
|
||||||
|
"Support/ParallelTest.cpp",
|
||||||
|
],
|
||||||
|
),
|
||||||
|
args = ["--gtest_filter=-ProgramTest.CreateProcessTrailingSlash"],
|
||||||
|
copts = [
|
||||||
|
"$(STACK_FRAME_UNLIMITED)",
|
||||||
|
],
|
||||||
|
linkstatic = 1,
|
||||||
|
tags = [
|
||||||
|
"local", # Not compatible with the sandbox on MacOS
|
||||||
|
],
|
||||||
|
visibility = ["//visibility:private"],
|
||||||
|
deps = [
|
||||||
|
"//llvm:AllTargetsCodeGens",
|
||||||
|
"//llvm:BinaryFormat",
|
||||||
|
"//llvm:Core",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:TestingSupport",
|
||||||
|
"//llvm:config",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "support_parallel_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = ["Support/ParallelTest.cpp"],
|
||||||
|
copts = [
|
||||||
|
"$(STACK_FRAME_UNLIMITED)",
|
||||||
|
],
|
||||||
|
linkstatic = 1,
|
||||||
|
deps = [
|
||||||
|
"//llvm:AllTargetsCodeGens",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:config",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "tablegen_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
[
|
||||||
|
"TableGen/*.cpp",
|
||||||
|
],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
deps = [
|
||||||
|
":automata_automata_gen",
|
||||||
|
":automata_tables_gen",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:TableGen",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
"//llvm:tblgen",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "target_aarch64_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
["Target/AArch64/*.cpp"],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
copts = [
|
||||||
|
"$(STACK_FRAME_UNLIMITED)",
|
||||||
|
],
|
||||||
|
deps = [
|
||||||
|
"//llvm:AArch64CodeGen",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "transforms_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
[
|
||||||
|
"Transforms/IPO/*.cpp",
|
||||||
|
"Transforms/IPO/*.h",
|
||||||
|
"Transforms/Utils/*.cpp",
|
||||||
|
],
|
||||||
|
allow_empty = False,
|
||||||
|
),
|
||||||
|
deps = [
|
||||||
|
"//llvm:Analysis",
|
||||||
|
"//llvm:AsmParser",
|
||||||
|
"//llvm:Core",
|
||||||
|
"//llvm:IPO",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:TestingSupport",
|
||||||
|
"//llvm:TransformUtils",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_test(
|
||||||
|
name = "llvm_exegesis_tests",
|
||||||
|
size = "small",
|
||||||
|
srcs = glob(
|
||||||
|
[
|
||||||
|
"tools/llvm-exegesis/*.cpp",
|
||||||
|
"tools/llvm-exegesis/X86/*.cpp",
|
||||||
|
"tools/llvm-exegesis/X86/*.h",
|
||||||
|
],
|
||||||
|
allow_empty = False,
|
||||||
|
) + [
|
||||||
|
"tools/llvm-exegesis/Common/AssemblerUtils.h",
|
||||||
|
],
|
||||||
|
copts = ["-DHAVE_LIBPFM=1"],
|
||||||
|
linkopts = ["-lpfm"],
|
||||||
|
tags = [
|
||||||
|
"manual", # External dependency (libpfm4)
|
||||||
|
"nobuildkite", # TODO(chandlerc): Add support for fetching and building libpfm4 and enable this.
|
||||||
|
],
|
||||||
|
deps = [
|
||||||
|
"//llvm:AllTargetsCodeGens",
|
||||||
|
"//llvm:AllTargetsDisassemblers",
|
||||||
|
"//llvm:MC",
|
||||||
|
"//llvm:MCDisassembler",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//llvm:TestingSupport",
|
||||||
|
"//llvm:gtest",
|
||||||
|
"//llvm:gtest_main",
|
||||||
|
"//llvm:llvm-exegesis-lib",
|
||||||
|
],
|
||||||
|
)
|
6595
utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
Normal file
6595
utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
Normal file
File diff suppressed because it is too large
Load Diff
26
utils/bazel/llvm-project-overlay/mlir/build_defs.bzl
Normal file
26
utils/bazel/llvm-project-overlay/mlir/build_defs.bzl
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
# See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
|
"""Rules and macros for MLIR"""
|
||||||
|
|
||||||
|
def if_cuda_available(if_true, if_false = []):
|
||||||
|
return select({
|
||||||
|
# CUDA is not yet supported.
|
||||||
|
"//conditions:default": if_false,
|
||||||
|
})
|
||||||
|
|
||||||
|
def _cc_headers_only_impl(ctx):
|
||||||
|
return CcInfo(compilation_context = ctx.attr.src[CcInfo].compilation_context)
|
||||||
|
|
||||||
|
cc_headers_only = rule(
|
||||||
|
implementation = _cc_headers_only_impl,
|
||||||
|
attrs = {
|
||||||
|
"src": attr.label(
|
||||||
|
mandatory = True,
|
||||||
|
providers = [CcInfo],
|
||||||
|
),
|
||||||
|
},
|
||||||
|
doc = "Provides the headers from 'src' without linking anything.",
|
||||||
|
provides = [CcInfo],
|
||||||
|
)
|
43
utils/bazel/llvm-project-overlay/mlir/linalggen.bzl
Normal file
43
utils/bazel/llvm-project-overlay/mlir/linalggen.bzl
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
# See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
|
"""BUILD extensions for MLIR linalg generation."""
|
||||||
|
|
||||||
|
def genlinalg(name, linalggen, src, linalg_outs):
|
||||||
|
"""genlinalg() generates code from a tc spec file.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
name: The name of the build rule for use in dependencies.
|
||||||
|
linalggen: The binary used to produce the output.
|
||||||
|
src: The tc spec file.
|
||||||
|
linalg_outs: A list of tuples (opts, out), where each opts is a string of
|
||||||
|
options passed to linalggen, and the out is the corresponding output file
|
||||||
|
produced.
|
||||||
|
"""
|
||||||
|
|
||||||
|
for (opts, out) in linalg_outs:
|
||||||
|
# All arguments to generate the output except output destination.
|
||||||
|
base_args = [
|
||||||
|
"$(location %s)" % linalggen,
|
||||||
|
"%s" % opts,
|
||||||
|
"$(location %s)" % src,
|
||||||
|
]
|
||||||
|
rule_suffix = "_".join(opts.replace("-", "_").replace("=", "_").split(" "))
|
||||||
|
|
||||||
|
# Rule to generate code using generated shell script.
|
||||||
|
native.genrule(
|
||||||
|
name = "%s_%s_genrule" % (name, rule_suffix),
|
||||||
|
srcs = [src],
|
||||||
|
outs = [out],
|
||||||
|
tools = [linalggen],
|
||||||
|
cmd = (" ".join(base_args)),
|
||||||
|
)
|
||||||
|
|
||||||
|
# List of opts that do not generate cc files.
|
||||||
|
hdrs = [f for (opts, f) in linalg_outs]
|
||||||
|
native.cc_library(
|
||||||
|
name = name,
|
||||||
|
hdrs = hdrs,
|
||||||
|
textual_hdrs = hdrs,
|
||||||
|
)
|
480
utils/bazel/llvm-project-overlay/mlir/tblgen.bzl
Normal file
480
utils/bazel/llvm-project-overlay/mlir/tblgen.bzl
Normal file
@ -0,0 +1,480 @@
|
|||||||
|
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
# See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
"""BUILD extensions for MLIR table generation."""
|
||||||
|
|
||||||
|
TdInfo = provider(
|
||||||
|
"Holds TableGen files and the dependencies and include paths necessary to" +
|
||||||
|
" build them.",
|
||||||
|
fields = {
|
||||||
|
"transitive_sources": "td files transitively used by this rule.",
|
||||||
|
"transitive_includes": (
|
||||||
|
"include arguments to add to the final TableGen invocation. These" +
|
||||||
|
" are the absolute directory paths that will be added with '-I'."
|
||||||
|
),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
# For now we allow anything that provides DefaultInfo to just forward its files.
|
||||||
|
# In particular, this allows filegroups to be used. This is mostly to ease
|
||||||
|
# transition. In the future, the TdInfo provider will be required.
|
||||||
|
# TODO(gcmn): Switch to enforcing TdInfo provider.
|
||||||
|
def _get_dep_transitive_srcs(dep):
|
||||||
|
"""Extract TdInfo.transitive_sources, falling back to DefaultInfo.files."""
|
||||||
|
if TdInfo in dep:
|
||||||
|
return dep[TdInfo].transitive_sources
|
||||||
|
return dep[DefaultInfo].files
|
||||||
|
|
||||||
|
def _get_dep_transitive_includes(dep):
|
||||||
|
"""Extract TdInfo.transitive_includes, falling back to an empty depset()."""
|
||||||
|
if TdInfo in dep:
|
||||||
|
return dep[TdInfo].transitive_includes
|
||||||
|
return depset()
|
||||||
|
|
||||||
|
def _get_transitive_srcs(srcs, deps):
|
||||||
|
"""Obtain the source files for a target and its transitive dependencies.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
srcs: a list of source files
|
||||||
|
deps: a list of targets that are direct dependencies
|
||||||
|
Returns:
|
||||||
|
a collection of the transitive sources
|
||||||
|
"""
|
||||||
|
return depset(
|
||||||
|
direct = srcs,
|
||||||
|
transitive = [_get_dep_transitive_srcs(dep) for dep in deps],
|
||||||
|
)
|
||||||
|
|
||||||
|
def _get_transitive_includes(includes, deps):
|
||||||
|
"""Obtain the includes paths for a target and its transitive dependencies.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
includes: a list of include paths
|
||||||
|
deps: a list of targets that are direct dependencies
|
||||||
|
Returns:
|
||||||
|
a collection of the transitive include paths
|
||||||
|
"""
|
||||||
|
return depset(
|
||||||
|
direct = includes,
|
||||||
|
transitive = [_get_dep_transitive_includes(dep) for dep in deps],
|
||||||
|
)
|
||||||
|
|
||||||
|
def _prefix_roots(ctx, includes):
|
||||||
|
"""Map the given includes to be relative to all root directories.
|
||||||
|
|
||||||
|
This will expand them to be relative to all the root directories available
|
||||||
|
in the execution environment for ctx.run (bin and genfiles in addition to
|
||||||
|
the normal source root)
|
||||||
|
"""
|
||||||
|
prefixed_includes = []
|
||||||
|
for include in includes:
|
||||||
|
prefixed_includes.append(include)
|
||||||
|
prefixed_includes.append(ctx.genfiles_dir.path + "/" + include)
|
||||||
|
prefixed_includes.append(ctx.bin_dir.path + "/" + include)
|
||||||
|
return prefixed_includes
|
||||||
|
|
||||||
|
def _resolve_includes(ctx, includes):
|
||||||
|
"""Resolves include paths to paths relative to the execution root.
|
||||||
|
|
||||||
|
Relative paths are interpreted as relative to the current label's package.
|
||||||
|
Absolute paths are interpreted as relative to the current label's workspace
|
||||||
|
root."""
|
||||||
|
package = ctx.label.package
|
||||||
|
workspace_root = ctx.label.workspace_root
|
||||||
|
workspace_root = workspace_root if workspace_root else "."
|
||||||
|
resolved_includes = []
|
||||||
|
for include in includes:
|
||||||
|
if not include.startswith("/"):
|
||||||
|
include = "/" + package + "/" + include
|
||||||
|
include = workspace_root + include
|
||||||
|
resolved_includes.extend(_prefix_roots(ctx, [include]))
|
||||||
|
return resolved_includes
|
||||||
|
|
||||||
|
def _td_library_impl(ctx):
|
||||||
|
trans_srcs = _get_transitive_srcs(ctx.files.srcs, ctx.attr.deps)
|
||||||
|
trans_includes = _get_transitive_includes(
|
||||||
|
_resolve_includes(ctx, ctx.attr.includes),
|
||||||
|
ctx.attr.deps,
|
||||||
|
)
|
||||||
|
return [
|
||||||
|
DefaultInfo(files = trans_srcs),
|
||||||
|
TdInfo(
|
||||||
|
transitive_sources = trans_srcs,
|
||||||
|
transitive_includes = trans_includes,
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
||||||
|
td_library = rule(
|
||||||
|
_td_library_impl,
|
||||||
|
attrs = {
|
||||||
|
"srcs": attr.label_list(allow_files = True),
|
||||||
|
"includes": attr.string_list(
|
||||||
|
doc = "Include paths to be added to the final TableGen tool" +
|
||||||
|
" invocation. Relative paths are interpreted as relative to" +
|
||||||
|
" the current label's package. Absolute paths are" +
|
||||||
|
" interpreted as relative to the current label's workspace",
|
||||||
|
),
|
||||||
|
# TODO(gcmn): limit to TdInfo providers.
|
||||||
|
"deps": attr.label_list(
|
||||||
|
doc = "Dependencies providing TableGen source files and include" +
|
||||||
|
" paths.",
|
||||||
|
),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
def _gentbl_rule_impl(ctx):
|
||||||
|
td_file = ctx.file.td_file
|
||||||
|
|
||||||
|
trans_srcs = _get_transitive_srcs(
|
||||||
|
ctx.files.td_srcs + [td_file],
|
||||||
|
ctx.attr.deps,
|
||||||
|
)
|
||||||
|
|
||||||
|
# Note that we have two types of includes here. The deprecated ones expanded
|
||||||
|
# only by "_prefix_roots" are already relative to the execution root, i.e.
|
||||||
|
# may contain an `external/<workspace_name>` prefix if the current workspace
|
||||||
|
# is not the main workspace (where workspace_name is something configured
|
||||||
|
# per-project and therefore generally not known). Note that dirname also
|
||||||
|
# already includes this prefix. The new style of includes have it prepended
|
||||||
|
# automatically by `_resolve_includes` to avoid BUILD files having to depend
|
||||||
|
# on project specific configurations and Bazel implementation details.
|
||||||
|
trans_includes = _get_transitive_includes(
|
||||||
|
_resolve_includes(ctx, ctx.attr.includes + ["/"]) +
|
||||||
|
_prefix_roots(ctx, ctx.attr.td_includes + [td_file.dirname]),
|
||||||
|
ctx.attr.deps,
|
||||||
|
)
|
||||||
|
|
||||||
|
args = ctx.actions.args()
|
||||||
|
args.add_all(ctx.attr.opts)
|
||||||
|
args.add(td_file)
|
||||||
|
args.add_all(trans_includes, before_each = "-I")
|
||||||
|
|
||||||
|
args.add("-o", ctx.outputs.out.path)
|
||||||
|
|
||||||
|
ctx.actions.run(
|
||||||
|
outputs = [ctx.outputs.out],
|
||||||
|
inputs = trans_srcs,
|
||||||
|
executable = ctx.executable.tblgen,
|
||||||
|
arguments = [args],
|
||||||
|
mnemonic = "TdGenerate",
|
||||||
|
)
|
||||||
|
|
||||||
|
return [DefaultInfo()]
|
||||||
|
|
||||||
|
gentbl_rule = rule(
|
||||||
|
_gentbl_rule_impl,
|
||||||
|
doc = "Generates tabular code from a table definition file.",
|
||||||
|
# Match genrule behavior
|
||||||
|
output_to_genfiles = True,
|
||||||
|
attrs = {
|
||||||
|
"tblgen": attr.label(
|
||||||
|
doc = "The TableGen executable with which to generate `out`.",
|
||||||
|
executable = True,
|
||||||
|
cfg = "exec",
|
||||||
|
),
|
||||||
|
"td_file": attr.label(
|
||||||
|
doc = "The TableGen file to run through `tblgen`.",
|
||||||
|
allow_single_file = True,
|
||||||
|
mandatory = True,
|
||||||
|
),
|
||||||
|
"td_srcs": attr.label_list(
|
||||||
|
doc = "Additional TableGen files included by `td_file`. It is not" +
|
||||||
|
" necessary to list td_file here (though not an error).",
|
||||||
|
allow_files = True,
|
||||||
|
),
|
||||||
|
# TODO(gcmn): limit to TdInfo providers.
|
||||||
|
"deps": attr.label_list(
|
||||||
|
doc = "Dependencies providing TableGen source files and include" +
|
||||||
|
" paths.",
|
||||||
|
),
|
||||||
|
"out": attr.output(
|
||||||
|
doc = "The output file for the TableGen invocation.",
|
||||||
|
mandatory = True,
|
||||||
|
),
|
||||||
|
"opts": attr.string_list(
|
||||||
|
doc = "Additional command line options to add to the TableGen" +
|
||||||
|
" invocation. For include arguments, prefer to use" +
|
||||||
|
" `includes`.",
|
||||||
|
),
|
||||||
|
"includes": attr.string_list(
|
||||||
|
doc = "Include paths to be added to the final TableGen tool" +
|
||||||
|
" invocation. Relative paths are interpreted as relative to" +
|
||||||
|
" the current label's package. Absolute paths are" +
|
||||||
|
" interpreted as relative to the current label's workspace." +
|
||||||
|
" Includes are applied from all roots available in the" +
|
||||||
|
" execution environment (source, genfiles, and bin" +
|
||||||
|
" directories). The execution roots themselves and the " +
|
||||||
|
" directory of td_file are always added.",
|
||||||
|
),
|
||||||
|
"td_includes": attr.string_list(
|
||||||
|
doc = "Include paths to add to the TableGen invocation. Paths are" +
|
||||||
|
" interpreted as relative to the current label's workspace" +
|
||||||
|
" root and applied from all roots available in the" +
|
||||||
|
" execution environment (source, genfiles, and bin" +
|
||||||
|
" directories). Deprecated. Use `includes` instead.",
|
||||||
|
),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
# TODO(gcmn): Figure out how to reduce duplication with _gentbl_rule_impl
|
||||||
|
def _gentbl_test_impl(ctx):
|
||||||
|
td_file = ctx.file.td_file
|
||||||
|
|
||||||
|
trans_srcs = _get_transitive_srcs(
|
||||||
|
ctx.files.td_srcs + [td_file],
|
||||||
|
ctx.attr.deps,
|
||||||
|
)
|
||||||
|
|
||||||
|
# Note that we have two types of includes here. The deprecated ones expanded
|
||||||
|
# only by "_prefix_roots" are already relative to the execution root, i.e.
|
||||||
|
# may contain an `external/<workspace_name>` prefix if the current workspace
|
||||||
|
# is not the main workspace (where workspace_name is something configured
|
||||||
|
# per-project and therefore generally not known). Note that dirname also
|
||||||
|
# already includes this prefix. The new style of includes have it prepended
|
||||||
|
# automatically by `_resolve_includes` to avoid BUILD files having to depend
|
||||||
|
# on project specific configurations and Bazel implementation details.
|
||||||
|
trans_includes = _get_transitive_includes(
|
||||||
|
_resolve_includes(ctx, ctx.attr.includes + ["/"]) +
|
||||||
|
_prefix_roots(ctx, ctx.attr.td_includes + [td_file.dirname]),
|
||||||
|
ctx.attr.deps,
|
||||||
|
)
|
||||||
|
|
||||||
|
test_args = [ctx.executable.tblgen.short_path]
|
||||||
|
test_args.extend(ctx.attr.opts)
|
||||||
|
test_args.append(td_file.path)
|
||||||
|
test_args.extend(["-I " + include for include in trans_includes.to_list()])
|
||||||
|
|
||||||
|
test_args.extend(["-o", "/dev/null"])
|
||||||
|
|
||||||
|
ctx.actions.write(
|
||||||
|
ctx.outputs.executable,
|
||||||
|
content = " ".join(test_args),
|
||||||
|
is_executable = True,
|
||||||
|
)
|
||||||
|
|
||||||
|
return [DefaultInfo(
|
||||||
|
runfiles = ctx.runfiles(
|
||||||
|
[ctx.executable.tblgen],
|
||||||
|
transitive_files = trans_srcs,
|
||||||
|
),
|
||||||
|
)]
|
||||||
|
|
||||||
|
gentbl_test = rule(
|
||||||
|
_gentbl_test_impl,
|
||||||
|
test = True,
|
||||||
|
doc = "A shell test that tests the given TablegGen invocation. Note" +
|
||||||
|
" that unlike gentbl_rule, this builds and invokes `tblgen` in the" +
|
||||||
|
" target configuration. Takes all the same arguments as gentbl_rule" +
|
||||||
|
" except for `out` (as it does not generate any output)",
|
||||||
|
# Match genrule behavior
|
||||||
|
output_to_genfiles = True,
|
||||||
|
attrs = {
|
||||||
|
"tblgen": attr.label(
|
||||||
|
doc = "The TableGen executable run in the shell command. Note" +
|
||||||
|
" that this is built in the target configuration.",
|
||||||
|
executable = True,
|
||||||
|
cfg = "target",
|
||||||
|
),
|
||||||
|
"td_file": attr.label(
|
||||||
|
doc = "See gentbl_rule.td_file",
|
||||||
|
allow_single_file = True,
|
||||||
|
mandatory = True,
|
||||||
|
),
|
||||||
|
"td_srcs": attr.label_list(
|
||||||
|
doc = "See gentbl_rule.td_srcs",
|
||||||
|
allow_files = True,
|
||||||
|
),
|
||||||
|
"deps": attr.label_list(doc = "See gentbl_rule.deps"),
|
||||||
|
"opts": attr.string_list(doc = "See gentbl_rule.opts"),
|
||||||
|
"includes": attr.string_list(doc = "See gentbl_rule.includes"),
|
||||||
|
"td_includes": attr.string_list(doc = "See gentbl_rule.td_includes"),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
def gentbl_filegroup(
|
||||||
|
name,
|
||||||
|
tblgen,
|
||||||
|
td_file,
|
||||||
|
tbl_outs,
|
||||||
|
td_srcs = [],
|
||||||
|
td_includes = [],
|
||||||
|
includes = [],
|
||||||
|
deps = [],
|
||||||
|
test = False,
|
||||||
|
skip_opts = [],
|
||||||
|
**kwargs):
|
||||||
|
"""Create multiple TableGen generated files using the same tool and input.
|
||||||
|
|
||||||
|
All generated outputs are bundled in a file group with the given name.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
name: The name of the generated filegroup rule for use in dependencies.
|
||||||
|
tblgen: The binary used to produce the output.
|
||||||
|
td_file: The primary table definitions file.
|
||||||
|
tbl_outs: A list of tuples ([opts], out), where each 'opts' is a list of
|
||||||
|
options passed to tblgen, each option being a string, and 'out' is the
|
||||||
|
corresponding output file produced.
|
||||||
|
td_srcs: See gentbl_rule.td_srcs
|
||||||
|
includes: See gentbl_rule.includes
|
||||||
|
td_includes: See gentbl_rule.td_includes
|
||||||
|
deps: See gentbl_rule.deps
|
||||||
|
test: Whether to create a shell test that invokes the tool too.
|
||||||
|
skip_opts: Files generated using these opts in tbl_outs will be excluded
|
||||||
|
from the generated filegroup.
|
||||||
|
**kwargs: Extra keyword arguments to pass to all generated rules.
|
||||||
|
"""
|
||||||
|
|
||||||
|
llvm_project_execroot_path = Label("//mlir:tblgen.bzl", relative_to_caller_repository = False).workspace_root
|
||||||
|
|
||||||
|
# TODO(gcmn): Update callers to td_library and explicit includes and drop
|
||||||
|
# this hardcoded include.
|
||||||
|
hardcoded_includes = [
|
||||||
|
"%s/mlir/include" % llvm_project_execroot_path,
|
||||||
|
]
|
||||||
|
|
||||||
|
for (opts, out) in tbl_outs:
|
||||||
|
first_opt = opts[0] if opts else ""
|
||||||
|
rule_suffix = "_{}_{}".format(
|
||||||
|
first_opt.replace("-", "_").replace("=", "_"),
|
||||||
|
str(hash(" ".join(opts))),
|
||||||
|
)
|
||||||
|
gentbl_name = "%s_%s_genrule" % (name, rule_suffix)
|
||||||
|
gentbl_rule(
|
||||||
|
name = gentbl_name,
|
||||||
|
td_file = td_file,
|
||||||
|
tblgen = tblgen,
|
||||||
|
opts = opts,
|
||||||
|
td_srcs = td_srcs,
|
||||||
|
deps = deps,
|
||||||
|
includes = includes,
|
||||||
|
td_includes = td_includes + hardcoded_includes,
|
||||||
|
out = out,
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
if test:
|
||||||
|
# Also run the generator in the target configuration as a test. This
|
||||||
|
# means it gets run with asserts and sanitizers and such when they
|
||||||
|
# are enabled and is counted in coverage.
|
||||||
|
gentbl_test(
|
||||||
|
name = "%s_test" % (gentbl_name,),
|
||||||
|
td_file = td_file,
|
||||||
|
tblgen = tblgen,
|
||||||
|
opts = opts,
|
||||||
|
td_srcs = td_srcs,
|
||||||
|
deps = deps,
|
||||||
|
includes = includes,
|
||||||
|
td_includes = td_includes + hardcoded_includes,
|
||||||
|
# Shell files not executable on Windows.
|
||||||
|
# TODO(gcmn): Support windows.
|
||||||
|
tags = ["no_windows"],
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
included_srcs = [f for (opts, f) in tbl_outs if not any([skip_opt in opts for skip_opt in skip_opts])]
|
||||||
|
native.filegroup(
|
||||||
|
name = name,
|
||||||
|
srcs = included_srcs,
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
def gentbl_cc_library(
|
||||||
|
name,
|
||||||
|
tblgen,
|
||||||
|
td_file,
|
||||||
|
tbl_outs,
|
||||||
|
td_srcs = [],
|
||||||
|
td_includes = [],
|
||||||
|
includes = [],
|
||||||
|
td_relative_includes = [],
|
||||||
|
deps = [],
|
||||||
|
strip_include_prefix = None,
|
||||||
|
test = False,
|
||||||
|
**kwargs):
|
||||||
|
"""Create multiple TableGen generated files using the same tool and input.
|
||||||
|
|
||||||
|
All generated outputs are bundled in a cc_library rule.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
name: The name of the generated cc_library rule for use in dependencies.
|
||||||
|
tblgen: The binary used to produce the output.
|
||||||
|
td_file: The primary table definitions file.
|
||||||
|
tbl_outs: A list of tuples ([opts], out), where each 'opts' is a list of
|
||||||
|
options passed to tblgen, each option being a string, and 'out' is the
|
||||||
|
corresponding output file produced.
|
||||||
|
td_srcs: See gentbl_rule.td_srcs
|
||||||
|
includes: See gentbl_rule.includes
|
||||||
|
td_includes: See gentbl_rule.td_includes
|
||||||
|
td_relative_includes: An alias for "includes". Deprecated. Use includes
|
||||||
|
instead.
|
||||||
|
deps: See gentbl_rule.deps
|
||||||
|
strip_include_prefix: attribute to pass through to cc_library.
|
||||||
|
test: whether to create a shell test that invokes the tool too.
|
||||||
|
**kwargs: Extra keyword arguments to pass to all generated rules.
|
||||||
|
"""
|
||||||
|
|
||||||
|
filegroup_name = name + "_filegroup"
|
||||||
|
gentbl_filegroup(
|
||||||
|
name = filegroup_name,
|
||||||
|
tblgen = tblgen,
|
||||||
|
td_file = td_file,
|
||||||
|
tbl_outs = tbl_outs,
|
||||||
|
td_srcs = td_srcs,
|
||||||
|
td_includes = td_includes,
|
||||||
|
includes = includes + td_relative_includes,
|
||||||
|
deps = deps,
|
||||||
|
test = test,
|
||||||
|
skip_opts = ["-gen-op-doc"],
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
native.cc_library(
|
||||||
|
name = name,
|
||||||
|
# strip_include_prefix does not apply to textual_hdrs.
|
||||||
|
# https://github.com/bazelbuild/bazel/issues/12424
|
||||||
|
hdrs = [":" + filegroup_name] if strip_include_prefix else [],
|
||||||
|
strip_include_prefix = strip_include_prefix,
|
||||||
|
textual_hdrs = [":" + filegroup_name],
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
def gentbl(
|
||||||
|
name,
|
||||||
|
tblgen,
|
||||||
|
td_file,
|
||||||
|
tbl_outs,
|
||||||
|
td_srcs = [],
|
||||||
|
td_includes = [],
|
||||||
|
includes = [],
|
||||||
|
td_relative_includes = [],
|
||||||
|
deps = [],
|
||||||
|
test = False,
|
||||||
|
**kwargs):
|
||||||
|
"""Deprecated version of gentbl_cc_library.
|
||||||
|
|
||||||
|
Accepts tbl_outs as list of pairs with the first element of the pair being
|
||||||
|
a whitespace-separated string of options rather than a list of options.
|
||||||
|
"""
|
||||||
|
|
||||||
|
split_opts = []
|
||||||
|
for (opts_string, out) in tbl_outs:
|
||||||
|
opts = opts_string.split(" ") if opts_string else []
|
||||||
|
|
||||||
|
# Filter out empty options
|
||||||
|
opts = [opt for opt in opts if opt]
|
||||||
|
|
||||||
|
split_opts.append((opts, out))
|
||||||
|
|
||||||
|
gentbl_cc_library(
|
||||||
|
name = name,
|
||||||
|
tblgen = tblgen,
|
||||||
|
td_file = td_file,
|
||||||
|
tbl_outs = split_opts,
|
||||||
|
td_srcs = td_srcs,
|
||||||
|
td_includes = td_includes,
|
||||||
|
includes = includes,
|
||||||
|
td_relative_includes = td_relative_includes,
|
||||||
|
deps = deps,
|
||||||
|
test = test,
|
||||||
|
deprecation = "generated by gentbl; use gentbl_cc_library or gentbl_filegroup instead",
|
||||||
|
**kwargs
|
||||||
|
)
|
516
utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel
Normal file
516
utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel
Normal file
@ -0,0 +1,516 @@
|
|||||||
|
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
# See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
|
load("//mlir:tblgen.bzl", "gentbl_cc_library", "td_library")
|
||||||
|
|
||||||
|
package(
|
||||||
|
default_visibility = ["//visibility:public"],
|
||||||
|
licenses = ["notice"],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "IRProducingAPITest",
|
||||||
|
hdrs = ["APITest.h"],
|
||||||
|
includes = ["."],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "TestAnalysis",
|
||||||
|
srcs = glob(["lib/Analysis/*.cpp"]),
|
||||||
|
includes = ["lib/Dialect/Test"],
|
||||||
|
deps = [
|
||||||
|
":TestDialect",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//mlir:Affine",
|
||||||
|
"//mlir:Analysis",
|
||||||
|
"//mlir:IR",
|
||||||
|
"//mlir:MemRefDialect",
|
||||||
|
"//mlir:Pass",
|
||||||
|
"//mlir:Support",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
td_library(
|
||||||
|
name = "TestOpTdFiles",
|
||||||
|
srcs = [
|
||||||
|
"lib/Dialect/Test/TestInterfaces.td",
|
||||||
|
"lib/Dialect/Test/TestOps.td",
|
||||||
|
"//mlir:include/mlir/Dialect/DLTI/DLTIBase.td",
|
||||||
|
"//mlir:include/mlir/IR/OpAsmInterface.td",
|
||||||
|
"//mlir:include/mlir/IR/RegionKindInterface.td",
|
||||||
|
"//mlir:include/mlir/IR/SymbolInterfaces.td",
|
||||||
|
"//mlir:include/mlir/Interfaces/CallInterfaces.td",
|
||||||
|
"//mlir:include/mlir/Interfaces/ControlFlowInterfaces.td",
|
||||||
|
"//mlir:include/mlir/Interfaces/CopyOpInterface.td",
|
||||||
|
"//mlir:include/mlir/Interfaces/DataLayoutInterfaces.td",
|
||||||
|
"//mlir:include/mlir/Interfaces/InferTypeOpInterface.td",
|
||||||
|
],
|
||||||
|
deps = [
|
||||||
|
"//mlir:OpBaseTdFiles",
|
||||||
|
"//mlir:SideEffectTdFiles",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
gentbl_cc_library(
|
||||||
|
name = "TestOpsIncGen",
|
||||||
|
strip_include_prefix = "lib/Dialect/Test",
|
||||||
|
tbl_outs = [
|
||||||
|
(
|
||||||
|
["-gen-op-decls"],
|
||||||
|
"lib/Dialect/Test/TestOps.h.inc",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
["-gen-op-defs"],
|
||||||
|
"lib/Dialect/Test/TestOps.cpp.inc",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
[
|
||||||
|
"-gen-dialect-decls",
|
||||||
|
"-dialect=test",
|
||||||
|
],
|
||||||
|
"lib/Dialect/Test/TestOpsDialect.h.inc",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
["-gen-enum-decls"],
|
||||||
|
"lib/Dialect/Test/TestOpEnums.h.inc",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
["-gen-enum-defs"],
|
||||||
|
"lib/Dialect/Test/TestOpEnums.cpp.inc",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
["-gen-struct-attr-decls"],
|
||||||
|
"lib/Dialect/Test/TestOpStructs.h.inc",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
["-gen-struct-attr-defs"],
|
||||||
|
"lib/Dialect/Test/TestOpStructs.cpp.inc",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
["-gen-rewriters"],
|
||||||
|
"lib/Dialect/Test/TestPatterns.inc",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
tblgen = "//mlir:mlir-tblgen",
|
||||||
|
td_file = "lib/Dialect/Test/TestOps.td",
|
||||||
|
test = True,
|
||||||
|
deps = [
|
||||||
|
":TestOpTdFiles",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
gentbl_cc_library(
|
||||||
|
name = "TestInterfacesIncGen",
|
||||||
|
strip_include_prefix = "lib/Dialect/Test",
|
||||||
|
tbl_outs = [
|
||||||
|
(
|
||||||
|
["-gen-attr-interface-decls"],
|
||||||
|
"lib/Dialect/Test/TestAttrInterfaces.h.inc",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
["-gen-attr-interface-defs"],
|
||||||
|
"lib/Dialect/Test/TestAttrInterfaces.cpp.inc",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
["-gen-type-interface-decls"],
|
||||||
|
"lib/Dialect/Test/TestTypeInterfaces.h.inc",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
["-gen-type-interface-defs"],
|
||||||
|
"lib/Dialect/Test/TestTypeInterfaces.cpp.inc",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
["-gen-op-interface-decls"],
|
||||||
|
"lib/Dialect/Test/TestOpInterfaces.h.inc",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
["-gen-op-interface-defs"],
|
||||||
|
"lib/Dialect/Test/TestOpInterfaces.cpp.inc",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
tblgen = "//mlir:mlir-tblgen",
|
||||||
|
td_file = "lib/Dialect/Test/TestInterfaces.td",
|
||||||
|
test = True,
|
||||||
|
deps = [
|
||||||
|
"//mlir:OpBaseTdFiles",
|
||||||
|
"//mlir:SideEffectInterfacesTdFiles",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
gentbl_cc_library(
|
||||||
|
name = "TestAttrDefsIncGen",
|
||||||
|
strip_include_prefix = "lib/Dialect/Test",
|
||||||
|
tbl_outs = [
|
||||||
|
(
|
||||||
|
["-gen-attrdef-decls"],
|
||||||
|
"lib/Dialect/Test/TestAttrDefs.h.inc",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
["-gen-attrdef-defs"],
|
||||||
|
"lib/Dialect/Test/TestAttrDefs.cpp.inc",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
tblgen = "//mlir:mlir-tblgen",
|
||||||
|
td_file = "lib/Dialect/Test/TestAttrDefs.td",
|
||||||
|
td_srcs = [
|
||||||
|
":TestOpTdFiles",
|
||||||
|
],
|
||||||
|
test = True,
|
||||||
|
)
|
||||||
|
|
||||||
|
gentbl_cc_library(
|
||||||
|
name = "TestTypeDefsIncGen",
|
||||||
|
strip_include_prefix = "lib/Dialect/Test",
|
||||||
|
tbl_outs = [
|
||||||
|
(
|
||||||
|
[
|
||||||
|
"-gen-typedef-decls",
|
||||||
|
"--typedefs-dialect=test",
|
||||||
|
],
|
||||||
|
"lib/Dialect/Test/TestTypeDefs.h.inc",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
[
|
||||||
|
"-gen-typedef-defs",
|
||||||
|
"--typedefs-dialect=test",
|
||||||
|
],
|
||||||
|
"lib/Dialect/Test/TestTypeDefs.cpp.inc",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
tblgen = "//mlir:mlir-tblgen",
|
||||||
|
td_file = "lib/Dialect/Test/TestTypeDefs.td",
|
||||||
|
test = True,
|
||||||
|
deps = [
|
||||||
|
":TestOpTdFiles",
|
||||||
|
"//mlir:BuiltinDialectTdFiles",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "TestDialect",
|
||||||
|
srcs = [
|
||||||
|
"lib/Dialect/Test/TestAttributes.cpp",
|
||||||
|
"lib/Dialect/Test/TestDialect.cpp",
|
||||||
|
"lib/Dialect/Test/TestInterfaces.cpp",
|
||||||
|
"lib/Dialect/Test/TestPatterns.cpp",
|
||||||
|
"lib/Dialect/Test/TestTraits.cpp",
|
||||||
|
"lib/Dialect/Test/TestTypes.cpp",
|
||||||
|
],
|
||||||
|
hdrs = [
|
||||||
|
"lib/Dialect/Test/TestAttributes.h",
|
||||||
|
"lib/Dialect/Test/TestDialect.h",
|
||||||
|
"lib/Dialect/Test/TestInterfaces.h",
|
||||||
|
"lib/Dialect/Test/TestTypes.h",
|
||||||
|
],
|
||||||
|
includes = [
|
||||||
|
"lib/Dialect/Test",
|
||||||
|
],
|
||||||
|
deps = [
|
||||||
|
":TestAttrDefsIncGen",
|
||||||
|
":TestInterfacesIncGen",
|
||||||
|
":TestOpsIncGen",
|
||||||
|
":TestTypeDefsIncGen",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//mlir:ControlFlowInterfaces",
|
||||||
|
"//mlir:CopyOpInterface",
|
||||||
|
"//mlir:DLTIDialect",
|
||||||
|
"//mlir:DataLayoutInterfaces",
|
||||||
|
"//mlir:DerivedAttributeOpInterface",
|
||||||
|
"//mlir:Dialect",
|
||||||
|
"//mlir:IR",
|
||||||
|
"//mlir:InferTypeOpInterface",
|
||||||
|
"//mlir:MemRefDialect",
|
||||||
|
"//mlir:Pass",
|
||||||
|
"//mlir:Reducer",
|
||||||
|
"//mlir:SideEffects",
|
||||||
|
"//mlir:StandardOps",
|
||||||
|
"//mlir:StandardOpsTransforms",
|
||||||
|
"//mlir:TensorDialect",
|
||||||
|
"//mlir:TransformUtils",
|
||||||
|
"//mlir:Transforms",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "TestIR",
|
||||||
|
srcs = glob(["lib/IR/*.cpp"]),
|
||||||
|
deps = [
|
||||||
|
":TestDialect",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//mlir:Analysis",
|
||||||
|
"//mlir:IR",
|
||||||
|
"//mlir:LinalgOps",
|
||||||
|
"//mlir:Pass",
|
||||||
|
"//mlir:StandardOps",
|
||||||
|
"//mlir:Support",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "TestPass",
|
||||||
|
srcs = glob(["lib/Pass/*.cpp"]),
|
||||||
|
deps = [
|
||||||
|
"//llvm:Support",
|
||||||
|
"//mlir:IR",
|
||||||
|
"//mlir:Pass",
|
||||||
|
"//mlir:Support",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "TestRewrite",
|
||||||
|
srcs = [
|
||||||
|
"lib/Rewrite/TestPDLByteCode.cpp",
|
||||||
|
],
|
||||||
|
deps = [
|
||||||
|
"//mlir:IR",
|
||||||
|
"//mlir:Pass",
|
||||||
|
"//mlir:Support",
|
||||||
|
"//mlir:TransformUtils",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "TestReducer",
|
||||||
|
srcs = [
|
||||||
|
"lib/Reducer/MLIRTestReducer.cpp",
|
||||||
|
],
|
||||||
|
deps = [
|
||||||
|
"//mlir:IR",
|
||||||
|
"//mlir:Pass",
|
||||||
|
"//mlir:Support",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "TestTransforms",
|
||||||
|
srcs = glob(["lib/Transforms/*.cpp"]),
|
||||||
|
defines = ["MLIR_CUDA_CONVERSIONS_ENABLED"],
|
||||||
|
includes = ["lib/Dialect/Test"],
|
||||||
|
deps = [
|
||||||
|
":TestDialect",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//mlir:Affine",
|
||||||
|
"//mlir:Analysis",
|
||||||
|
"//mlir:IR",
|
||||||
|
"//mlir:MathDialect",
|
||||||
|
"//mlir:Pass",
|
||||||
|
"//mlir:SCFDialect",
|
||||||
|
"//mlir:SPIRVDialect",
|
||||||
|
"//mlir:StandardOps",
|
||||||
|
"//mlir:TransformUtils",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "TestStandardToLLVM",
|
||||||
|
srcs = glob(["lib/Conversion/StandardToLLVM/*.cpp"]),
|
||||||
|
defines = ["MLIR_CUDA_CONVERSIONS_ENABLED"],
|
||||||
|
includes = ["lib/Dialect/Test"],
|
||||||
|
deps = [
|
||||||
|
":TestDialect",
|
||||||
|
"//mlir:LLVMDialect",
|
||||||
|
"//mlir:LLVMTransforms",
|
||||||
|
"//mlir:Pass",
|
||||||
|
"//mlir:StandardOps",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "TestAffine",
|
||||||
|
srcs = glob([
|
||||||
|
"lib/Dialect/Affine/*.cpp",
|
||||||
|
]),
|
||||||
|
deps = [
|
||||||
|
"//llvm:Support",
|
||||||
|
"//mlir:Affine",
|
||||||
|
"//mlir:AffineTransforms",
|
||||||
|
"//mlir:AffineUtils",
|
||||||
|
"//mlir:Analysis",
|
||||||
|
"//mlir:IR",
|
||||||
|
"//mlir:MemRefDialect",
|
||||||
|
"//mlir:Pass",
|
||||||
|
"//mlir:Support",
|
||||||
|
"//mlir:Transforms",
|
||||||
|
"//mlir:VectorOps",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "TestDLTI",
|
||||||
|
srcs = glob(["lib/Dialect/DLTI/*.cpp"]),
|
||||||
|
defines = ["MLIR_CUDA_CONVERSIONS_ENABLED"],
|
||||||
|
includes = ["lib/Dialect/Test"],
|
||||||
|
deps = [
|
||||||
|
":TestDialect",
|
||||||
|
"//mlir:Analysis",
|
||||||
|
"//mlir:DLTIDialect",
|
||||||
|
"//mlir:IR",
|
||||||
|
"//mlir:Pass",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "TestGPU",
|
||||||
|
srcs = glob(["lib/Dialect/GPU/*.cpp"]),
|
||||||
|
defines = ["MLIR_CUDA_CONVERSIONS_ENABLED"],
|
||||||
|
includes = ["lib/Dialect/Test"],
|
||||||
|
deps = [
|
||||||
|
"//llvm:NVPTXCodeGen",
|
||||||
|
"//llvm:Support",
|
||||||
|
"//mlir:Affine",
|
||||||
|
"//mlir:GPUDialect",
|
||||||
|
"//mlir:GPUTransforms",
|
||||||
|
"//mlir:IR",
|
||||||
|
"//mlir:MemRefDialect",
|
||||||
|
"//mlir:NVVMToLLVMIRTranslation",
|
||||||
|
"//mlir:Pass",
|
||||||
|
"//mlir:ROCDLToLLVMIRTranslation",
|
||||||
|
"//mlir:SCFDialect",
|
||||||
|
"//mlir:SPIRVDialect",
|
||||||
|
"//mlir:StandardOps",
|
||||||
|
"//mlir:ToLLVMIRTranslation",
|
||||||
|
"//mlir:TransformUtils",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "TestLinalg",
|
||||||
|
srcs = glob(["lib/Dialect/Linalg/*.cpp"]),
|
||||||
|
defines = ["MLIR_CUDA_CONVERSIONS_ENABLED"],
|
||||||
|
includes = ["lib/Dialect/Test"],
|
||||||
|
deps = [
|
||||||
|
"//llvm:Support",
|
||||||
|
"//mlir:Affine",
|
||||||
|
"//mlir:GPUDialect",
|
||||||
|
"//mlir:IR",
|
||||||
|
"//mlir:LinalgOps",
|
||||||
|
"//mlir:LinalgTransforms",
|
||||||
|
"//mlir:Pass",
|
||||||
|
"//mlir:StandardOps",
|
||||||
|
"//mlir:TransformUtils",
|
||||||
|
"//mlir:VectorOps",
|
||||||
|
"//mlir:VectorToSCF",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "TestMath",
|
||||||
|
srcs = glob(["lib/Dialect/Math/*.cpp"]),
|
||||||
|
defines = ["MLIR_CUDA_CONVERSIONS_ENABLED"],
|
||||||
|
includes = ["lib/Dialect/Test"],
|
||||||
|
deps = [
|
||||||
|
"//mlir:LLVMDialect",
|
||||||
|
"//mlir:MathDialect",
|
||||||
|
"//mlir:MathTransforms",
|
||||||
|
"//mlir:Pass",
|
||||||
|
"//mlir:TransformUtils",
|
||||||
|
"//mlir:VectorOps",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "TestSCF",
|
||||||
|
srcs = glob(["lib/Dialect/SCF/*.cpp"]),
|
||||||
|
defines = ["MLIR_CUDA_CONVERSIONS_ENABLED"],
|
||||||
|
includes = ["lib/Dialect/Test"],
|
||||||
|
deps = [
|
||||||
|
"//llvm:Support",
|
||||||
|
"//mlir:IR",
|
||||||
|
"//mlir:Pass",
|
||||||
|
"//mlir:SCFDialect",
|
||||||
|
"//mlir:TransformUtils",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "TestShapeDialect",
|
||||||
|
srcs = [
|
||||||
|
"lib/Dialect/Shape/TestShapeFunctions.cpp",
|
||||||
|
],
|
||||||
|
deps = [
|
||||||
|
"//llvm:Support",
|
||||||
|
"//mlir:IR",
|
||||||
|
"//mlir:InferTypeOpInterface",
|
||||||
|
"//mlir:Pass",
|
||||||
|
"//mlir:Shape",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "TestSPIRV",
|
||||||
|
srcs = glob([
|
||||||
|
"lib/Dialect/SPIRV/*.cpp",
|
||||||
|
]),
|
||||||
|
deps = [
|
||||||
|
"//mlir:GPUDialect",
|
||||||
|
"//mlir:IR",
|
||||||
|
"//mlir:Pass",
|
||||||
|
"//mlir:SPIRVConversion",
|
||||||
|
"//mlir:SPIRVDialect",
|
||||||
|
"//mlir:SPIRVModuleCombiner",
|
||||||
|
"//mlir:Transforms",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "TestStandardOps",
|
||||||
|
srcs = glob(["lib/Dialect/StandardOps/*.cpp"]),
|
||||||
|
defines = ["MLIR_CUDA_CONVERSIONS_ENABLED"],
|
||||||
|
includes = ["lib/Dialect/Test"],
|
||||||
|
deps = [
|
||||||
|
":TestDialect",
|
||||||
|
"//mlir:Affine",
|
||||||
|
"//mlir:IR",
|
||||||
|
"//mlir:Pass",
|
||||||
|
"//mlir:StandardOps",
|
||||||
|
"//mlir:StandardOpsTransforms",
|
||||||
|
"//mlir:TransformUtils",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "TestVector",
|
||||||
|
srcs = glob(["lib/Dialect/Vector/*.cpp"]),
|
||||||
|
defines = ["MLIR_CUDA_CONVERSIONS_ENABLED"],
|
||||||
|
includes = ["lib/Dialect/Test"],
|
||||||
|
deps = [
|
||||||
|
"//mlir:Affine",
|
||||||
|
"//mlir:Analysis",
|
||||||
|
"//mlir:LinalgOps",
|
||||||
|
"//mlir:MemRefDialect",
|
||||||
|
"//mlir:Pass",
|
||||||
|
"//mlir:SCFDialect",
|
||||||
|
"//mlir:StandardOps",
|
||||||
|
"//mlir:TransformUtils",
|
||||||
|
"//mlir:VectorOps",
|
||||||
|
"//mlir:VectorToSCF",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "TestTypeDialect",
|
||||||
|
srcs = glob([
|
||||||
|
"lib/Dialect/LLVMIR/*.cpp",
|
||||||
|
]),
|
||||||
|
deps = [
|
||||||
|
":TestDialect",
|
||||||
|
"//mlir:IR",
|
||||||
|
"//mlir:LLVMDialect",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "TestTosaDialect",
|
||||||
|
srcs = glob([
|
||||||
|
"lib/Dialect/Tosa/*.cpp",
|
||||||
|
]),
|
||||||
|
deps = [
|
||||||
|
"//mlir:IR",
|
||||||
|
"//mlir:Pass",
|
||||||
|
"//mlir:StandardOps",
|
||||||
|
"//mlir:TosaDialect",
|
||||||
|
"//mlir:Transforms",
|
||||||
|
],
|
||||||
|
)
|
29
utils/bazel/llvm_configs/BUILD.bazel
Normal file
29
utils/bazel/llvm_configs/BUILD.bazel
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
# See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
|
# We perform diff testing here to avoid any in-tree BUILD files depending on
|
||||||
|
# bazel_sklyib. These diff tests ensure that the current Bazel configuration
|
||||||
|
# does not drift from the configuration in the .cmake files, since we don't
|
||||||
|
# alway use them directly (and even if we did we wouldn't necessarily pick up
|
||||||
|
# changes there). These are literal change-detector tests.
|
||||||
|
|
||||||
|
load("@bazel_skylib//rules:diff_test.bzl", "diff_test")
|
||||||
|
|
||||||
|
diff_test(
|
||||||
|
name = "diff_config.h.cmake",
|
||||||
|
file1 = "@llvm-project//llvm:include/llvm/Config/config.h.cmake",
|
||||||
|
file2 = "config.h.cmake",
|
||||||
|
)
|
||||||
|
|
||||||
|
diff_test(
|
||||||
|
name = "diff_llvm-config.h.cmake",
|
||||||
|
file1 = "@llvm-project//llvm:include/llvm/Config/llvm-config.h.cmake",
|
||||||
|
file2 = "llvm-config.h.cmake",
|
||||||
|
)
|
||||||
|
|
||||||
|
diff_test(
|
||||||
|
name = "diff_abi-breaking.h.cmake",
|
||||||
|
file1 = "@llvm-project//llvm:include/llvm/Config/abi-breaking.h.cmake",
|
||||||
|
file2 = "abi-breaking.h.cmake",
|
||||||
|
)
|
62
utils/bazel/llvm_configs/abi-breaking.h.cmake
Normal file
62
utils/bazel/llvm_configs/abi-breaking.h.cmake
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
/*===------- llvm/Config/abi-breaking.h - llvm configuration -------*- C -*-===*/
|
||||||
|
/* */
|
||||||
|
/* Part of the LLVM Project, under the Apache License v2.0 with LLVM */
|
||||||
|
/* Exceptions. */
|
||||||
|
/* See https://llvm.org/LICENSE.txt for license information. */
|
||||||
|
/* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */
|
||||||
|
/* */
|
||||||
|
/*===----------------------------------------------------------------------===*/
|
||||||
|
|
||||||
|
/* This file controls the C++ ABI break introduced in LLVM public header. */
|
||||||
|
|
||||||
|
#ifndef LLVM_ABI_BREAKING_CHECKS_H
|
||||||
|
#define LLVM_ABI_BREAKING_CHECKS_H
|
||||||
|
|
||||||
|
/* Define to enable checks that alter the LLVM C++ ABI */
|
||||||
|
#cmakedefine01 LLVM_ENABLE_ABI_BREAKING_CHECKS
|
||||||
|
|
||||||
|
/* Define to enable reverse iteration of unordered llvm containers */
|
||||||
|
#cmakedefine01 LLVM_ENABLE_REVERSE_ITERATION
|
||||||
|
|
||||||
|
/* Allow selectively disabling link-time mismatch checking so that header-only
|
||||||
|
ADT content from LLVM can be used without linking libSupport. */
|
||||||
|
#if !defined(LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING) || !LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING
|
||||||
|
|
||||||
|
// ABI_BREAKING_CHECKS protection: provides link-time failure when clients build
|
||||||
|
// mismatch with LLVM
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
// Use pragma with MSVC
|
||||||
|
#define LLVM_XSTR(s) LLVM_STR(s)
|
||||||
|
#define LLVM_STR(s) #s
|
||||||
|
#pragma detect_mismatch("LLVM_ENABLE_ABI_BREAKING_CHECKS", LLVM_XSTR(LLVM_ENABLE_ABI_BREAKING_CHECKS))
|
||||||
|
#undef LLVM_XSTR
|
||||||
|
#undef LLVM_STR
|
||||||
|
#elif defined(_WIN32) || defined(__CYGWIN__) // Win32 w/o #pragma detect_mismatch
|
||||||
|
// FIXME: Implement checks without weak.
|
||||||
|
#elif defined(__cplusplus)
|
||||||
|
#if !(defined(_AIX) && defined(__GNUC__) && !defined(__clang__))
|
||||||
|
#define LLVM_HIDDEN_VISIBILITY __attribute__ ((visibility("hidden")))
|
||||||
|
#else
|
||||||
|
// GCC on AIX does not support visibility attributes. Symbols are not
|
||||||
|
// exported by default on AIX.
|
||||||
|
#define LLVM_HIDDEN_VISIBILITY
|
||||||
|
#endif
|
||||||
|
namespace llvm {
|
||||||
|
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
|
||||||
|
extern int EnableABIBreakingChecks;
|
||||||
|
LLVM_HIDDEN_VISIBILITY
|
||||||
|
__attribute__((weak)) int *VerifyEnableABIBreakingChecks =
|
||||||
|
&EnableABIBreakingChecks;
|
||||||
|
#else
|
||||||
|
extern int DisableABIBreakingChecks;
|
||||||
|
LLVM_HIDDEN_VISIBILITY
|
||||||
|
__attribute__((weak)) int *VerifyDisableABIBreakingChecks =
|
||||||
|
&DisableABIBreakingChecks;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#undef LLVM_HIDDEN_VISIBILITY
|
||||||
|
#endif // _MSC_VER
|
||||||
|
|
||||||
|
#endif // LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING
|
||||||
|
|
||||||
|
#endif
|
355
utils/bazel/llvm_configs/config.h.cmake
Normal file
355
utils/bazel/llvm_configs/config.h.cmake
Normal file
@ -0,0 +1,355 @@
|
|||||||
|
#ifndef CONFIG_H
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
// Include this header only under the llvm source tree.
|
||||||
|
// This is a private header.
|
||||||
|
|
||||||
|
/* Exported configuration */
|
||||||
|
#include "llvm/Config/llvm-config.h"
|
||||||
|
|
||||||
|
/* Bug report URL. */
|
||||||
|
#define BUG_REPORT_URL "${BUG_REPORT_URL}"
|
||||||
|
|
||||||
|
/* Define to 1 to enable backtraces, and to 0 otherwise. */
|
||||||
|
#cmakedefine01 ENABLE_BACKTRACES
|
||||||
|
|
||||||
|
/* Define to 1 to enable crash overrides, and to 0 otherwise. */
|
||||||
|
#cmakedefine01 ENABLE_CRASH_OVERRIDES
|
||||||
|
|
||||||
|
/* Define to 1 to enable crash memory dumps, and to 0 otherwise. */
|
||||||
|
#cmakedefine01 LLVM_ENABLE_CRASH_DUMPS
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `backtrace' function. */
|
||||||
|
#cmakedefine HAVE_BACKTRACE ${HAVE_BACKTRACE}
|
||||||
|
|
||||||
|
#define BACKTRACE_HEADER <${BACKTRACE_HEADER}>
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <CrashReporterClient.h> header file. */
|
||||||
|
#cmakedefine HAVE_CRASHREPORTERCLIENT_H
|
||||||
|
|
||||||
|
/* can use __crashreporter_info__ */
|
||||||
|
#cmakedefine01 HAVE_CRASHREPORTER_INFO
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `arc4random', and to 0 if you
|
||||||
|
don't. */
|
||||||
|
#cmakedefine01 HAVE_DECL_ARC4RANDOM
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `FE_ALL_EXCEPT', and to 0 if you
|
||||||
|
don't. */
|
||||||
|
#cmakedefine01 HAVE_DECL_FE_ALL_EXCEPT
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `FE_INEXACT', and to 0 if you
|
||||||
|
don't. */
|
||||||
|
#cmakedefine01 HAVE_DECL_FE_INEXACT
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `strerror_s', and to 0 if you
|
||||||
|
don't. */
|
||||||
|
#cmakedefine01 HAVE_DECL_STRERROR_S
|
||||||
|
|
||||||
|
/* Define to 1 if you have the DIA SDK installed, and to 0 if you don't. */
|
||||||
|
#cmakedefine01 LLVM_ENABLE_DIA_SDK
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||||
|
#cmakedefine HAVE_DLFCN_H ${HAVE_DLFCN_H}
|
||||||
|
|
||||||
|
/* Define if dlopen() is available on this platform. */
|
||||||
|
#cmakedefine HAVE_DLOPEN ${HAVE_DLOPEN}
|
||||||
|
|
||||||
|
/* Define if dladdr() is available on this platform. */
|
||||||
|
#cmakedefine HAVE_DLADDR ${HAVE_DLADDR}
|
||||||
|
|
||||||
|
/* Define to 1 if we can register EH frames on this platform. */
|
||||||
|
#cmakedefine HAVE_REGISTER_FRAME ${HAVE_REGISTER_FRAME}
|
||||||
|
|
||||||
|
/* Define to 1 if we can deregister EH frames on this platform. */
|
||||||
|
#cmakedefine HAVE_DEREGISTER_FRAME ${HAVE_DEREGISTER_FRAME}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <errno.h> header file. */
|
||||||
|
#cmakedefine HAVE_ERRNO_H ${HAVE_ERRNO_H}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||||
|
#cmakedefine HAVE_FCNTL_H ${HAVE_FCNTL_H}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <fenv.h> header file. */
|
||||||
|
#cmakedefine HAVE_FENV_H ${HAVE_FENV_H}
|
||||||
|
|
||||||
|
/* Define if libffi is available on this platform. */
|
||||||
|
#cmakedefine HAVE_FFI_CALL ${HAVE_FFI_CALL}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <ffi/ffi.h> header file. */
|
||||||
|
#cmakedefine HAVE_FFI_FFI_H ${HAVE_FFI_FFI_H}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <ffi.h> header file. */
|
||||||
|
#cmakedefine HAVE_FFI_H ${HAVE_FFI_H}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `futimens' function. */
|
||||||
|
#cmakedefine HAVE_FUTIMENS ${HAVE_FUTIMENS}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `futimes' function. */
|
||||||
|
#cmakedefine HAVE_FUTIMES ${HAVE_FUTIMES}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getpagesize' function. */
|
||||||
|
#cmakedefine HAVE_GETPAGESIZE ${HAVE_GETPAGESIZE}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getrlimit' function. */
|
||||||
|
#cmakedefine HAVE_GETRLIMIT ${HAVE_GETRLIMIT}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getrusage' function. */
|
||||||
|
#cmakedefine HAVE_GETRUSAGE ${HAVE_GETRUSAGE}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `isatty' function. */
|
||||||
|
#cmakedefine HAVE_ISATTY 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `edit' library (-ledit). */
|
||||||
|
#cmakedefine HAVE_LIBEDIT ${HAVE_LIBEDIT}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `pfm' library (-lpfm). */
|
||||||
|
#cmakedefine HAVE_LIBPFM ${HAVE_LIBPFM}
|
||||||
|
|
||||||
|
/* Define to 1 if the `perf_branch_entry' struct has field cycles. */
|
||||||
|
#cmakedefine LIBPFM_HAS_FIELD_CYCLES ${LIBPFM_HAS_FIELD_CYCLES}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `psapi' library (-lpsapi). */
|
||||||
|
#cmakedefine HAVE_LIBPSAPI ${HAVE_LIBPSAPI}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `pthread' library (-lpthread). */
|
||||||
|
#cmakedefine HAVE_LIBPTHREAD ${HAVE_LIBPTHREAD}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `pthread_getname_np' function. */
|
||||||
|
#cmakedefine HAVE_PTHREAD_GETNAME_NP ${HAVE_PTHREAD_GETNAME_NP}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `pthread_setname_np' function. */
|
||||||
|
#cmakedefine HAVE_PTHREAD_SETNAME_NP ${HAVE_PTHREAD_SETNAME_NP}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <link.h> header file. */
|
||||||
|
#cmakedefine HAVE_LINK_H ${HAVE_LINK_H}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `lseek64' function. */
|
||||||
|
#cmakedefine HAVE_LSEEK64 ${HAVE_LSEEK64}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <mach/mach.h> header file. */
|
||||||
|
#cmakedefine HAVE_MACH_MACH_H ${HAVE_MACH_MACH_H}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `mallctl' function. */
|
||||||
|
#cmakedefine HAVE_MALLCTL ${HAVE_MALLCTL}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `mallinfo' function. */
|
||||||
|
#cmakedefine HAVE_MALLINFO ${HAVE_MALLINFO}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `mallinfo2' function. */
|
||||||
|
#cmakedefine HAVE_MALLINFO2 ${HAVE_MALLINFO2}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <malloc/malloc.h> header file. */
|
||||||
|
#cmakedefine HAVE_MALLOC_MALLOC_H ${HAVE_MALLOC_MALLOC_H}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `malloc_zone_statistics' function. */
|
||||||
|
#cmakedefine HAVE_MALLOC_ZONE_STATISTICS ${HAVE_MALLOC_ZONE_STATISTICS}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `posix_fallocate' function. */
|
||||||
|
#cmakedefine HAVE_POSIX_FALLOCATE ${HAVE_POSIX_FALLOCATE}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `posix_spawn' function. */
|
||||||
|
#cmakedefine HAVE_POSIX_SPAWN ${HAVE_POSIX_SPAWN}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `pread' function. */
|
||||||
|
#cmakedefine HAVE_PREAD ${HAVE_PREAD}
|
||||||
|
|
||||||
|
/* Have pthread_getspecific */
|
||||||
|
#cmakedefine HAVE_PTHREAD_GETSPECIFIC ${HAVE_PTHREAD_GETSPECIFIC}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <pthread.h> header file. */
|
||||||
|
#cmakedefine HAVE_PTHREAD_H ${HAVE_PTHREAD_H}
|
||||||
|
|
||||||
|
/* Have pthread_mutex_lock */
|
||||||
|
#cmakedefine HAVE_PTHREAD_MUTEX_LOCK ${HAVE_PTHREAD_MUTEX_LOCK}
|
||||||
|
|
||||||
|
/* Have pthread_rwlock_init */
|
||||||
|
#cmakedefine HAVE_PTHREAD_RWLOCK_INIT ${HAVE_PTHREAD_RWLOCK_INIT}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `sbrk' function. */
|
||||||
|
#cmakedefine HAVE_SBRK ${HAVE_SBRK}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `setenv' function. */
|
||||||
|
#cmakedefine HAVE_SETENV ${HAVE_SETENV}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `setrlimit' function. */
|
||||||
|
#cmakedefine HAVE_SETRLIMIT ${HAVE_SETRLIMIT}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `sigaltstack' function. */
|
||||||
|
#cmakedefine HAVE_SIGALTSTACK ${HAVE_SIGALTSTACK}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <signal.h> header file. */
|
||||||
|
#cmakedefine HAVE_SIGNAL_H ${HAVE_SIGNAL_H}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `strerror' function. */
|
||||||
|
#cmakedefine HAVE_STRERROR ${HAVE_STRERROR}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `strerror_r' function. */
|
||||||
|
#cmakedefine HAVE_STRERROR_R ${HAVE_STRERROR_R}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `sysconf' function. */
|
||||||
|
#cmakedefine HAVE_SYSCONF ${HAVE_SYSCONF}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/ioctl.h> header file. */
|
||||||
|
#cmakedefine HAVE_SYS_IOCTL_H ${HAVE_SYS_IOCTL_H}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/mman.h> header file. */
|
||||||
|
#cmakedefine HAVE_SYS_MMAN_H ${HAVE_SYS_MMAN_H}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/param.h> header file. */
|
||||||
|
#cmakedefine HAVE_SYS_PARAM_H ${HAVE_SYS_PARAM_H}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/resource.h> header file. */
|
||||||
|
#cmakedefine HAVE_SYS_RESOURCE_H ${HAVE_SYS_RESOURCE_H}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||||
|
#cmakedefine HAVE_SYS_STAT_H ${HAVE_SYS_STAT_H}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||||
|
#cmakedefine HAVE_SYS_TIME_H ${HAVE_SYS_TIME_H}
|
||||||
|
|
||||||
|
/* Define to 1 if stat struct has st_mtimespec member .*/
|
||||||
|
#cmakedefine HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC ${HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC}
|
||||||
|
|
||||||
|
/* Define to 1 if stat struct has st_mtim member. */
|
||||||
|
#cmakedefine HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC ${HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||||
|
#cmakedefine HAVE_SYS_TYPES_H ${HAVE_SYS_TYPES_H}
|
||||||
|
|
||||||
|
/* Define if the setupterm() function is supported this platform. */
|
||||||
|
#cmakedefine LLVM_ENABLE_TERMINFO ${LLVM_ENABLE_TERMINFO}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <termios.h> header file. */
|
||||||
|
#cmakedefine HAVE_TERMIOS_H ${HAVE_TERMIOS_H}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <unistd.h> header file. */
|
||||||
|
#cmakedefine HAVE_UNISTD_H ${HAVE_UNISTD_H}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <valgrind/valgrind.h> header file. */
|
||||||
|
#cmakedefine HAVE_VALGRIND_VALGRIND_H ${HAVE_VALGRIND_VALGRIND_H}
|
||||||
|
|
||||||
|
/* Have host's _alloca */
|
||||||
|
#cmakedefine HAVE__ALLOCA ${HAVE__ALLOCA}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `_chsize_s' function. */
|
||||||
|
#cmakedefine HAVE__CHSIZE_S ${HAVE__CHSIZE_S}
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `_Unwind_Backtrace' function. */
|
||||||
|
#cmakedefine HAVE__UNWIND_BACKTRACE ${HAVE__UNWIND_BACKTRACE}
|
||||||
|
|
||||||
|
/* Have host's __alloca */
|
||||||
|
#cmakedefine HAVE___ALLOCA ${HAVE___ALLOCA}
|
||||||
|
|
||||||
|
/* Have host's __ashldi3 */
|
||||||
|
#cmakedefine HAVE___ASHLDI3 ${HAVE___ASHLDI3}
|
||||||
|
|
||||||
|
/* Have host's __ashrdi3 */
|
||||||
|
#cmakedefine HAVE___ASHRDI3 ${HAVE___ASHRDI3}
|
||||||
|
|
||||||
|
/* Have host's __chkstk */
|
||||||
|
#cmakedefine HAVE___CHKSTK ${HAVE___CHKSTK}
|
||||||
|
|
||||||
|
/* Have host's __chkstk_ms */
|
||||||
|
#cmakedefine HAVE___CHKSTK_MS ${HAVE___CHKSTK_MS}
|
||||||
|
|
||||||
|
/* Have host's __cmpdi2 */
|
||||||
|
#cmakedefine HAVE___CMPDI2 ${HAVE___CMPDI2}
|
||||||
|
|
||||||
|
/* Have host's __divdi3 */
|
||||||
|
#cmakedefine HAVE___DIVDI3 ${HAVE___DIVDI3}
|
||||||
|
|
||||||
|
/* Have host's __fixdfdi */
|
||||||
|
#cmakedefine HAVE___FIXDFDI ${HAVE___FIXDFDI}
|
||||||
|
|
||||||
|
/* Have host's __fixsfdi */
|
||||||
|
#cmakedefine HAVE___FIXSFDI ${HAVE___FIXSFDI}
|
||||||
|
|
||||||
|
/* Have host's __floatdidf */
|
||||||
|
#cmakedefine HAVE___FLOATDIDF ${HAVE___FLOATDIDF}
|
||||||
|
|
||||||
|
/* Have host's __lshrdi3 */
|
||||||
|
#cmakedefine HAVE___LSHRDI3 ${HAVE___LSHRDI3}
|
||||||
|
|
||||||
|
/* Have host's __main */
|
||||||
|
#cmakedefine HAVE___MAIN ${HAVE___MAIN}
|
||||||
|
|
||||||
|
/* Have host's __moddi3 */
|
||||||
|
#cmakedefine HAVE___MODDI3 ${HAVE___MODDI3}
|
||||||
|
|
||||||
|
/* Have host's __udivdi3 */
|
||||||
|
#cmakedefine HAVE___UDIVDI3 ${HAVE___UDIVDI3}
|
||||||
|
|
||||||
|
/* Have host's __umoddi3 */
|
||||||
|
#cmakedefine HAVE___UMODDI3 ${HAVE___UMODDI3}
|
||||||
|
|
||||||
|
/* Have host's ___chkstk */
|
||||||
|
#cmakedefine HAVE____CHKSTK ${HAVE____CHKSTK}
|
||||||
|
|
||||||
|
/* Have host's ___chkstk_ms */
|
||||||
|
#cmakedefine HAVE____CHKSTK_MS ${HAVE____CHKSTK_MS}
|
||||||
|
|
||||||
|
/* Linker version detected at compile time. */
|
||||||
|
#cmakedefine HOST_LINK_VERSION "${HOST_LINK_VERSION}"
|
||||||
|
|
||||||
|
/* Target triple LLVM will generate code for by default */
|
||||||
|
/* Doesn't use `cmakedefine` because it is allowed to be empty. */
|
||||||
|
#define LLVM_DEFAULT_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}"
|
||||||
|
|
||||||
|
/* Define if zlib compression is available */
|
||||||
|
#cmakedefine01 LLVM_ENABLE_ZLIB
|
||||||
|
|
||||||
|
/* Define if overriding target triple is enabled */
|
||||||
|
#cmakedefine LLVM_TARGET_TRIPLE_ENV "${LLVM_TARGET_TRIPLE_ENV}"
|
||||||
|
|
||||||
|
/* LLVM version information */
|
||||||
|
#cmakedefine LLVM_VERSION_INFO "${LLVM_VERSION_INFO}"
|
||||||
|
|
||||||
|
/* Whether tools show host and target info when invoked with --version */
|
||||||
|
#cmakedefine01 LLVM_VERSION_PRINTER_SHOW_HOST_TARGET_INFO
|
||||||
|
|
||||||
|
/* Define if libxml2 is supported on this platform. */
|
||||||
|
#cmakedefine LLVM_ENABLE_LIBXML2 ${LLVM_ENABLE_LIBXML2}
|
||||||
|
|
||||||
|
/* Define to the extension used for shared libraries, say, ".so". */
|
||||||
|
#cmakedefine LTDL_SHLIB_EXT "${LTDL_SHLIB_EXT}"
|
||||||
|
|
||||||
|
/* Define to the extension used for plugin libraries, say, ".so". */
|
||||||
|
#cmakedefine LLVM_PLUGIN_EXT "${LLVM_PLUGIN_EXT}"
|
||||||
|
|
||||||
|
/* Define to the address where bug reports for this package should be sent. */
|
||||||
|
#cmakedefine PACKAGE_BUGREPORT "${PACKAGE_BUGREPORT}"
|
||||||
|
|
||||||
|
/* Define to the full name of this package. */
|
||||||
|
#cmakedefine PACKAGE_NAME "${PACKAGE_NAME}"
|
||||||
|
|
||||||
|
/* Define to the full name and version of this package. */
|
||||||
|
#cmakedefine PACKAGE_STRING "${PACKAGE_STRING}"
|
||||||
|
|
||||||
|
/* Define to the version of this package. */
|
||||||
|
#cmakedefine PACKAGE_VERSION "${PACKAGE_VERSION}"
|
||||||
|
|
||||||
|
/* Define to the vendor of this package. */
|
||||||
|
#cmakedefine PACKAGE_VENDOR "${PACKAGE_VENDOR}"
|
||||||
|
|
||||||
|
/* Define as the return type of signal handlers (`int' or `void'). */
|
||||||
|
#cmakedefine RETSIGTYPE ${RETSIGTYPE}
|
||||||
|
|
||||||
|
/* Define if std::is_trivially_copyable is supported */
|
||||||
|
#cmakedefine HAVE_STD_IS_TRIVIALLY_COPYABLE ${HAVE_STD_IS_TRIVIALLY_COPYABLE}
|
||||||
|
|
||||||
|
/* Define to a function implementing stricmp */
|
||||||
|
#cmakedefine stricmp ${stricmp}
|
||||||
|
|
||||||
|
/* Define to a function implementing strdup */
|
||||||
|
#cmakedefine strdup ${strdup}
|
||||||
|
|
||||||
|
/* Whether GlobalISel rule coverage is being collected */
|
||||||
|
#cmakedefine01 LLVM_GISEL_COV_ENABLED
|
||||||
|
|
||||||
|
/* Define to the default GlobalISel coverage file prefix */
|
||||||
|
#cmakedefine LLVM_GISEL_COV_PREFIX "${LLVM_GISEL_COV_PREFIX}"
|
||||||
|
|
||||||
|
#cmakedefine HAVE_PROC_PID_RUSAGE 1
|
||||||
|
|
||||||
|
#endif
|
104
utils/bazel/llvm_configs/llvm-config.h.cmake
Normal file
104
utils/bazel/llvm_configs/llvm-config.h.cmake
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
/*===------- llvm/Config/llvm-config.h - llvm configuration -------*- C -*-===*/
|
||||||
|
/* */
|
||||||
|
/* Part of the LLVM Project, under the Apache License v2.0 with LLVM */
|
||||||
|
/* Exceptions. */
|
||||||
|
/* See https://llvm.org/LICENSE.txt for license information. */
|
||||||
|
/* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */
|
||||||
|
/* */
|
||||||
|
/*===----------------------------------------------------------------------===*/
|
||||||
|
|
||||||
|
/* This file enumerates variables from the LLVM configuration so that they
|
||||||
|
can be in exported headers and won't override package specific directives.
|
||||||
|
This is a C header that can be included in the llvm-c headers. */
|
||||||
|
|
||||||
|
#ifndef LLVM_CONFIG_H
|
||||||
|
#define LLVM_CONFIG_H
|
||||||
|
|
||||||
|
/* Define if LLVM_ENABLE_DUMP is enabled */
|
||||||
|
#cmakedefine LLVM_ENABLE_DUMP
|
||||||
|
|
||||||
|
/* Target triple LLVM will generate code for by default */
|
||||||
|
#cmakedefine LLVM_DEFAULT_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}"
|
||||||
|
|
||||||
|
/* Define if threads enabled */
|
||||||
|
#cmakedefine01 LLVM_ENABLE_THREADS
|
||||||
|
|
||||||
|
/* Has gcc/MSVC atomic intrinsics */
|
||||||
|
#cmakedefine01 LLVM_HAS_ATOMICS
|
||||||
|
|
||||||
|
/* Host triple LLVM will be executed on */
|
||||||
|
#cmakedefine LLVM_HOST_TRIPLE "${LLVM_HOST_TRIPLE}"
|
||||||
|
|
||||||
|
/* LLVM architecture name for the native architecture, if available */
|
||||||
|
#cmakedefine LLVM_NATIVE_ARCH ${LLVM_NATIVE_ARCH}
|
||||||
|
|
||||||
|
/* LLVM name for the native AsmParser init function, if available */
|
||||||
|
#cmakedefine LLVM_NATIVE_ASMPARSER LLVMInitialize${LLVM_NATIVE_ARCH}AsmParser
|
||||||
|
|
||||||
|
/* LLVM name for the native AsmPrinter init function, if available */
|
||||||
|
#cmakedefine LLVM_NATIVE_ASMPRINTER LLVMInitialize${LLVM_NATIVE_ARCH}AsmPrinter
|
||||||
|
|
||||||
|
/* LLVM name for the native Disassembler init function, if available */
|
||||||
|
#cmakedefine LLVM_NATIVE_DISASSEMBLER LLVMInitialize${LLVM_NATIVE_ARCH}Disassembler
|
||||||
|
|
||||||
|
/* LLVM name for the native Target init function, if available */
|
||||||
|
#cmakedefine LLVM_NATIVE_TARGET LLVMInitialize${LLVM_NATIVE_ARCH}Target
|
||||||
|
|
||||||
|
/* LLVM name for the native TargetInfo init function, if available */
|
||||||
|
#cmakedefine LLVM_NATIVE_TARGETINFO LLVMInitialize${LLVM_NATIVE_ARCH}TargetInfo
|
||||||
|
|
||||||
|
/* LLVM name for the native target MC init function, if available */
|
||||||
|
#cmakedefine LLVM_NATIVE_TARGETMC LLVMInitialize${LLVM_NATIVE_ARCH}TargetMC
|
||||||
|
|
||||||
|
/* Define if this is Unixish platform */
|
||||||
|
#cmakedefine LLVM_ON_UNIX ${LLVM_ON_UNIX}
|
||||||
|
|
||||||
|
/* Define if we have the Intel JIT API runtime support library */
|
||||||
|
#cmakedefine01 LLVM_USE_INTEL_JITEVENTS
|
||||||
|
|
||||||
|
/* Define if we have the oprofile JIT-support library */
|
||||||
|
#cmakedefine01 LLVM_USE_OPROFILE
|
||||||
|
|
||||||
|
/* Define if we have the perf JIT-support library */
|
||||||
|
#cmakedefine01 LLVM_USE_PERF
|
||||||
|
|
||||||
|
/* Major version of the LLVM API */
|
||||||
|
#define LLVM_VERSION_MAJOR ${LLVM_VERSION_MAJOR}
|
||||||
|
|
||||||
|
/* Minor version of the LLVM API */
|
||||||
|
#define LLVM_VERSION_MINOR ${LLVM_VERSION_MINOR}
|
||||||
|
|
||||||
|
/* Patch version of the LLVM API */
|
||||||
|
#define LLVM_VERSION_PATCH ${LLVM_VERSION_PATCH}
|
||||||
|
|
||||||
|
/* LLVM version string */
|
||||||
|
#define LLVM_VERSION_STRING "${PACKAGE_VERSION}"
|
||||||
|
|
||||||
|
/* Whether LLVM records statistics for use with GetStatistics(),
|
||||||
|
* PrintStatistics() or PrintStatisticsJSON()
|
||||||
|
*/
|
||||||
|
#cmakedefine01 LLVM_FORCE_ENABLE_STATS
|
||||||
|
|
||||||
|
/* Define if we have z3 and want to build it */
|
||||||
|
#cmakedefine LLVM_WITH_Z3 ${LLVM_WITH_Z3}
|
||||||
|
|
||||||
|
/* Define if LLVM was built with a dependency to the libtensorflow dynamic library */
|
||||||
|
#cmakedefine LLVM_HAVE_TF_API
|
||||||
|
|
||||||
|
/* Define if LLVM was built with a dependency to the tensorflow compiler */
|
||||||
|
#cmakedefine LLVM_HAVE_TF_AOT
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sysexits.h> header file. */
|
||||||
|
#cmakedefine HAVE_SYSEXITS_H ${HAVE_SYSEXITS_H}
|
||||||
|
|
||||||
|
/* Define to 1 to enable the experimental new pass manager by default */
|
||||||
|
#cmakedefine01 LLVM_ENABLE_NEW_PASS_MANAGER
|
||||||
|
|
||||||
|
/* Define if the xar_open() function is supported on this platform. */
|
||||||
|
#cmakedefine LLVM_HAVE_LIBXAR ${LLVM_HAVE_LIBXAR}
|
||||||
|
|
||||||
|
/* Whether Timers signpost passes in Xcode Instruments */
|
||||||
|
#cmakedefine01 LLVM_SUPPORT_XCODE_SIGNPOSTS
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
92
utils/bazel/overlay_directories.py
Executable file
92
utils/bazel/overlay_directories.py
Executable file
@ -0,0 +1,92 @@
|
|||||||
|
#!/bin/python3
|
||||||
|
|
||||||
|
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
# See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
"""Overlays two directories into a target directory using symlinks.
|
||||||
|
|
||||||
|
Tries to minimize the number of symlinks created (that is, does not symlink
|
||||||
|
every single file). Symlinks every file in the overlay directory. Only symlinks
|
||||||
|
individual files in the source directory if their parent directory is also
|
||||||
|
contained in the overlay directory tree.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import errno
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def _check_python_version():
|
||||||
|
if sys.version_info[0] < 3:
|
||||||
|
raise RuntimeError(
|
||||||
|
"Must be invoked with a python 3 interpreter but was %s" %
|
||||||
|
sys.executable)
|
||||||
|
|
||||||
|
|
||||||
|
def _check_dir_exists(path):
|
||||||
|
if not os.path.isdir(path):
|
||||||
|
raise OSError(errno.ENOENT, os.strerror(errno.ENOENT), path)
|
||||||
|
|
||||||
|
|
||||||
|
def parse_arguments():
|
||||||
|
parser = argparse.ArgumentParser(description="""
|
||||||
|
Overlays two directories into a target directory using symlinks.
|
||||||
|
|
||||||
|
Tries to minimize the number of symlinks created (that is, does not symlink
|
||||||
|
every single file). Symlinks every file in the overlay directory. Only
|
||||||
|
symlinks individual files in the source directory if their parent directory
|
||||||
|
is also contained in the overlay directory tree.
|
||||||
|
""")
|
||||||
|
parser.add_argument(
|
||||||
|
"--src",
|
||||||
|
required=True,
|
||||||
|
help="Directory that contains most of the content to symlink.")
|
||||||
|
parser.add_argument(
|
||||||
|
"--overlay",
|
||||||
|
required=True,
|
||||||
|
help="Directory to overlay on top of the source directory.")
|
||||||
|
parser.add_argument(
|
||||||
|
"--target",
|
||||||
|
required=True,
|
||||||
|
help="Directory in which to place the fused symlink directories.")
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
_check_dir_exists(args.target)
|
||||||
|
_check_dir_exists(args.overlay)
|
||||||
|
_check_dir_exists(args.src)
|
||||||
|
|
||||||
|
return args
|
||||||
|
|
||||||
|
|
||||||
|
def _symlink_abs(from_path, to_path):
|
||||||
|
os.symlink(os.path.abspath(from_path), os.path.abspath(to_path))
|
||||||
|
|
||||||
|
|
||||||
|
def main(args):
|
||||||
|
for root, dirs, files in os.walk(args.overlay):
|
||||||
|
# We could do something more intelligent here and only symlink individual
|
||||||
|
# files if the directory is present in both overlay and src. This could also
|
||||||
|
# be generalized to an arbitrary number of directories without any
|
||||||
|
# "src/overlay" distinction. In the current use case we only have two and
|
||||||
|
# the overlay directory is always small, so putting that off for now.
|
||||||
|
rel_root = os.path.relpath(root, start=args.overlay)
|
||||||
|
if rel_root != ".":
|
||||||
|
os.mkdir(os.path.join(args.target, rel_root))
|
||||||
|
|
||||||
|
for file in files:
|
||||||
|
relpath = os.path.join(rel_root, file)
|
||||||
|
_symlink_abs(os.path.join(args.overlay, relpath),
|
||||||
|
os.path.join(args.target, relpath))
|
||||||
|
|
||||||
|
for src_entry in os.listdir(os.path.join(args.src, rel_root)):
|
||||||
|
if src_entry not in dirs:
|
||||||
|
relpath = os.path.join(rel_root, src_entry)
|
||||||
|
_symlink_abs(os.path.join(args.src, relpath),
|
||||||
|
os.path.join(args.target, relpath))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
_check_python_version()
|
||||||
|
main(parse_arguments())
|
202
utils/bazel/terminfo.bzl
Normal file
202
utils/bazel/terminfo.bzl
Normal file
@ -0,0 +1,202 @@
|
|||||||
|
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
# See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
|
"""Repository rules to configure the terminfo used by LLVM.
|
||||||
|
|
||||||
|
Most users should pick one of the explicit rules to configure their use of terminfo
|
||||||
|
with LLVM:
|
||||||
|
- `llvm_terminfo_system` will detect and link against a terminfo-implementing
|
||||||
|
system library (non-hermetically).
|
||||||
|
- 'llvm_terminfo_disable` will disable terminfo completely.
|
||||||
|
|
||||||
|
If you would like to make your build configurable, you can use
|
||||||
|
`llvm_terminfo_from_env`. By default, this will disable terminfo, but will
|
||||||
|
inspect the environment variable (most easily set with a `--repo_env` flag to
|
||||||
|
the Bazel invocation) `BAZEL_LLVM_TERMINFO_STRATEGY`. If it is set to
|
||||||
|
`system` then it will behave the same as `llvm_terminfo_system`. Any other
|
||||||
|
setting will disable terminfo the same as not setting it at all.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def _llvm_terminfo_disable_impl(repository_ctx):
|
||||||
|
repository_ctx.template(
|
||||||
|
"BUILD",
|
||||||
|
repository_ctx.attr._disable_build_template,
|
||||||
|
executable = False,
|
||||||
|
)
|
||||||
|
|
||||||
|
_terminfo_disable_attrs = {
|
||||||
|
"_disable_build_template": attr.label(
|
||||||
|
default = Label("//deps_impl:terminfo_disable.BUILD"),
|
||||||
|
allow_single_file = True,
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
llvm_terminfo_disable = repository_rule(
|
||||||
|
implementation = _llvm_terminfo_disable_impl,
|
||||||
|
attrs = _terminfo_disable_attrs,
|
||||||
|
)
|
||||||
|
|
||||||
|
def _find_c_compiler(repository_ctx):
|
||||||
|
"""Returns the path to a plausible C compiler.
|
||||||
|
|
||||||
|
This routine will only reliably work on roughly POSIX-y systems as it
|
||||||
|
ultimately falls back on the `cc` binary. Fortunately, the thing we are
|
||||||
|
trying to use it for (detecting if a trivial source file can compile and
|
||||||
|
link against a particular library) requires very little.
|
||||||
|
"""
|
||||||
|
cc_env = repository_ctx.os.environ.get("CC")
|
||||||
|
cc = None
|
||||||
|
if cc_env:
|
||||||
|
if "/" in cc_env:
|
||||||
|
return repository_ctx.path(cc_env)
|
||||||
|
else:
|
||||||
|
return repository_ctx.which(cc_env)
|
||||||
|
|
||||||
|
# Look for Clang, GCC, and the POSIX / UNIX specified C compiler
|
||||||
|
# binaries.
|
||||||
|
for compiler in ["clang", "gcc", "c99", "c89", "cc"]:
|
||||||
|
cc = repository_ctx.which(compiler)
|
||||||
|
if cc:
|
||||||
|
return cc
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
|
def _try_link(repository_ctx, cc, source, linker_flags):
|
||||||
|
"""Returns `True` if able to link the source with the linker flag.
|
||||||
|
|
||||||
|
Given a source file that contains references to library routines, this
|
||||||
|
will check that when linked with the provided linker flag, those
|
||||||
|
references are successfully resolved. This routine assumes a generally
|
||||||
|
POSIX-y and GCC-ish compiler and environment and shouldn't be expected to
|
||||||
|
work outside of that.
|
||||||
|
"""
|
||||||
|
cmd = [
|
||||||
|
cc,
|
||||||
|
# Force discard the linked executable.
|
||||||
|
"-o",
|
||||||
|
"/dev/null",
|
||||||
|
# Leave language detection to the compiler.
|
||||||
|
source,
|
||||||
|
]
|
||||||
|
|
||||||
|
# The linker flag must be valid for a compiler invocation of the link step,
|
||||||
|
# so just append them to the command.
|
||||||
|
cmd += linker_flags
|
||||||
|
exec_result = repository_ctx.execute(cmd, timeout = 20)
|
||||||
|
return exec_result.return_code == 0
|
||||||
|
|
||||||
|
def _llvm_terminfo_system_impl(repository_ctx):
|
||||||
|
# LLVM doesn't need terminfo support on Windows, so just disable it.
|
||||||
|
if repository_ctx.os.name.lower().find("windows") != -1:
|
||||||
|
_llvm_terminfo_disable_impl(repository_ctx)
|
||||||
|
return
|
||||||
|
|
||||||
|
if len(repository_ctx.attr.system_linkopts) > 0:
|
||||||
|
linkopts = repository_ctx.attr.system_linkopts
|
||||||
|
else:
|
||||||
|
required = repository_ctx.attr.system_required
|
||||||
|
|
||||||
|
# Find a C compiler we can use to detect viable linkopts on this system.
|
||||||
|
cc = _find_c_compiler(repository_ctx)
|
||||||
|
if not cc:
|
||||||
|
if required:
|
||||||
|
fail("Failed to find a C compiler executable")
|
||||||
|
else:
|
||||||
|
_llvm_terminfo_disable_impl(repository_ctx)
|
||||||
|
return
|
||||||
|
|
||||||
|
# Get the source file we use to detect successful linking of terminfo.
|
||||||
|
source = repository_ctx.path(repository_ctx.attr._terminfo_test_source)
|
||||||
|
|
||||||
|
# Collect the candidate linkopts and wrap them into a list. Ideally,
|
||||||
|
# these would be provided as lists, but Bazel doesn't currently
|
||||||
|
# support that. See: https://github.com/bazelbuild/bazel/issues/12178
|
||||||
|
linkopts_candidates = [[x] for x in repository_ctx.attr.candidate_system_linkopts]
|
||||||
|
|
||||||
|
# For each candidate, try to use it to link our test source file.
|
||||||
|
for linkopts_candidate in linkopts_candidates:
|
||||||
|
if _try_link(repository_ctx, cc, source, linkopts_candidate):
|
||||||
|
linkopts = linkopts_candidate
|
||||||
|
break
|
||||||
|
|
||||||
|
# If we never found a viable linkopts candidate, either error or disable
|
||||||
|
# terminfo for LLVM.
|
||||||
|
if not linkopts:
|
||||||
|
if required:
|
||||||
|
fail("Failed to detect which linkopt would successfully provide the " +
|
||||||
|
"necessary terminfo functionality")
|
||||||
|
else:
|
||||||
|
_llvm_terminfo_disable_impl(repository_ctx)
|
||||||
|
return
|
||||||
|
|
||||||
|
repository_ctx.template(
|
||||||
|
"BUILD",
|
||||||
|
repository_ctx.attr._system_build_template,
|
||||||
|
substitutions = {
|
||||||
|
"{TERMINFO_LINKOPTS}": str(linkopts),
|
||||||
|
},
|
||||||
|
executable = False,
|
||||||
|
)
|
||||||
|
|
||||||
|
def _merge_attrs(attrs_list):
|
||||||
|
attrs = {}
|
||||||
|
for input_attrs in attrs_list:
|
||||||
|
attrs.update(input_attrs)
|
||||||
|
return attrs
|
||||||
|
|
||||||
|
_terminfo_system_attrs = _merge_attrs([_terminfo_disable_attrs, {
|
||||||
|
"_system_build_template": attr.label(
|
||||||
|
default = Label("//deps_impl:terminfo_system.BUILD"),
|
||||||
|
allow_single_file = True,
|
||||||
|
),
|
||||||
|
"_terminfo_test_source": attr.label(
|
||||||
|
default = Label("//deps_impl:terminfo_test.c"),
|
||||||
|
allow_single_file = True,
|
||||||
|
),
|
||||||
|
"candidate_system_linkopts": attr.string_list(
|
||||||
|
default = [
|
||||||
|
"-lterminfo",
|
||||||
|
"-ltinfo",
|
||||||
|
"-lcurses",
|
||||||
|
"-lncurses",
|
||||||
|
"-lncursesw",
|
||||||
|
],
|
||||||
|
doc = "Candidate linkopts to test and see if they can link " +
|
||||||
|
"successfully.",
|
||||||
|
),
|
||||||
|
"system_required": attr.bool(
|
||||||
|
default = False,
|
||||||
|
doc = "Require that one of the candidates is detected successfully on POSIX platforms where it is needed.",
|
||||||
|
),
|
||||||
|
"system_linkopts": attr.string_list(
|
||||||
|
default = [],
|
||||||
|
doc = "If non-empty, a specific array of linkopts to use to " +
|
||||||
|
"successfully link against the terminfo library. No " +
|
||||||
|
"detection is performed if this option is provided, it " +
|
||||||
|
"directly forces the use of these link options. No test is " +
|
||||||
|
"run to determine if they are valid or work correctly either.",
|
||||||
|
),
|
||||||
|
}])
|
||||||
|
|
||||||
|
llvm_terminfo_system = repository_rule(
|
||||||
|
implementation = _llvm_terminfo_system_impl,
|
||||||
|
configure = True,
|
||||||
|
local = True,
|
||||||
|
attrs = _terminfo_system_attrs,
|
||||||
|
)
|
||||||
|
|
||||||
|
def _llvm_terminfo_from_env_impl(repository_ctx):
|
||||||
|
terminfo_strategy = repository_ctx.os.environ.get("BAZEL_LLVM_TERMINFO_STRATEGY")
|
||||||
|
if terminfo_strategy == "system":
|
||||||
|
_llvm_terminfo_system_impl(repository_ctx)
|
||||||
|
else:
|
||||||
|
_llvm_terminfo_disable_impl(repository_ctx)
|
||||||
|
|
||||||
|
llvm_terminfo_from_env = repository_rule(
|
||||||
|
implementation = _llvm_terminfo_from_env_impl,
|
||||||
|
configure = True,
|
||||||
|
local = True,
|
||||||
|
attrs = _merge_attrs([_terminfo_disable_attrs, _terminfo_system_attrs]),
|
||||||
|
environ = ["BAZEL_LLVM_TERMINFO_STRATEGY", "CC"],
|
||||||
|
)
|
5
utils/bazel/third_party_build/BUILD
Normal file
5
utils/bazel/third_party_build/BUILD
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
# See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
|
licenses(["notice"])
|
30
utils/bazel/third_party_build/vulkan_headers.BUILD
Normal file
30
utils/bazel/third_party_build/vulkan_headers.BUILD
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
# See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
|
package(
|
||||||
|
default_visibility = ["//visibility:public"],
|
||||||
|
licenses = ["notice"],
|
||||||
|
)
|
||||||
|
|
||||||
|
# Exports all headers but defining VK_NO_PROTOTYPES to disable the
|
||||||
|
# inclusion of C function prototypes. Useful if dynamically loading
|
||||||
|
# all symbols via dlopen/etc.
|
||||||
|
# Not all headers are hermetic, so they are just included as textual
|
||||||
|
# headers to disable additional validation.
|
||||||
|
cc_library(
|
||||||
|
name = "vulkan_headers_no_prototypes",
|
||||||
|
defines = ["VK_NO_PROTOTYPES"],
|
||||||
|
includes = ["include"],
|
||||||
|
textual_hdrs = glob(["include/vulkan/*.h"]),
|
||||||
|
)
|
||||||
|
|
||||||
|
# Exports all headers, including C function prototypes. Useful if statically
|
||||||
|
# linking against the Vulkan SDK.
|
||||||
|
# Not all headers are hermetic, so they are just included as textual
|
||||||
|
# headers to disable additional validation.
|
||||||
|
cc_library(
|
||||||
|
name = "vulkan_headers",
|
||||||
|
includes = ["include"],
|
||||||
|
textual_hdrs = glob(["include/vulkan/*.h"]),
|
||||||
|
)
|
46
utils/bazel/third_party_build/zlib.BUILD
Normal file
46
utils/bazel/third_party_build/zlib.BUILD
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
# See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
|
package(
|
||||||
|
default_visibility = ["//visibility:public"],
|
||||||
|
# BSD/MIT-like license (for zlib)
|
||||||
|
licenses = ["notice"],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "zlib",
|
||||||
|
srcs = [
|
||||||
|
"adler32.c",
|
||||||
|
"compress.c",
|
||||||
|
"crc32.c",
|
||||||
|
"crc32.h",
|
||||||
|
"deflate.c",
|
||||||
|
"deflate.h",
|
||||||
|
"gzclose.c",
|
||||||
|
"gzguts.h",
|
||||||
|
"gzlib.c",
|
||||||
|
"gzread.c",
|
||||||
|
"gzwrite.c",
|
||||||
|
"infback.c",
|
||||||
|
"inffast.c",
|
||||||
|
"inffast.h",
|
||||||
|
"inffixed.h",
|
||||||
|
"inflate.c",
|
||||||
|
"inflate.h",
|
||||||
|
"inftrees.c",
|
||||||
|
"inftrees.h",
|
||||||
|
"trees.c",
|
||||||
|
"trees.h",
|
||||||
|
"uncompr.c",
|
||||||
|
"zconf.h",
|
||||||
|
"zutil.c",
|
||||||
|
"zutil.h",
|
||||||
|
],
|
||||||
|
hdrs = ["zlib.h"],
|
||||||
|
copts = [
|
||||||
|
"-Wno-shift-negative-value",
|
||||||
|
"-DZ_HAVE_UNISTD_H",
|
||||||
|
],
|
||||||
|
includes = ["."],
|
||||||
|
)
|
43
utils/bazel/vulkan_sdk.bzl
Normal file
43
utils/bazel/vulkan_sdk.bzl
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
# See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
|
"""Repository rule to statically link against the Vulkan SDK.
|
||||||
|
|
||||||
|
Requires installing the Vulkan SDK from https://vulkan.lunarg.com/.
|
||||||
|
|
||||||
|
If the Vulkan SDK is not installed, this generates an empty rule and you may
|
||||||
|
encounter linker errors like `error: undefined reference to 'vkCreateInstance'`.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def _impl(repository_ctx):
|
||||||
|
if "VULKAN_SDK" in repository_ctx.os.environ:
|
||||||
|
sdk_path = repository_ctx.os.environ["VULKAN_SDK"]
|
||||||
|
repository_ctx.symlink(sdk_path, "vulkan-sdk")
|
||||||
|
|
||||||
|
repository_ctx.file("BUILD", """
|
||||||
|
cc_library(
|
||||||
|
name = "sdk",
|
||||||
|
srcs = select({
|
||||||
|
"@bazel_tools//src/conditions:windows": [
|
||||||
|
"vulkan-sdk/Lib/vulkan-1.lib"
|
||||||
|
],
|
||||||
|
"//conditions:default": [
|
||||||
|
"vulkan-sdk/lib/libvulkan.so.1",
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)""")
|
||||||
|
else:
|
||||||
|
# Empty rule. Will fail to link for just targets that use Vulkan.
|
||||||
|
repository_ctx.file("BUILD", """
|
||||||
|
cc_library(
|
||||||
|
name = "sdk",
|
||||||
|
srcs = [],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)""")
|
||||||
|
|
||||||
|
vulkan_sdk_setup = repository_rule(
|
||||||
|
implementation = _impl,
|
||||||
|
local = True,
|
||||||
|
)
|
112
utils/bazel/zlib.bzl
Normal file
112
utils/bazel/zlib.bzl
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
# See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
|
"""Repository rules to configure the zlib used by LLVM.
|
||||||
|
|
||||||
|
Most users should pick one of the explicit rules to configure their use of zlib
|
||||||
|
with LLVM:
|
||||||
|
- `llvm_zlib_external` will link against an external Bazel zlib repository.
|
||||||
|
- `llvm_zlib_system` will link against the system zlib (non-hermetically).
|
||||||
|
- 'llvm_zlib_disable` will disable zlib completely.
|
||||||
|
|
||||||
|
If you would like to make your build configurable, you can use
|
||||||
|
`llvm_zlib_from_env`. By default, this will disable zlib, but will inspect
|
||||||
|
the environment variable (most easily set with a `--repo_env` flag to the
|
||||||
|
Bazel invocation) `BAZEL_LLVM_ZLIB_STRATEGY`. If it is set to `external`,
|
||||||
|
then it will behave the same as `llvm_zlib_external`. If it is set to
|
||||||
|
`system` then it will behave the same as `llvm_zlib_system`. Any other
|
||||||
|
setting will disable zlib the same as not setting it at all.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def _llvm_zlib_external_impl(repository_ctx):
|
||||||
|
repository_ctx.template(
|
||||||
|
"BUILD",
|
||||||
|
repository_ctx.attr._external_build_template,
|
||||||
|
substitutions = {
|
||||||
|
"@external_zlib_repo//:zlib_rule": str(repository_ctx.attr.external_zlib),
|
||||||
|
},
|
||||||
|
executable = False,
|
||||||
|
)
|
||||||
|
|
||||||
|
llvm_zlib_external = repository_rule(
|
||||||
|
implementation = _llvm_zlib_external_impl,
|
||||||
|
attrs = {
|
||||||
|
"_external_build_template": attr.label(
|
||||||
|
default = Label("//deps_impl:zlib_external.BUILD"),
|
||||||
|
allow_single_file = True,
|
||||||
|
),
|
||||||
|
"external_zlib": attr.label(
|
||||||
|
doc = "The dependency that should be used for the external zlib library.",
|
||||||
|
mandatory = True,
|
||||||
|
),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
def _llvm_zlib_system_impl(repository_ctx):
|
||||||
|
repository_ctx.template(
|
||||||
|
"BUILD",
|
||||||
|
repository_ctx.attr._system_build_template,
|
||||||
|
executable = False,
|
||||||
|
)
|
||||||
|
|
||||||
|
# While it may seem like this needs to be local, it doesn't actually inspect
|
||||||
|
# any local state, it just configures to build against that local state.
|
||||||
|
llvm_zlib_system = repository_rule(
|
||||||
|
implementation = _llvm_zlib_system_impl,
|
||||||
|
attrs = {
|
||||||
|
"_system_build_template": attr.label(
|
||||||
|
default = Label("//deps_impl:zlib_system.BUILD"),
|
||||||
|
allow_single_file = True,
|
||||||
|
),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
def _llvm_zlib_disable_impl(repository_ctx):
|
||||||
|
repository_ctx.template(
|
||||||
|
"BUILD",
|
||||||
|
repository_ctx.attr._disable_build_template,
|
||||||
|
executable = False,
|
||||||
|
)
|
||||||
|
|
||||||
|
llvm_zlib_disable = repository_rule(
|
||||||
|
implementation = _llvm_zlib_disable_impl,
|
||||||
|
attrs = {
|
||||||
|
"_disable_build_template": attr.label(
|
||||||
|
default = Label("//deps_impl:zlib_disable.BUILD"),
|
||||||
|
allow_single_file = True,
|
||||||
|
),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
def _llvm_zlib_from_env_impl(repository_ctx):
|
||||||
|
zlib_strategy = repository_ctx.os.environ.get("BAZEL_LLVM_ZLIB_STRATEGY")
|
||||||
|
if zlib_strategy == "external":
|
||||||
|
_llvm_zlib_external_impl(repository_ctx)
|
||||||
|
elif zlib_strategy == "system":
|
||||||
|
_llvm_zlib_system_impl(repository_ctx)
|
||||||
|
else:
|
||||||
|
_llvm_zlib_disable_impl(repository_ctx)
|
||||||
|
|
||||||
|
llvm_zlib_from_env = repository_rule(
|
||||||
|
implementation = _llvm_zlib_from_env_impl,
|
||||||
|
attrs = {
|
||||||
|
"_disable_build_template": attr.label(
|
||||||
|
default = Label("//deps_impl:zlib_disable.BUILD"),
|
||||||
|
allow_single_file = True,
|
||||||
|
),
|
||||||
|
"_external_build_template": attr.label(
|
||||||
|
default = Label("//deps_impl:zlib_external.BUILD"),
|
||||||
|
allow_single_file = True,
|
||||||
|
),
|
||||||
|
"_system_build_template": attr.label(
|
||||||
|
default = Label("//deps_impl:zlib_system.BUILD"),
|
||||||
|
allow_single_file = True,
|
||||||
|
),
|
||||||
|
"external_zlib": attr.label(
|
||||||
|
doc = "The dependency that should be used for the external zlib library.",
|
||||||
|
mandatory = True,
|
||||||
|
),
|
||||||
|
},
|
||||||
|
environ = ["BAZEL_LLVM_ZLIB_STRATEGY"],
|
||||||
|
)
|
Loading…
x
Reference in New Issue
Block a user