summaryrefslogtreecommitdiff
path: root/lib/ExecutionEngine/Orc/OrcCBindingsStack.cpp
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2015-10-28 00:28:26 +0000
committerLang Hames <lhames@gmail.com>2015-10-28 00:28:26 +0000
commit5fc6406e3924021b53e0b5f246a5cb604c1c3624 (patch)
treef385f29316a704f8a73d63d873407f6ce209418d /lib/ExecutionEngine/Orc/OrcCBindingsStack.cpp
parent727f95c8fc22e8356fcfa1582c30bc4679f9a33d (diff)
[Orc] Add experimental C bindings for Orc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251472 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/Orc/OrcCBindingsStack.cpp')
-rw-r--r--lib/ExecutionEngine/Orc/OrcCBindingsStack.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/lib/ExecutionEngine/Orc/OrcCBindingsStack.cpp b/lib/ExecutionEngine/Orc/OrcCBindingsStack.cpp
new file mode 100644
index 00000000000..93c698da104
--- /dev/null
+++ b/lib/ExecutionEngine/Orc/OrcCBindingsStack.cpp
@@ -0,0 +1,47 @@
+//===-------- OrcCBindingsStack.cpp - Orc JIT stack for C bindings --------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "OrcCBindingsStack.h"
+
+#include "llvm/ExecutionEngine/Orc/OrcTargetSupport.h"
+#include "llvm/Support/Debug.h"
+#include "llvm/Support/DynamicLibrary.h"
+#include <cstdio>
+#include <system_error>
+
+using namespace llvm;
+
+OrcCBindingsStack::CallbackManagerBuilder
+OrcCBindingsStack::createCallbackManagerBuilder(Triple T) {
+ switch (T.getArch()) {
+ default: return nullptr;
+
+ case Triple::x86_64: {
+ typedef orc::JITCompileCallbackManager<CompileLayerT,
+ orc::OrcX86_64> CCMgrT;
+ return [](CompileLayerT &CompileLayer, RuntimeDyld::MemoryManager &MemMgr,
+ LLVMContext &Context) {
+ return llvm::make_unique<CCMgrT>(CompileLayer, MemMgr, Context, 0,
+ 64);
+ };
+ }
+ }
+}
+
+OrcCBindingsStack::IndirectStubsManagerBuilder
+OrcCBindingsStack::createIndirectStubsMgrBuilder(Triple T) {
+ switch (T.getArch()) {
+ default: return nullptr;
+
+ case Triple::x86_64:
+ return [](){
+ return llvm::make_unique<orc::IndirectStubsManager<orc::OrcX86_64>>();
+ };
+ }
+}