futhark-0.19.4: An optimising compiler for a functional, array-oriented language.
Safe HaskellNone
LanguageHaskell2010

Futhark.Optimise.Simplify

Synopsis

Documentation

simplifyProg :: SimplifiableLore lore => SimpleOps lore -> RuleBook (Wise lore) -> HoistBlockers lore -> Prog lore -> PassM (Prog lore) Source #

Simplify the given program. Even if the output differs from the output, meaningful simplification may not have taken place - the order of bindings may simply have been rearranged.

simplifySomething :: (MonadFreshNames m, SimplifiableLore lore) => (a -> SimpleM lore b) -> (b -> a) -> SimpleOps lore -> RuleBook (Wise lore) -> HoistBlockers lore -> SymbolTable (Wise lore) -> a -> m a Source #

Run a simplification operation to convergence.

simplifyFun :: (MonadFreshNames m, SimplifiableLore lore) => SimpleOps lore -> RuleBook (Wise lore) -> HoistBlockers lore -> SymbolTable (Wise lore) -> FunDef lore -> m (FunDef lore) Source #

Simplify the given function. Even if the output differs from the output, meaningful simplification may not have taken place - the order of bindings may simply have been rearranged. Runs in a loop until convergence.

simplifyLambda :: (MonadFreshNames m, HasScope lore m, SimplifiableLore lore) => SimpleOps lore -> RuleBook (Wise lore) -> HoistBlockers lore -> Lambda lore -> m (Lambda lore) Source #

Simplify just a single Lambda.

simplifyStms :: (MonadFreshNames m, SimplifiableLore lore) => SimpleOps lore -> RuleBook (Wise lore) -> HoistBlockers lore -> Scope lore -> Stms lore -> m (SymbolTable (Wise lore), Stms lore) Source #

Simplify a sequence of Stms.

data SimpleOps lore Source #

Constructors

SimpleOps 

Fields

Instances

Instances details
MonadReader (SimpleOps lore, Env lore) (SimpleM lore) Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Engine

Methods

ask :: SimpleM lore (SimpleOps lore, Env lore) #

local :: ((SimpleOps lore, Env lore) -> (SimpleOps lore, Env lore)) -> SimpleM lore a -> SimpleM lore a #

reader :: ((SimpleOps lore, Env lore) -> a) -> SimpleM lore a #

data SimpleM lore a Source #

Instances

Instances details
Monad (SimpleM lore) Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Engine

Methods

(>>=) :: SimpleM lore a -> (a -> SimpleM lore b) -> SimpleM lore b #

(>>) :: SimpleM lore a -> SimpleM lore b -> SimpleM lore b #

return :: a -> SimpleM lore a #

Functor (SimpleM lore) Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Engine

Methods

fmap :: (a -> b) -> SimpleM lore a -> SimpleM lore b #

(<$) :: a -> SimpleM lore b -> SimpleM lore a #

Applicative (SimpleM lore) Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Engine

Methods

pure :: a -> SimpleM lore a #

(<*>) :: SimpleM lore (a -> b) -> SimpleM lore a -> SimpleM lore b #

liftA2 :: (a -> b -> c) -> SimpleM lore a -> SimpleM lore b -> SimpleM lore c #

(*>) :: SimpleM lore a -> SimpleM lore b -> SimpleM lore b #

(<*) :: SimpleM lore a -> SimpleM lore b -> SimpleM lore a #

MonadFreshNames (SimpleM lore) Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Engine

SimplifiableLore lore => LocalScope (Wise lore) (SimpleM lore) Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Engine

Methods

localScope :: Scope (Wise lore) -> SimpleM lore a -> SimpleM lore a Source #

SimplifiableLore lore => HasScope (Wise lore) (SimpleM lore) Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Engine

Methods

lookupType :: VName -> SimpleM lore Type Source #

lookupInfo :: VName -> SimpleM lore (NameInfo (Wise lore)) Source #

askScope :: SimpleM lore (Scope (Wise lore)) Source #

asksScope :: (Scope (Wise lore) -> a) -> SimpleM lore a Source #

MonadReader (SimpleOps lore, Env lore) (SimpleM lore) Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Engine

Methods

ask :: SimpleM lore (SimpleOps lore, Env lore) #

local :: ((SimpleOps lore, Env lore) -> (SimpleOps lore, Env lore)) -> SimpleM lore a -> SimpleM lore a #

reader :: ((SimpleOps lore, Env lore) -> a) -> SimpleM lore a #

MonadState (VNameSource, Bool, Certificates) (SimpleM lore) Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Engine

type SimplifyOp lore op = op -> SimpleM lore (OpWithWisdom op, Stms (Wise lore)) Source #

bindableSimpleOps :: (SimplifiableLore lore, Bindable lore) => SimplifyOp lore (Op lore) -> SimpleOps lore Source #

data RuleBook lore Source #

A collection of both top-down and bottom-up rules.

Instances

Instances details
Semigroup (RuleBook lore) Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Rule

Methods

(<>) :: RuleBook lore -> RuleBook lore -> RuleBook lore #

sconcat :: NonEmpty (RuleBook lore) -> RuleBook lore #

stimes :: Integral b => b -> RuleBook lore -> RuleBook lore #

Monoid (RuleBook lore) Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Rule

Methods

mempty :: RuleBook lore #

mappend :: RuleBook lore -> RuleBook lore -> RuleBook lore #

mconcat :: [RuleBook lore] -> RuleBook lore #