[AArch64] Change the CMake to avoid to build GlobalISel related APIs

when GISel is not built.
The positive side effects are:
- We do not have to define dummy implementation
- We do not have to do weird gymnastic to avoid like issues (like
  missing constructor or vtable for the base classes)

llvm-svn: 265570
This commit is contained in:
Quentin Colombet 2016-04-06 17:38:12 +00:00
parent 92f4ef1017
commit 4f03c0b806
2 changed files with 12 additions and 18 deletions

View File

@ -21,16 +21,9 @@
using namespace llvm;
#ifndef LLVM_BUILD_GLOBAL_ISEL
AArch64RegisterBankInfo::AArch64RegisterBankInfo(const TargetRegisterInfo &TRI)
: RegisterBankInfo() {
llvm_unreachable("This API shouldn't be useful outside of GlobalISel");
}
#error You shouldn't build this
#endif
unsigned AArch64RegisterBankInfo::copyCost(const RegisterBank &A,
const RegisterBank &B) const {
return 0;
}
#else
AArch64RegisterBankInfo::AArch64RegisterBankInfo(const TargetRegisterInfo &TRI)
: RegisterBankInfo(AArch64::NumRegisterBanks) {
// Initialize the GPR bank.
@ -70,4 +63,3 @@ unsigned AArch64RegisterBankInfo::copyCost(const RegisterBank &A,
// * build_sequence cost.
return 0;
}
#endif

View File

@ -14,18 +14,20 @@ tablegen(LLVM AArch64GenSubtargetInfo.inc -gen-subtarget)
tablegen(LLVM AArch64GenDisassemblerTables.inc -gen-disassembler)
add_public_tablegen_target(AArch64CommonTableGen)
# List of all GlobalISel files.
set(GLOBAL_ISEL_FILES
AArch64RegisterBankInfo.cpp
)
AArch64RegisterBankInfo.cpp
)
if(NOT LLVM_BUILD_GLOBAL_ISEL)
set(LLVM_OPTIONAL_SOURCES ${GLOBAL_ISEL_FILES})
set(GLOBAL_ISEL_FILES)
# Add GlobalISel files to the dependencies if the user wants to build it.
if(LLVM_BUILD_GLOBAL_ISEL)
set(GLOBAL_ISEL_BUILD_FILES ${GLOBAL_ISEL_FILES})
else()
set(GLOBAL_ISEL_BUILD_FILES"")
set(LLVM_OPTIONAL_SOURCES LLVMGlobalISel ${GLOBAL_ISEL_FILES})
endif()
set(LLVM_OPTIONAL_SOURCES AArch64RegisterBankInfo.cpp)
add_llvm_target(AArch64CodeGen
AArch64A57FPLoadBalancing.cpp
AArch64AddressTypePromotion.cpp
@ -57,7 +59,7 @@ add_llvm_target(AArch64CodeGen
AArch64TargetMachine.cpp
AArch64TargetObjectFile.cpp
AArch64TargetTransformInfo.cpp
${GLOBAL_ISEL_FILES}
${GLOBAL_ISEL_BUILD_FILES}
)
add_dependencies(LLVMAArch64CodeGen intrinsics_gen)