summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2019-12-15 19:51:35 -0800
committerLang Hames <lhames@gmail.com>2019-12-15 21:57:10 -0800
commit67a1b7f05379f2686f858fc103debcac0aed3973 (patch)
tree13671ed78a48298c003cfbb551f35a5d0c78bdd0 /llvm
parent073df421e0d7caf3ba3b2fd163cbb29251162f57 (diff)
downloadbcm5719-llvm-67a1b7f05379f2686f858fc103debcac0aed3973.tar.gz
bcm5719-llvm-67a1b7f05379f2686f858fc103debcac0aed3973.zip
[Orc][LLJIT] Automatically use JITLink for LLJIT on supported platforms.
JITLink (which underlies ObjectLinkingLayer) is a replacement for RuntimeDyld. It supports the native code model, and linker plugins that enable a wider range of features than RuntimeDyld. Currently only enabled for MachO/x86-64 and MachO/arm64. New architectures will be added as JITLink support for them is developed.
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/ExecutionEngine/Orc/LLJIT.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
index 89dad6d61b4..5c393739f40 100644
--- a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
@@ -7,6 +7,8 @@
//===----------------------------------------------------------------------===//
#include "llvm/ExecutionEngine/Orc/LLJIT.h"
+#include "llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h"
+#include "llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h"
#include "llvm/ExecutionEngine/Orc/OrcError.h"
#include "llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h"
#include "llvm/ExecutionEngine/SectionMemoryManager.h"
@@ -22,6 +24,22 @@ Error LLJITBuilderState::prepareForConstruction() {
JTMB = std::move(*JTMBOrErr);
else
return JTMBOrErr.takeError();
+
+ // If no ObjectLinkingLayer creator was set and the target supports JITLink
+ // then configure for JITLink.
+ auto &TT = JTMB->getTargetTriple();
+ if (!CreateObjectLinkingLayer && TT.isOSBinFormatMachO() &&
+ (TT.getArch() == Triple::aarch64 || TT.getArch() == Triple::x86_64)) {
+
+ JTMB->setRelocationModel(Reloc::PIC_);
+ JTMB->setCodeModel(CodeModel::Small);
+ CreateObjectLinkingLayer =
+ [](ExecutionSession &ES,
+ const Triple &) -> std::unique_ptr<ObjectLayer> {
+ return std::make_unique<ObjectLinkingLayer>(
+ ES, std::make_unique<jitlink::InProcessMemoryManager>());
+ };
+ }
}
return Error::success();
OpenPOWER on IntegriCloud