Safe Haskell | None |
---|---|
Language | Haskell98 |
Synopsis
- class Zero a => Additive a where
- one :: IntegerConstant a => a
- inc :: (IsArithmetic a, IsConst a, Num a) => Value a -> CodeGenFunction r (Value a)
- dec :: (IsArithmetic a, IsConst a, Num a) => Value a -> CodeGenFunction r (Value a)
- class Additive a => PseudoRing a where
- mul :: a -> a -> CodeGenFunction r a
- square :: PseudoRing a => a -> CodeGenFunction r a
- type family Scalar vector
- class (PseudoRing (Scalar v), Additive v) => PseudoModule v where
- class PseudoRing a => Field a where
- fdiv :: a -> a -> CodeGenFunction r a
- class IntegerConstant a where
- fromInteger' :: Integer -> a
- class IntegerConstant a => RationalConstant a where
- fromRational' :: Rational -> a
- idiv :: IsInteger a => Value a -> Value a -> CodeGenFunction r (Value a)
- irem :: IsInteger a => Value a -> Value a -> CodeGenFunction r (Value a)
- class Comparison a => FloatingComparison a where
- fcmp :: FPPredicate -> a -> a -> CodeGenFunction r (CmpResult a)
- class Comparison a where
- cmp :: CmpPredicate -> a -> a -> CodeGenFunction r (CmpResult a)
- type family CmpResult a
- data CmpPredicate
- class Logic a where
- class Additive a => Real a where
- class Real a => Fraction a where
- signedFraction :: Fraction a => a -> CodeGenFunction r a
- addToPhase :: Fraction a => a -> a -> CodeGenFunction r a
- incPhase :: Fraction a => a -> a -> CodeGenFunction r a
- advanceArrayElementPtr :: Value (Ptr a) -> CodeGenFunction r (Value (Ptr a))
- decreaseArrayElementPtr :: Value (Ptr a) -> CodeGenFunction r (Value (Ptr a))
- class Field a => Algebraic a where
- sqrt :: a -> CodeGenFunction r a
- class Algebraic a => Transcendental a where
- exp2 :: IsFloating a => Value a -> CodeGenFunction r (Value a)
- log2 :: IsFloating a => Value a -> CodeGenFunction r (Value a)
- log10 :: IsFloating a => Value a -> CodeGenFunction r (Value a)
arithmetic: generalized and improved type inference
class Zero a => Additive a where Source #
This and the following type classes are intended for arithmetic operations on wrappers around LLVM types. E.g. you might define a fixed point fraction type by
newtype Fixed = Fixed Int32
and then use the same methods for floating point and fixed point arithmetic.
In contrast to the arithmetic methods in the llvm
wrapper,
in our methods the types of operands and result match.
Advantage: Type inference determines most of the types automatically.
Disadvantage: You cannot use constant values directly,
but you have to convert them all to Value
.
Instances
IsArithmetic a => Additive (ConstValue a) Source # | |
IsArithmetic a => Additive (Value a) Source # | |
Additive a => Additive (T a) Source # | |
Additive a => Additive (T a) Source # | |
(Additive a, Additive b) => Additive (a, b) Source # | |
(Positive n, Additive a) => Additive (T n a) Source # | |
(Flags flags, Tuple a, Additive a) => Additive (Context flags a) Source # | |
Defined in LLVM.Extra.FastMath | |
(Additive a, Additive b, Additive c) => Additive (a, b, c) Source # | |
one :: IntegerConstant a => a Source #
class Additive a => PseudoRing a where Source #
Instances
IsArithmetic v => PseudoRing (ConstValue v) Source # | |
Defined in LLVM.Extra.Arithmetic | |
IsArithmetic v => PseudoRing (Value v) Source # | |
Defined in LLVM.Extra.Arithmetic | |
PseudoRing a => PseudoRing (T a) Source # | |
PseudoRing a => PseudoRing (T a) Source # | |
(Positive n, PseudoRing a) => PseudoRing (T n a) Source # | |
(Flags flags, PseudoRing a, Tuple a) => PseudoRing (Context flags a) Source # | |
square :: PseudoRing a => a -> CodeGenFunction r a Source #
type family Scalar vector Source #
Instances
type Scalar (ConstValue a) Source # | |
Defined in LLVM.Extra.Arithmetic | |
type Scalar (Value a) Source # | |
Defined in LLVM.Extra.Arithmetic | |
type Scalar (T a) Source # | |
Defined in LLVM.Extra.Scalar | |
type Scalar (T a) Source # | |
Defined in LLVM.Extra.Multi.Value.Private | |
type Scalar (T n a) Source # | |
Defined in LLVM.Extra.Multi.Vector | |
type Scalar (Context flags a) Source # | |
Defined in LLVM.Extra.FastMath |
class (PseudoRing (Scalar v), Additive v) => PseudoModule v where Source #
Instances
PseudoModule v => PseudoModule (ConstValue v) Source # | |
Defined in LLVM.Extra.Arithmetic | |
PseudoModule v => PseudoModule (Value v) Source # | |
Defined in LLVM.Extra.Arithmetic | |
PseudoRing a => PseudoModule (T a) Source # | |
PseudoModule a => PseudoModule (T a) Source # | |
(Positive n, PseudoModule a) => PseudoModule (T n a) Source # | |
(Flags flags, PseudoModule v, Tuple v, Scalar v ~ a, Tuple a) => PseudoModule (Context flags v) Source # | |
class PseudoRing a => Field a where Source #
Instances
IsFloating v => Field (ConstValue v) Source # | |
Defined in LLVM.Extra.Arithmetic | |
IsFloating v => Field (Value v) Source # | |
Defined in LLVM.Extra.Arithmetic | |
Field a => Field (T a) Source # | |
Field a => Field (T a) Source # | |
(Positive n, Field a) => Field (T n a) Source # | |
(Flags flags, Tuple v, Field v) => Field (Context flags v) Source # | |
class IntegerConstant a where Source #
fromInteger' :: Integer -> a Source #
Instances
IntegerConstant a => IntegerConstant (ConstValue a) Source # | |
Defined in LLVM.Extra.Arithmetic fromInteger' :: Integer -> ConstValue a Source # | |
IntegerConstant a => IntegerConstant (Value a) Source # | |
Defined in LLVM.Extra.Arithmetic fromInteger' :: Integer -> Value a Source # | |
IntegerConstant a => IntegerConstant (T a) Source # | |
Defined in LLVM.Extra.Scalar fromInteger' :: Integer -> T a Source # | |
IntegerConstant a => IntegerConstant (T a) Source # | |
Defined in LLVM.Extra.Multi.Value.Private fromInteger' :: Integer -> T a Source # | |
(Positive n, IntegerConstant a) => IntegerConstant (T n a) Source # | |
Defined in LLVM.Extra.Multi.Vector fromInteger' :: Integer -> T n a Source # | |
(Flags flags, Tuple a, IntegerConstant a) => IntegerConstant (Context flags a) Source # | |
Defined in LLVM.Extra.FastMath fromInteger' :: Integer -> Context flags a Source # |
class IntegerConstant a => RationalConstant a where Source #
fromRational' :: Rational -> a Source #
Instances
RationalConstant a => RationalConstant (ConstValue a) Source # | |
Defined in LLVM.Extra.Arithmetic fromRational' :: Rational -> ConstValue a Source # | |
RationalConstant a => RationalConstant (Value a) Source # | |
Defined in LLVM.Extra.Arithmetic fromRational' :: Rational -> Value a Source # | |
RationalConstant a => RationalConstant (T a) Source # | |
Defined in LLVM.Extra.Scalar fromRational' :: Rational -> T a Source # | |
RationalConstant a => RationalConstant (T a) Source # | |
Defined in LLVM.Extra.Multi.Value.Private fromRational' :: Rational -> T a Source # | |
(Positive n, RationalConstant a) => RationalConstant (T n a) Source # | |
Defined in LLVM.Extra.Multi.Vector fromRational' :: Rational -> T n a Source # | |
(Flags flags, Tuple a, RationalConstant a) => RationalConstant (Context flags a) Source # | |
Defined in LLVM.Extra.FastMath fromRational' :: Rational -> Context flags a Source # |
idiv :: IsInteger a => Value a -> Value a -> CodeGenFunction r (Value a) Source #
In Haskell terms this is a quot
.
class Comparison a => FloatingComparison a where Source #
fcmp :: FPPredicate -> a -> a -> CodeGenFunction r (CmpResult a) Source #
Instances
(IsFloating a, CmpRet a) => FloatingComparison (ConstValue a) Source # | |
Defined in LLVM.Extra.Arithmetic fcmp :: FPPredicate -> ConstValue a -> ConstValue a -> CodeGenFunction r (CmpResult (ConstValue a)) Source # | |
(IsFloating a, CmpRet a) => FloatingComparison (Value a) Source # | |
Defined in LLVM.Extra.Arithmetic fcmp :: FPPredicate -> Value a -> Value a -> CodeGenFunction r (CmpResult (Value a)) Source # | |
FloatingComparison a => FloatingComparison (T a) Source # | |
Defined in LLVM.Extra.Multi.Value.Private | |
(Positive n, FloatingComparison a) => FloatingComparison (T n a) Source # | |
Defined in LLVM.Extra.Multi.Vector | |
(Flags flags, Tuple a, FloatingComparison a) => FloatingComparison (Context flags a) Source # | |
Defined in LLVM.Extra.FastMath |
class Comparison a where Source #
cmp :: CmpPredicate -> a -> a -> CodeGenFunction r (CmpResult a) Source #
Instances
CmpRet a => Comparison (ConstValue a) Source # | |
Defined in LLVM.Extra.Arithmetic cmp :: CmpPredicate -> ConstValue a -> ConstValue a -> CodeGenFunction r (CmpResult (ConstValue a)) Source # | |
CmpRet a => Comparison (Value a) Source # | |
Defined in LLVM.Extra.Arithmetic cmp :: CmpPredicate -> Value a -> Value a -> CodeGenFunction r (CmpResult (Value a)) Source # | |
Comparison a => Comparison (T a) Source # | |
(Positive n, Comparison a) => Comparison (T n a) Source # | |
(Flags flags, Tuple a, Comparison a) => Comparison (Context flags a) Source # | |
type family CmpResult a Source #
Instances
type CmpResult (ConstValue a) Source # | |
Defined in LLVM.Extra.Arithmetic type CmpResult (ConstValue a) = ConstValue (CmpResult a) | |
type CmpResult (Value a) Source # | |
Defined in LLVM.Extra.Arithmetic type CmpResult (Value a) = Value (CmpResult a) | |
type CmpResult (T a) Source # | |
Defined in LLVM.Extra.Multi.Value.Private | |
type CmpResult (T n a) Source # | |
Defined in LLVM.Extra.Multi.Vector | |
type CmpResult (Context flags a) Source # | |
Defined in LLVM.Extra.FastMath |
data CmpPredicate #
Instances
and :: a -> a -> CodeGenFunction r a Source #
or :: a -> a -> CodeGenFunction r a Source #
Instances
IsInteger a => Logic (ConstValue a) Source # | |
Defined in LLVM.Extra.Arithmetic and :: ConstValue a -> ConstValue a -> CodeGenFunction r (ConstValue a) Source # or :: ConstValue a -> ConstValue a -> CodeGenFunction r (ConstValue a) Source # xor :: ConstValue a -> ConstValue a -> CodeGenFunction r (ConstValue a) Source # inv :: ConstValue a -> CodeGenFunction r (ConstValue a) Source # | |
IsInteger a => Logic (Value a) Source # | |
Logic a => Logic (T a) Source # | |
(Positive n, Logic a) => Logic (T n a) Source # | |
class Additive a => Real a where Source #
min :: a -> a -> CodeGenFunction r a Source #
max :: a -> a -> CodeGenFunction r a Source #
Instances
Real a => Real (Value a) Source # | |
Real a => Real (T a) Source # | |
Real a => Real (T a) Source # | |
(Positive n, Real a) => Real (T n a) Source # | |
(Flags flags, Tuple a, Real a) => Real (Context flags a) Source # | |
Defined in LLVM.Extra.FastMath min :: Context flags a -> Context flags a -> CodeGenFunction r (Context flags a) Source # max :: Context flags a -> Context flags a -> CodeGenFunction r (Context flags a) Source # abs :: Context flags a -> CodeGenFunction r (Context flags a) Source # signum :: Context flags a -> CodeGenFunction r (Context flags a) Source # |
signedFraction :: Fraction a => a -> CodeGenFunction r a Source #
addToPhase :: Fraction a => a -> a -> CodeGenFunction r a Source #
incPhase :: Fraction a => a -> a -> CodeGenFunction r a Source #
both increment and phase must be non-negative
pointer arithmetic
advanceArrayElementPtr :: Value (Ptr a) -> CodeGenFunction r (Value (Ptr a)) #
decreaseArrayElementPtr :: Value (Ptr a) -> CodeGenFunction r (Value (Ptr a)) #
transcendental functions
class Algebraic a => Transcendental a where Source #
pi :: CodeGenFunction r a Source #
sin :: a -> CodeGenFunction r a Source #
cos :: a -> CodeGenFunction r a Source #
exp :: a -> CodeGenFunction r a Source #
Instances
(IsFloating a, TranscendentalConstant a) => Transcendental (Value a) Source # | |
Defined in LLVM.Extra.Arithmetic pi :: CodeGenFunction r (Value a) Source # sin :: Value a -> CodeGenFunction r (Value a) Source # cos :: Value a -> CodeGenFunction r (Value a) Source # exp :: Value a -> CodeGenFunction r (Value a) Source # log :: Value a -> CodeGenFunction r (Value a) Source # pow :: Value a -> Value a -> CodeGenFunction r (Value a) Source # | |
Transcendental a => Transcendental (T a) Source # | |
Defined in LLVM.Extra.Scalar | |
Transcendental a => Transcendental (T a) Source # | |
Defined in LLVM.Extra.Multi.Value.Private | |
(Positive n, Transcendental a) => Transcendental (T n a) Source # | |
Defined in LLVM.Extra.Multi.Vector | |
(Flags flags, Tuple a, Transcendental a) => Transcendental (Context flags a) Source # | |
Defined in LLVM.Extra.FastMath pi :: CodeGenFunction r (Context flags a) Source # sin :: Context flags a -> CodeGenFunction r (Context flags a) Source # cos :: Context flags a -> CodeGenFunction r (Context flags a) Source # exp :: Context flags a -> CodeGenFunction r (Context flags a) Source # log :: Context flags a -> CodeGenFunction r (Context flags a) Source # pow :: Context flags a -> Context flags a -> CodeGenFunction r (Context flags a) Source # |