llvm-party-12.1.1: General purpose LLVM bindings
Safe HaskellSafe-Inferred
LanguageHaskell2010

LLVM.OrcJIT

Synopsis

ExecutionSession

disposeExecutionSession :: ExecutionSession -> IO () Source #

Dispose of an ExecutionSession. This should be called when the ExecutionSession is not needed anymore.

JITDylib

newtype JITDylib Source #

Constructors

JITDylib (Ptr JITDylib) 

createJITDylib :: ExecutionSession -> ShortByteString -> IO JITDylib Source #

Create a new JITDylib with the given name.

Symbol search generators

addDynamicLibrarySearchGeneratorForCurrentProcess :: IRLayer l => l -> JITDylib -> IO () Source #

Adds a JITDylib definition generator that looks up missing symbols in the namespace of the current process.

addDynamicLibrarySearchGenerator :: IRLayer l => l -> JITDylib -> FilePath -> IO () Source #

Adds a JITDylib definition generator that looks up missing symbols in the namespace of a shared library located at the specified FilePath.

Symbol definitions

Symbol lookups

lookupSymbol :: IRLayer l => ExecutionSession -> l -> JITDylib -> ShortByteString -> IO (Either JITSymbolError JITSymbol) Source #

Looks up an (unmangled) symbol name in the given JITDylib.

The symbol is expected to have been added to the JITDylib by the same IRLayer as specified in this function. Using a different IRLayer can cause the lookup to fail due to differences in mangling schemes.

data JITSymbol Source #

Constructors

JITSymbol 

Fields

data JITSymbolFlags Source #

Contrary to the C++ interface, we do not store the HasError flag here. Instead decoding a JITSymbol produces a sumtype based on whether that flag is set or not.

Constructors

JITSymbolFlags 

Fields

Mangled symbols

ThreadSafeContext

Lifetime management

ThreadSafeModule

Lifetime management

cloneAsThreadSafeModule :: Module -> IO ThreadSafeModule Source #

Create a ThreadSafeModule with the same content as the input Module.

The module will get cloned into a fresh LLVM context. The lifetime of the new context is bound to the lifetime of the returned ThreadSafeModule.

Object layers

class ObjectLayer l Source #

A type class implemented by the different OrcJIT object layers.

See e.g. RTDyldObjectLinkingLayer.

Minimal complete definition

getObjectLayer

ObjectLinkingLayer

RTDyldObjectLinkingLayer

createRTDyldObjectLinkingLayer :: ExecutionSession -> IO RTDyldObjectLinkingLayer Source #

Create a new RTDyldObjectLinkingLayer.

The layer will get automatically disposed along with its ExecutionSession.

IR layers

class IRLayer l Source #

A type class implemented by the different OrcJIT IR layers.

See e.g. IRCompileLayer.

Minimal complete definition

getIRLayer, getDataLayout, getMangler

addModule :: IRLayer l => ThreadSafeModule -> JITDylib -> l -> IO () Source #

Add a Module to the specified JITDylib.

The specified IRLayer will be responsible for compiling the symbols present in the module. The module itself is consumed and should not be used again.

IRCompileLayer

data IRCompileLayer Source #

An IR layer that compiles the symbols in a module eagerly.

createIRCompileLayer :: ObjectLayer l => ExecutionSession -> l -> TargetMachine -> IO IRCompileLayer Source #

Create a new IRCompileLayer.

The layer will get automatically disposed along with its ExecutionSession.