LLVM API Documentation

Classes | Typedefs | Functions
Execution Engine
LLVM-C: C interface to LLVM
Collaboration diagram for Execution Engine:

Classes

struct  LLVMMCJITCompilerOptions

Typedefs

typedef struct
LLVMOpaqueGenericValue * 
LLVMGenericValueRef
typedef struct
LLVMOpaqueExecutionEngine * 
LLVMExecutionEngineRef
typedef struct
LLVMOpaqueMCJITMemoryManager * 
LLVMMCJITMemoryManagerRef
typedef uint8_t *(* LLVMMemoryManagerAllocateCodeSectionCallback )(void *Opaque, uintptr_t Size, unsigned Alignment, unsigned SectionID, const char *SectionName)
typedef uint8_t *(* LLVMMemoryManagerAllocateDataSectionCallback )(void *Opaque, uintptr_t Size, unsigned Alignment, unsigned SectionID, const char *SectionName, LLVMBool IsReadOnly)
typedef LLVMBool(* LLVMMemoryManagerFinalizeMemoryCallback )(void *Opaque, char **ErrMsg)
typedef void(* LLVMMemoryManagerDestroyCallback )(void *Opaque)

Functions

void LLVMLinkInJIT (void)
void LLVMLinkInMCJIT (void)
void LLVMLinkInInterpreter (void)
LLVMGenericValueRef LLVMCreateGenericValueOfInt (LLVMTypeRef Ty, unsigned long long N, LLVMBool IsSigned)
LLVMGenericValueRef LLVMCreateGenericValueOfPointer (void *P)
LLVMGenericValueRef LLVMCreateGenericValueOfFloat (LLVMTypeRef Ty, double N)
unsigned LLVMGenericValueIntWidth (LLVMGenericValueRef GenValRef)
unsigned long long LLVMGenericValueToInt (LLVMGenericValueRef GenVal, LLVMBool IsSigned)
void * LLVMGenericValueToPointer (LLVMGenericValueRef GenVal)
double LLVMGenericValueToFloat (LLVMTypeRef TyRef, LLVMGenericValueRef GenVal)
void LLVMDisposeGenericValue (LLVMGenericValueRef GenVal)
LLVMBool LLVMCreateExecutionEngineForModule (LLVMExecutionEngineRef *OutEE, LLVMModuleRef M, char **OutError)
LLVMBool LLVMCreateInterpreterForModule (LLVMExecutionEngineRef *OutInterp, LLVMModuleRef M, char **OutError)
LLVMBool LLVMCreateJITCompilerForModule (LLVMExecutionEngineRef *OutJIT, LLVMModuleRef M, unsigned OptLevel, char **OutError)
void LLVMInitializeMCJITCompilerOptions (struct LLVMMCJITCompilerOptions *Options, size_t SizeOfOptions)
LLVMBool LLVMCreateMCJITCompilerForModule (LLVMExecutionEngineRef *OutJIT, LLVMModuleRef M, struct LLVMMCJITCompilerOptions *Options, size_t SizeOfOptions, char **OutError)
LLVMBool LLVMCreateExecutionEngine (LLVMExecutionEngineRef *OutEE, LLVMModuleProviderRef MP, char **OutError)
LLVMBool LLVMCreateInterpreter (LLVMExecutionEngineRef *OutInterp, LLVMModuleProviderRef MP, char **OutError)
LLVMBool LLVMCreateJITCompiler (LLVMExecutionEngineRef *OutJIT, LLVMModuleProviderRef MP, unsigned OptLevel, char **OutError)
void LLVMDisposeExecutionEngine (LLVMExecutionEngineRef EE)
void LLVMRunStaticConstructors (LLVMExecutionEngineRef EE)
void LLVMRunStaticDestructors (LLVMExecutionEngineRef EE)
int LLVMRunFunctionAsMain (LLVMExecutionEngineRef EE, LLVMValueRef F, unsigned ArgC, const char *const *ArgV, const char *const *EnvP)
LLVMGenericValueRef LLVMRunFunction (LLVMExecutionEngineRef EE, LLVMValueRef F, unsigned NumArgs, LLVMGenericValueRef *Args)
void LLVMFreeMachineCodeForFunction (LLVMExecutionEngineRef EE, LLVMValueRef F)
void LLVMAddModule (LLVMExecutionEngineRef EE, LLVMModuleRef M)
void LLVMAddModuleProvider (LLVMExecutionEngineRef EE, LLVMModuleProviderRef MP)
LLVMBool LLVMRemoveModule (LLVMExecutionEngineRef EE, LLVMModuleRef M, LLVMModuleRef *OutMod, char **OutError)
LLVMBool LLVMRemoveModuleProvider (LLVMExecutionEngineRef EE, LLVMModuleProviderRef MP, LLVMModuleRef *OutMod, char **OutError)
LLVMBool LLVMFindFunction (LLVMExecutionEngineRef EE, const char *Name, LLVMValueRef *OutFn)
void * LLVMRecompileAndRelinkFunction (LLVMExecutionEngineRef EE, LLVMValueRef Fn)
LLVMTargetDataRef LLVMGetExecutionEngineTargetData (LLVMExecutionEngineRef EE)
LLVMTargetMachineRef LLVMGetExecutionEngineTargetMachine (LLVMExecutionEngineRef EE)
void LLVMAddGlobalMapping (LLVMExecutionEngineRef EE, LLVMValueRef Global, void *Addr)
void * LLVMGetPointerToGlobal (LLVMExecutionEngineRef EE, LLVMValueRef Global)
LLVMMCJITMemoryManagerRef LLVMCreateSimpleMCJITMemoryManager (void *Opaque, LLVMMemoryManagerAllocateCodeSectionCallback AllocateCodeSection, LLVMMemoryManagerAllocateDataSectionCallback AllocateDataSection, LLVMMemoryManagerFinalizeMemoryCallback FinalizeMemory, LLVMMemoryManagerDestroyCallback Destroy)
void LLVMDisposeMCJITMemoryManager (LLVMMCJITMemoryManagerRef MM)

Typedef Documentation

typedef struct LLVMOpaqueExecutionEngine* LLVMExecutionEngineRef

Definition at line 42 of file c/ExecutionEngine.h.

typedef struct LLVMOpaqueGenericValue* LLVMGenericValueRef

Definition at line 41 of file c/ExecutionEngine.h.

typedef struct LLVMOpaqueMCJITMemoryManager* LLVMMCJITMemoryManagerRef

Definition at line 43 of file c/ExecutionEngine.h.

typedef uint8_t*(* LLVMMemoryManagerAllocateCodeSectionCallback)(void *Opaque, uintptr_t Size, unsigned Alignment, unsigned SectionID, const char *SectionName)

Definition at line 176 of file c/ExecutionEngine.h.

typedef uint8_t*(* LLVMMemoryManagerAllocateDataSectionCallback)(void *Opaque, uintptr_t Size, unsigned Alignment, unsigned SectionID, const char *SectionName, LLVMBool IsReadOnly)

Definition at line 179 of file c/ExecutionEngine.h.

typedef void(* LLVMMemoryManagerDestroyCallback)(void *Opaque)

Definition at line 184 of file c/ExecutionEngine.h.

typedef LLVMBool(* LLVMMemoryManagerFinalizeMemoryCallback)(void *Opaque, char **ErrMsg)

Definition at line 182 of file c/ExecutionEngine.h.


Function Documentation

void LLVMAddGlobalMapping ( LLVMExecutionEngineRef  EE,
LLVMValueRef  Global,
void *  Addr 
)

Definition at line 329 of file ExecutionEngineBindings.cpp.

References llvm::unwrap().

Definition at line 281 of file ExecutionEngineBindings.cpp.

References llvm::unwrap().

Referenced by LLVMAddModuleProvider().

Deprecated: Use LLVMAddModule instead.

Definition at line 285 of file ExecutionEngineBindings.cpp.

References LLVMAddModule().

Deprecated: Use LLVMCreateExecutionEngineForModule instead.

Definition at line 209 of file ExecutionEngineBindings.cpp.

References LLVMCreateExecutionEngineForModule().

Definition at line 54 of file ExecutionEngineBindings.cpp.

References llvm::GenericValue::PointerVal, and llvm::wrap().

LLVMBool LLVMCreateInterpreter ( LLVMExecutionEngineRef OutInterp,
LLVMModuleProviderRef  MP,
char **  OutError 
)

Deprecated: Use LLVMCreateInterpreterForModule instead.

Definition at line 218 of file ExecutionEngineBindings.cpp.

References LLVMCreateInterpreterForModule().

LLVMBool LLVMCreateInterpreterForModule ( LLVMExecutionEngineRef OutInterp,
LLVMModuleRef  M,
char **  OutError 
)
LLVMBool LLVMCreateJITCompiler ( LLVMExecutionEngineRef OutJIT,
LLVMModuleProviderRef  MP,
unsigned  OptLevel,
char **  OutError 
)

Deprecated: Use LLVMCreateJITCompilerForModule instead.

Definition at line 227 of file ExecutionEngineBindings.cpp.

References LLVMCreateJITCompilerForModule().

LLVMBool LLVMCreateJITCompilerForModule ( LLVMExecutionEngineRef OutJIT,
LLVMModuleRef  M,
unsigned  OptLevel,
char **  OutError 
)
LLVMBool LLVMCreateMCJITCompilerForModule ( LLVMExecutionEngineRef OutJIT,
LLVMModuleRef  M,
struct LLVMMCJITCompilerOptions Options,
size_t  SizeOfOptions,
char **  OutError 
)

Create an MCJIT execution engine for a module, with the given options. It is the responsibility of the caller to ensure that all fields in Options up to the given SizeOfOptions are initialized. It is correct to pass a smaller value of SizeOfOptions that omits some fields. The canonical way of using this is:

LLVMMCJITCompilerOptions options; LLVMInitializeMCJITCompilerOptions(&options, sizeof(options)); ... fill in those options you care about LLVMCreateMCJITCompilerForModule(&jit, mod, &options, sizeof(options), &error);

Note that this is also correct, though possibly suboptimal:

LLVMCreateMCJITCompilerForModule(&jit, mod, 0, 0, &error);

Definition at line 166 of file ExecutionEngineBindings.cpp.

References LLVMMCJITCompilerOptions::CodeModel, llvm::EngineBuilder::create(), LLVMMCJITCompilerOptions::EnableFastISel, llvm::TargetOptions::EnableFastISel, llvm::lltok::Error, llvm::EngineKind::JIT, LLVMInitializeMCJITCompilerOptions(), LLVMMCJITCompilerOptions::MCJMM, llvm::LibFunc::memcpy, LLVMMCJITCompilerOptions::NoFramePointerElim, llvm::TargetOptions::NoFramePointerElim, LLVMMCJITCompilerOptions::OptLevel, llvm::EngineBuilder::setCodeModel(), llvm::EngineBuilder::setEngineKind(), llvm::EngineBuilder::setErrorStr(), llvm::EngineBuilder::setMCJITMemoryManager(), llvm::EngineBuilder::setOptLevel(), llvm::EngineBuilder::setTargetOptions(), llvm::EngineBuilder::setUseMCJIT(), llvm::LibFunc::strdup, llvm::unwrap(), and llvm::wrap().

Create a simple custom MCJIT memory manager. This memory manager can intercept allocations in a module-oblivious way. This will return NULL if any of the passed functions are NULL.

Parameters:
OpaqueAn opaque client object to pass back to the callbacks.
AllocateCodeSectionAllocate a block of memory for executable code.
AllocateDataSectionAllocate a block of memory for data.
FinalizeMemorySet page permissions and flush cache. Return 0 on success, 1 on error.

Definition at line 420 of file ExecutionEngineBindings.cpp.

References functions, and llvm::wrap().

Definition at line 238 of file ExecutionEngineBindings.cpp.

References llvm::unwrap().

Definition at line 103 of file ExecutionEngineBindings.cpp.

References llvm::unwrap().

Definition at line 439 of file ExecutionEngineBindings.cpp.

References llvm::unwrap().

LLVMBool LLVMFindFunction ( LLVMExecutionEngineRef  EE,
const char *  Name,
LLVMValueRef OutFn 
)

Definition at line 306 of file ExecutionEngineBindings.cpp.

References F(), llvm::unwrap(), and llvm::wrap().

Definition at line 277 of file ExecutionEngineBindings.cpp.

References llvm::unwrap().

Definition at line 75 of file ExecutionEngineBindings.cpp.

References llvm::unwrap().

unsigned long long LLVMGenericValueToInt ( LLVMGenericValueRef  GenVal,
LLVMBool  IsSigned 
)

Definition at line 88 of file ExecutionEngineBindings.cpp.

References llvm::unwrap().

Definition at line 320 of file ExecutionEngineBindings.cpp.

References llvm::unwrap(), and llvm::wrap().

Definition at line 325 of file ExecutionEngineBindings.cpp.

References llvm::unwrap(), and llvm::wrap().

Definition at line 334 of file ExecutionEngineBindings.cpp.

References llvm::unwrap().

void LLVMInitializeMCJITCompilerOptions ( struct LLVMMCJITCompilerOptions Options,
size_t  SizeOfOptions 
)
void LLVMLinkInInterpreter ( void  )

Definition at line 31 of file Interpreter.cpp.

void LLVMLinkInJIT ( void  )

Definition at line 69 of file JIT.cpp.

void LLVMLinkInMCJIT ( void  )

Definition at line 43 of file MCJIT.cpp.

Definition at line 315 of file ExecutionEngineBindings.cpp.

References llvm::unwrap().

LLVMBool LLVMRemoveModule ( LLVMExecutionEngineRef  EE,
LLVMModuleRef  M,
LLVMModuleRef OutMod,
char **  OutError 
)

Definition at line 290 of file ExecutionEngineBindings.cpp.

References llvm::unwrap(), and llvm::wrap().

Referenced by LLVMRemoveModuleProvider().

Deprecated: Use LLVMRemoveModule instead.

Definition at line 298 of file ExecutionEngineBindings.cpp.

References LLVMRemoveModule().

Definition at line 262 of file ExecutionEngineBindings.cpp.

References I, llvm::unwrap(), and llvm::wrap().

int LLVMRunFunctionAsMain ( LLVMExecutionEngineRef  EE,
LLVMValueRef  F,
unsigned  ArgC,
const char *const ArgV,
const char *const EnvP 
)

Definition at line 250 of file ExecutionEngineBindings.cpp.

References I, and llvm::unwrap().

Definition at line 242 of file ExecutionEngineBindings.cpp.

References llvm::unwrap().

Definition at line 246 of file ExecutionEngineBindings.cpp.

References llvm::unwrap().