Safe Haskell | None |
---|---|
Language | Haskell2010 |
Optimize Feldspar expressions
- 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 sig sup. (:<:) sub sup => TypeRep (DenResult sig) -> sub sig -> AST ((:&:) sup TypeRepFun) sig
- pattern VarP :: forall sup sig t. (:<:) BindingT sup => forall a. ((~#) * * sig (Full a), Typeable * a) => t (DenResult sig) -> Name -> AST ((:&:) sup t) sig
- pattern LamP :: forall t sup t1. (:<:) BindingT sup => forall a a1 b. ((~#) * * ((:->) a t1) ((:->) b (Full (a1 -> b))), Typeable * a1) => t (DenResult ((:->) a t1)) -> Name -> AST ((:&:) sup t) (Full a) -> AST ((:&:) sup t) t1
- viewLit :: ASTF FeldDomain a -> Maybe a
- pattern LitP :: forall a. () => (Eq a, Show a) => TypeRep a -> a -> ASTF FeldDomain a
- pattern NonLitP :: forall a. ASTF FeldDomain a
- pattern AddP :: forall a. () => (Num a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a -> ASTF FeldDomain a
- pattern SubP :: forall a. () => (Num a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a -> ASTF FeldDomain a
- pattern MulP :: forall a. () => (Num a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a -> ASTF FeldDomain a
- pattern NegP :: forall a. () => (Num a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a
- pattern QuotP :: forall a. () => (Integral a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a -> ASTF FeldDomain a
- pattern RemP :: forall a. () => (Integral a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a -> ASTF FeldDomain a
- pattern DivP :: forall a. () => (Integral a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a -> ASTF FeldDomain a
- pattern ModP :: forall a. () => (Integral a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a -> ASTF FeldDomain a
- pattern DivBalancedP :: forall a. () => (Integral a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a -> 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 sig sup. (:<:) sub sup => TypeRep (DenResult sig) -> sub sig -> AST ((:&:) sup TypeRepFun) sig Source #
pattern VarP :: forall sup sig t. (:<:) BindingT sup => forall a. ((~#) * * sig (Full a), Typeable * a) => t (DenResult sig) -> Name -> AST ((:&:) sup t) sig Source #
pattern LamP :: forall t sup t1. (:<:) BindingT sup => forall a a1 b. ((~#) * * ((:->) a t1) ((:->) b (Full (a1 -> b))), Typeable * a1) => t (DenResult ((:->) a t1)) -> Name -> AST ((:&:) sup t) (Full a) -> AST ((:&:) sup t) t1 Source #
pattern NonLitP :: forall a. ASTF FeldDomain a Source #
pattern AddP :: forall a. () => (Num a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a -> ASTF FeldDomain a Source #
pattern SubP :: forall a. () => (Num a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a -> ASTF FeldDomain a Source #
pattern MulP :: forall a. () => (Num a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a -> ASTF FeldDomain a Source #
pattern NegP :: forall a. () => (Num a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a Source #
pattern QuotP :: forall a. () => (Integral a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a -> ASTF FeldDomain a Source #
pattern RemP :: forall a. () => (Integral a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a -> ASTF FeldDomain a Source #
pattern DivP :: forall a. () => (Integral a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a -> ASTF FeldDomain a Source #
pattern ModP :: forall a. () => (Integral a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a -> ASTF FeldDomain a Source #
pattern DivBalancedP :: forall a. () => (Integral a, PrimType' a) => TypeRep a -> ASTF FeldDomain a -> ASTF FeldDomain a -> 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