summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/Orc
diff options
context:
space:
mode:
authorChris Bieneman <chris.bieneman@me.com>2019-10-09 14:27:52 -0700
committerChris Bieneman <chris.bieneman@me.com>2019-10-29 17:31:28 -0700
commita34680a33eb1caa5e224a9432e9f3e643824dc2d (patch)
tree11483618a9a67f1403e0fd8b22a1a9d12c9779b4 /llvm/lib/ExecutionEngine/Orc
parentcbb3104b1c8ea93b6749043184a8d8952b8b2747 (diff)
downloadbcm5719-llvm-a34680a33eb1caa5e224a9432e9f3e643824dc2d.tar.gz
bcm5719-llvm-a34680a33eb1caa5e224a9432e9f3e643824dc2d.zip
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
Diffstat (limited to 'llvm/lib/ExecutionEngine/Orc')
-rw-r--r--llvm/lib/ExecutionEngine/Orc/CMakeLists.txt2
-rw-r--r--llvm/lib/ExecutionEngine/Orc/LLVMBuild.txt4
-rw-r--r--llvm/lib/ExecutionEngine/Orc/OrcError.cpp115
-rw-r--r--llvm/lib/ExecutionEngine/Orc/RPCUtils.cpp54
4 files changed, 2 insertions, 173 deletions
diff --git a/llvm/lib/ExecutionEngine/Orc/CMakeLists.txt b/llvm/lib/ExecutionEngine/Orc/CMakeLists.txt
index 6c0881d4b25..e615fd8f234 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 11a7c5bf09b..4a78243551c 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/Orc/OrcError.cpp b/llvm/lib/ExecutionEngine/Orc/OrcError.cpp
deleted file mode 100644
index e6e9a095319..00000000000
--- a/llvm/lib/ExecutionEngine/Orc/OrcError.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-//===---------------- OrcError.cpp - Error codes for ORC ------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-//
-// Error codes for ORC.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/ExecutionEngine/Orc/OrcError.h"
-#include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/ManagedStatic.h"
-
-using namespace llvm;
-using namespace llvm::orc;
-
-namespace {
-
-// FIXME: This class is only here to support the transition to llvm::Error. It
-// will be removed once this transition is complete. Clients should prefer to
-// deal with the Error value directly, rather than converting to error_code.
-class OrcErrorCategory : public std::error_category {
-public:
- const char *name() const noexcept override { return "orc"; }
-
- std::string message(int condition) const override {
- switch (static_cast<OrcErrorCode>(condition)) {
- case OrcErrorCode::UnknownORCError:
- return "Unknown ORC error";
- case OrcErrorCode::DuplicateDefinition:
- return "Duplicate symbol definition";
- case OrcErrorCode::JITSymbolNotFound:
- return "JIT symbol not found";
- case OrcErrorCode::RemoteAllocatorDoesNotExist:
- return "Remote allocator does not exist";
- case OrcErrorCode::RemoteAllocatorIdAlreadyInUse:
- return "Remote allocator Id already in use";
- case OrcErrorCode::RemoteMProtectAddrUnrecognized:
- return "Remote mprotect call references unallocated memory";
- case OrcErrorCode::RemoteIndirectStubsOwnerDoesNotExist:
- return "Remote indirect stubs owner does not exist";
- case OrcErrorCode::RemoteIndirectStubsOwnerIdAlreadyInUse:
- return "Remote indirect stubs owner Id already in use";
- case OrcErrorCode::RPCConnectionClosed:
- return "RPC connection closed";
- case OrcErrorCode::RPCCouldNotNegotiateFunction:
- return "Could not negotiate RPC function";
- case OrcErrorCode::RPCResponseAbandoned:
- return "RPC response abandoned";
- case OrcErrorCode::UnexpectedRPCCall:
- return "Unexpected RPC call";
- case OrcErrorCode::UnexpectedRPCResponse:
- return "Unexpected RPC response";
- case OrcErrorCode::UnknownErrorCodeFromRemote:
- return "Unknown error returned from remote RPC function "
- "(Use StringError to get error message)";
- case OrcErrorCode::UnknownResourceHandle:
- return "Unknown resource handle";
- }
- llvm_unreachable("Unhandled error code");
- }
-};
-
-static ManagedStatic<OrcErrorCategory> OrcErrCat;
-}
-
-namespace llvm {
-namespace orc {
-
-char DuplicateDefinition::ID = 0;
-char JITSymbolNotFound::ID = 0;
-
-std::error_code orcError(OrcErrorCode ErrCode) {
- typedef std::underlying_type<OrcErrorCode>::type UT;
- return std::error_code(static_cast<UT>(ErrCode), *OrcErrCat);
-}
-
-
-DuplicateDefinition::DuplicateDefinition(std::string SymbolName)
- : SymbolName(std::move(SymbolName)) {}
-
-std::error_code DuplicateDefinition::convertToErrorCode() const {
- return orcError(OrcErrorCode::DuplicateDefinition);
-}
-
-void DuplicateDefinition::log(raw_ostream &OS) const {
- OS << "Duplicate definition of symbol '" << SymbolName << "'";
-}
-
-const std::string &DuplicateDefinition::getSymbolName() const {
- return SymbolName;
-}
-
-JITSymbolNotFound::JITSymbolNotFound(std::string SymbolName)
- : SymbolName(std::move(SymbolName)) {}
-
-std::error_code JITSymbolNotFound::convertToErrorCode() const {
- typedef std::underlying_type<OrcErrorCode>::type UT;
- return std::error_code(static_cast<UT>(OrcErrorCode::JITSymbolNotFound),
- *OrcErrCat);
-}
-
-void JITSymbolNotFound::log(raw_ostream &OS) const {
- OS << "Could not find symbol '" << SymbolName << "'";
-}
-
-const std::string &JITSymbolNotFound::getSymbolName() const {
- return SymbolName;
-}
-
-}
-}
diff --git a/llvm/lib/ExecutionEngine/Orc/RPCUtils.cpp b/llvm/lib/ExecutionEngine/Orc/RPCUtils.cpp
deleted file mode 100644
index 367b3639f84..00000000000
--- a/llvm/lib/ExecutionEngine/Orc/RPCUtils.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-//===--------------- RPCUtils.cpp - RPCUtils implementation ---------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-//
-// RPCUtils implementation.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/ExecutionEngine/Orc/RPCUtils.h"
-
-char llvm::orc::rpc::RPCFatalError::ID = 0;
-char llvm::orc::rpc::ConnectionClosed::ID = 0;
-char llvm::orc::rpc::ResponseAbandoned::ID = 0;
-char llvm::orc::rpc::CouldNotNegotiate::ID = 0;
-
-namespace llvm {
-namespace orc {
-namespace rpc {
-
-std::error_code ConnectionClosed::convertToErrorCode() const {
- return orcError(OrcErrorCode::RPCConnectionClosed);
-}
-
-void ConnectionClosed::log(raw_ostream &OS) const {
- OS << "RPC connection already closed";
-}
-
-std::error_code ResponseAbandoned::convertToErrorCode() const {
- return orcError(OrcErrorCode::RPCResponseAbandoned);
-}
-
-void ResponseAbandoned::log(raw_ostream &OS) const {
- OS << "RPC response abandoned";
-}
-
-CouldNotNegotiate::CouldNotNegotiate(std::string Signature)
- : Signature(std::move(Signature)) {}
-
-std::error_code CouldNotNegotiate::convertToErrorCode() const {
- return orcError(OrcErrorCode::RPCCouldNotNegotiateFunction);
-}
-
-void CouldNotNegotiate::log(raw_ostream &OS) const {
- OS << "Could not negotiate RPC function " << Signature;
-}
-
-
-} // end namespace rpc
-} // end namespace orc
-} // end namespace llvm
OpenPOWER on IntegriCloud