llvm-0.8.0.2: Bindings to the LLVM compiler toolkit.

LLVM.ExecutionEngine

Contents

Description

An ExecutionEngine is JIT compiler that is used to generate code for an LLVM module.

Synopsis

Execution engine

runEngineAccess :: EngineAccess a -> IO aSource

The LLVM execution engine is encapsulated so it cannot be accessed directly. The reason is that (currently) there must only ever be one engine, so access to it is wrapped in a monad.

type FreePointers = (Ptr ExecutionEngine, ModuleProviderRef, ValueRef)Source

Get all the information needed to free a function. Freeing code might have to be done from a (C) finalizer, so it has to done from C. The function c_freeFunctionObject take these pointers as arguments and frees the function.

Translation

class Translatable f Source

Class of LLVM function types that can be translated to the corresponding Haskell type.

Instances

Generic a => Translatable (IO a) 
(Generic a, Translatable b) => Translatable (a -> b) 

generateFunction :: Translatable f => Value (Ptr f) -> EngineAccess fSource

Generate a Haskell function from an LLVM function.

Unsafe type conversion

class Unsafe a b | a -> b whereSource

Methods

unsafePurifySource

Arguments

:: a 
-> b

Remove the IO from a function return type. This is unsafe in general.

Instances

Unsafe (IO a) a 
Unsafe b b' => Unsafe (a -> b) (a -> b') 

Simplified interface.

simpleFunction :: Translatable f => CodeGenModule (Function f) -> IO fSource

Translate a function to Haskell code. This is a simplified interface to the execution engine and module mechanism.

Target information

data TargetData Source

Constructors

TargetData 

Fields

aBIAlignmentOfType :: Type -> Int
 
aBISizeOfType :: Type -> Int
 
littleEndian :: Bool
 
callFrameAlignmentOfType :: Type -> Int
 
intPtrType :: Type
 
pointerSize :: Int
 
preferredAlignmentOfType :: Type -> Int
 
sizeOfTypeInBits :: Type -> Int
 
storeSizeOfType :: Type -> Int
 

Instances

withIntPtrType :: (forall n. Nat n => WordN n -> a) -> aSource