Have ABI plugins vend llvm MCRegisterInfo data
authorPavel Labath <pavel@labath.sk>
Wed, 25 Sep 2019 13:03:04 +0000 (13:03 +0000)
committerPavel Labath <pavel@labath.sk>
Wed, 25 Sep 2019 13:03:04 +0000 (13:03 +0000)
commitd0b44dbefd140949fed7916dc33e19f7c86b2cfd
tree318a6e9e16ef40497b6e766535ecde4bfa6fc796
parent7f9ac3372ccb85fbe652276d4081c9c64dfb3836
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
35 files changed:
lldb/include/lldb/Target/ABI.h
lldb/source/API/CMakeLists.txt
lldb/source/API/SystemInitializerFull.cpp
lldb/source/Plugins/ABI/CMakeLists.txt
lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp
lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h
lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp
lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h
lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h
lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp
lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.h
lldb/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp
lldb/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.h
lldb/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
lldb/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h
lldb/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp
lldb/source/Plugins/ABI/SysV-i386/ABISysV_i386.h
lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.h
lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h
lldb/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp
lldb/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.h
lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h
lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp
lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h
lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h
lldb/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.cpp
lldb/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.h
lldb/source/Target/ABI.cpp
lldb/tools/lldb-test/CMakeLists.txt
lldb/tools/lldb-test/SystemInitializerTest.cpp