Skip to content

Commit

Permalink
[lldb] Group ABI plugins
Browse files Browse the repository at this point in the history
Summary:
There's a fair amount of code duplication between the different ABI plugins for
the same architecture (e.g. ABIMacOSX_arm & ABISysV_arm). Deduplicating this
code is not very easy at the moment because there is no good place where to put
the common code.

Instead of creating more plugins, this patch reduces their number by grouping
similar plugins into a single folder/plugin. This makes it easy to extract
common code to a (e.g.) base class, which can then live in the same folder.

The grouping is done based on the underlying llvm target for that architecture,
because the plugins already require this for their operation.

Reviewers: JDevlieghere, jasonmolenda, jfb

Subscribers: sdardis, nemanjai, mgorny, kristof.beyls, fedor.sergeev, kbarton, jrtc27, atanasyan, jsji, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D74138
  • Loading branch information
labath committed Feb 7, 2020
1 parent 2e005c6 commit e21b39a
Show file tree
Hide file tree
Showing 48 changed files with 51 additions and 141 deletions.
30 changes: 15 additions & 15 deletions lldb/source/API/SystemInitializerFull.cpp
Expand Up @@ -24,21 +24,21 @@
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Utility/Timer.h"

#include "Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h"
#include "Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h"
#include "Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h"
#include "Plugins/ABI/SysV-arc/ABISysV_arc.h"
#include "Plugins/ABI/SysV-arm/ABISysV_arm.h"
#include "Plugins/ABI/SysV-arm64/ABISysV_arm64.h"
#include "Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h"
#include "Plugins/ABI/SysV-i386/ABISysV_i386.h"
#include "Plugins/ABI/SysV-mips/ABISysV_mips.h"
#include "Plugins/ABI/SysV-mips64/ABISysV_mips64.h"
#include "Plugins/ABI/SysV-ppc/ABISysV_ppc.h"
#include "Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h"
#include "Plugins/ABI/SysV-s390x/ABISysV_s390x.h"
#include "Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h"
#include "Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.h"
#include "Plugins/ABI/AArch64/ABIMacOSX_arm64.h"
#include "Plugins/ABI/AArch64/ABISysV_arm64.h"
#include "Plugins/ABI/ARC/ABISysV_arc.h"
#include "Plugins/ABI/ARM/ABIMacOSX_arm.h"
#include "Plugins/ABI/ARM/ABISysV_arm.h"
#include "Plugins/ABI/Hexagon/ABISysV_hexagon.h"
#include "Plugins/ABI/Mips/ABISysV_mips.h"
#include "Plugins/ABI/Mips/ABISysV_mips64.h"
#include "Plugins/ABI/PowerPC/ABISysV_ppc.h"
#include "Plugins/ABI/PowerPC/ABISysV_ppc64.h"
#include "Plugins/ABI/SystemZ/ABISysV_s390x.h"
#include "Plugins/ABI/X86/ABIMacOSX_i386.h"
#include "Plugins/ABI/X86/ABISysV_i386.h"
#include "Plugins/ABI/X86/ABISysV_x86_64.h"
#include "Plugins/ABI/X86/ABIWindows_x86_64.h"
#include "Plugins/Architecture/Arm/ArchitectureArm.h"
#include "Plugins/Architecture/Mips/ArchitectureMips.h"
#include "Plugins/Architecture/PPC64/ArchitecturePPC64.h"
Expand Down
@@ -1,6 +1,7 @@
add_lldb_library(lldbPluginABIMacOSX_arm64 PLUGIN
add_lldb_library(lldbPluginABIAArch64 PLUGIN
ABIMacOSX_arm64.cpp

ABISysV_arm64.cpp

LINK_LIBS
lldbCore
lldbSymbol
Expand Down
File renamed without changes.
File renamed without changes.
@@ -1,4 +1,4 @@
add_lldb_library(lldbPluginABISysV_arc PLUGIN
add_lldb_library(lldbPluginABIARC PLUGIN
ABISysV_arc.cpp

LINK_LIBS
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,5 +1,6 @@
add_lldb_library(lldbPluginABIMacOSX_arm PLUGIN
add_lldb_library(lldbPluginABIARM PLUGIN
ABIMacOSX_arm.cpp
ABISysV_arm.cpp

LINK_LIBS
lldbCore
Expand Down
36 changes: 5 additions & 31 deletions lldb/source/Plugins/ABI/CMakeLists.txt
@@ -1,31 +1,5 @@
if ("AArch64" IN_LIST LLVM_TARGETS_TO_BUILD)
add_subdirectory(MacOSX-arm64)
add_subdirectory(SysV-arm64)
endif()
if ("ARM" IN_LIST LLVM_TARGETS_TO_BUILD)
add_subdirectory(MacOSX-arm)
add_subdirectory(SysV-arm)
endif()
if ("ARC" IN_LIST LLVM_TARGETS_TO_BUILD)
add_subdirectory(SysV-arc)
endif()
if ("Hexagon" IN_LIST LLVM_TARGETS_TO_BUILD)
add_subdirectory(SysV-hexagon)
endif()
if ("Mips" IN_LIST LLVM_TARGETS_TO_BUILD)
add_subdirectory(SysV-mips)
add_subdirectory(SysV-mips64)
endif()
if ("PowerPC" IN_LIST LLVM_TARGETS_TO_BUILD)
add_subdirectory(SysV-ppc)
add_subdirectory(SysV-ppc64)
endif()
if ("SystemZ" IN_LIST LLVM_TARGETS_TO_BUILD)
add_subdirectory(SysV-s390x)
endif()
if ("X86" IN_LIST LLVM_TARGETS_TO_BUILD)
add_subdirectory(SysV-i386)
add_subdirectory(SysV-x86_64)
add_subdirectory(MacOSX-i386)
add_subdirectory(Windows-x86_64)
endif()
foreach(target AArch64 ARM ARC Hexagon Mips PowerPC SystemZ X86)
if (${target} IN_LIST LLVM_TARGETS_TO_BUILD)
add_subdirectory(${target})
endif()
endforeach()
@@ -1,4 +1,4 @@
add_lldb_library(lldbPluginABISysV_hexagon PLUGIN
add_lldb_library(lldbPluginABIHexagon PLUGIN
ABISysV_hexagon.cpp

LINK_LIBS
Expand Down
10 changes: 0 additions & 10 deletions lldb/source/Plugins/ABI/MacOSX-i386/CMakeLists.txt

This file was deleted.

File renamed without changes.
@@ -1,4 +1,5 @@
add_lldb_library(lldbPluginABISysV_mips64 PLUGIN
add_lldb_library(lldbPluginABIMips PLUGIN
ABISysV_mips.cpp
ABISysV_mips64.cpp

LINK_LIBS
Expand Down
@@ -1,4 +1,5 @@
add_lldb_library(lldbPluginABISysV_ppc64 PLUGIN
add_lldb_library(lldbPluginABIPowerPC PLUGIN
ABISysV_ppc.cpp
ABISysV_ppc64.cpp

LINK_LIBS
Expand Down
11 changes: 0 additions & 11 deletions lldb/source/Plugins/ABI/SysV-arm/CMakeLists.txt

This file was deleted.

10 changes: 0 additions & 10 deletions lldb/source/Plugins/ABI/SysV-arm64/CMakeLists.txt

This file was deleted.

10 changes: 0 additions & 10 deletions lldb/source/Plugins/ABI/SysV-i386/CMakeLists.txt

This file was deleted.

10 changes: 0 additions & 10 deletions lldb/source/Plugins/ABI/SysV-mips/CMakeLists.txt

This file was deleted.

10 changes: 0 additions & 10 deletions lldb/source/Plugins/ABI/SysV-ppc/CMakeLists.txt

This file was deleted.

10 changes: 0 additions & 10 deletions lldb/source/Plugins/ABI/SysV-x86_64/CMakeLists.txt

This file was deleted.

@@ -1,4 +1,4 @@
add_lldb_library(lldbPluginABISysV_s390x PLUGIN
add_lldb_library(lldbPluginABISystemZ PLUGIN
ABISysV_s390x.cpp

LINK_LIBS
Expand Down
File renamed without changes.
@@ -1,4 +1,7 @@
add_lldb_library(lldbPluginABIWindows_x86_64 PLUGIN
add_lldb_library(lldbPluginABIX86 PLUGIN
ABIMacOSX_i386.cpp
ABISysV_i386.cpp
ABISysV_x86_64.cpp
ABIWindows_x86_64.cpp

LINK_LIBS
Expand Down
30 changes: 15 additions & 15 deletions lldb/tools/lldb-test/SystemInitializerTest.cpp
Expand Up @@ -14,21 +14,21 @@
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Utility/Timer.h"

#include "Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h"
#include "Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h"
#include "Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h"
#include "Plugins/ABI/SysV-arc/ABISysV_arc.h"
#include "Plugins/ABI/SysV-arm/ABISysV_arm.h"
#include "Plugins/ABI/SysV-arm64/ABISysV_arm64.h"
#include "Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h"
#include "Plugins/ABI/SysV-i386/ABISysV_i386.h"
#include "Plugins/ABI/SysV-mips/ABISysV_mips.h"
#include "Plugins/ABI/SysV-mips64/ABISysV_mips64.h"
#include "Plugins/ABI/SysV-ppc/ABISysV_ppc.h"
#include "Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h"
#include "Plugins/ABI/SysV-s390x/ABISysV_s390x.h"
#include "Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h"
#include "Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.h"
#include "Plugins/ABI/AArch64/ABIMacOSX_arm64.h"
#include "Plugins/ABI/AArch64/ABISysV_arm64.h"
#include "Plugins/ABI/ARC/ABISysV_arc.h"
#include "Plugins/ABI/ARM/ABIMacOSX_arm.h"
#include "Plugins/ABI/ARM/ABISysV_arm.h"
#include "Plugins/ABI/Hexagon/ABISysV_hexagon.h"
#include "Plugins/ABI/Mips/ABISysV_mips.h"
#include "Plugins/ABI/Mips/ABISysV_mips64.h"
#include "Plugins/ABI/PowerPC/ABISysV_ppc.h"
#include "Plugins/ABI/PowerPC/ABISysV_ppc64.h"
#include "Plugins/ABI/SystemZ/ABISysV_s390x.h"
#include "Plugins/ABI/X86/ABIMacOSX_i386.h"
#include "Plugins/ABI/X86/ABISysV_i386.h"
#include "Plugins/ABI/X86/ABISysV_x86_64.h"
#include "Plugins/ABI/X86/ABIWindows_x86_64.h"
#include "Plugins/Architecture/Arm/ArchitectureArm.h"
#include "Plugins/Architecture/Mips/ArchitectureMips.h"
#include "Plugins/Architecture/PPC64/ArchitecturePPC64.h"
Expand Down

0 comments on commit e21b39a

Please sign in to comment.