mirror of
https://github.com/intel/llvm.git
synced 2026-01-23 16:06:39 +08:00
[BOLT][PR] Target compilation based on LLVM CMake configuration
Summary: Minimalist implementation of target configurable compilation. Fixes https://github.com/facebookincubator/BOLT/issues/59 Pull Request resolved: https://github.com/facebookincubator/BOLT/pull/60 GitHub Author: Pierre RAMOIN <pierre.ramoin@amadeus.com> (cherry picked from FBD16461879)
This commit is contained in:
committed by
Maksim Panchenko
parent
2c9c6b164b
commit
86800abc81
@@ -48,8 +48,6 @@ add_public_gen_version_target(GenBoltRevision)
|
||||
set(LLVM_LINK_COMPONENTS
|
||||
${LLVM_TARGETS_TO_BUILD}
|
||||
BOLTPasses
|
||||
BOLTTargetAArch64
|
||||
BOLTTargetX86
|
||||
CodeGen
|
||||
Core
|
||||
DebugInfoDWARF
|
||||
@@ -61,6 +59,18 @@ set(LLVM_LINK_COMPONENTS
|
||||
Support
|
||||
)
|
||||
|
||||
string(FIND "${LLVM_TARGETS_TO_BUILD}" "AArch64" POSITION)
|
||||
if (NOT ${POSITION} EQUAL -1)
|
||||
list(APPEND LLVM_LINK_COMPONENTS BOLTTargetAArch64)
|
||||
set(BOLT_AArcb64 On)
|
||||
endif()
|
||||
|
||||
string(FIND "${LLVM_TARGETS_TO_BUILD}" "X86" POSITION)
|
||||
if (NOT ${POSITION} EQUAL -1)
|
||||
list(APPEND LLVM_LINK_COMPONENTS BOLTTargetX86)
|
||||
set(BOLT_X64 On)
|
||||
endif()
|
||||
|
||||
add_llvm_tool(llvm-bolt
|
||||
llvm-bolt.cpp
|
||||
BinaryBasicBlock.cpp
|
||||
@@ -93,6 +103,14 @@ add_llvm_tool(llvm-bolt
|
||||
intrinsics_gen
|
||||
)
|
||||
|
||||
if (DEFINED BOLT_AArcb64)
|
||||
target_compile_definitions(llvm-bolt PRIVATE AARCH64_AVAILABLE)
|
||||
endif()
|
||||
|
||||
if (DEFINED BOLT_X64)
|
||||
target_compile_definitions(llvm-bolt PRIVATE X86_AVAILABLE)
|
||||
endif()
|
||||
|
||||
add_llvm_tool_symlink(perf2bolt llvm-bolt)
|
||||
add_llvm_tool_symlink(llvm-boltdiff llvm-bolt)
|
||||
add_llvm_tool_symlink(llvm-bolt-heatmap llvm-bolt)
|
||||
|
||||
@@ -535,15 +535,18 @@ namespace {
|
||||
MCPlusBuilder *createMCPlusBuilder(const Triple::ArchType Arch,
|
||||
const MCInstrAnalysis *Analysis, const MCInstrInfo *Info,
|
||||
const MCRegisterInfo *RegInfo) {
|
||||
if (Arch == Triple::x86_64) {
|
||||
#ifdef X86_AVAILABLE
|
||||
if (Arch == Triple::x86_64)
|
||||
return createX86MCPlusBuilder(Analysis, Info, RegInfo);
|
||||
} else if (Arch == Triple::aarch64) {
|
||||
return createAArch64MCPlusBuilder(Analysis, Info, RegInfo);
|
||||
} else {
|
||||
llvm_unreachable("architecture unsupport by MCPlusBuilder");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef AARCH64_AVAILABLE
|
||||
if (Arch == Triple::aarch64)
|
||||
return createAArch64MCPlusBuilder(Analysis, Info, RegInfo);
|
||||
#endif
|
||||
|
||||
llvm_unreachable("architecture unsupport by MCPlusBuilder");
|
||||
}
|
||||
}
|
||||
|
||||
constexpr const char *RewriteInstance::SectionsToOverwrite[];
|
||||
|
||||
Reference in New Issue
Block a user