Skip to content

Commit

Permalink
update llvm build script
Browse files Browse the repository at this point in the history
  • Loading branch information
TianlongLiang committed Nov 18, 2024
1 parent 484baa4 commit c1ae902
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions build-scripts/build_llvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,26 @@ def build_llvm(llvm_dir, platform, backends, projects, use_clang=False, extra_fl
"default": [],
}

normal_backends = [s for s in backends if s != "ARC"]
expeirmental_backends = [s for s in backends if s == "ARC"]
normal_backends = [s for s in backends if s != "ARC" and s != "Xtensa"]
experimental_backends = [s for s in backends if s == "ARC" or s == "Xtensa"]

LLVM_TARGETS_TO_BUILD = [
'-DLLVM_TARGETS_TO_BUILD:STRING="' + ";".join(normal_backends) + '"'
if normal_backends
else '-DLLVM_TARGETS_TO_BUILD:STRING="AArch64;ARM;Mips;RISCV;X86"'
]

# if not on ARC platform, but want to add expeirmental backend ARC as target
if platform != expeirmental_backend:
LLVM_TARGETS_TO_BUILD.extend(LLVM_EXTRA_COMPILE_OPTIONS[expeirmental_backend.lower()])
for experimental_backend in experimental_backends:
# if not on ARC platform, but want to add expeirmental backend ARC as target
if platform != "ARC" and experimental_backend == "ARC":
LLVM_TARGETS_TO_BUILD.extend(
LLVM_EXTRA_COMPILE_OPTIONS[experimental_backend.lower()]
)
elif platform != "Xtensa" and experimental_backend == "Xtensa":
print(
"Currently it's not supported to build Xtensa backend on non-Xtensa platform"
)
return None

LLVM_PROJECTS_TO_BUILD = [
'-DLLVM_ENABLE_PROJECTS:STRING="' + ";".join(projects) + '"' if projects else ""
Expand Down Expand Up @@ -275,6 +283,10 @@ def main():
)
options = parser.parse_args()

# Ensure options.arch is always a list
if options.arch is None:
options.arch = []

# if the "platform" is not identified in the command line option,
# detect it
if not options.platform:
Expand Down

0 comments on commit c1ae902

Please sign in to comment.