mirror of
https://github.com/intel/llvm.git
synced 2026-01-24 17:01:00 +08:00
[Bazel] Derive targets from file presence as in CMake build
This makes the logic used to determine if targets have the given features the same as is used in CMake. Incidentally, it enables these features for the targets added in https://reviews.llvm.org/D106921 which were missing because this was previously a hardcoded list. Reviewed By: chandlerc Differential Revision: https://reviews.llvm.org/D107019
This commit is contained in:
@@ -33,30 +33,27 @@ enum_targets_gen(
|
||||
targets = llvm_targets,
|
||||
)
|
||||
|
||||
# Enabled targets with ASM printers.
|
||||
llvm_target_asm_printers = [
|
||||
t
|
||||
for t in llvm_targets
|
||||
if glob(["lib/Target/{}/*AsmPrinter.cpp".format(t)])
|
||||
]
|
||||
|
||||
enum_targets_gen(
|
||||
name = "asm_printers_def_gen",
|
||||
src = "include/llvm/Config/AsmPrinters.def.in",
|
||||
out = "include/llvm/Config/AsmPrinters.def",
|
||||
macro_name = "ASM_PRINTER",
|
||||
targets = llvm_targets,
|
||||
targets = llvm_target_asm_printers,
|
||||
)
|
||||
|
||||
# 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]
|
||||
# Enabled targets with ASM parsers.
|
||||
llvm_target_asm_parsers = [
|
||||
t
|
||||
for t in llvm_targets
|
||||
if glob(["lib/Target/{}/AsmParser/CMakeLists.txt".format(t)])
|
||||
]
|
||||
|
||||
enum_targets_gen(
|
||||
name = "asm_parsers_def_gen",
|
||||
@@ -66,20 +63,12 @@ enum_targets_gen(
|
||||
targets = llvm_target_asm_parsers,
|
||||
)
|
||||
|
||||
# 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]
|
||||
# Enabled targets with disassemblers.
|
||||
llvm_target_disassemblers = [
|
||||
t
|
||||
for t in llvm_targets
|
||||
if glob(["lib/Target/{}/Disassembler/CMakeLists.txt".format(t)])
|
||||
]
|
||||
|
||||
enum_targets_gen(
|
||||
name = "disassemblers_def_gen",
|
||||
@@ -89,10 +78,12 @@ enum_targets_gen(
|
||||
targets = llvm_target_disassemblers,
|
||||
)
|
||||
|
||||
# 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]
|
||||
# Enabled targets with MCA.
|
||||
llvm_target_mcas = [
|
||||
t
|
||||
for t in llvm_targets
|
||||
if glob(["lib/Target/{}/MCA/CMakeLists.txt".format(t)])
|
||||
]
|
||||
|
||||
enum_targets_gen(
|
||||
name = "target_mca_def_gen",
|
||||
|
||||
Reference in New Issue
Block a user