[llvm] a34680a - Break out OrcError and RPC

Chris Bieneman via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 29 17:31:49 PDT 2019


Author: Chris Bieneman
Date: 2019-10-29T17:31:28-07:00
New Revision: a34680a33eb1caa5e224a9432e9f3e643824dc2d

URL: https://github.com/llvm/llvm-project/commit/a34680a33eb1caa5e224a9432e9f3e643824dc2d
DIFF: https://github.com/llvm/llvm-project/commit/a34680a33eb1caa5e224a9432e9f3e643824dc2d.diff

LOG: Break out OrcError and RPC

Summary:
When createing an ORC remote JIT target the current library split forces the target process to link large portions of LLVM (Core, Execution Engine, JITLink, Object, MC, Passes, RuntimeDyld, Support, Target, and TransformUtils). This occurs because the ORC RPC interfaces rely on the static globals the ORC Error types require, which starts a cycle of pulling in more and more.

This patch breaks the ORC RPC Error implementations out into an "OrcError" library which only depends on LLVM Support. It also pulls the ORC RPC headers into their own subdirectory.

With this patch code can include the Orc/RPC/*.h headers and will only incur link dependencies on LLVMOrcError and LLVMSupport.

Reviewers: lhames

Reviewed By: lhames

Subscribers: mgorny, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D68732

Added: 
    llvm/include/llvm/ExecutionEngine/Orc/RPC/RPCSerialization.h
    llvm/include/llvm/ExecutionEngine/Orc/RPC/RPCUtils.h
    llvm/include/llvm/ExecutionEngine/Orc/RPC/RawByteChannel.h
    llvm/lib/ExecutionEngine/OrcError/CMakeLists.txt
    llvm/lib/ExecutionEngine/OrcError/LLVMBuild.txt
    llvm/lib/ExecutionEngine/OrcError/OrcError.cpp
    llvm/lib/ExecutionEngine/OrcError/RPCError.cpp

Modified: 
    llvm/examples/Kaleidoscope/BuildingAJIT/Chapter5/RemoteJITUtils.h
    llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h
    llvm/lib/ExecutionEngine/CMakeLists.txt
    llvm/lib/ExecutionEngine/LLVMBuild.txt
    llvm/lib/ExecutionEngine/Orc/CMakeLists.txt
    llvm/lib/ExecutionEngine/Orc/LLVMBuild.txt
    llvm/tools/lli/RemoteJITUtils.h
    llvm/unittests/ExecutionEngine/Orc/QueueChannel.h
    llvm/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp

Removed: 
    llvm/include/llvm/ExecutionEngine/Orc/RPCSerialization.h
    llvm/include/llvm/ExecutionEngine/Orc/RPCUtils.h
    llvm/include/llvm/ExecutionEngine/Orc/RawByteChannel.h
    llvm/lib/ExecutionEngine/Orc/OrcError.cpp
    llvm/lib/ExecutionEngine/Orc/RPCUtils.cpp


################################################################################
diff  --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter5/RemoteJITUtils.h b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter5/RemoteJITUtils.h
index 14a2815bc021..c7d15bb8dd97 100644
--- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter5/RemoteJITUtils.h
+++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter5/RemoteJITUtils.h
@@ -13,7 +13,7 @@
 #ifndef LLVM_TOOLS_LLI_REMOTEJITUTILS_H
 #define LLVM_TOOLS_LLI_REMOTEJITUTILS_H
 
-#include "llvm/ExecutionEngine/Orc/RawByteChannel.h"
+#include "llvm/ExecutionEngine/Orc/RPC/RawByteChannel.h"
 #include "llvm/Support/Error.h"
 #include <cassert>
 #include <cerrno>

diff  --git a/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h b/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h
index e7b598d8f812..3ff5a5f6e90e 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h
@@ -16,8 +16,8 @@
 #define LLVM_EXECUTIONENGINE_ORC_ORCREMOTETARGETRPCAPI_H
 
 #include "llvm/ExecutionEngine/JITSymbol.h"
-#include "llvm/ExecutionEngine/Orc/RPCUtils.h"
-#include "llvm/ExecutionEngine/Orc/RawByteChannel.h"
+#include "llvm/ExecutionEngine/Orc/RPC/RPCUtils.h"
+#include "llvm/ExecutionEngine/Orc/RPC/RawByteChannel.h"
 
 namespace llvm {
 namespace orc {

diff  --git a/llvm/include/llvm/ExecutionEngine/Orc/RPCSerialization.h b/llvm/include/llvm/ExecutionEngine/Orc/RPC/RPCSerialization.h
similarity index 99%
rename from llvm/include/llvm/ExecutionEngine/Orc/RPCSerialization.h
rename to llvm/include/llvm/ExecutionEngine/Orc/RPC/RPCSerialization.h
index 752a0a34e0a1..9c69a84f4c67 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/RPCSerialization.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/RPC/RPCSerialization.h
@@ -1,4 +1,4 @@
-//===- llvm/ExecutionEngine/Orc/RPCSerialization.h --------------*- C++ -*-===//
+//===- llvm/ExecutionEngine/Orc/RPC/RPCSerialization.h --------------*- C++ -*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -9,7 +9,7 @@
 #ifndef LLVM_EXECUTIONENGINE_ORC_RPCSERIALIZATION_H
 #define LLVM_EXECUTIONENGINE_ORC_RPCSERIALIZATION_H
 
-#include "OrcError.h"
+#include "llvm/ExecutionEngine/Orc/OrcError.h"
 #include "llvm/Support/thread.h"
 #include <map>
 #include <mutex>

diff  --git a/llvm/include/llvm/ExecutionEngine/Orc/RPCUtils.h b/llvm/include/llvm/ExecutionEngine/Orc/RPC/RPCUtils.h
similarity index 99%
rename from llvm/include/llvm/ExecutionEngine/Orc/RPCUtils.h
rename to llvm/include/llvm/ExecutionEngine/Orc/RPC/RPCUtils.h
index ee9c2cc69c30..ed09363dcecc 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/RPCUtils.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/RPC/RPCUtils.h
@@ -23,7 +23,7 @@
 
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ExecutionEngine/Orc/OrcError.h"
-#include "llvm/ExecutionEngine/Orc/RPCSerialization.h"
+#include "llvm/ExecutionEngine/Orc/RPC/RPCSerialization.h"
 #include "llvm/Support/MSVCErrorWorkarounds.h"
 
 #include <future>

diff  --git a/llvm/include/llvm/ExecutionEngine/Orc/RawByteChannel.h b/llvm/include/llvm/ExecutionEngine/Orc/RPC/RawByteChannel.h
similarity index 97%
rename from llvm/include/llvm/ExecutionEngine/Orc/RawByteChannel.h
rename to llvm/include/llvm/ExecutionEngine/Orc/RPC/RawByteChannel.h
index 46b7c59450e6..50e26f8449df 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/RawByteChannel.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/RPC/RawByteChannel.h
@@ -1,4 +1,4 @@
-//===- llvm/ExecutionEngine/Orc/RawByteChannel.h ----------------*- C++ -*-===//
+//===- llvm/ExecutionEngine/Orc/RPC/RawByteChannel.h ----------------*- C++ -*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -10,7 +10,7 @@
 #define LLVM_EXECUTIONENGINE_ORC_RAWBYTECHANNEL_H
 
 #include "llvm/ADT/StringRef.h"
-#include "llvm/ExecutionEngine/Orc/RPCSerialization.h"
+#include "llvm/ExecutionEngine/Orc/RPC/RPCSerialization.h"
 #include "llvm/Support/Endian.h"
 #include "llvm/Support/Error.h"
 #include <cstdint>

diff  --git a/llvm/lib/ExecutionEngine/CMakeLists.txt b/llvm/lib/ExecutionEngine/CMakeLists.txt
index ccee3460339f..c5445fbc16d7 100644
--- a/llvm/lib/ExecutionEngine/CMakeLists.txt
+++ b/llvm/lib/ExecutionEngine/CMakeLists.txt
@@ -21,6 +21,7 @@ endif()
 add_subdirectory(Interpreter)
 add_subdirectory(JITLink)
 add_subdirectory(MCJIT)
+add_subdirectory(OrcError)
 add_subdirectory(Orc)
 add_subdirectory(RuntimeDyld)
 

diff  --git a/llvm/lib/ExecutionEngine/LLVMBuild.txt b/llvm/lib/ExecutionEngine/LLVMBuild.txt
index 13872da4a564..9bc6775f78a0 100644
--- a/llvm/lib/ExecutionEngine/LLVMBuild.txt
+++ b/llvm/lib/ExecutionEngine/LLVMBuild.txt
@@ -16,7 +16,7 @@
 
 [common]
 subdirectories = Interpreter MCJIT JITLink RuntimeDyld IntelJITEvents
-                 OProfileJIT Orc PerfJITEvents
+                 OProfileJIT Orc OrcError PerfJITEvents
 
 [component_0]
 type = Library

diff  --git a/llvm/lib/ExecutionEngine/Orc/CMakeLists.txt b/llvm/lib/ExecutionEngine/Orc/CMakeLists.txt
index 6c0881d4b25a..e615fd8f2347 100644
--- a/llvm/lib/ExecutionEngine/Orc/CMakeLists.txt
+++ b/llvm/lib/ExecutionEngine/Orc/CMakeLists.txt
@@ -16,9 +16,7 @@ add_llvm_library(LLVMOrcJIT
   ObjectTransformLayer.cpp
   OrcABISupport.cpp
   OrcCBindings.cpp
-  OrcError.cpp
   OrcMCJITReplacement.cpp
-  RPCUtils.cpp
   RTDyldObjectLinkingLayer.cpp
   ThreadSafeModule.cpp
   Speculation.cpp

diff  --git a/llvm/lib/ExecutionEngine/Orc/LLVMBuild.txt b/llvm/lib/ExecutionEngine/Orc/LLVMBuild.txt
index 11a7c5bf09bd..4a78243551ca 100644
--- a/llvm/lib/ExecutionEngine/Orc/LLVMBuild.txt
+++ b/llvm/lib/ExecutionEngine/Orc/LLVMBuild.txt
@@ -18,5 +18,5 @@
 type = Library
 name = OrcJIT
 parent = ExecutionEngine
-required_libraries = Core ExecutionEngine JITLink Object MC Passes RuntimeDyld
-                     Support Target TransformUtils
+required_libraries = Core ExecutionEngine JITLink Object OrcError MC Passes
+                     RuntimeDyld Support Target TransformUtils

diff  --git a/llvm/lib/ExecutionEngine/OrcError/CMakeLists.txt b/llvm/lib/ExecutionEngine/OrcError/CMakeLists.txt
new file mode 100644
index 000000000000..7273a33030ef
--- /dev/null
+++ b/llvm/lib/ExecutionEngine/OrcError/CMakeLists.txt
@@ -0,0 +1,6 @@
+add_llvm_library(LLVMOrcError
+  OrcError.cpp
+  RPCError.cpp
+  ADDITIONAL_HEADER_DIRS
+  ${LLVM_MAIN_INCLUDE_DIR}/llvm/ExecutionEngine/Orc
+  )

diff  --git a/llvm/lib/ExecutionEngine/OrcError/LLVMBuild.txt b/llvm/lib/ExecutionEngine/OrcError/LLVMBuild.txt
new file mode 100644
index 000000000000..65e7916916f3
--- /dev/null
+++ b/llvm/lib/ExecutionEngine/OrcError/LLVMBuild.txt
@@ -0,0 +1,21 @@
+;===- ./lib/ExecutionEngine/OrcError/LLVMBuild.txt -------------*- Conf -*--===;
+;
+; Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+; See https://llvm.org/LICENSE.txt for license information.
+; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+;
+;===------------------------------------------------------------------------===;
+;
+; This is an LLVMBuild description file for the components in this subdirectory.
+;
+; For more information on the LLVMBuild system, please see:
+;
+;   http://llvm.org/docs/LLVMBuild.html
+;
+;===------------------------------------------------------------------------===;
+
+[component_0]
+type = Library
+name = OrcError
+parent = ExecutionEngine
+required_libraries = Support

diff  --git a/llvm/lib/ExecutionEngine/Orc/OrcError.cpp b/llvm/lib/ExecutionEngine/OrcError/OrcError.cpp
similarity index 100%
rename from llvm/lib/ExecutionEngine/Orc/OrcError.cpp
rename to llvm/lib/ExecutionEngine/OrcError/OrcError.cpp

diff  --git a/llvm/lib/ExecutionEngine/Orc/RPCUtils.cpp b/llvm/lib/ExecutionEngine/OrcError/RPCError.cpp
similarity index 90%
rename from llvm/lib/ExecutionEngine/Orc/RPCUtils.cpp
rename to llvm/lib/ExecutionEngine/OrcError/RPCError.cpp
index 367b3639f841..b77a526f5718 100644
--- a/llvm/lib/ExecutionEngine/Orc/RPCUtils.cpp
+++ b/llvm/lib/ExecutionEngine/OrcError/RPCError.cpp
@@ -1,4 +1,4 @@
-//===--------------- RPCUtils.cpp - RPCUtils implementation ---------------===//
+//===--------------- RPCError.cpp - RPCERror implementation ---------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -6,11 +6,11 @@
 //
 //===----------------------------------------------------------------------===//
 //
-// RPCUtils implementation.
+// RPC Error type implmentations.
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/ExecutionEngine/Orc/RPCUtils.h"
+#include "llvm/ExecutionEngine/Orc/RPC/RPCUtils.h"
 
 char llvm::orc::rpc::RPCFatalError::ID = 0;
 char llvm::orc::rpc::ConnectionClosed::ID = 0;

diff  --git a/llvm/tools/lli/RemoteJITUtils.h b/llvm/tools/lli/RemoteJITUtils.h
index 8e80e73c8082..cc93294af0cf 100644
--- a/llvm/tools/lli/RemoteJITUtils.h
+++ b/llvm/tools/lli/RemoteJITUtils.h
@@ -13,7 +13,7 @@
 #ifndef LLVM_TOOLS_LLI_REMOTEJITUTILS_H
 #define LLVM_TOOLS_LLI_REMOTEJITUTILS_H
 
-#include "llvm/ExecutionEngine/Orc/RawByteChannel.h"
+#include "llvm/ExecutionEngine/Orc/RPC/RawByteChannel.h"
 #include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
 #include <mutex>
 

diff  --git a/llvm/unittests/ExecutionEngine/Orc/QueueChannel.h b/llvm/unittests/ExecutionEngine/Orc/QueueChannel.h
index caf696987bf7..fabe2d11fe9d 100644
--- a/llvm/unittests/ExecutionEngine/Orc/QueueChannel.h
+++ b/llvm/unittests/ExecutionEngine/Orc/QueueChannel.h
@@ -9,7 +9,7 @@
 #ifndef LLVM_UNITTESTS_EXECUTIONENGINE_ORC_QUEUECHANNEL_H
 #define LLVM_UNITTESTS_EXECUTIONENGINE_ORC_QUEUECHANNEL_H
 
-#include "llvm/ExecutionEngine/Orc/RawByteChannel.h"
+#include "llvm/ExecutionEngine/Orc/RPC/RawByteChannel.h"
 #include "llvm/Support/Error.h"
 
 #include <atomic>

diff  --git a/llvm/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp b/llvm/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp
index 2a0ed0772524..734511bf33ad 100644
--- a/llvm/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/ExecutionEngine/Orc/RPCUtils.h"
+#include "llvm/ExecutionEngine/Orc/RPC/RPCUtils.h"
 #include "QueueChannel.h"
 #include "gtest/gtest.h"
 


        


More information about the llvm-commits mailing list