{-# LANGUAGE MultiParamTypeClasses, ForeignFunctionInterface #-}
module LLVM.Internal.FFI.OrcJIT where
import LLVM.Prelude
import Foreign.C
import Foreign.Ptr
import LLVM.Internal.FFI.DataLayout
import LLVM.Internal.FFI.LLVMCTypes
newtype ModuleKey = ModuleKey Word64 deriving (ModuleKey -> ModuleKey -> Bool
(ModuleKey -> ModuleKey -> Bool)
-> (ModuleKey -> ModuleKey -> Bool) -> Eq ModuleKey
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModuleKey -> ModuleKey -> Bool
$c/= :: ModuleKey -> ModuleKey -> Bool
== :: ModuleKey -> ModuleKey -> Bool
$c== :: ModuleKey -> ModuleKey -> Bool
Eq, Eq ModuleKey
Eq ModuleKey =>
(ModuleKey -> ModuleKey -> Ordering)
-> (ModuleKey -> ModuleKey -> Bool)
-> (ModuleKey -> ModuleKey -> Bool)
-> (ModuleKey -> ModuleKey -> Bool)
-> (ModuleKey -> ModuleKey -> Bool)
-> (ModuleKey -> ModuleKey -> ModuleKey)
-> (ModuleKey -> ModuleKey -> ModuleKey)
-> Ord ModuleKey
ModuleKey -> ModuleKey -> Bool
ModuleKey -> ModuleKey -> Ordering
ModuleKey -> ModuleKey -> ModuleKey
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: ModuleKey -> ModuleKey -> ModuleKey
$cmin :: ModuleKey -> ModuleKey -> ModuleKey
max :: ModuleKey -> ModuleKey -> ModuleKey
$cmax :: ModuleKey -> ModuleKey -> ModuleKey
>= :: ModuleKey -> ModuleKey -> Bool
$c>= :: ModuleKey -> ModuleKey -> Bool
> :: ModuleKey -> ModuleKey -> Bool
$c> :: ModuleKey -> ModuleKey -> Bool
<= :: ModuleKey -> ModuleKey -> Bool
$c<= :: ModuleKey -> ModuleKey -> Bool
< :: ModuleKey -> ModuleKey -> Bool
$c< :: ModuleKey -> ModuleKey -> Bool
compare :: ModuleKey -> ModuleKey -> Ordering
$ccompare :: ModuleKey -> ModuleKey -> Ordering
$cp1Ord :: Eq ModuleKey
Ord, Int -> ModuleKey -> ShowS
[ModuleKey] -> ShowS
ModuleKey -> String
(Int -> ModuleKey -> ShowS)
-> (ModuleKey -> String)
-> ([ModuleKey] -> ShowS)
-> Show ModuleKey
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModuleKey] -> ShowS
$cshowList :: [ModuleKey] -> ShowS
show :: ModuleKey -> String
$cshow :: ModuleKey -> String
showsPrec :: Int -> ModuleKey -> ShowS
$cshowsPrec :: Int -> ModuleKey -> ShowS
Show)
data JITSymbol
data SymbolResolver
data ExecutionSession
newtype TargetAddress = TargetAddress Word64
type SymbolResolverFn = CString -> Ptr JITSymbol -> IO ()
foreign import ccall "wrapper" wrapSymbolResolverFn ::
SymbolResolverFn -> IO (FunPtr SymbolResolverFn)
foreign import ccall safe "LLVM_Hs_disposeJITSymbol" disposeSymbol ::
Ptr JITSymbol -> IO ()
foreign import ccall safe "LLVM_Hs_createLambdaResolver" createLambdaResolver ::
Ptr ExecutionSession ->
FunPtr SymbolResolverFn ->
IO (Ptr SymbolResolver)
foreign import ccall safe "LLVM_Hs_disposeSymbolResolver" disposeSymbolResolver ::
Ptr SymbolResolver -> IO ()
foreign import ccall safe "LLVM_Hs_JITSymbol_getAddress" getAddress ::
Ptr JITSymbol -> Ptr (OwnerTransfered CString) -> IO TargetAddress
foreign import ccall safe "LLVM_Hs_JITSymbol_getFlags" getFlags ::
Ptr JITSymbol -> IO JITSymbolFlags
foreign import ccall safe "LLVM_Hs_JITSymbol_getErrorMsg" getErrorMsg ::
Ptr JITSymbol -> IO (OwnerTransfered CString)
foreign import ccall safe "LLVM_Hs_setJITSymbol" setJITSymbol ::
Ptr JITSymbol -> TargetAddress -> JITSymbolFlags -> IO ()
foreign import ccall safe "LLVM_Hs_getMangledSymbol" getMangledSymbol ::
Ptr CString -> CString -> Ptr DataLayout -> IO ()
foreign import ccall safe "LLVM_Hs_disposeMangledSymbol" disposeMangledSymbol ::
CString -> IO ()
foreign import ccall safe "LLVM_Hs_createExecutionSession" createExecutionSession ::
IO (Ptr ExecutionSession)
foreign import ccall safe "LLVM_Hs_disposeExecutionSession" disposeExecutionSession ::
Ptr ExecutionSession -> IO ()
foreign import ccall safe "LLVM_Hs_allocateVModule" allocateVModule ::
Ptr ExecutionSession -> IO ModuleKey
foreign import ccall safe "LLVM_Hs_releaseVModule" releaseVModule ::
Ptr ExecutionSession -> ModuleKey -> IO ()
foreign import ccall "wrapper" wrapGetSymbolResolver ::
(ModuleKey -> IO (Ptr SymbolResolver)) -> IO (FunPtr (ModuleKey -> IO (Ptr SymbolResolver)))
foreign import ccall "wrapper" wrapSetSymbolResolver ::
(ModuleKey -> Ptr SymbolResolver -> IO ()) -> IO (FunPtr (ModuleKey -> Ptr SymbolResolver -> IO ()))