1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00
llvm-mirror/include/llvm-c/Orc.h
Lang Hames 4ce58a4d70 [Orc] Add basic OrcV2 C bindings and example.
Renames the llvm/examples/LLJITExamples directory to llvm/examples/OrcV2Examples
since it is becoming a home for all OrcV2 examples, not just LLJIT.

See http://llvm.org/PR31103.
2020-03-14 14:41:22 -07:00

96 lines
3.8 KiB
C++

/*===---------------- llvm-c/Orc.h - OrcV2 C bindings -----------*- C++ -*-===*\
|* *|
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|* Exceptions. *|
|* See https://llvm.org/LICENSE.txt for license information. *|
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|* *|
|*===----------------------------------------------------------------------===*|
|* *|
|* This header declares the C interface to libLLVMOrcJIT.a, which implements *|
|* JIT compilation of LLVM IR. *|
|* *|
|* Many exotic languages can interoperate with C code but have a harder time *|
|* with C++ due to name mangling. So in addition to C, this interface enables *|
|* tools written in such languages. *|
|* *|
|* Note: This interface is experimental. It is *NOT* stable, and may be *|
|* changed without warning. Only C API usage documentation is *|
|* provided. See the C++ documentation for all higher level ORC API *|
|* details. *|
|* *|
\*===----------------------------------------------------------------------===*/
#ifndef LLVM_C_ORC_H
#define LLVM_C_ORC_H
#include "llvm-c/Error.h"
#include "llvm-c/Types.h"
LLVM_C_EXTERN_C_BEGIN
typedef struct LLVMOrcOpaqueThreadSafeContext *LLVMOrcThreadSafeContextRef;
typedef struct LLVMOrcOpaqueThreadSafeModule *LLVMOrcThreadSafeModuleRef;
typedef struct LLVMOrcOpaqueLLJIT *LLVMOrcLLJITRef;
typedef uint64_t LLVMOrcJITTargetAddress;
/**
* Create a ThreadSafeContext containing a new LLVMContext.
*/
LLVMOrcThreadSafeContextRef LLVMOrcCreateNewThreadSafeContext(void);
/**
* Get a reference to the wrapped LLVMContext.
*/
LLVMContextRef
LLVMOrcThreadSafeContextGetContext(LLVMOrcThreadSafeContextRef TSCtx);
/**
* Dispose of a ThreadSafeContext.
*/
void LLVMOrcDisposeThreadSafeContext(LLVMOrcThreadSafeContextRef TSCtx);
/**
* Create a ThreadSafeModule wrapper around the given LLVM module. This takes
* ownership of the M argument which should not be disposed of or referenced
* after this function returns.
*/
LLVMOrcThreadSafeModuleRef
LLVMOrcCreateNewThreadSafeModule(LLVMModuleRef M,
LLVMOrcThreadSafeContextRef TSCtx);
/**
* Dispose of a ThreadSafeModule.
*/
void LLVMOrcDisposeThreadSafeModule(LLVMOrcThreadSafeModuleRef TSM);
/**
* Create an LLJIT instance using all default values.
*/
LLVMErrorRef LLVMOrcCreateDefaultLLJIT(LLVMOrcLLJITRef *Result);
/**
* Dispose of an LLJIT instance.
*/
LLVMErrorRef LLVMOrcDisposeLLJIT(LLVMOrcLLJITRef J);
/**
* Add an IR module to the main JITDylib of the given LLJIT instance. This
* operation takes ownership of the TSM argument which should not be disposed
* of or referenced once this function returns.
*/
LLVMErrorRef LLVMOrcLLJITAddLLVMIRModule(LLVMOrcLLJITRef J,
LLVMOrcThreadSafeModuleRef TSM);
/**
* Look up the given symbol in the main JITDylib of the given LLJIT instance.
*
* This operation does not take ownership of the Name argument.
*/
LLVMErrorRef LLVMOrcLLJITLookup(LLVMOrcLLJITRef J,
LLVMOrcJITTargetAddress *Result,
const char *Name);
LLVM_C_EXTERN_C_END
#endif /* LLVM_C_ORC_H */