Skip to content

Commit

Permalink
cr suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
TianlongLiang committed Nov 18, 2024
1 parent c1ae902 commit 9596579
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions build-scripts/build_llvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,26 +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" and s != "Xtensa"]
experimental_backends = [s for s in backends if s == "ARC" or s == "Xtensa"]
experimental_backends = ["ARC", "Xtensa"]
normal_backends = [s for s in backends if s not in experimental_backends]

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"'
]

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
# if not on ARC platform, but want to add expeirmental backend ARC as target
if platform != "ARC" and "ARC" in backends:
LLVM_TARGETS_TO_BUILD.extend(
LLVM_EXTRA_COMPILE_OPTIONS["arc"]
)

if platform != "Xtensa" and "Xtensa" in backends:
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 @@ -255,6 +255,7 @@ def main():
"X86",
"Xtensa",
],
default=[],
help="identify LLVM supported backends, separate by space, like '--arch ARM Mips X86'",
)
parser.add_argument(
Expand Down Expand Up @@ -283,10 +284,6 @@ 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 9596579

Please sign in to comment.