diff --git a/llvm/lib/Target/AArch64/AArch64RegisterBankInfo.cpp b/llvm/lib/Target/AArch64/AArch64RegisterBankInfo.cpp index 9f8d4d5184d3..83dccdad4fb9 100644 --- a/llvm/lib/Target/AArch64/AArch64RegisterBankInfo.cpp +++ b/llvm/lib/Target/AArch64/AArch64RegisterBankInfo.cpp @@ -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 diff --git a/llvm/lib/Target/AArch64/CMakeLists.txt b/llvm/lib/Target/AArch64/CMakeLists.txt index 37e2e6418a66..0f2c55cf8ab5 100644 --- a/llvm/lib/Target/AArch64/CMakeLists.txt +++ b/llvm/lib/Target/AArch64/CMakeLists.txt @@ -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)