#include "llvm-c/LLJIT.h"
#include "llvm-c/Orc.h"
#include "llvm-c/OrcEE.h"
#include "llvm-c/TargetMachine.h"
#include "llvm/ExecutionEngine/Orc/JITTargetMachineBuilder.h"
#include "llvm/ExecutionEngine/Orc/LLJIT.h"
#include "llvm/ExecutionEngine/Orc/ObjectTransformLayer.h"
#include "llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h"
#include "llvm/ExecutionEngine/SectionMemoryManager.h"
usingnamespacellvm;
usingnamespacellvm::orc;
namespace llvm {
namespace orc {
class InProgressLookupState;
class OrcV2CAPIHelper { … };
}
}
inline LLVMOrcSymbolStringPoolEntryRef wrap(SymbolStringPoolEntryUnsafe E) { … }
inline SymbolStringPoolEntryUnsafe unwrap(LLVMOrcSymbolStringPoolEntryRef E) { … }
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(…)
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(…)
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(…)
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(…)
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(…)
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(…)
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(…)
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(…)
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(…)
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(…)
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(…)
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(…)
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(…)
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(…)
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(…)
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(…)
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(…)
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(…)
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(…)
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(…)
namespace {
class OrcCAPIMaterializationUnit : public llvm::orc::MaterializationUnit { … };
static JITSymbolFlags toJITSymbolFlags(LLVMJITSymbolFlags F) { … }
static LLVMJITSymbolFlags fromJITSymbolFlags(JITSymbolFlags JSF) { … }
static SymbolNameSet toSymbolNameSet(LLVMOrcCSymbolsList Symbols) { … }
static SymbolMap toSymbolMap(LLVMOrcCSymbolMapPairs Syms, size_t NumPairs) { … }
static SymbolDependenceMap
toSymbolDependenceMap(LLVMOrcCDependenceMapPairs Pairs, size_t NumPairs) { … }
static LookupKind toLookupKind(LLVMOrcLookupKind K) { … }
static LLVMOrcLookupKind fromLookupKind(LookupKind K) { … }
static JITDylibLookupFlags
toJITDylibLookupFlags(LLVMOrcJITDylibLookupFlags LF) { … }
static LLVMOrcJITDylibLookupFlags
fromJITDylibLookupFlags(JITDylibLookupFlags LF) { … }
static SymbolLookupFlags toSymbolLookupFlags(LLVMOrcSymbolLookupFlags SLF) { … }
static LLVMOrcSymbolLookupFlags fromSymbolLookupFlags(SymbolLookupFlags SLF) { … }
static LLVMJITEvaluatedSymbol
fromExecutorSymbolDef(const ExecutorSymbolDef &S) { … }
}
namespace llvm {
namespace orc {
class CAPIDefinitionGenerator final : public DefinitionGenerator { … };
}
}
void LLVMOrcExecutionSessionSetErrorReporter(
LLVMOrcExecutionSessionRef ES, LLVMOrcErrorReporterFunction ReportError,
void *Ctx) { … }
LLVMOrcSymbolStringPoolRef
LLVMOrcExecutionSessionGetSymbolStringPool(LLVMOrcExecutionSessionRef ES) { … }
void LLVMOrcSymbolStringPoolClearDeadEntries(LLVMOrcSymbolStringPoolRef SSP) { … }
LLVMOrcSymbolStringPoolEntryRef
LLVMOrcExecutionSessionIntern(LLVMOrcExecutionSessionRef ES, const char *Name) { … }
void LLVMOrcExecutionSessionLookup(
LLVMOrcExecutionSessionRef ES, LLVMOrcLookupKind K,
LLVMOrcCJITDylibSearchOrder SearchOrder, size_t SearchOrderSize,
LLVMOrcCLookupSet Symbols, size_t SymbolsSize,
LLVMOrcExecutionSessionLookupHandleResultFunction HandleResult, void *Ctx) { … }
void LLVMOrcRetainSymbolStringPoolEntry(LLVMOrcSymbolStringPoolEntryRef S) { … }
void LLVMOrcReleaseSymbolStringPoolEntry(LLVMOrcSymbolStringPoolEntryRef S) { … }
const char *LLVMOrcSymbolStringPoolEntryStr(LLVMOrcSymbolStringPoolEntryRef S) { … }
LLVMOrcResourceTrackerRef
LLVMOrcJITDylibCreateResourceTracker(LLVMOrcJITDylibRef JD) { … }
LLVMOrcResourceTrackerRef
LLVMOrcJITDylibGetDefaultResourceTracker(LLVMOrcJITDylibRef JD) { … }
void LLVMOrcReleaseResourceTracker(LLVMOrcResourceTrackerRef RT) { … }
void LLVMOrcResourceTrackerTransferTo(LLVMOrcResourceTrackerRef SrcRT,
LLVMOrcResourceTrackerRef DstRT) { … }
LLVMErrorRef LLVMOrcResourceTrackerRemove(LLVMOrcResourceTrackerRef RT) { … }
void LLVMOrcDisposeDefinitionGenerator(LLVMOrcDefinitionGeneratorRef DG) { … }
void LLVMOrcDisposeMaterializationUnit(LLVMOrcMaterializationUnitRef MU) { … }
LLVMOrcMaterializationUnitRef LLVMOrcCreateCustomMaterializationUnit(
const char *Name, void *Ctx, LLVMOrcCSymbolFlagsMapPairs Syms,
size_t NumSyms, LLVMOrcSymbolStringPoolEntryRef InitSym,
LLVMOrcMaterializationUnitMaterializeFunction Materialize,
LLVMOrcMaterializationUnitDiscardFunction Discard,
LLVMOrcMaterializationUnitDestroyFunction Destroy) { … }
LLVMOrcMaterializationUnitRef
LLVMOrcAbsoluteSymbols(LLVMOrcCSymbolMapPairs Syms, size_t NumPairs) { … }
LLVMOrcMaterializationUnitRef LLVMOrcLazyReexports(
LLVMOrcLazyCallThroughManagerRef LCTM, LLVMOrcIndirectStubsManagerRef ISM,
LLVMOrcJITDylibRef SourceJD, LLVMOrcCSymbolAliasMapPairs CallableAliases,
size_t NumPairs) { … }
void LLVMOrcDisposeMaterializationResponsibility(
LLVMOrcMaterializationResponsibilityRef MR) { … }
LLVMOrcJITDylibRef LLVMOrcMaterializationResponsibilityGetTargetDylib(
LLVMOrcMaterializationResponsibilityRef MR) { … }
LLVMOrcExecutionSessionRef
LLVMOrcMaterializationResponsibilityGetExecutionSession(
LLVMOrcMaterializationResponsibilityRef MR) { … }
LLVMOrcCSymbolFlagsMapPairs LLVMOrcMaterializationResponsibilityGetSymbols(
LLVMOrcMaterializationResponsibilityRef MR, size_t *NumPairs) { … }
void LLVMOrcDisposeCSymbolFlagsMap(LLVMOrcCSymbolFlagsMapPairs Pairs) { … }
LLVMOrcSymbolStringPoolEntryRef
LLVMOrcMaterializationResponsibilityGetInitializerSymbol(
LLVMOrcMaterializationResponsibilityRef MR) { … }
LLVMOrcSymbolStringPoolEntryRef *
LLVMOrcMaterializationResponsibilityGetRequestedSymbols(
LLVMOrcMaterializationResponsibilityRef MR, size_t *NumSymbols) { … }
void LLVMOrcDisposeSymbols(LLVMOrcSymbolStringPoolEntryRef *Symbols) { … }
LLVMErrorRef LLVMOrcMaterializationResponsibilityNotifyResolved(
LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcCSymbolMapPairs Symbols,
size_t NumSymbols) { … }
LLVMErrorRef LLVMOrcMaterializationResponsibilityNotifyEmitted(
LLVMOrcMaterializationResponsibilityRef MR,
LLVMOrcCSymbolDependenceGroup *SymbolDepGroups, size_t NumSymbolDepGroups) { … }
LLVMErrorRef LLVMOrcMaterializationResponsibilityDefineMaterializing(
LLVMOrcMaterializationResponsibilityRef MR,
LLVMOrcCSymbolFlagsMapPairs Syms, size_t NumSyms) { … }
LLVMErrorRef LLVMOrcMaterializationResponsibilityReplace(
LLVMOrcMaterializationResponsibilityRef MR,
LLVMOrcMaterializationUnitRef MU) { … }
LLVMErrorRef LLVMOrcMaterializationResponsibilityDelegate(
LLVMOrcMaterializationResponsibilityRef MR,
LLVMOrcSymbolStringPoolEntryRef *Symbols, size_t NumSymbols,
LLVMOrcMaterializationResponsibilityRef *Result) { … }
void LLVMOrcMaterializationResponsibilityFailMaterialization(
LLVMOrcMaterializationResponsibilityRef MR) { … }
void LLVMOrcIRTransformLayerEmit(LLVMOrcIRTransformLayerRef IRLayer,
LLVMOrcMaterializationResponsibilityRef MR,
LLVMOrcThreadSafeModuleRef TSM) { … }
LLVMOrcJITDylibRef
LLVMOrcExecutionSessionCreateBareJITDylib(LLVMOrcExecutionSessionRef ES,
const char *Name) { … }
LLVMErrorRef
LLVMOrcExecutionSessionCreateJITDylib(LLVMOrcExecutionSessionRef ES,
LLVMOrcJITDylibRef *Result,
const char *Name) { … }
LLVMOrcJITDylibRef
LLVMOrcExecutionSessionGetJITDylibByName(LLVMOrcExecutionSessionRef ES,
const char *Name) { … }
LLVMErrorRef LLVMOrcJITDylibDefine(LLVMOrcJITDylibRef JD,
LLVMOrcMaterializationUnitRef MU) { … }
LLVMErrorRef LLVMOrcJITDylibClear(LLVMOrcJITDylibRef JD) { … }
void LLVMOrcJITDylibAddGenerator(LLVMOrcJITDylibRef JD,
LLVMOrcDefinitionGeneratorRef DG) { … }
LLVMOrcDefinitionGeneratorRef LLVMOrcCreateCustomCAPIDefinitionGenerator(
LLVMOrcCAPIDefinitionGeneratorTryToGenerateFunction F, void *Ctx,
LLVMOrcDisposeCAPIDefinitionGeneratorFunction Dispose) { … }
void LLVMOrcLookupStateContinueLookup(LLVMOrcLookupStateRef S,
LLVMErrorRef Err) { … }
LLVMErrorRef LLVMOrcCreateDynamicLibrarySearchGeneratorForProcess(
LLVMOrcDefinitionGeneratorRef *Result, char GlobalPrefix,
LLVMOrcSymbolPredicate Filter, void *FilterCtx) { … }
LLVMErrorRef LLVMOrcCreateDynamicLibrarySearchGeneratorForPath(
LLVMOrcDefinitionGeneratorRef *Result, const char *FileName,
char GlobalPrefix, LLVMOrcSymbolPredicate Filter, void *FilterCtx) { … }
LLVMErrorRef LLVMOrcCreateStaticLibrarySearchGeneratorForPath(
LLVMOrcDefinitionGeneratorRef *Result, LLVMOrcObjectLayerRef ObjLayer,
const char *FileName) { … }
LLVMOrcThreadSafeContextRef LLVMOrcCreateNewThreadSafeContext(void) { … }
LLVMContextRef
LLVMOrcThreadSafeContextGetContext(LLVMOrcThreadSafeContextRef TSCtx) { … }
void LLVMOrcDisposeThreadSafeContext(LLVMOrcThreadSafeContextRef TSCtx) { … }
LLVMErrorRef
LLVMOrcThreadSafeModuleWithModuleDo(LLVMOrcThreadSafeModuleRef TSM,
LLVMOrcGenericIRModuleOperationFunction F,
void *Ctx) { … }
LLVMOrcThreadSafeModuleRef
LLVMOrcCreateNewThreadSafeModule(LLVMModuleRef M,
LLVMOrcThreadSafeContextRef TSCtx) { … }
void LLVMOrcDisposeThreadSafeModule(LLVMOrcThreadSafeModuleRef TSM) { … }
LLVMErrorRef LLVMOrcJITTargetMachineBuilderDetectHost(
LLVMOrcJITTargetMachineBuilderRef *Result) { … }
LLVMOrcJITTargetMachineBuilderRef
LLVMOrcJITTargetMachineBuilderCreateFromTargetMachine(LLVMTargetMachineRef TM) { … }
void LLVMOrcDisposeJITTargetMachineBuilder(
LLVMOrcJITTargetMachineBuilderRef JTMB) { … }
char *LLVMOrcJITTargetMachineBuilderGetTargetTriple(
LLVMOrcJITTargetMachineBuilderRef JTMB) { … }
void LLVMOrcJITTargetMachineBuilderSetTargetTriple(
LLVMOrcJITTargetMachineBuilderRef JTMB, const char *TargetTriple) { … }
LLVMErrorRef LLVMOrcObjectLayerAddObjectFile(LLVMOrcObjectLayerRef ObjLayer,
LLVMOrcJITDylibRef JD,
LLVMMemoryBufferRef ObjBuffer) { … }
LLVMErrorRef LLVMOrcObjectLayerAddObjectFileWithRT(LLVMOrcObjectLayerRef ObjLayer,
LLVMOrcResourceTrackerRef RT,
LLVMMemoryBufferRef ObjBuffer) { … }
void LLVMOrcObjectLayerEmit(LLVMOrcObjectLayerRef ObjLayer,
LLVMOrcMaterializationResponsibilityRef R,
LLVMMemoryBufferRef ObjBuffer) { … }
void LLVMOrcDisposeObjectLayer(LLVMOrcObjectLayerRef ObjLayer) { … }
void LLVMOrcIRTransformLayerSetTransform(
LLVMOrcIRTransformLayerRef IRTransformLayer,
LLVMOrcIRTransformLayerTransformFunction TransformFunction, void *Ctx) { … }
void LLVMOrcObjectTransformLayerSetTransform(
LLVMOrcObjectTransformLayerRef ObjTransformLayer,
LLVMOrcObjectTransformLayerTransformFunction TransformFunction, void *Ctx) { … }
LLVMOrcDumpObjectsRef LLVMOrcCreateDumpObjects(const char *DumpDir,
const char *IdentifierOverride) { … }
void LLVMOrcDisposeDumpObjects(LLVMOrcDumpObjectsRef DumpObjects) { … }
LLVMErrorRef LLVMOrcDumpObjects_CallOperator(LLVMOrcDumpObjectsRef DumpObjects,
LLVMMemoryBufferRef *ObjBuffer) { … }
LLVMOrcLLJITBuilderRef LLVMOrcCreateLLJITBuilder(void) { … }
void LLVMOrcDisposeLLJITBuilder(LLVMOrcLLJITBuilderRef Builder) { … }
void LLVMOrcLLJITBuilderSetJITTargetMachineBuilder(
LLVMOrcLLJITBuilderRef Builder, LLVMOrcJITTargetMachineBuilderRef JTMB) { … }
void LLVMOrcLLJITBuilderSetObjectLinkingLayerCreator(
LLVMOrcLLJITBuilderRef Builder,
LLVMOrcLLJITBuilderObjectLinkingLayerCreatorFunction F, void *Ctx) { … }
LLVMErrorRef LLVMOrcCreateLLJIT(LLVMOrcLLJITRef *Result,
LLVMOrcLLJITBuilderRef Builder) { … }
LLVMErrorRef LLVMOrcDisposeLLJIT(LLVMOrcLLJITRef J) { … }
LLVMOrcExecutionSessionRef LLVMOrcLLJITGetExecutionSession(LLVMOrcLLJITRef J) { … }
LLVMOrcJITDylibRef LLVMOrcLLJITGetMainJITDylib(LLVMOrcLLJITRef J) { … }
const char *LLVMOrcLLJITGetTripleString(LLVMOrcLLJITRef J) { … }
char LLVMOrcLLJITGetGlobalPrefix(LLVMOrcLLJITRef J) { … }
LLVMOrcSymbolStringPoolEntryRef
LLVMOrcLLJITMangleAndIntern(LLVMOrcLLJITRef J, const char *UnmangledName) { … }
LLVMErrorRef LLVMOrcLLJITAddObjectFile(LLVMOrcLLJITRef J, LLVMOrcJITDylibRef JD,
LLVMMemoryBufferRef ObjBuffer) { … }
LLVMErrorRef LLVMOrcLLJITAddObjectFileWithRT(LLVMOrcLLJITRef J,
LLVMOrcResourceTrackerRef RT,
LLVMMemoryBufferRef ObjBuffer) { … }
LLVMErrorRef LLVMOrcLLJITAddLLVMIRModule(LLVMOrcLLJITRef J,
LLVMOrcJITDylibRef JD,
LLVMOrcThreadSafeModuleRef TSM) { … }
LLVMErrorRef LLVMOrcLLJITAddLLVMIRModuleWithRT(LLVMOrcLLJITRef J,
LLVMOrcResourceTrackerRef RT,
LLVMOrcThreadSafeModuleRef TSM) { … }
LLVMErrorRef LLVMOrcLLJITLookup(LLVMOrcLLJITRef J,
LLVMOrcJITTargetAddress *Result,
const char *Name) { … }
LLVMOrcObjectLayerRef LLVMOrcLLJITGetObjLinkingLayer(LLVMOrcLLJITRef J) { … }
LLVMOrcObjectTransformLayerRef
LLVMOrcLLJITGetObjTransformLayer(LLVMOrcLLJITRef J) { … }
LLVMOrcObjectLayerRef
LLVMOrcCreateRTDyldObjectLinkingLayerWithSectionMemoryManager(
LLVMOrcExecutionSessionRef ES) { … }
LLVMOrcObjectLayerRef
LLVMOrcCreateRTDyldObjectLinkingLayerWithMCJITMemoryManagerLikeCallbacks(
LLVMOrcExecutionSessionRef ES, void *CreateContextCtx,
LLVMMemoryManagerCreateContextCallback CreateContext,
LLVMMemoryManagerNotifyTerminatingCallback NotifyTerminating,
LLVMMemoryManagerAllocateCodeSectionCallback AllocateCodeSection,
LLVMMemoryManagerAllocateDataSectionCallback AllocateDataSection,
LLVMMemoryManagerFinalizeMemoryCallback FinalizeMemory,
LLVMMemoryManagerDestroyCallback Destroy) { … }
void LLVMOrcRTDyldObjectLinkingLayerRegisterJITEventListener(
LLVMOrcObjectLayerRef RTDyldObjLinkingLayer,
LLVMJITEventListenerRef Listener) { … }
LLVMOrcIRTransformLayerRef LLVMOrcLLJITGetIRTransformLayer(LLVMOrcLLJITRef J) { … }
const char *LLVMOrcLLJITGetDataLayoutStr(LLVMOrcLLJITRef J) { … }
LLVMOrcIndirectStubsManagerRef
LLVMOrcCreateLocalIndirectStubsManager(const char *TargetTriple) { … }
void LLVMOrcDisposeIndirectStubsManager(LLVMOrcIndirectStubsManagerRef ISM) { … }
LLVMErrorRef LLVMOrcCreateLocalLazyCallThroughManager(
const char *TargetTriple, LLVMOrcExecutionSessionRef ES,
LLVMOrcJITTargetAddress ErrorHandlerAddr,
LLVMOrcLazyCallThroughManagerRef *Result) { … }
void LLVMOrcDisposeLazyCallThroughManager(
LLVMOrcLazyCallThroughManagerRef LCM) { … }