[ORC][C-API] Expose LLVMOrc{Unr,R}egisterJITEventListener().

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D44890

llvm-svn: 333229
This commit is contained in:
Andres Freund 2018-05-24 21:32:52 +00:00
parent 6801feee07
commit 7aa54e956e
4 changed files with 34 additions and 0 deletions

View File

@ -154,6 +154,20 @@ LLVMOrcErrorCode LLVMOrcGetSymbolAddressIn(LLVMOrcJITStackRef JITStack,
*/
LLVMOrcErrorCode LLVMOrcDisposeInstance(LLVMOrcJITStackRef JITStack);
/**
* Register a JIT Event Listener.
*
* A NULL listener is ignored.
*/
void LLVMOrcRegisterJITEventListener(LLVMOrcJITStackRef JITStack, LLVMJITEventListenerRef L);
/**
* Unegister a JIT Event Listener.
*
* A NULL listener is ignored.
*/
void LLVMOrcUnregisterJITEventListener(LLVMOrcJITStackRef JITStack, LLVMJITEventListenerRef L);
#ifdef __cplusplus
}
#endif /* extern "C" */

View File

@ -144,6 +144,11 @@ typedef struct LLVMComdat *LLVMComdatRef;
*/
typedef struct LLVMOpaqueModuleFlagEntry LLVMModuleFlagEntry;
/**
* @see llvm::JITEventListener
*/
typedef struct LLVMOpaqueJITEventListener *LLVMJITEventListenerRef;
/**
* @}
*/

View File

@ -15,9 +15,11 @@
#ifndef LLVM_EXECUTIONENGINE_JITEVENTLISTENER_H
#define LLVM_EXECUTIONENGINE_JITEVENTLISTENER_H
#include "llvm-c/ExecutionEngine.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/ExecutionEngine/RuntimeDyld.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/Support/CBindingWrapping.h"
#include <cstdint>
#include <vector>
@ -119,6 +121,8 @@ private:
virtual void anchor();
};
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(JITEventListener, LLVMJITEventListenerRef)
} // end namespace llvm
#endif // LLVM_EXECUTIONENGINE_JITEVENTLISTENER_H

View File

@ -9,6 +9,7 @@
#include "OrcCBindingsStack.h"
#include "llvm-c/OrcBindings.h"
#include "llvm/ExecutionEngine/JITEventListener.h"
using namespace llvm;
@ -126,3 +127,13 @@ LLVMOrcErrorCode LLVMOrcDisposeInstance(LLVMOrcJITStackRef JITStack) {
delete J;
return Err;
}
void LLVMOrcRegisterJITEventListener(LLVMOrcJITStackRef JITStack, LLVMJITEventListenerRef L)
{
unwrap(JITStack)->RegisterJITEventListener(unwrap(L));
}
void LLVMOrcUnregisterJITEventListener(LLVMOrcJITStackRef JITStack, LLVMJITEventListenerRef L)
{
unwrap(JITStack)->UnregisterJITEventListener(unwrap(L));
}