llvm-dsl-0.1.2: Support for writing an EDSL with LLVM-JIT as target
Safe HaskellSafe-Inferred
LanguageHaskell98

LLVM.DSL.Expression

Synopsis

Documentation

newtype Exp a Source #

Constructors

Exp 

Fields

Instances

Instances details
Value Exp Source # 
Instance details

Defined in LLVM.DSL.Expression

Methods

lift0 :: T a -> Exp a Source #

lift1 :: (T a -> T b) -> Exp a -> Exp b Source #

lift2 :: (T a -> T b -> T c) -> Exp a -> Exp b -> Exp c Source #

(Transcendental a, Real a, RationalConstant a) => Floating (Exp a) Source # 
Instance details

Defined in LLVM.DSL.Expression

Methods

pi :: Exp a #

exp :: Exp a -> Exp a #

log :: Exp a -> Exp a #

sqrt :: Exp a -> Exp a #

(**) :: Exp a -> Exp a -> Exp a #

logBase :: Exp a -> Exp a -> Exp a #

sin :: Exp a -> Exp a #

cos :: Exp a -> Exp a #

tan :: Exp a -> Exp a #

asin :: Exp a -> Exp a #

acos :: Exp a -> Exp a #

atan :: Exp a -> Exp a #

sinh :: Exp a -> Exp a #

cosh :: Exp a -> Exp a #

tanh :: Exp a -> Exp a #

asinh :: Exp a -> Exp a #

acosh :: Exp a -> Exp a #

atanh :: Exp a -> Exp a #

log1p :: Exp a -> Exp a #

expm1 :: Exp a -> Exp a #

log1pexp :: Exp a -> Exp a #

log1mexp :: Exp a -> Exp a #

(PseudoRing a, Real a, IntegerConstant a) => Num (Exp a) Source # 
Instance details

Defined in LLVM.DSL.Expression

Methods

(+) :: Exp a -> Exp a -> Exp a #

(-) :: Exp a -> Exp a -> Exp a #

(*) :: Exp a -> Exp a -> Exp a #

negate :: Exp a -> Exp a #

abs :: Exp a -> Exp a #

signum :: Exp a -> Exp a #

fromInteger :: Integer -> Exp a #

(Field a, Real a, RationalConstant a) => Fractional (Exp a) Source # 
Instance details

Defined in LLVM.DSL.Expression

Methods

(/) :: Exp a -> Exp a -> Exp a #

recip :: Exp a -> Exp a #

fromRational :: Rational -> Exp a #

Compose (Exp a) Source # 
Instance details

Defined in LLVM.DSL.Expression

Associated Types

type Composed (Exp a) Source #

Methods

compose :: Exp a -> Exp (Composed (Exp a)) Source #

(Real a, PseudoRing a, IntegerConstant a) => C (Exp a) Source # 
Instance details

Defined in LLVM.DSL.Expression

Methods

abs :: Exp a -> Exp a #

signum :: Exp a -> Exp a #

Additive a => C (Exp a) Source #

We do not require a numeric prelude superclass, thus also LLVM only types like vectors are instances.

Instance details

Defined in LLVM.DSL.Expression

Methods

zero :: Exp a #

(+) :: Exp a -> Exp a -> Exp a #

(-) :: Exp a -> Exp a -> Exp a #

negate :: Exp a -> Exp a #

(Transcendental a, RationalConstant a) => C (Exp a) Source # 
Instance details

Defined in LLVM.DSL.Expression

Methods

sqrt :: Exp a -> Exp a #

root :: Integer -> Exp a -> Exp a #

(^/) :: Exp a -> Rational -> Exp a #

(Field a, RationalConstant a) => C (Exp a) Source # 
Instance details

Defined in LLVM.DSL.Expression

Methods

(/) :: Exp a -> Exp a -> Exp a #

recip :: Exp a -> Exp a #

fromRational' :: Rational -> Exp a #

(^-) :: Exp a -> Integer -> Exp a #

(PseudoRing a, IntegerConstant a) => C (Exp a) Source # 
Instance details

Defined in LLVM.DSL.Expression

Methods

(*) :: Exp a -> Exp a -> Exp a #

one :: Exp a #

fromInteger :: Integer -> Exp a #

(^) :: Exp a -> Integer -> Exp a #

(Transcendental a, RationalConstant a) => C (Exp a) Source # 
Instance details

Defined in LLVM.DSL.Expression

Methods

pi :: Exp a #

exp :: Exp a -> Exp a #

log :: Exp a -> Exp a #

logBase :: Exp a -> Exp a -> Exp a #

(**) :: Exp a -> Exp a -> Exp a #

sin :: Exp a -> Exp a #

cos :: Exp a -> Exp a #

tan :: Exp a -> Exp a #

asin :: Exp a -> Exp a #

acos :: Exp a -> Exp a #

atan :: Exp a -> Exp a #

sinh :: Exp a -> Exp a #

cosh :: Exp a -> Exp a #

tanh :: Exp a -> Exp a #

asinh :: Exp a -> Exp a #

acosh :: Exp a -> Exp a #

atanh :: Exp a -> Exp a #

Aggregate (Exp a) (T a) Source # 
Instance details

Defined in LLVM.DSL.Expression

Associated Types

type MultiValuesOf (Exp a) Source #

type ExpressionsOf (T a) Source #

Methods

bundle :: Exp a -> CodeGenFunction r (T a) Source #

dissect :: T a -> Exp a Source #

(a ~ Scalar v, PseudoModule v, IntegerConstant a) => C (Exp a) (Exp v) Source # 
Instance details

Defined in LLVM.DSL.Expression

Methods

(*>) :: Exp a -> Exp v -> Exp v #

type Composed (Exp a) Source # 
Instance details

Defined in LLVM.DSL.Expression

type Composed (Exp a) = a
type MultiValuesOf (Exp a) Source # 
Instance details

Defined in LLVM.DSL.Expression

type MultiValuesOf (Exp a) = T a

unique :: (forall r. CodeGenFunction r (T a)) -> Exp a Source #

_unique :: (forall r. CodeGenFunction r (T a)) -> Exp a Source #

withKey :: (forall r. CodeGenFunction r (T a)) -> IORef (Maybe (T a)) -> Exp a Source #

with :: Exp a -> (Exp a -> Exp b) -> Exp b Source #

class Value val where Source #

Methods

lift0 :: T a -> val a Source #

lift1 :: (T a -> T b) -> val a -> val b Source #

lift2 :: (T a -> T b -> T c) -> val a -> val b -> val c Source #

Instances

Instances details
Value Exp Source # 
Instance details

Defined in LLVM.DSL.Expression

Methods

lift0 :: T a -> Exp a Source #

lift1 :: (T a -> T b) -> Exp a -> Exp b Source #

lift2 :: (T a -> T b -> T c) -> Exp a -> Exp b -> Exp c Source #

Value T Source # 
Instance details

Defined in LLVM.DSL.Expression

Methods

lift0 :: T a -> T a Source #

lift1 :: (T a -> T b) -> T a -> T b Source #

lift2 :: (T a -> T b -> T c) -> T a -> T b -> T c Source #

lift3 :: Value val => (T a -> T b -> T c -> T d) -> val a -> val b -> val c -> val d Source #

lift4 :: Value val => (T a -> T b -> T c -> T d -> T e) -> val a -> val b -> val c -> val d -> val e Source #

liftM :: Aggregate ae am => (forall r. am -> CodeGenFunction r (T b)) -> ae -> Exp b Source #

liftM2 :: Aggregate ae am => Aggregate be bm => (forall r. am -> bm -> CodeGenFunction r (T c)) -> ae -> be -> Exp c Source #

liftM3 :: Aggregate ae am => Aggregate be bm => Aggregate ce cm => (forall r. am -> bm -> cm -> CodeGenFunction r (T d)) -> ae -> be -> ce -> Exp d Source #

unliftM1 :: Aggregate ae am => Aggregate be bm => (ae -> be) -> am -> CodeGenFunction r bm Source #

unliftM2 :: Aggregate ae am => Aggregate be bm => Aggregate ce cm => (ae -> be -> ce) -> am -> bm -> CodeGenFunction r cm Source #

unliftM3 :: Aggregate ae am => Aggregate be bm => Aggregate ce cm => Aggregate de dm => (ae -> be -> ce -> de) -> am -> bm -> cm -> CodeGenFunction r dm Source #

unliftM4 :: Aggregate ae am => Aggregate be bm => Aggregate ce cm => Aggregate de dm => Aggregate ee em => (ae -> be -> ce -> de -> ee) -> am -> bm -> cm -> dm -> CodeGenFunction r em Source #

liftReprM :: (forall r. Repr a -> CodeGenFunction r (Repr b)) -> Exp a -> Exp b Source #

liftReprM2 :: (forall r. Repr a -> Repr b -> CodeGenFunction r (Repr c)) -> Exp a -> Exp b -> Exp c Source #

liftReprM3 :: (forall r. Repr a -> Repr b -> Repr c -> CodeGenFunction r (Repr d)) -> Exp a -> Exp b -> Exp c -> Exp d Source #

zip :: Value val => val a -> val b -> val (a, b) Source #

zip3 :: Value val => val a -> val b -> val c -> val (a, b, c) Source #

zip4 :: Value val => val a -> val b -> val c -> val d -> val (a, b, c, d) Source #

unzip :: Value val => val (a, b) -> (val a, val b) Source #

unzip3 :: Value val => val (a, b, c) -> (val a, val b, val c) Source #

unzip4 :: Value val => val (a, b, c, d) -> (val a, val b, val c, val d) Source #

fst :: Value val => val (a, b) -> val a Source #

snd :: Value val => val (a, b) -> val b Source #

mapFst :: (Exp a -> Exp b) -> Exp (a, c) -> Exp (b, c) Source #

mapSnd :: (Exp b -> Exp c) -> Exp (a, b) -> Exp (a, c) Source #

mapPair :: (Exp a0 -> Exp a1, Exp b0 -> Exp b1) -> Exp (a0, b0) -> Exp (a1, b1) Source #

swap :: Value val => val (a, b) -> val (b, a) Source #

curry :: (Exp (a, b) -> c) -> Exp a -> Exp b -> c Source #

uncurry :: (Exp a -> Exp b -> c) -> Exp (a, b) -> c Source #

fst3 :: Value val => val (a, b, c) -> val a Source #

snd3 :: Value val => val (a, b, c) -> val b Source #

thd3 :: Value val => val (a, b, c) -> val c Source #

mapFst3 :: (Exp a0 -> Exp a1) -> Exp (a0, b, c) -> Exp (a1, b, c) Source #

mapSnd3 :: (Exp b0 -> Exp b1) -> Exp (a, b0, c) -> Exp (a, b1, c) Source #

mapThd3 :: (Exp c0 -> Exp c1) -> Exp (a, b, c0) -> Exp (a, b, c1) Source #

mapTriple :: (Exp a0 -> Exp a1, Exp b0 -> Exp b1, Exp c0 -> Exp c1) -> Exp (a0, b0, c0) -> Exp (a1, b1, c1) Source #

tuple :: Exp tuple -> Exp (Tuple tuple) Source #

untuple :: Exp (Tuple tuple) -> Exp tuple Source #

modifyMultiValue :: (Value val, Compose a, Decompose pattern, PatternTuple pattern ~ tuple) => pattern -> (Decomposed T pattern -> a) -> val tuple -> val (Composed a) Source #

modifyMultiValue2 :: (Value val, Compose a, Decompose patternA, Decompose patternB, PatternTuple patternA ~ tupleA, PatternTuple patternB ~ tupleB) => patternA -> patternB -> (Decomposed T patternA -> Decomposed T patternB -> a) -> val tupleA -> val tupleB -> val (Composed a) Source #

modifyMultiValueM :: (Compose a, Decompose pattern, PatternTuple pattern ~ tuple) => pattern -> (forall r. Decomposed T pattern -> CodeGenFunction r a) -> Exp tuple -> Exp (Composed a) Source #

modifyMultiValueM2 :: (Compose a, Decompose patternA, Decompose patternB, PatternTuple patternA ~ tupleA, PatternTuple patternB ~ tupleB) => patternA -> patternB -> (forall r. Decomposed T patternA -> Decomposed T patternB -> CodeGenFunction r a) -> Exp tupleA -> Exp tupleB -> Exp (Composed a) Source #

class Compose multituple where Source #

Associated Types

type Composed multituple Source #

Methods

compose :: multituple -> Exp (Composed multituple) Source #

A nested zip.

Instances

Instances details
Compose () Source # 
Instance details

Defined in LLVM.DSL.Expression

Associated Types

type Composed () Source #

Methods

compose :: () -> Exp (Composed ()) Source #

Compose a => Compose (Complex a) Source # 
Instance details

Defined in LLVM.DSL.Expression

Associated Types

type Composed (Complex a) Source #

Methods

compose :: Complex a -> Exp (Composed (Complex a)) Source #

Compose (Exp a) Source # 
Instance details

Defined in LLVM.DSL.Expression

Associated Types

type Composed (Exp a) Source #

Methods

compose :: Exp a -> Exp (Composed (Exp a)) Source #

Compose tuple => Compose (Tuple tuple) Source # 
Instance details

Defined in LLVM.DSL.Expression

Associated Types

type Composed (Tuple tuple) Source #

Methods

compose :: Tuple tuple -> Exp (Composed (Tuple tuple)) Source #

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

Defined in LLVM.DSL.Expression

Associated Types

type Composed (a, b) Source #

Methods

compose :: (a, b) -> Exp (Composed (a, b)) Source #

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

Defined in LLVM.DSL.Expression

Associated Types

type Composed (a, b, c) Source #

Methods

compose :: (a, b, c) -> Exp (Composed (a, b, c)) Source #

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

Defined in LLVM.DSL.Expression

Associated Types

type Composed (a, b, c, d) Source #

Methods

compose :: (a, b, c, d) -> Exp (Composed (a, b, c, d)) Source #

class Composed (Decomposed Exp pattern) ~ PatternTuple pattern => Decompose pattern where Source #

Methods

decompose :: pattern -> Exp (PatternTuple pattern) -> Decomposed Exp pattern Source #

Analogous to decompose.

Instances

Instances details
Decompose () Source # 
Instance details

Defined in LLVM.DSL.Expression

Methods

decompose :: () -> Exp (PatternTuple ()) -> Decomposed Exp () Source #

Decompose p => Decompose (Complex p) Source # 
Instance details

Defined in LLVM.DSL.Expression

Decompose (Atom a) Source # 
Instance details

Defined in LLVM.DSL.Expression

Decompose p => Decompose (Tuple p) Source # 
Instance details

Defined in LLVM.DSL.Expression

(Decompose pa, Decompose pb) => Decompose (pa, pb) Source # 
Instance details

Defined in LLVM.DSL.Expression

Methods

decompose :: (pa, pb) -> Exp (PatternTuple (pa, pb)) -> Decomposed Exp (pa, pb) Source #

(Decompose pa, Decompose pb, Decompose pc) => Decompose (pa, pb, pc) Source # 
Instance details

Defined in LLVM.DSL.Expression

Methods

decompose :: (pa, pb, pc) -> Exp (PatternTuple (pa, pb, pc)) -> Decomposed Exp (pa, pb, pc) Source #

(Decompose pa, Decompose pb, Decompose pc, Decompose pd) => Decompose (pa, pb, pc, pd) Source # 
Instance details

Defined in LLVM.DSL.Expression

Methods

decompose :: (pa, pb, pc, pd) -> Exp (PatternTuple (pa, pb, pc, pd)) -> Decomposed Exp (pa, pb, pc, pd) Source #

modify :: (Compose a, Decompose pattern) => pattern -> (Decomposed Exp pattern -> a) -> Exp (PatternTuple pattern) -> Exp (Composed a) Source #

Analogus to modifyMultiValue.

modify2 :: (Compose a, Decompose patternA, Decompose patternB) => patternA -> patternB -> (Decomposed Exp patternA -> Decomposed Exp patternB -> a) -> Exp (PatternTuple patternA) -> Exp (PatternTuple patternB) -> Exp (Composed a) Source #

consComplex :: Exp a -> Exp a -> Exp (Complex a) Source #

You can construct complex numbers this way, but they will not make you happy, because the numeric operations require a RealFloat instance that we could only provide with lots of undefined methods (also in its superclasses). You may either define your own arithmetic or use the NumericPrelude type classes.

class (MultiValuesOf exp ~ mv, ExpressionsOf mv ~ exp) => Aggregate exp mv where Source #

Associated Types

type MultiValuesOf exp Source #

type ExpressionsOf mv Source #

Methods

bundle :: exp -> CodeGenFunction r mv Source #

dissect :: mv -> exp Source #

Instances

Instances details
Aggregate (Exp a) (T a) Source # 
Instance details

Defined in LLVM.DSL.Expression

Associated Types

type MultiValuesOf (Exp a) Source #

type ExpressionsOf (T a) Source #

Methods

bundle :: Exp a -> CodeGenFunction r (T a) Source #

dissect :: T a -> Exp a Source #

Aggregate exp mv => Aggregate (Scalar exp) (T mv) Source # 
Instance details

Defined in LLVM.DSL.Expression

Associated Types

type MultiValuesOf (Scalar exp) Source #

type ExpressionsOf (T mv) Source #

Methods

bundle :: Scalar exp -> CodeGenFunction r (T mv) Source #

dissect :: T mv -> Scalar exp Source #

Aggregate exp mv => Aggregate (T exp) (T mv) Source # 
Instance details

Defined in LLVM.DSL.Expression.Maybe

Associated Types

type MultiValuesOf (T exp) Source #

type ExpressionsOf (T mv) Source #

Methods

bundle :: T exp -> CodeGenFunction r (T0 mv) Source #

dissect :: T0 mv -> T exp Source #

Aggregate ae al => Aggregate (T ae) (T al) Source # 
Instance details

Defined in LLVM.DSL.Expression

Associated Types

type MultiValuesOf (T ae) Source #

type ExpressionsOf (T al) Source #

Methods

bundle :: T ae -> CodeGenFunction r (T al) Source #

dissect :: T al -> T ae Source #

(Aggregate ae al, Aggregate be bl) => Aggregate (ae, be) (al, bl) Source # 
Instance details

Defined in LLVM.DSL.Expression

Associated Types

type MultiValuesOf (ae, be) Source #

type ExpressionsOf (al, bl) Source #

Methods

bundle :: (ae, be) -> CodeGenFunction r (al, bl) Source #

dissect :: (al, bl) -> (ae, be) Source #

(Aggregate ae al, Aggregate be bl, Aggregate ce cl) => Aggregate (ae, be, ce) (al, bl, cl) Source # 
Instance details

Defined in LLVM.DSL.Expression

Associated Types

type MultiValuesOf (ae, be, ce) Source #

type ExpressionsOf (al, bl, cl) Source #

Methods

bundle :: (ae, be, ce) -> CodeGenFunction r (al, bl, cl) Source #

dissect :: (al, bl, cl) -> (ae, be, ce) Source #

(Aggregate ae al, Aggregate be bl, Aggregate ce cl, Aggregate de dl) => Aggregate (ae, be, ce, de) (al, bl, cl, dl) Source # 
Instance details

Defined in LLVM.DSL.Expression

Associated Types

type MultiValuesOf (ae, be, ce, de) Source #

type ExpressionsOf (al, bl, cl, dl) Source #

Methods

bundle :: (ae, be, ce, de) -> CodeGenFunction r (al, bl, cl, dl) Source #

dissect :: (al, bl, cl, dl) -> (ae, be, ce, de) Source #

newtype Scalar a Source #

Constructors

Scalar a 

Instances

Instances details
C a => C (Scalar a) Source # 
Instance details

Defined in LLVM.DSL.Expression

Methods

zero :: Scalar a #

(+) :: Scalar a -> Scalar a -> Scalar a #

(-) :: Scalar a -> Scalar a -> Scalar a #

negate :: Scalar a -> Scalar a #

C a => C (Scalar a) Source # 
Instance details

Defined in LLVM.DSL.Expression

Methods

(*) :: Scalar a -> Scalar a -> Scalar a #

one :: Scalar a #

fromInteger :: Integer -> Scalar a #

(^) :: Scalar a -> Integer -> Scalar a #

Aggregate exp mv => Aggregate (Scalar exp) (T mv) Source # 
Instance details

Defined in LLVM.DSL.Expression

Associated Types

type MultiValuesOf (Scalar exp) Source #

type ExpressionsOf (T mv) Source #

Methods

bundle :: Scalar exp -> CodeGenFunction r (T mv) Source #

dissect :: T mv -> Scalar exp Source #

(C a, a ~ b) => C (Scalar a) (Scalar b) Source # 
Instance details

Defined in LLVM.DSL.Expression

Methods

(*>) :: Scalar a -> Scalar b -> Scalar b #

type MultiValuesOf (Scalar exp) Source # 
Instance details

Defined in LLVM.DSL.Expression

type MultiValuesOf (Scalar exp) = T (MultiValuesOf exp)

cons :: C a => a -> Exp a Source #

zero :: C a => Exp a Source #

add :: Additive a => Exp a -> Exp a -> Exp a Source #

sub :: Additive a => Exp a -> Exp a -> Exp a Source #

neg :: Additive a => Exp a -> Exp a Source #

mul :: PseudoRing a => Exp a -> Exp a -> Exp a Source #

sqr :: PseudoRing a => Exp a -> Exp a Source #

recip :: (Field a, IntegerConstant a) => Exp a -> Exp a Source #

fdiv :: Field a => Exp a -> Exp a -> Exp a Source #

sqrt :: Algebraic a => Exp a -> Exp a Source #

pow :: Transcendental a => Exp a -> Exp a -> Exp a Source #

idiv :: Integral a => Exp a -> Exp a -> Exp a Source #

irem :: Integral a => Exp a -> Exp a -> Exp a Source #

shl :: BitShift a => Exp a -> Exp a -> Exp a Source #

shr :: BitShift a => Exp a -> Exp a -> Exp a Source #

toEnum :: Repr w ~ Value w => Exp w -> Exp (T w e) Source #

fromEnum :: Repr w ~ Value w => Exp (T w e) -> Exp w Source #

succ :: (IsArithmetic w, IntegerConstant w) => Exp (T w e) -> Exp (T w e) Source #

pred :: (IsArithmetic w, IntegerConstant w) => Exp (T w e) -> Exp (T w e) Source #

fromFastMath :: Exp (Number flags a) -> Exp a Source #

toFastMath :: Exp a -> Exp (Number flags a) Source #

(==*) :: Comparison a => Exp a -> Exp a -> Exp Bool infix 4 Source #

(/=*) :: Comparison a => Exp a -> Exp a -> Exp Bool infix 4 Source #

(<*) :: Comparison a => Exp a -> Exp a -> Exp Bool infix 4 Source #

(>=*) :: Comparison a => Exp a -> Exp a -> Exp Bool infix 4 Source #

(>*) :: Comparison a => Exp a -> Exp a -> Exp Bool infix 4 Source #

(<=*) :: Comparison a => Exp a -> Exp a -> Exp Bool infix 4 Source #

min :: Real a => Exp a -> Exp a -> Exp a Source #

max :: Real a => Exp a -> Exp a -> Exp a Source #

limit :: Real a => (Exp a, Exp a) -> Exp a -> Exp a Source #

fraction :: Fraction a => Exp a -> Exp a Source #

(&&*) :: Exp Bool -> Exp Bool -> Exp Bool infixr 3 Source #

(||*) :: Exp Bool -> Exp Bool -> Exp Bool infixr 2 Source #

select :: Select a => Exp Bool -> Exp a -> Exp a -> Exp a Source #

Like ifThenElse but computes both alternative expressions and then uses LLVM's efficient select instruction.

ifThenElse :: C a => Exp Bool -> Exp a -> Exp a -> Exp a Source #

complement :: Logic a => Exp a -> Exp a Source #

(.&.*) :: Logic a => Exp a -> Exp a -> Exp a infixl 7 Source #

(.|.*) :: Logic a => Exp a -> Exp a -> Exp a infixl 5 Source #

xor :: Logic a => Exp a -> Exp a -> Exp a infixl 6 Source #

toMaybe :: Exp Bool -> Exp a -> Exp (Maybe a) Source #

maybe :: C b => Exp b -> (Exp a -> Exp b) -> Exp (Maybe a) -> Exp b Source #