Index: lib/Target/ARM/ARM.td =================================================================== --- lib/Target/ARM/ARM.td +++ lib/Target/ARM/ARM.td @@ -838,6 +838,8 @@ include "ARMRegisterInfo.td" +include "ARMRegisterBanks.td" + include "ARMCallingConv.td" //===----------------------------------------------------------------------===// Index: lib/Target/ARM/ARMRegisterBankInfo.h =================================================================== --- lib/Target/ARM/ARMRegisterBankInfo.h +++ lib/Target/ARM/ARMRegisterBankInfo.h @@ -16,19 +16,20 @@ #include "llvm/CodeGen/GlobalISel/RegisterBankInfo.h" +#define GET_REGBANK_DECLARATIONS +#include "ARMGenRegisterBank.inc" + namespace llvm { class TargetRegisterInfo; -namespace ARM { -enum { - GPRRegBankID = 0, // General purpose registers - NumRegisterBanks, +class ARMGenRegisterBankInfo : public RegisterBankInfo { +#define GET_TARGET_REGBANK_CLASS +#include "ARMGenRegisterBank.inc" }; -} // end namespace ARM /// This class provides the information for the target register banks. -class ARMRegisterBankInfo final : public RegisterBankInfo { +class ARMRegisterBankInfo final : public ARMGenRegisterBankInfo { public: ARMRegisterBankInfo(const TargetRegisterInfo &TRI); Index: lib/Target/ARM/ARMRegisterBankInfo.cpp =================================================================== --- lib/Target/ARM/ARMRegisterBankInfo.cpp +++ lib/Target/ARM/ARMRegisterBankInfo.cpp @@ -18,6 +18,9 @@ #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/Target/TargetRegisterInfo.h" +#define GET_TARGET_REGBANK_IMPL +#include "ARMGenRegisterBank.inc" + using namespace llvm; #ifndef LLVM_BUILD_GLOBAL_ISEL @@ -29,70 +32,6 @@ // into an ARMGenRegisterBankInfo.def (similar to AArch64). namespace llvm { namespace ARM { -const uint32_t GPRCoverageData[] = { - // Classes 0-31 - (1u << ARM::GPRRegClassID) | (1u << ARM::GPRwithAPSRRegClassID) | - (1u << ARM::GPRnopcRegClassID) | (1u << ARM::rGPRRegClassID) | - (1u << ARM::hGPRRegClassID) | (1u << ARM::tGPRRegClassID) | - (1u << ARM::GPRnopc_and_hGPRRegClassID) | - (1u << ARM::hGPR_and_rGPRRegClassID) | (1u << ARM::tcGPRRegClassID) | - (1u << ARM::tGPR_and_tcGPRRegClassID) | (1u << ARM::GPRspRegClassID) | - (1u << ARM::hGPR_and_tcGPRRegClassID), - // Classes 32-63 - 0, - // Classes 64-96 - (1u << (ARM::DQuadSpc_with_ssub_0RegClassID - 64)) | - (1u << (ARM::DQuadSpc_with_dsub_4_then_ssub_0RegClassID - 64)) | - (1u << (ARM::DQuadSpc_with_dsub_0_in_DPR_8RegClassID - 64)) | - (1u << (ARM::DQuadSpc_with_dsub_2_in_DPR_8RegClassID - 64)) | - (1u << (ARM::DQuadSpc_with_dsub_4_in_DPR_8RegClassID - 64)) | - (1u << (ARM::DQuadRegClassID - 64)) | - (1u << (ARM::DQuad_with_ssub_0RegClassID - 64)) | - (1u << (ARM::DQuad_with_dsub_1_dsub_2_in_QPR_VFP2RegClassID - 64)) | - (1u << (ARM::DQuad_with_dsub_1_in_DPR_8RegClassID - 64)) | - (1u << (ARM::DQuad_with_qsub_1_in_QPR_VFP2RegClassID - 64)) | - (1u << (ARM::DQuad_with_dsub_2_in_DPR_8RegClassID - 64)) | - (1u - << (ARM:: - DQuad_with_dsub_3_then_ssub_0_and_DQuad_with_dsub_1_dsub_2_in_QPRRegClassID - - 64)) | - (1u << (ARM::DQuad_with_dsub_3_in_DPR_8RegClassID - 64)) | - (1u - << (ARM:: - DQuad_with_dsub_0_in_DPR_8_and_DQuad_with_dsub_1_dsub_2_in_QPRRegClassID - - 64)) | - (1u << (ARM::DQuad_with_qsub_0_in_QPR_8RegClassID - 64)) | - (1u << (ARM::DQuad_with_dsub_1_dsub_2_in_QPR_8RegClassID - 64)) | - (1u << (ARM::DQuad_with_qsub_1_in_QPR_8RegClassID - 64)) | - (1u - << (ARM:: - DQuad_with_dsub_3_in_DPR_8_and_DQuad_with_dsub_1_dsub_2_in_QPRRegClassID - - 64)) | - (1u << (ARM::QQQQPRRegClassID - 64)) | - (1u << (ARM::QQQQPR_with_ssub_0RegClassID - 64)) | - (1u << (ARM::QQQQPR_with_dsub_2_then_ssub_0RegClassID - 64)) | - (1u << (ARM::QQQQPR_with_dsub_7_then_ssub_0RegClassID - 64)), - (1u << (ARM::QQQQPR_with_dsub_0_in_DPR_8RegClassID - 96)) | - (1u << (ARM::QQQQPR_with_dsub_2_in_DPR_8RegClassID - 96)) | - (1u << (ARM::QQQQPR_with_dsub_6_in_DPR_8RegClassID - 96)), - // FIXME: Some of the entries below this point can be safely removed once - // this is tablegenerated. It's only needed because of the hardcoded - // register class limit. - // Classes 97-128 - 0, - // Classes 129-160 - 0, - // Classes 161-192 - 0, - // Classes 193-224 - 0, -}; - -// FIXME: The 200 will be replaced by the number of register classes when this is -// tablegenerated. -RegisterBank GPRRegBank(ARM::GPRRegBankID, "GPRB", 32, ARM::GPRCoverageData, 200); -RegisterBank *RegBanks[] = {&GPRRegBank}; - RegisterBankInfo::PartialMapping GPRPartialMapping{0, 32, GPRRegBank}; RegisterBankInfo::ValueMapping ValueMappings[] = { @@ -101,7 +40,7 @@ } // end namespace llvm ARMRegisterBankInfo::ARMRegisterBankInfo(const TargetRegisterInfo &TRI) - : RegisterBankInfo(ARM::RegBanks, ARM::NumRegisterBanks) { + : ARMGenRegisterBankInfo() { static bool AlreadyInit = false; // We have only one set of register banks, whatever the subtarget // is. Therefore, the initialization of the RegBanks table should be Index: lib/Target/ARM/ARMRegisterBanks.td =================================================================== --- /dev/null +++ lib/Target/ARM/ARMRegisterBanks.td @@ -0,0 +1,13 @@ +//=- ARMRegisterBank.td - Describe the AArch64 Banks ---------*- tablegen -*-=// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// +//===----------------------------------------------------------------------===// + +def GPRRegBank : RegisterBank<"GPRB", [GPR, GPRwithAPSR]>; Index: lib/Target/ARM/CMakeLists.txt =================================================================== --- lib/Target/ARM/CMakeLists.txt +++ lib/Target/ARM/CMakeLists.txt @@ -1,5 +1,6 @@ set(LLVM_TARGET_DEFINITIONS ARM.td) +tablegen(LLVM ARMGenRegisterBank.inc -gen-register-bank) tablegen(LLVM ARMGenRegisterInfo.inc -gen-register-info) tablegen(LLVM ARMGenInstrInfo.inc -gen-instr-info) tablegen(LLVM ARMGenMCCodeEmitter.inc -gen-emitter)