[PATCH] D134512: [bazel] Respect llvm_target_list in llvm-exegesis

Jordan Rupprecht via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 22 19:08:02 PDT 2022


rupprecht created this revision.
rupprecht added reviewers: cmtice, aeubanks.
Herald added subscribers: mstojanovic, atanasyan, arichardson, sdardis.
Herald added a project: All.
rupprecht requested review of this revision.
Herald added subscribers: llvm-commits, courbet.
Herald added a project: LLVM.

- 47afaf2eb02b1424a9aba241ccd02393a0cbc648 <https://reviews.llvm.org/rG47afaf2eb02b1424a9aba241ccd02393a0cbc648> changed llvm-exegesis cmake rules
- 5b2f838db42ea190fdda147a33b5f0fcc8145689 <https://reviews.llvm.org/rG5b2f838db42ea190fdda147a33b5f0fcc8145689> ported them to bazel, but did so by adding all the `lib/{target}/*.cpp` sources in exegesis to the build rule
- c7bf9d084d037aa6c8fd479be9ccdf963dc59e10 <https://reviews.llvm.org/rGc7bf9d084d037aa6c8fd479be9ccdf963dc59e10> removed it, because it breaks users who don't build Mips and fail when building `lib/Mips/*.cpp`. But that in turn breaks those who *do* build the Mips target.

This should hopefully fix it for the final time by using selectively build subdirectories of exegesis target libs using llvm_target_exegesis, which is derived from llvm_targets, and is the list that can vary based on the downstream user.

I verified this builds with and without `Mips` in the `DEFAULT_TARGETS` configure list, and also double checked with `bazel query --output=build @llvm-project//llvm:Exegesis` that `lib/Mips/Target.cpp` is being included if and only if `Mips` is in the target list.
`


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134512

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
@@ -2591,16 +2591,18 @@
     name = "Exegesis",
     srcs = glob([
         "tools/llvm-exegesis/lib/*.cpp",
-        "tools/llvm-exegesis/lib/AArch64/*.cpp",
-        "tools/llvm-exegesis/lib/PowerPC/*.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
         # them, even though consumers of this library use inclusion relative to
         # `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",
+    ] + [
+        "tools/llvm-exegesis/lib/{}/*.cpp".format(t)
+        for t in llvm_target_exegesis
+    ] + [
+        "tools/llvm-exegesis/lib/{}/*.h".format(t)
+        for t in llvm_target_exegesis
     ]),
     hdrs = glob(["tools/llvm-exegesis/lib/*.h"]),
     copts = llvm_copts + ["-DHAVE_LIBPFM=1"],


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134512.462377.patch
Type: text/x-patch
Size: 1281 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220923/9edf984a/attachment.bin>


More information about the llvm-commits mailing list