diff options
author | Lang Hames <lhames@gmail.com> | 2015-10-28 02:40:04 +0000 |
---|---|---|
committer | Lang Hames <lhames@gmail.com> | 2015-10-28 02:40:04 +0000 |
commit | f3f591ae0051b1f04ac08006e066822ea89b9765 (patch) | |
tree | 7a32e1e9bbe1dd4ecdf0a904408f80c96120953f /lib/ExecutionEngine/Orc/OrcCBindingsStack.cpp | |
parent | 1d7e0281ab1beead3ac25e9a38cb9749e949d7ec (diff) |
[Orc] Re-add C bindings for the Orc APIs, with a fix to remove the union that
was causing builder failures.
The bindings were originally added in r251472, and reverted in r251473 due to
the builder failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251482 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/Orc/OrcCBindingsStack.cpp')
-rw-r--r-- | lib/ExecutionEngine/Orc/OrcCBindingsStack.cpp | 47 |
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>>(); + }; + } +} |