Safe Haskell | None |
---|---|
Language | Haskell98 |
LLVM.Module
Description
A Module
holds a C++ LLVM IR module. Module
s may be converted to or from strings or Haskell ASTs, or
added to an ExecutionEngine
and so JIT compiled to get function pointers.
- data Module
- newtype File = File FilePath
- withModuleFromAST :: Context -> Module -> (Module -> IO a) -> ExceptT String IO a
- moduleAST :: Module -> IO Module
- withModuleFromLLVMAssembly :: LLVMAssemblyInput s => Context -> s -> (Module -> IO a) -> ExceptT String IO a
- moduleLLVMAssembly :: Module -> IO String
- writeLLVMAssemblyToFile :: File -> Module -> ExceptT String IO ()
- withModuleFromBitcode :: BitcodeInput b => Context -> b -> (Module -> IO a) -> ExceptT String IO a
- moduleBitcode :: Module -> IO ByteString
- writeBitcodeToFile :: File -> Module -> ExceptT String IO ()
- moduleTargetAssembly :: TargetMachine -> Module -> ExceptT String IO String
- writeTargetAssemblyToFile :: TargetMachine -> File -> Module -> ExceptT String IO ()
- moduleObject :: TargetMachine -> Module -> ExceptT String IO ByteString
- writeObjectToFile :: TargetMachine -> File -> Module -> ExceptT String IO ()
- linkModules :: Module -> Module -> ExceptT String IO ()
Documentation
A newtype to distinguish strings used for paths from other strings
withModuleFromAST :: Context -> Module -> (Module -> IO a) -> ExceptT String IO a Source #
This function will call disposeModule after the callback
exits. Calling deleteModule
prevents double free errors. As long
as you only call functions provided by llvm-hs this should not
be necessary since llvm-hs takes care of this.
withModuleFromLLVMAssembly :: LLVMAssemblyInput s => Context -> s -> (Module -> IO a) -> ExceptT String IO a Source #
parse Module
from LLVM assembly
writeLLVMAssemblyToFile :: File -> Module -> ExceptT String IO () Source #
write LLVM assembly for a Module
to a file
withModuleFromBitcode :: BitcodeInput b => Context -> b -> (Module -> IO a) -> ExceptT String IO a Source #
parse Module
from LLVM bitcode
moduleBitcode :: Module -> IO ByteString Source #
generate LLVM bitcode from a Module
writeBitcodeToFile :: File -> Module -> ExceptT String IO () Source #
write LLVM bitcode from a Module
into a file
moduleTargetAssembly :: TargetMachine -> Module -> ExceptT String IO String Source #
produce target-specific assembly as a String
writeTargetAssemblyToFile :: TargetMachine -> File -> Module -> ExceptT String IO () Source #
write target-specific assembly directly into a file
moduleObject :: TargetMachine -> Module -> ExceptT String IO ByteString Source #
produce target-specific object code as a ByteString
writeObjectToFile :: TargetMachine -> File -> Module -> ExceptT String IO () Source #
write target-specific object code directly into a file
Arguments
:: Module | The module into which to link |
-> Module | The module to link into the other (this module is destroyed) |
-> ExceptT String IO () |
link LLVM modules - move or copy parts of a source module into a destination module. Note that this operation is not commutative - not only concretely (e.g. the destination module is modified, becoming the result) but abstractly (e.g. unused private globals in the source module do not appear in the result, but similar globals in the destination remain). The source module is destroyed.