futhark-0.25.6: An optimising compiler for a functional, array-oriented language.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Futhark.Optimise.Simplify.Rep

Description

Representation used by the simplification engine. It contains aliasing information and a bit of caching for various information that is looked up frequently. The name is an old relic; feel free to suggest a better one.

Synopsis

Documentation

data Wise rep Source #

Representative phantom type for the simplifier representation.

Instances

Instances details
BuilderOps (Wise GPU) Source # 
Instance details

Defined in Futhark.IR.GPU.Simplify

BuilderOps (Wise GPUMem) Source # 
Instance details

Defined in Futhark.IR.GPUMem

BuilderOps (Wise MC) Source # 
Instance details

Defined in Futhark.IR.MC

Methods

mkExpDecB :: (MonadBuilder m, Rep m ~ Wise MC) => Pat (LetDec (Wise MC)) -> Exp (Wise MC) -> m (ExpDec (Wise MC)) Source #

mkBodyB :: (MonadBuilder m, Rep m ~ Wise MC) => Stms (Wise MC) -> Result -> m (Body (Wise MC)) Source #

mkLetNamesB :: (MonadBuilder m, Rep m ~ Wise MC) => [VName] -> Exp (Wise MC) -> m (Stm (Wise MC)) Source #

BuilderOps (Wise MCMem) Source # 
Instance details

Defined in Futhark.IR.MCMem

BuilderOps (Wise SOACS) Source # 
Instance details

Defined in Futhark.IR.SOACS.Simplify

BuilderOps (Wise Seq) Source # 
Instance details

Defined in Futhark.IR.Seq

BuilderOps (Wise SeqMem) Source # 
Instance details

Defined in Futhark.IR.SeqMem

(Buildable rep, Informing rep) => Buildable (Wise rep) Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Rep

Methods

mkExpPat :: [Ident] -> Exp (Wise rep) -> Pat (LetDec (Wise rep)) Source #

mkExpDec :: Pat (LetDec (Wise rep)) -> Exp (Wise rep) -> ExpDec (Wise rep) Source #

mkBody :: Stms (Wise rep) -> Result -> Body (Wise rep) Source #

mkLetNames :: (MonadFreshNames m, HasScope (Wise rep) m) => [VName] -> Exp (Wise rep) -> m (Stm (Wise rep)) Source #

OpReturns (HostOp (NoOp :: Type -> Type) (Wise GPUMem)) Source # 
Instance details

Defined in Futhark.IR.GPUMem

Methods

opReturns :: forall rep (inner :: Type -> Type) m. (Mem rep inner, Monad m, HasScope rep m) => HostOp NoOp (Wise GPUMem) -> m [ExpReturns] Source #

OpReturns (MCOp (NoOp :: Type -> Type) (Wise MCMem)) Source # 
Instance details

Defined in Futhark.IR.MCMem

Methods

opReturns :: forall rep (inner :: Type -> Type) m. (Mem rep inner, Monad m, HasScope rep m) => MCOp NoOp (Wise MCMem) -> m [ExpReturns] Source #

(Informing rep, Pretty (OpC rep (Wise rep))) => PrettyRep (Wise rep) Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Rep

Methods

ppExpDec :: ExpDec (Wise rep) -> Exp (Wise rep) -> Maybe (Doc a) Source #

(Informing rep, IsOp (OpC rep (Wise rep))) => ASTRep (Wise rep) Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Rep

Methods

expTypesFromPat :: (HasScope (Wise rep) m, Monad m) => Pat (LetDec (Wise rep)) -> m [BranchType (Wise rep)] Source #

Informing rep => Aliased (Wise rep) Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Rep

(Informing rep, Ord (OpC rep (Wise rep)), Eq (OpC rep (Wise rep)), Show (OpC rep (Wise rep)), IsOp (OpC rep (Wise rep)), Pretty (OpC rep (Wise rep))) => RepTypes (Wise rep) Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Rep

Associated Types

type LetDec (Wise rep) Source #

type ExpDec (Wise rep) Source #

type BodyDec (Wise rep) Source #

type FParamInfo (Wise rep) Source #

type LParamInfo (Wise rep) Source #

type RetType (Wise rep) Source #

type BranchType (Wise rep) Source #

type OpC (Wise rep) :: Type -> Type Source #

HasSOAC (Wise GPU) Source # 
Instance details

Defined in Futhark.IR.GPU.Simplify

HasSOAC (Wise SOACS) Source # 
Instance details

Defined in Futhark.IR.SOACS.Simplify

HasSegOp (Wise GPU) Source # 
Instance details

Defined in Futhark.IR.GPU.Simplify

Associated Types

type SegOpLevel (Wise GPU) Source #

HasSegOp (Wise MC) Source # 
Instance details

Defined in Futhark.IR.MC

Associated Types

type SegOpLevel (Wise MC) Source #

TraverseOpStms (Wise GPU) Source # 
Instance details

Defined in Futhark.IR.GPU.Simplify

TraverseOpStms (Wise GPUMem) Source # 
Instance details

Defined in Futhark.IR.GPUMem

TraverseOpStms (Wise MC) Source # 
Instance details

Defined in Futhark.IR.MC

TraverseOpStms (Wise MCMem) Source # 
Instance details

Defined in Futhark.IR.MCMem

TraverseOpStms (Wise SOACS) Source # 
Instance details

Defined in Futhark.IR.SOACS.Simplify

TraverseOpStms (Wise Seq) Source # 
Instance details

Defined in Futhark.IR.Seq

TraverseOpStms (Wise SeqMem) Source # 
Instance details

Defined in Futhark.IR.SeqMem

SimplifiableRep rep => HasScope (Wise rep) (SimpleM rep) Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Engine

Methods

lookupType :: VName -> SimpleM rep Type Source #

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

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

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

SimplifiableRep rep => LocalScope (Wise rep) (SimpleM rep) Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Engine

Methods

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

type BodyDec (Wise rep) Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Rep

type BodyDec (Wise rep)
type BranchType (Wise rep) Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Rep

type BranchType (Wise rep) = BranchType rep
type ExpDec (Wise rep) Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Rep

type ExpDec (Wise rep) = (ExpWisdom, ExpDec rep)
type FParamInfo (Wise rep) Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Rep

type FParamInfo (Wise rep) = FParamInfo rep
type LParamInfo (Wise rep) Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Rep

type LParamInfo (Wise rep) = LParamInfo rep
type LetDec (Wise rep) Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Rep

type LetDec (Wise rep) = (VarWisdom, LetDec rep)
type OpC (Wise rep) Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Rep

type OpC (Wise rep) = OpC rep
type RetType (Wise rep) Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Rep

type RetType (Wise rep) = RetType rep
type SegOpLevel (Wise GPU) Source # 
Instance details

Defined in Futhark.IR.GPU.Simplify

type SegOpLevel (Wise MC) Source # 
Instance details

Defined in Futhark.IR.MC

type SegOpLevel (Wise MC) = ()

newtype VarWisdom Source #

The information associated with a let-bound variable.

Constructors

VarWisdom 

Instances

Instances details
Show VarWisdom Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Rep

FreeIn VarWisdom Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Rep

Methods

freeIn' :: VarWisdom -> FV Source #

Rename VarWisdom Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Rep

Substitute VarWisdom Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Rep

Eq VarWisdom Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Rep

Ord VarWisdom Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Rep

Pretty VarWisdom Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Rep

Methods

pretty :: VarWisdom -> Doc ann #

prettyList :: [VarWisdom] -> Doc ann #

AliasesOf (VarWisdom, dec) Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Rep

Methods

aliasesOf :: (VarWisdom, dec) -> Names Source #

data ExpWisdom Source #

Simplifier information about an expression.

removeStmWisdom :: RephraseOp (OpC rep) => Stm (Wise rep) -> Stm rep Source #

Remove simplifier information from statement.

removeLambdaWisdom :: RephraseOp (OpC rep) => Lambda (Wise rep) -> Lambda rep Source #

Remove simplifier information from lambda.

removeFunDefWisdom :: RephraseOp (OpC rep) => FunDef (Wise rep) -> FunDef rep Source #

Remove simplifier information from function.

removeExpWisdom :: RephraseOp (OpC rep) => Exp (Wise rep) -> Exp rep Source #

Remove simplifier information from expression.

removePatWisdom :: Pat (VarWisdom, a) -> Pat a Source #

Remove simplifier information from pattern.

removeBodyWisdom :: RephraseOp (OpC rep) => Body (Wise rep) -> Body rep Source #

Remove simplifier information from body.

removeScopeWisdom :: Scope (Wise rep) -> Scope rep Source #

Remove simplifier information from scope.

addScopeWisdom :: Scope rep -> Scope (Wise rep) Source #

Add simplifier information to scope. All the aliasing information will be vacuous, however.

addWisdomToPat :: Informing rep => Pat (LetDec rep) -> Exp (Wise rep) -> Pat (LetDec (Wise rep)) Source #

Add simplifier information to pattern.

mkWiseBody :: Informing rep => BodyDec rep -> Stms (Wise rep) -> Result -> Body (Wise rep) Source #

Produce a body with simplifier information.

mkWiseStm :: Informing rep => Pat (LetDec rep) -> StmAux (ExpDec rep) -> Exp (Wise rep) -> Stm (Wise rep) Source #

Produce a statement with simplifier information.

mkWiseExpDec :: Informing rep => Pat (LetDec (Wise rep)) -> ExpDec rep -> Exp (Wise rep) -> ExpDec (Wise rep) Source #

Produce simplifier information for an expression.

class CanBeWise op where Source #

A type class for indicating that this operation can be lifted into the simplifier representation.

Methods

addOpWisdom :: Informing rep => op rep -> op (Wise rep) Source #

Instances

Instances details
CanBeWise SOAC Source # 
Instance details

Defined in Futhark.IR.SOACS.SOAC

Methods

addOpWisdom :: Informing rep => SOAC rep -> SOAC (Wise rep) Source #

CanBeWise op => CanBeWise (HostOp op) Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

addOpWisdom :: Informing rep => HostOp op rep -> HostOp op (Wise rep) Source #

CanBeWise op => CanBeWise (MCOp op) Source # 
Instance details

Defined in Futhark.IR.MC.Op

Methods

addOpWisdom :: Informing rep => MCOp op rep -> MCOp op (Wise rep) Source #

CanBeWise inner => CanBeWise (MemOp inner) Source # 
Instance details

Defined in Futhark.IR.Mem

Methods

addOpWisdom :: Informing rep => MemOp inner rep -> MemOp inner (Wise rep) Source #

CanBeWise (NoOp :: Type -> Type) Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Rep

Methods

addOpWisdom :: Informing rep => NoOp rep -> NoOp (Wise rep) Source #

CanBeWise (SegOp lvl) Source # 
Instance details

Defined in Futhark.IR.SegOp

Methods

addOpWisdom :: Informing rep => SegOp lvl rep -> SegOp lvl (Wise rep) Source #

Constructing representation

type Informing rep = (ASTRep rep, AliasedOp (OpC rep (Wise rep)), RephraseOp (OpC rep), CanBeWise (OpC rep), FreeIn (OpC rep (Wise rep))) Source #

Constraints that let us transform a representation into a Wise representation.

informLambda :: Informing rep => Lambda rep -> Lambda (Wise rep) Source #

Construct a Wise lambda.

informFunDef :: Informing rep => FunDef rep -> FunDef (Wise rep) Source #

Construct a Wise function definition.

informStms :: Informing rep => Stms rep -> Stms (Wise rep) Source #

Construct Wise statements.

informBody :: Informing rep => Body rep -> Body (Wise rep) Source #

Construct a Wise body.