llvm-extra-0.12.0.1: Utility functions for the llvm interface
Safe HaskellSafe-Inferred
LanguageHaskell98

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, IsPrimitive i) => Value i -> Value (Ptr b) -> a -> (Value (Ptr b) -> a -> CodeGenFunction r a) -> CodeGenFunction r a Source #

arrayLoop2 :: (Phi s, IsType a, IsType b, Num i, IsConst i, IsInteger i, CmpRet i, IsPrimitive i) => Value i -> Value (Ptr a) -> Value (Ptr b) -> s -> (Value (Ptr a) -> Value (Ptr b) -> s -> CodeGenFunction r s) -> CodeGenFunction r s Source #

arrayLoopWithExit :: (Phi s, IsType a, Num i, IsConst i, IsInteger i, CmpRet i, IsPrimitive i) => 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, IsPrimitive i) => 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, IsPrimitive i) => Value i -> s -> (s -> CodeGenFunction r s) -> CodeGenFunction r s Source #

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

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

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 b Source #

This is a loop with a single point for exit from within the loop. The Bool value indicates whether the loop shall be continued.

ifThenElse :: Phi a => Value Bool -> CodeGenFunction r a -> CodeGenFunction r a -> CodeGenFunction r a Source #

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

class Phi a => Select a where Source #

Methods

select :: Value Bool -> a -> a -> CodeGenFunction r a Source #

Instances

Instances details
Select () Source # 
Instance details

Defined in LLVM.Extra.Control

Methods

select :: Value Bool -> () -> () -> CodeGenFunction r () Source #

Select a => Select (T a) Source # 
Instance details

Defined in LLVM.Extra.Multi.Value.Private

Methods

select :: Value Bool -> T a -> T a -> CodeGenFunction r (T a) Source #

(CmpRet a, IsPrimitive a) => Select (Value a) Source # 
Instance details

Defined in LLVM.Extra.Control

Methods

select :: Value Bool -> Value a -> Value a -> CodeGenFunction r (Value a) Source #

(Select a, Select b) => Select (a, b) Source # 
Instance details

Defined in LLVM.Extra.Control

Methods

select :: Value Bool -> (a, b) -> (a, b) -> CodeGenFunction r (a, b) Source #

(Select a, Select b, Select c) => Select (a, b, c) Source # 
Instance details

Defined in LLVM.Extra.Control

Methods

select :: Value Bool -> (a, b, c) -> (a, b, c) -> CodeGenFunction r (a, b, c) Source #

ifThenSelect :: Select a => Value Bool -> a -> CodeGenFunction r a -> CodeGenFunction r a Source #

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.

ret :: Value a -> CodeGenFunction a () Source #

ret terminates a basic block which interferes badly with other control structures in this module. If you use the control structures then better use LLVM.Extra.Function.