From d0b44dbefd140949fed7916dc33e19f7c86b2cfd Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Wed, 25 Sep 2019 13:03:04 +0000 Subject: Have ABI plugins vend llvm MCRegisterInfo data Summary: I was recently surprised to learn that there is a total of 2 (two) users of the register info definitions contained in the ABI plugins. Yet, the defitions themselves span nearly 10kLOC. The two users are: - dwarf expression pretty printer - the mechanism for augmenting the register info definitions obtained over gdb-remote protocol (AugmentRegisterInfoViaABI) Both of these uses need the DWARF an EH register numbers, which is information that is already available in LLVM. This patch makes it possible to do so. It adds a GetMCRegisterInfo method to the ABI class, which every class is expected to implement. Normally, it should be sufficient to obtain the definitions from the appropriate llvm::Target object (for which I provide a utility function), but the subclasses are free to construct it in any way they deem fit. We should be able to always get the MCRegisterInfo object from llvm, with one important exception: if the relevant llvm target was disabled at compile time. To handle this, I add a mechanism to disable the compilation of ABI plugins based on the value of LLVM_TARGETS_TO_BUILD cmake setting. This ensures all our existing are able to create their MCRegisterInfo objects. The new MCRegisterInfo api is not used yet, but the intention is to make use of it in follow-up patches. Reviewers: jasonmolenda, aprantl, JDevlieghere, tatyana-krasnukha Subscribers: wuzish, nemanjai, mgorny, kbarton, atanasyan, lldb-commits Differential Revision: https://reviews.llvm.org/D67965 llvm-svn: 372862 --- lldb/source/API/SystemInitializerFull.cpp | 57 +++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 14 deletions(-) (limited to 'lldb/source/API/SystemInitializerFull.cpp') diff --git a/lldb/source/API/SystemInitializerFull.cpp b/lldb/source/API/SystemInitializerFull.cpp index e7f2206b9a5..f71dd51db1e 100644 --- a/lldb/source/API/SystemInitializerFull.cpp +++ b/lldb/source/API/SystemInitializerFull.cpp @@ -174,20 +174,34 @@ llvm::Error SystemInitializerFull::Initialize() { ClangASTContext::Initialize(); - ABIMacOSX_i386::Initialize(); - ABIMacOSX_arm::Initialize(); +#ifdef LLVM_TARGET_AArch64_BUILT ABIMacOSX_arm64::Initialize(); - ABISysV_arm::Initialize(); ABISysV_arm64::Initialize(); +#endif +#ifdef LLVM_TARGET_ARM_BUILT + ABIMacOSX_arm::Initialize(); + ABISysV_arm::Initialize(); +#endif +#ifdef LLVM_TARGET_Hexagon_BUILT ABISysV_hexagon::Initialize(); - ABISysV_i386::Initialize(); - ABISysV_x86_64::Initialize(); - ABISysV_ppc::Initialize(); - ABISysV_ppc64::Initialize(); +#endif +#ifdef LLVM_TARGET_Mips_BUILT ABISysV_mips::Initialize(); ABISysV_mips64::Initialize(); +#endif +#ifdef LLVM_TARGET_PowerPC_BUILT + ABISysV_ppc::Initialize(); + ABISysV_ppc64::Initialize(); +#endif +#ifdef LLVM_TARGET_SystemZ_BUILT ABISysV_s390x::Initialize(); +#endif +#ifdef LLVM_TARGET_X86_BUILT + ABIMacOSX_i386::Initialize(); + ABISysV_i386::Initialize(); + ABISysV_x86_64::Initialize(); ABIWindows_x86_64::Initialize(); +#endif ArchitectureArm::Initialize(); ArchitectureMips::Initialize(); @@ -288,20 +302,35 @@ void SystemInitializerFull::Terminate() { ArchitectureMips::Terminate(); ArchitecturePPC64::Terminate(); - ABIMacOSX_i386::Terminate(); - ABIMacOSX_arm::Terminate(); +#ifdef LLVM_TARGET_AArch64_BUILT ABIMacOSX_arm64::Terminate(); - ABISysV_arm::Terminate(); ABISysV_arm64::Terminate(); +#endif +#ifdef LLVM_TARGET_ARM_BUILT + ABIMacOSX_arm::Terminate(); + ABISysV_arm::Terminate(); +#endif +#ifdef LLVM_TARGET_Hexagon_BUILT ABISysV_hexagon::Terminate(); - ABISysV_i386::Terminate(); - ABISysV_x86_64::Terminate(); - ABISysV_ppc::Terminate(); - ABISysV_ppc64::Terminate(); +#endif +#ifdef LLVM_TARGET_Mips_BUILT ABISysV_mips::Terminate(); ABISysV_mips64::Terminate(); +#endif +#ifdef LLVM_TARGET_PowerPC_BUILT + ABISysV_ppc::Terminate(); + ABISysV_ppc64::Terminate(); +#endif +#ifdef LLVM_TARGET_SystemZ_BUILT ABISysV_s390x::Terminate(); +#endif +#ifdef LLVM_TARGET_X86_BUILT + ABIMacOSX_i386::Terminate(); + ABISysV_i386::Terminate(); + ABISysV_x86_64::Terminate(); ABIWindows_x86_64::Terminate(); +#endif + DisassemblerLLVMC::Terminate(); JITLoaderGDB::Terminate(); -- cgit v1.2.3