Skip to content

Commit a34680a

Browse files
committed
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
1 parent cbb3104 commit a34680a

File tree

16 files changed

+45
-19
lines changed

16 files changed

+45
-19
lines changed

llvm/examples/Kaleidoscope/BuildingAJIT/Chapter5/RemoteJITUtils.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#ifndef LLVM_TOOLS_LLI_REMOTEJITUTILS_H
1414
#define LLVM_TOOLS_LLI_REMOTEJITUTILS_H
1515

16-
#include "llvm/ExecutionEngine/Orc/RawByteChannel.h"
16+
#include "llvm/ExecutionEngine/Orc/RPC/RawByteChannel.h"
1717
#include "llvm/Support/Error.h"
1818
#include <cassert>
1919
#include <cerrno>

llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
#define LLVM_EXECUTIONENGINE_ORC_ORCREMOTETARGETRPCAPI_H
1717

1818
#include "llvm/ExecutionEngine/JITSymbol.h"
19-
#include "llvm/ExecutionEngine/Orc/RPCUtils.h"
20-
#include "llvm/ExecutionEngine/Orc/RawByteChannel.h"
19+
#include "llvm/ExecutionEngine/Orc/RPC/RPCUtils.h"
20+
#include "llvm/ExecutionEngine/Orc/RPC/RawByteChannel.h"
2121

2222
namespace llvm {
2323
namespace orc {

llvm/include/llvm/ExecutionEngine/Orc/RPCSerialization.h llvm/include/llvm/ExecutionEngine/Orc/RPC/RPCSerialization.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===- llvm/ExecutionEngine/Orc/RPCSerialization.h --------------*- C++ -*-===//
1+
//===- llvm/ExecutionEngine/Orc/RPC/RPCSerialization.h --------------*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -9,7 +9,7 @@
99
#ifndef LLVM_EXECUTIONENGINE_ORC_RPCSERIALIZATION_H
1010
#define LLVM_EXECUTIONENGINE_ORC_RPCSERIALIZATION_H
1111

12-
#include "OrcError.h"
12+
#include "llvm/ExecutionEngine/Orc/OrcError.h"
1313
#include "llvm/Support/thread.h"
1414
#include <map>
1515
#include <mutex>

llvm/include/llvm/ExecutionEngine/Orc/RPCUtils.h llvm/include/llvm/ExecutionEngine/Orc/RPC/RPCUtils.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
#include "llvm/ADT/STLExtras.h"
2525
#include "llvm/ExecutionEngine/Orc/OrcError.h"
26-
#include "llvm/ExecutionEngine/Orc/RPCSerialization.h"
26+
#include "llvm/ExecutionEngine/Orc/RPC/RPCSerialization.h"
2727
#include "llvm/Support/MSVCErrorWorkarounds.h"
2828

2929
#include <future>

llvm/include/llvm/ExecutionEngine/Orc/RawByteChannel.h llvm/include/llvm/ExecutionEngine/Orc/RPC/RawByteChannel.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===- llvm/ExecutionEngine/Orc/RawByteChannel.h ----------------*- C++ -*-===//
1+
//===- llvm/ExecutionEngine/Orc/RPC/RawByteChannel.h ----------------*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -10,7 +10,7 @@
1010
#define LLVM_EXECUTIONENGINE_ORC_RAWBYTECHANNEL_H
1111

1212
#include "llvm/ADT/StringRef.h"
13-
#include "llvm/ExecutionEngine/Orc/RPCSerialization.h"
13+
#include "llvm/ExecutionEngine/Orc/RPC/RPCSerialization.h"
1414
#include "llvm/Support/Endian.h"
1515
#include "llvm/Support/Error.h"
1616
#include <cstdint>

llvm/lib/ExecutionEngine/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ endif()
2121
add_subdirectory(Interpreter)
2222
add_subdirectory(JITLink)
2323
add_subdirectory(MCJIT)
24+
add_subdirectory(OrcError)
2425
add_subdirectory(Orc)
2526
add_subdirectory(RuntimeDyld)
2627

llvm/lib/ExecutionEngine/LLVMBuild.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
[common]
1818
subdirectories = Interpreter MCJIT JITLink RuntimeDyld IntelJITEvents
19-
OProfileJIT Orc PerfJITEvents
19+
OProfileJIT Orc OrcError PerfJITEvents
2020

2121
[component_0]
2222
type = Library

llvm/lib/ExecutionEngine/Orc/CMakeLists.txt

-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ add_llvm_library(LLVMOrcJIT
1616
ObjectTransformLayer.cpp
1717
OrcABISupport.cpp
1818
OrcCBindings.cpp
19-
OrcError.cpp
2019
OrcMCJITReplacement.cpp
21-
RPCUtils.cpp
2220
RTDyldObjectLinkingLayer.cpp
2321
ThreadSafeModule.cpp
2422
Speculation.cpp

llvm/lib/ExecutionEngine/Orc/LLVMBuild.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@
1818
type = Library
1919
name = OrcJIT
2020
parent = ExecutionEngine
21-
required_libraries = Core ExecutionEngine JITLink Object MC Passes RuntimeDyld
22-
Support Target TransformUtils
21+
required_libraries = Core ExecutionEngine JITLink Object OrcError MC Passes
22+
RuntimeDyld Support Target TransformUtils
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
add_llvm_library(LLVMOrcError
2+
OrcError.cpp
3+
RPCError.cpp
4+
ADDITIONAL_HEADER_DIRS
5+
${LLVM_MAIN_INCLUDE_DIR}/llvm/ExecutionEngine/Orc
6+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
;===- ./lib/ExecutionEngine/OrcError/LLVMBuild.txt -------------*- Conf -*--===;
2+
;
3+
; Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
; See https://llvm.org/LICENSE.txt for license information.
5+
; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
;
7+
;===------------------------------------------------------------------------===;
8+
;
9+
; This is an LLVMBuild description file for the components in this subdirectory.
10+
;
11+
; For more information on the LLVMBuild system, please see:
12+
;
13+
; http://llvm.org/docs/LLVMBuild.html
14+
;
15+
;===------------------------------------------------------------------------===;
16+
17+
[component_0]
18+
type = Library
19+
name = OrcError
20+
parent = ExecutionEngine
21+
required_libraries = Support

llvm/lib/ExecutionEngine/Orc/RPCUtils.cpp llvm/lib/ExecutionEngine/OrcError/RPCError.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
//===--------------- RPCUtils.cpp - RPCUtils implementation ---------------===//
1+
//===--------------- RPCError.cpp - RPCERror implementation ---------------===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
88
//
9-
// RPCUtils implementation.
9+
// RPC Error type implmentations.
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#include "llvm/ExecutionEngine/Orc/RPCUtils.h"
13+
#include "llvm/ExecutionEngine/Orc/RPC/RPCUtils.h"
1414

1515
char llvm::orc::rpc::RPCFatalError::ID = 0;
1616
char llvm::orc::rpc::ConnectionClosed::ID = 0;

llvm/tools/lli/RemoteJITUtils.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#ifndef LLVM_TOOLS_LLI_REMOTEJITUTILS_H
1414
#define LLVM_TOOLS_LLI_REMOTEJITUTILS_H
1515

16-
#include "llvm/ExecutionEngine/Orc/RawByteChannel.h"
16+
#include "llvm/ExecutionEngine/Orc/RPC/RawByteChannel.h"
1717
#include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
1818
#include <mutex>
1919

llvm/unittests/ExecutionEngine/Orc/QueueChannel.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#ifndef LLVM_UNITTESTS_EXECUTIONENGINE_ORC_QUEUECHANNEL_H
1010
#define LLVM_UNITTESTS_EXECUTIONENGINE_ORC_QUEUECHANNEL_H
1111

12-
#include "llvm/ExecutionEngine/Orc/RawByteChannel.h"
12+
#include "llvm/ExecutionEngine/Orc/RPC/RawByteChannel.h"
1313
#include "llvm/Support/Error.h"
1414

1515
#include <atomic>

llvm/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "llvm/ExecutionEngine/Orc/RPCUtils.h"
9+
#include "llvm/ExecutionEngine/Orc/RPC/RPCUtils.h"
1010
#include "QueueChannel.h"
1111
#include "gtest/gtest.h"
1212

0 commit comments

Comments
 (0)