[PATCH] D106196: [Bazel] Condition Exegesis target-specific sources

Geoffrey Martin-Noble via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 16 15:48:24 PDT 2021


GMNGeoffrey created this revision.
GMNGeoffrey added reviewers: chandlerc, rupprecht.
Herald added subscribers: mstojanovic, pengfei.
GMNGeoffrey requested review of this revision.
Herald added subscribers: llvm-commits, courbet.
Herald added a project: LLVM.

Not everything is X86 :-P


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106196

Files:
  utils/bazel/llvm-project-overlay/llvm/BUILD.bazel


Index: utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
===================================================================
--- utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
+++ utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
@@ -2,6 +2,7 @@
 # See https://llvm.org/LICENSE.txt for license information.
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
+load("@bazel_skylib//lib:selects.bzl", "selects")
 load(":template_rule.bzl", "template_rule")
 load(":tblgen.bzl", "gentbl")
 load(":config.bzl", "llvm_config_defines")
@@ -25,6 +26,24 @@
     "$(STACK_FRAME_UNLIMITED)",
 ]
 
+config_setting(
+    name = "x86_32",
+    constraint_values = ["@platforms//cpu/cpu:x86_32"],
+)
+
+config_setting(
+    name = "x86_64",
+    constraint_values = ["@platforms//cpu/cpu:x86_64"],
+)
+
+selects.config_setting_group(
+    name = "any_x86",
+    match_any = [
+        ":x86_32",
+        ":x86_64",
+    ],
+)
+
 enum_targets_gen(
     name = "targets_def_gen",
     src = "include/llvm/Config/Targets.def.in",
@@ -2326,8 +2345,6 @@
     name = "Exegesis",
     srcs = glob([
         "tools/llvm-exegesis/lib/*.cpp",
-        "tools/llvm-exegesis/lib/X86/*.cpp",
-        "tools/llvm-exegesis/lib/X86/*.h",
 
         # We have to include these headers here as well as in the `hdrs` below
         # to allow the `.cpp` files to use file-relative-inclusion to find
@@ -2335,7 +2352,13 @@
         # `tools/llvm-exegesis/lib` with the `strip_includes_prefix` of this
         # library. This mixture appears to be incompatible with header modules.
         "tools/llvm-exegesis/lib/*.h",
-    ]),
+    ]) + select({
+        ":any_x86": glob([
+            "tools/llvm-exegesis/lib/X86/*.cpp",
+            "tools/llvm-exegesis/lib/X86/*.h",
+        ]),
+        "//conditions:default": [],
+    }),
     hdrs = glob(["tools/llvm-exegesis/lib/*.h"]),
     copts = llvm_copts + ["-DHAVE_LIBPFM=1"],
     defines = ["LLVM_EXEGESIS_INITIALIZE_NATIVE_TARGET=InitializeX86ExegesisTarget"],


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106196.359469.patch
Type: text/x-patch
Size: 2001 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210716/6c93a509/attachment.bin>


More information about the llvm-commits mailing list