Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions llvm/include/llvm-c/OrcEE.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ typedef void (*LLVMMemoryManagerNotifyTerminatingCallback)(void *CtxCtx);
* @{
*/

/**
* Create a ObjectLinkingLayer instance using the standard JITLink
* InProcessMemoryManager for memory management.
*/
LLVM_C_ABI LLVMErrorRef
LLVMOrcCreateObjectLinkingLayerWithInProcessMemoryManager(
LLVMOrcObjectLayerRef *Result, LLVMOrcExecutionSessionRef ES);

/**
* Create a RTDyldObjectLinkingLayer instance using the standard
* SectionMemoryManager for memory management.
Expand Down
14 changes: 14 additions & 0 deletions llvm/lib/ExecutionEngine/Orc/OrcV2CBindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
#include "llvm-c/OrcEE.h"
#include "llvm-c/TargetMachine.h"

#include "llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h"
#include "llvm/ExecutionEngine/Orc/AbsoluteSymbols.h"
#include "llvm/ExecutionEngine/Orc/JITTargetMachineBuilder.h"
#include "llvm/ExecutionEngine/Orc/LLJIT.h"
#include "llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h"
#include "llvm/ExecutionEngine/Orc/ObjectTransformLayer.h"
#include "llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h"
#include "llvm/ExecutionEngine/SectionMemoryManager.h"
Expand Down Expand Up @@ -1017,6 +1019,18 @@ LLVMOrcLLJITGetObjTransformLayer(LLVMOrcLLJITRef J) {
return wrap(&unwrap(J)->getObjTransformLayer());
}

LLVMErrorRef LLVMOrcCreateObjectLinkingLayerWithInProcessMemoryManager(
LLVMOrcObjectLayerRef *Result, LLVMOrcExecutionSessionRef ES) {
assert(Result && "Result must not be null");
assert(ES && "ES must not be null");
auto MM = jitlink::InProcessMemoryManager::Create();
if (!MM) {
return wrap(MM.takeError());
}
*Result = wrap(new ObjectLinkingLayer(*unwrap(ES), std::move(*MM)));
return LLVMErrorSuccess;
}

LLVMOrcObjectLayerRef
LLVMOrcCreateRTDyldObjectLinkingLayerWithSectionMemoryManager(
LLVMOrcExecutionSessionRef ES) {
Expand Down