Safe Haskell | None |
---|
- newtype Module = Module {}
- withModule :: Module -> (ModuleRef -> IO a) -> IO a
- createModule :: String -> IO Module
- destroyModule :: Module -> IO ()
- writeBitcodeToFile :: String -> Module -> IO ()
- readBitcodeFromFile :: String -> IO Module
- getModuleValues :: Module -> IO [(String, Value)]
- getFunctions :: Module -> IO [(String, Value)]
- getGlobalVariables :: Module -> IO [(String, Value)]
- valueHasType :: Value -> Type -> Bool
- newtype ModuleProvider = ModuleProvider {}
- withModuleProvider :: ModuleProvider -> (ModuleProviderRef -> IO a) -> IO a
- createModuleProviderForExistingModule :: Module -> IO ModuleProvider
- newtype PassManager = PassManager {}
- withPassManager :: PassManager -> (PassManagerRef -> IO a) -> IO a
- createPassManager :: IO PassManager
- createFunctionPassManager :: ModuleProvider -> IO PassManager
- runFunctionPassManager :: PassManager -> Function -> IO Int
- initializeFunctionPassManager :: PassManager -> IO Int
- finalizeFunctionPassManager :: PassManager -> IO Int
- newtype Builder = Builder {}
- withBuilder :: Builder -> (BuilderRef -> IO a) -> IO a
- createBuilder :: IO Builder
- positionAtEnd :: Builder -> BasicBlockRef -> IO ()
- getInsertBlock :: Builder -> IO BasicBlockRef
- type BasicBlock = BasicBlockRef
- appendBasicBlock :: Function -> String -> IO BasicBlock
- getBasicBlocks :: Value -> IO [(String, Value)]
- type Function = ValueRef
- addFunction :: Module -> Linkage -> String -> Type -> IO Function
- getParam :: Function -> Int -> Value
- getParams :: Value -> IO [(String, Value)]
- structType :: [Type] -> Bool -> Type
- addGlobal :: Module -> Linkage -> String -> Type -> IO Value
- constString :: String -> (Value, Int)
- constStringNul :: String -> (Value, Int)
- constVector :: Int -> [Value] -> Value
- constArray :: Type -> Int -> [Value] -> Value
- constStruct :: [Value] -> Bool -> Value
- makeCall :: Function -> BuilderRef -> [Value] -> IO Value
- makeInvoke :: BasicBlock -> BasicBlock -> Function -> BuilderRef -> [Value] -> IO Value
- makeCallWithCc :: CallingConvention -> Function -> BuilderRef -> [Value] -> IO Value
- makeInvokeWithCc :: CallingConvention -> BasicBlock -> BasicBlock -> Function -> BuilderRef -> [Value] -> IO Value
- withValue :: Value -> (Value -> IO a) -> IO a
- getInstructions :: Value -> IO [(String, Value)]
- getOperands :: Value -> IO [(String, Value)]
- hasUsers :: Value -> IO Bool
- getUsers :: [Use] -> IO [(String, Value)]
- getUses :: Value -> IO [Use]
- getUser :: Use -> IO Value
- isChildOf :: BasicBlock -> Value -> IO Bool
- getDep :: Use -> IO (String, String)
- type CString = Ptr CChar
- withArrayLen :: Storable a => [a] -> (Int -> Ptr a -> IO b) -> IO b
- withEmptyCString :: (CString -> IO a) -> IO a
- functionType :: Bool -> Type -> [Type] -> Type
- buildEmptyPhi :: BuilderRef -> Type -> IO Value
- addPhiIns :: Value -> [(Value, BasicBlock)] -> IO ()
- showTypeOf :: Value -> IO String
- getValueNameU :: Value -> IO String
- getObjList :: (t1 -> (t2 -> IO [Ptr a]) -> t) -> (t2 -> IO (Ptr a)) -> (Ptr a -> IO (Ptr a)) -> t1 -> t
- annotateValueList :: [Value] -> IO [(String, Value)]
- isConstant :: Value -> IO Bool
- addCFGSimplificationPass :: PassManager -> IO ()
- addConstantPropagationPass :: PassManager -> IO ()
- addDemoteMemoryToRegisterPass :: PassManager -> IO ()
- addGVNPass :: PassManager -> IO ()
- addInstructionCombiningPass :: PassManager -> IO ()
- addPromoteMemoryToRegisterPass :: PassManager -> IO ()
- addReassociatePass :: PassManager -> IO ()
- addTargetData :: TargetDataRef -> PassManager -> IO ()
Module handling
Type of top level modules.
createModule :: String -> IO ModuleSource
destroyModule :: Module -> IO ()Source
Free all storage related to a module. *Note*, this is a dangerous call, since referring to the module after this call is an error. The reason for the explicit call to free the module instead of an automatic lifetime management is that modules have a somewhat complicated ownership. Handing a module to a module provider changes the ownership of the module, and the module provider will free the module when necessary.
writeBitcodeToFile :: String -> Module -> IO ()Source
Write a module to a file.
readBitcodeFromFile :: String -> IO ModuleSource
Read a module from a file.
getModuleValues :: Module -> IO [(String, Value)]Source
getFunctions :: Module -> IO [(String, Value)]Source
getGlobalVariables :: Module -> IO [(String, Value)]Source
valueHasType :: Value -> Type -> BoolSource
Module provider handling
newtype ModuleProvider Source
A module provider is used by the code generator to get access to a module.
withModuleProvider :: ModuleProvider -> (ModuleProviderRef -> IO a) -> IO aSource
createModuleProviderForExistingModule :: Module -> IO ModuleProviderSource
Turn a module into a module provider.
Pass manager handling
newtype PassManager Source
Manage compile passes.
withPassManager :: PassManager -> (PassManagerRef -> IO a) -> IO aSource
createPassManager :: IO PassManagerSource
Create a pass manager.
createFunctionPassManager :: ModuleProvider -> IO PassManagerSource
Create a pass manager for a module.
runFunctionPassManager :: PassManager -> Function -> IO IntSource
Instruction builder
withBuilder :: Builder -> (BuilderRef -> IO a) -> IO aSource
positionAtEnd :: Builder -> BasicBlockRef -> IO ()Source
Basic blocks
type BasicBlock = BasicBlockRefSource
appendBasicBlock :: Function -> String -> IO BasicBlockSource
getBasicBlocks :: Value -> IO [(String, Value)]Source
Functions
Structs
structType :: [Type] -> Bool -> TypeSource
Globals
constString :: String -> (Value, Int)Source
constStringNul :: String -> (Value, Int)Source
constVector :: Int -> [Value] -> ValueSource
constArray :: Type -> Int -> [Value] -> ValueSource
constStruct :: [Value] -> Bool -> ValueSource
Instructions
makeCall :: Function -> BuilderRef -> [Value] -> IO ValueSource
makeInvoke :: BasicBlock -> BasicBlock -> Function -> BuilderRef -> [Value] -> IO ValueSource
makeCallWithCc :: CallingConvention -> Function -> BuilderRef -> [Value] -> IO ValueSource
makeInvokeWithCc :: CallingConvention -> BasicBlock -> BasicBlock -> Function -> BuilderRef -> [Value] -> IO ValueSource
getInstructions :: Value -> IO [(String, Value)]Source
getOperands :: Value -> IO [(String, Value)]Source
Uses and Users
isChildOf :: BasicBlock -> Value -> IO BoolSource
Misc
withArrayLen :: Storable a => [a] -> (Int -> Ptr a -> IO b) -> IO b
Like withArray
, but the action gets the number of values
as an additional parameter
withEmptyCString :: (CString -> IO a) -> IO aSource
functionType :: Bool -> Type -> [Type] -> TypeSource
buildEmptyPhi :: BuilderRef -> Type -> IO ValueSource
addPhiIns :: Value -> [(Value, BasicBlock)] -> IO ()Source
showTypeOf :: Value -> IO StringSource
getValueNameU :: Value -> IO StringSource
getObjList :: (t1 -> (t2 -> IO [Ptr a]) -> t) -> (t2 -> IO (Ptr a)) -> (Ptr a -> IO (Ptr a)) -> t1 -> tSource
annotateValueList :: [Value] -> IO [(String, Value)]Source
isConstant :: Value -> IO BoolSource
Transformation passes
addCFGSimplificationPass :: PassManager -> IO ()Source
Add a control flow graph simplification pass to the manager.
addConstantPropagationPass :: PassManager -> IO ()Source
Add a constant propagation pass to the manager.
addGVNPass :: PassManager -> IO ()Source
Add a global value numbering pass to the manager.
addReassociatePass :: PassManager -> IO ()Source
addTargetData :: TargetDataRef -> PassManager -> IO ()Source