| Safe Haskell | None | 
|---|---|
| Language | Haskell2010 | 
Feldspar.Optimize
Description
Optimize Feldspar expressions
Synopsis
- witInteger :: ASTF FeldDomain a -> Maybe (Dict (Integral a, Ord a))
 - isExact :: ASTF FeldDomain a -> Bool
 - prj' :: sub :<: sup => sup sig -> Maybe (sub sig)
 - pattern SymP :: forall sub (sup :: Type -> Type) sig. sub :<: sup => TypeRep (DenResult sig) -> sub sig -> AST (sup :&: TypeRepFun) sig
 - pattern VarP :: forall (sup :: Type -> Type) info sig a. BindingT :<: sup => forall. (sig ~ Full a, Typeable a) => info (DenResult sig) -> Name -> AST (sup :&: info) sig
 - pattern LamP :: forall (sup :: Type -> Type) info sig a1 a2 b. BindingT :<: sup => forall. ((a1 :-> sig) ~ (b :-> Full (a2 -> b)), Typeable a2) => info (DenResult (a1 :-> sig)) -> Name -> AST (sup :&: info) (Full a1) -> AST (sup :&: info) sig
 - pattern LitP :: () => (Eq a, Show a) => TypeRep a -> a -> ASTF FeldDomain a
 - pattern AddP :: () => (Num a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a -> ASTF FeldDomain a
 - pattern SubP :: () => (Num a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a -> ASTF FeldDomain a
 - pattern MulP :: () => (Num a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a -> ASTF FeldDomain a
 - pattern NegP :: () => (Num a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a
 - pattern QuotP :: () => (Integral a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a -> ASTF FeldDomain a
 - pattern RemP :: () => (Integral a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a -> ASTF FeldDomain a
 - pattern DivP :: () => (Integral a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a -> ASTF FeldDomain a
 - pattern ModP :: () => (Integral a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a -> ASTF FeldDomain a
 - pattern DivBalancedP :: () => (Integral a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a -> ASTF FeldDomain a
 - viewLit :: ASTF FeldDomain a -> Maybe a
 - pattern NonLitP :: ASTF FeldDomain a
 - simplifyUp :: ASTF FeldDomain a -> ASTF FeldDomain a
 - constFold :: ASTF FeldDomain a -> ASTF FeldDomain a
 - constArgs :: AST FeldDomain sig -> Bool
 - type OptEnv = Selection AssertionLabel
 - type Opt = ReaderT OptEnv (Writer (Set Name, Any))
 - tellVar :: Name -> Opt ()
 - deleteVar :: Name -> Opt a -> Opt a
 - tellUnsafe :: Opt ()
 - simplifyM :: ASTF FeldDomain a -> Opt (ASTF FeldDomain a)
 - simplify :: OptEnv -> ASTF FeldDomain a -> ASTF FeldDomain a
 - cmInterface :: CodeMotionInterface FeldDomain
 - optimize :: OptEnv -> ASTF FeldDomain a -> ASTF FeldDomain a
 
Documentation
witInteger :: ASTF FeldDomain a -> Maybe (Dict (Integral a, Ord a)) Source #
prj' :: sub :<: sup => sup sig -> Maybe (sub sig) Source #
prj with a stronger constraint to allow using it in bidirectional
 patterns
pattern SymP :: forall sub (sup :: Type -> Type) sig. sub :<: sup => TypeRep (DenResult sig) -> sub sig -> AST (sup :&: TypeRepFun) sig Source #
pattern VarP :: forall (sup :: Type -> Type) info sig a. BindingT :<: sup => forall. (sig ~ Full a, Typeable a) => info (DenResult sig) -> Name -> AST (sup :&: info) sig Source #
pattern LamP :: forall (sup :: Type -> Type) info sig a1 a2 b. BindingT :<: sup => forall. ((a1 :-> sig) ~ (b :-> Full (a2 -> b)), Typeable a2) => info (DenResult (a1 :-> sig)) -> Name -> AST (sup :&: info) (Full a1) -> AST (sup :&: info) sig Source #
pattern AddP :: () => (Num a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a -> ASTF FeldDomain a Source #
pattern SubP :: () => (Num a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a -> ASTF FeldDomain a Source #
pattern MulP :: () => (Num a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a -> ASTF FeldDomain a Source #
pattern NegP :: () => (Num a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a Source #
pattern QuotP :: () => (Integral a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a -> ASTF FeldDomain a Source #
pattern RemP :: () => (Integral a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a -> ASTF FeldDomain a Source #
pattern DivP :: () => (Integral a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a -> ASTF FeldDomain a Source #
pattern ModP :: () => (Integral a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a -> ASTF FeldDomain a Source #
pattern DivBalancedP :: () => (Integral a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a -> ASTF FeldDomain a Source #
pattern NonLitP :: ASTF FeldDomain a Source #
simplifyUp :: ASTF FeldDomain a -> ASTF FeldDomain a Source #
constFold :: ASTF FeldDomain a -> ASTF FeldDomain a Source #
Reduce an expression to a literal if the following conditions are met:
- The top-most symbol can be evaluated statically (i.g. not a variable or a lifted side-effecting program)
 - All immediate sub-terms are literals
 - The type of the expression is an allowed type for literals (e.g. not a function)
 
Note that this function only folds the top-level node of an expressions (if
 possible). It does not reduce an expression like 1+(2+3) where the
 sub-expression 2+3 is not a literal.
constArgs :: AST FeldDomain sig -> Bool Source #
Check whether all arguments of a symbol are literals
type OptEnv = Selection AssertionLabel Source #
tellUnsafe :: Opt () Source #
simplifyM :: ASTF FeldDomain a -> Opt (ASTF FeldDomain a) Source #
simplify :: OptEnv -> ASTF FeldDomain a -> ASTF FeldDomain a Source #
cmInterface :: CodeMotionInterface FeldDomain Source #
Interface for controlling code motion
optimize :: OptEnv -> ASTF FeldDomain a -> ASTF FeldDomain a Source #
Optimize a Feldspar expression