[Lldb-commits] [lldb] r360067 - Initialization: move InstructionEmulation to full initialization

Saleem Abdulrasool via lldb-commits lldb-commits at lists.llvm.org
Mon May 6 12:38:24 PDT 2019


Author: compnerd
Date: Mon May  6 12:38:24 2019
New Revision: 360067

URL: http://llvm.org/viewvc/llvm-project?rev=360067&view=rev
Log:
Initialization: move InstructionEmulation to full initialization

The debug server does not need to use the instruction emulation. This
helps reduce the size of the final lldb-server binary by another ~100K
(~1% savings).

Modified:
    lldb/trunk/source/API/SystemInitializerFull.cpp
    lldb/trunk/source/Initialization/CMakeLists.txt
    lldb/trunk/source/Initialization/SystemInitializerCommon.cpp
    lldb/trunk/tools/lldb-server/CMakeLists.txt
    lldb/trunk/tools/lldb-server/SystemInitializerLLGS.cpp

Modified: lldb/trunk/source/API/SystemInitializerFull.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SystemInitializerFull.cpp?rev=360067&r1=360066&r2=360067&view=diff
==============================================================================
--- lldb/trunk/source/API/SystemInitializerFull.cpp (original)
+++ lldb/trunk/source/API/SystemInitializerFull.cpp Mon May  6 12:38:24 2019
@@ -43,7 +43,10 @@
 #include "Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h"
 #include "Plugins/DynamicLoader/Static/DynamicLoaderStatic.h"
 #include "Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h"
+#include "Plugins/Instruction/ARM/EmulateInstructionARM.h"
 #include "Plugins/Instruction/ARM64/EmulateInstructionARM64.h"
+#include "Plugins/Instruction/MIPS/EmulateInstructionMIPS.h"
+#include "Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h"
 #include "Plugins/Instruction/PPC64/EmulateInstructionPPC64.h"
 #include "Plugins/InstrumentationRuntime/ASan/ASanRuntime.h"
 #include "Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h"
@@ -207,8 +210,13 @@ llvm::Error SystemInitializerFull::Initi
   SymbolFileSymtab::Initialize();
   UnwindAssemblyInstEmulation::Initialize();
   UnwindAssembly_x86::Initialize();
+
+  EmulateInstructionARM::Initialize();
   EmulateInstructionARM64::Initialize();
+  EmulateInstructionMIPS::Initialize();
+  EmulateInstructionMIPS64::Initialize();
   EmulateInstructionPPC64::Initialize();
+
   SymbolFileDWARFDebugMap::Initialize();
   ItaniumABILanguageRuntime::Initialize();
   AppleObjCRuntimeV2::Initialize();
@@ -309,8 +317,13 @@ void SystemInitializerFull::Terminate()
   SymbolFileSymtab::Terminate();
   UnwindAssembly_x86::Terminate();
   UnwindAssemblyInstEmulation::Terminate();
+
+  EmulateInstructionARM::Terminate();
   EmulateInstructionARM64::Terminate();
+  EmulateInstructionMIPS::Terminate();
+  EmulateInstructionMIPS64::Terminate();
   EmulateInstructionPPC64::Terminate();
+
   SymbolFileDWARFDebugMap::Terminate();
   ItaniumABILanguageRuntime::Terminate();
   AppleObjCRuntimeV2::Terminate();

Modified: lldb/trunk/source/Initialization/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Initialization/CMakeLists.txt?rev=360067&r1=360066&r2=360067&view=diff
==============================================================================
--- lldb/trunk/source/Initialization/CMakeLists.txt (original)
+++ lldb/trunk/source/Initialization/CMakeLists.txt Mon May  6 12:38:24 2019
@@ -14,9 +14,6 @@ add_lldb_library(lldbInitialization
   LINK_LIBS
     lldbCore
     lldbHost
-    lldbPluginInstructionARM
-    lldbPluginInstructionMIPS
-    lldbPluginInstructionMIPS64
     lldbPluginProcessGDBRemote
     ${EXTRA_PLUGINS}
     ${LLDB_SYSTEM_LIBS}

Modified: lldb/trunk/source/Initialization/SystemInitializerCommon.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Initialization/SystemInitializerCommon.cpp?rev=360067&r1=360066&r2=360067&view=diff
==============================================================================
--- lldb/trunk/source/Initialization/SystemInitializerCommon.cpp (original)
+++ lldb/trunk/source/Initialization/SystemInitializerCommon.cpp Mon May  6 12:38:24 2019
@@ -8,9 +8,6 @@
 
 #include "lldb/Initialization/SystemInitializerCommon.h"
 
-#include "Plugins/Instruction/ARM/EmulateInstructionARM.h"
-#include "Plugins/Instruction/MIPS/EmulateInstructionMIPS.h"
-#include "Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h"
 #include "Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h"
 #include "lldb/Host/FileSystem.h"
 #include "lldb/Host/Host.h"
@@ -99,10 +96,6 @@ llvm::Error SystemInitializerCommon::Ini
 
   process_gdb_remote::ProcessGDBRemoteLog::Initialize();
 
-  EmulateInstructionARM::Initialize();
-  EmulateInstructionMIPS::Initialize();
-  EmulateInstructionMIPS64::Initialize();
-
 #if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
   ProcessPOSIXLog::Initialize();
 #endif
@@ -117,10 +110,6 @@ void SystemInitializerCommon::Terminate(
   static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
   Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
 
-  EmulateInstructionARM::Terminate();
-  EmulateInstructionMIPS::Terminate();
-  EmulateInstructionMIPS64::Terminate();
-
 #if defined(_WIN32)
   ProcessWindowsLog::Terminate();
 #endif

Modified: lldb/trunk/tools/lldb-server/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/CMakeLists.txt?rev=360067&r1=360066&r2=360067&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-server/CMakeLists.txt (original)
+++ lldb/trunk/tools/lldb-server/CMakeLists.txt Mon May  6 12:38:24 2019
@@ -67,6 +67,9 @@ add_lldb_tool(lldb-server
       lldbHost
       lldbInitialization
       ${LLDB_PLUGINS}
+      lldbPluginInstructionARM
+      lldbPluginInstructionMIPS
+      lldbPluginInstructionMIPS64
       ${LLDB_SYSTEM_LIBS}
 
     LINK_COMPONENTS

Modified: lldb/trunk/tools/lldb-server/SystemInitializerLLGS.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/SystemInitializerLLGS.cpp?rev=360067&r1=360066&r2=360067&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-server/SystemInitializerLLGS.cpp (original)
+++ lldb/trunk/tools/lldb-server/SystemInitializerLLGS.cpp Mon May  6 12:38:24 2019
@@ -19,6 +19,23 @@ using HostObjectFile = ObjectFilePECOFF;
 using HostObjectFile = ObjectFileELF;
 #endif
 
+#if defined(__arm__) || defined(__arm) || defined(_ARM) || defined(_M_ARM)
+#define LLDB_TARGET_ARM
+#include "Plugins/Instruction/ARM/EmulateInstructionARM.h"
+#endif
+
+#if defined(__mips__) || defined(mips) || defined(__mips) ||                   \
+    defined(__MIPS__) || defined(_M_MIPS)
+#define LLDB_TARGET_MIPS
+#include "Plugins/Instruction/MIPS/EmulateInstructionMIPS.h"
+#endif
+
+#if defined(__mips64__) || defined(mips64) || defined(__mips64) ||             \
+    defined(__MIPS64__) || defined(_M_MIPS64)
+#define LLDB_TARGET_MIPS64
+#include "Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h"
+#endif
+
 using namespace lldb_private;
 
 llvm::Error SystemInitializerLLGS::Initialize() {
@@ -27,10 +44,31 @@ llvm::Error SystemInitializerLLGS::Initi
 
   HostObjectFile::Initialize();
 
+#if defined(LLDB_TARGET_ARM)
+  EmulateInstructionARM::Initialize();
+#endif
+#if defined(LLDB_TARGET_MIPS)
+  EmulateInstructionMIPS::Initialize();
+#endif
+#if defined(LLDB_TARGET_MIPS64)
+  EmulateInstructionMIPS64::Initialize();
+#endif
+
   return llvm::Error::success();
 }
 
 void SystemInitializerLLGS::Terminate() {
   HostObjectFile::Terminate();
+
+#if defined(LLDB_TARGET_ARM)
+  EmulateInstructionARM::Terminate();
+#endif
+#if defined(LLDB_TARGET_MIPS)
+  EmulateInstructionMIPS::Terminate();
+#endif
+#if defined(LLDB_TARGET_MIPS64)
+  EmulateInstructionMIPS64::Terminate();
+#endif
+
   SystemInitializerCommon::Terminate();
 }




More information about the lldb-commits mailing list