[bazel] Respect llvm_target_list in llvm-exegesis
authorJordan Rupprecht <rupprecht@google.com>
Fri, 23 Sep 2022 02:20:04 +0000 (19:20 -0700)
committerJordan Rupprecht <rupprecht@google.com>
Fri, 23 Sep 2022 02:20:04 +0000 (19:20 -0700)
commit892260d7f3526c429047b645f22401635a7df368
tree58a611ac2e28c9a0f97c41ec54a30a9ca9912099
parentdb021abf33d325303500c883902be9150bcd3c22
[bazel] Respect llvm_target_list in llvm-exegesis

47afaf2eb02b1424a9aba241ccd02393a0cbc648 changed llvm-exegesis cmake rules
5b2f838db42ea190fdda147a33b5f0fcc8145689 ported them to bazel, but did so by adding all the `lib/{target}/*.cpp` sources in exegesis to the build rule
c7bf9d084d037aa6c8fd479be9ccdf963dc59e10 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.

Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D134512
utils/bazel/llvm-project-overlay/llvm/BUILD.bazel