llvm-project/llvm/lib/ExecutionEngine/Orc/OrcCBindingsStack.cpp
Lang Hames 130a7c4152 [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.

llvm-svn: 251482
2015-10-28 02:40:04 +00:00

48 lines
1.4 KiB
C++

//===-------- 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>>();
};
}
}