diff --git a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel --- a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel @@ -41,22 +41,14 @@ targets = llvm_targets, ) -# TODO(gcmn): We should derive these lists from the presence of CMakeLists.txt -# files, as is done in the CMake build. # List of targets with ASM parsers, filtered to our list of overall targets. -llvm_target_asm_parsers = [t for t in [ - "AArch64", - "AMDGPU", - "ARM", - "BPF", - "Hexagon", - "Lanai", - "PowerPC", - "RISCV", - "Sparc", - "WebAssembly", - "X86", -] if t in llvm_targets] +llvm_target_asm_parsers = [ + t.split("/")[2] + for t in glob([ + "lib/Target/{}/AsmParser/CMakeLists.txt".format(t) + for t in llvm_targets + ]) +] enum_targets_gen( name = "asm_parsers_def_gen", @@ -67,19 +59,13 @@ ) # List of targets with disassemblers, filtered to our list of overall targets. -llvm_target_disassemblers = [t for t in [ - "AArch64", - "AMDGPU", - "ARM", - "BPF", - "Hexagon", - "Lanai", - "PowerPC", - "RISCV", - "Sparc", - "WebAssembly", - "X86", -] if t in llvm_targets] +llvm_target_disassemblers = [ + t.split("/")[2] + for t in glob([ + "lib/Target/{}/Disassembler/CMakeLists.txt".format(t) + for t in llvm_targets + ]) +] enum_targets_gen( name = "disassemblers_def_gen", @@ -90,9 +76,13 @@ ) # List of targets with mca, filtered to our list of overall targets. -llvm_target_mcas = [t for t in [ - "AMDGPU", -] if t in llvm_targets] +llvm_target_mcas = [ + t.split("/")[2] + for t in glob([ + "lib/Target/{}/MCA/CMakeLists.txt".format(t) + for t in llvm_targets + ]) +] enum_targets_gen( name = "target_mca_def_gen",