llvm-extra-0.7.1: Utility functions for the llvm interface

Safe HaskellNone

LLVM.Extra.Control

Description

Useful control structures additionally to those in LLVM.Util.Loop.

Synopsis

Documentation

arrayLoop :: (Phi a, IsType b, Num i, IsConst i, IsInteger i, CmpRet i, CmpResult i ~ Bool) => Value i -> Value (Ptr b) -> a -> (Value (Ptr b) -> a -> CodeGenFunction r a) -> CodeGenFunction r aSource

arrayLoop2 :: (Phi s, IsType a, IsType b, Num i, IsConst i, IsInteger i, CmpRet i, CmpResult i ~ Bool) => Value i -> Value (Ptr a) -> Value (Ptr b) -> s -> (Value (Ptr a) -> Value (Ptr b) -> s -> CodeGenFunction r s) -> CodeGenFunction r sSource

arrayLoopWithExit :: (Phi s, IsType a, Num i, IsConst i, IsInteger i, CmpRet i, CmpResult i ~ Bool) => Value i -> Value (Ptr a) -> s -> (Value (Ptr a) -> s -> CodeGenFunction r (Value Bool, s)) -> CodeGenFunction r (Value i, s)Source

arrayLoop2WithExit :: (Phi s, IsType a, IsType b, Num i, IsConst i, IsInteger i, CmpRet i, CmpResult i ~ Bool) => Value i -> Value (Ptr a) -> Value (Ptr b) -> s -> (Value (Ptr a) -> Value (Ptr b) -> s -> CodeGenFunction r (Value Bool, s)) -> CodeGenFunction r (Value i, s)Source

fixedLengthLoop :: (Phi s, Num i, IsConst i, IsInteger i, CmpRet i, CmpResult i ~ Bool) => Value i -> s -> (s -> CodeGenFunction r s) -> CodeGenFunction r sSource

whileLoop :: Phi a => a -> (a -> CodeGenFunction r (Value Bool)) -> (a -> CodeGenFunction r a) -> CodeGenFunction r aSource

whileLoopShared :: Phi a => a -> (a -> (CodeGenFunction r (Value Bool), CodeGenFunction r a)) -> CodeGenFunction r aSource

This is a variant of whileLoop that may be more convient, because you only need one lambda expression for both loop condition and loop body.

loopWithExit :: Phi a => a -> (a -> CodeGenFunction r (Value Bool, b)) -> (b -> CodeGenFunction r a) -> CodeGenFunction r bSource

ifThenElse :: Phi a => Value Bool -> CodeGenFunction r a -> CodeGenFunction r a -> CodeGenFunction r aSource

This construct starts new blocks, so be prepared when continueing after an ifThenElse.

class Phi a => Select a whereSource

Methods

select :: Value Bool -> a -> a -> CodeGenFunction r aSource

Instances

Select () 
(IsFirstClass a, CmpRet a, ~ * (CmpResult a) Bool) => Select (Value a) 
Select a => Select (T a) 
(Select a, Select b) => Select (a, b) 
(Select a, Select b, Select c) => Select (a, b, c) 

ifThenSelect :: Select a => Value Bool -> a -> CodeGenFunction r a -> CodeGenFunction r aSource

Branch-free variant of ifThen that is faster if the enclosed block is very simply, say, if it contains at most two instructions. It can only be used as alternative to ifThen if the enclosed block is free of side effects.