futhark-0.25.32: An optimising compiler for a functional, array-oriented language.

Safe Haskell | None
Language | GHC2021

Futhark.IR.Rephrase

Description

Facilities for changing the representation of some fragment, within a monadic context. We call this "rephrasing", for no deep reason.

Synopsis

- rephraseProg :: Monad m => Rephraser m from to -> Prog from -> m (Prog to)
- rephraseFunDef :: Monad m => Rephraser m from to -> FunDef from -> m (FunDef to)
- rephraseExp :: Monad m => Rephraser m from to -> Exp from -> m (Exp to)
- rephraseBody :: Monad m => Rephraser m from to -> Body from -> m (Body to)
- rephraseStm :: Monad m => Rephraser m from to -> Stm from -> m (Stm to)
- rephraseLambda :: Monad m => Rephraser m from to -> Lambda from -> m (Lambda to)
- rephrasePat :: Monad m => (from -> m to) -> Pat from -> m (Pat to)
- rephrasePatElem :: Monad m => (from -> m to) -> PatElem from -> m (PatElem to)
- data Rephraser (m :: Type -> Type) from to = Rephraser {
  - rephraseExpDec :: ExpDec from -> m (ExpDec to)
  - rephraseLetBoundDec :: LetDec from -> m (LetDec to)
  - rephraseFParamDec :: FParamInfo from -> m (FParamInfo to)
  - rephraseLParamDec :: LParamInfo from -> m (LParamInfo to)
  - rephraseBodyDec :: BodyDec from -> m (BodyDec to)
  - rephraseRetType :: RetType from -> m (RetType to)
  - rephraseBranchType :: BranchType from -> m (BranchType to)
  - rephraseOp :: Op from -> m (Op to)
  }
- class RephraseOp (op :: Type -> Type) where
  - rephraseInOp :: Monad m => Rephraser m from to -> op from -> m (op to)

# Documentation

rephraseProg :: Monad m => Rephraser m from to -> Prog from -> m (Prog to) Source #

Rephrase an entire program.

rephraseFunDef :: Monad m => Rephraser m from to -> FunDef from -> m (FunDef to) Source #

Rephrase a function definition.

rephraseExp :: Monad m => Rephraser m from to -> Exp from -> m (Exp to) Source #

Rephrase an expression.

rephraseBody :: Monad m => Rephraser m from to -> Body from -> m (Body to) Source #

Rephrase a body.

rephraseStm :: Monad m => Rephraser m from to -> Stm from -> m (Stm to) Source #

Rephrase a statement.

rephraseLambda :: Monad m => Rephraser m from to -> Lambda from -> m (Lambda to) Source #

Rephrase a lambda.

rephrasePat :: Monad m => (from -> m to) -> Pat from -> m (Pat to) Source #

Rephrase a pattern.

rephrasePatElem :: Monad m => (from -> m to) -> PatElem from -> m (PatElem to) Source #

Rephrase a pattern element.

data Rephraser (m :: Type -> Type) from to Source #

A collection of functions that together allow us to rephrase some IR fragment, in some monad `m`. If we let `m` be the `Maybe` monad, we can conveniently do rephrasing that might fail. This is useful if you want to see if some IR in e.g. the `Kernels` rep actually uses any `Kernels`-specific operations.

Constructors

Rephraser |

Fields

- rephraseExpDec :: ExpDec from -> m (ExpDec to)
- rephraseLetBoundDec :: LetDec from -> m (LetDec to)
- rephraseFParamDec :: FParamInfo from -> m (FParamInfo to)
- rephraseLParamDec :: LParamInfo from -> m (LParamInfo to)
- rephraseBodyDec :: BodyDec from -> m (BodyDec to)
- rephraseRetType :: RetType from -> m (RetType to)
- rephraseBranchType :: BranchType from -> m (BranchType to)
- rephraseOp :: Op from -> m (Op to)

class RephraseOp (op :: Type -> Type) where Source #

Rephrasing any fragments inside an Op from one representation to another.

Methods

rephraseInOp :: Monad m => Rephraser m from to -> op from -> m (op to) Source #

#### Instances

Instances details

RephraseOp SOAC Source # |
Instance details Defined in Futhark.IR.SOACS.SOAC Methods rephraseInOp :: Monad m => Rephraser m from to -> SOAC from -> m (SOAC to) Source #
RephraseOp op => RephraseOp (HostOp op) Source # |
Instance details Defined in Futhark.IR.GPU.Op Methods rephraseInOp :: Monad m => Rephraser m from to -> HostOp op from -> m (HostOp op to) Source #
RephraseOp op => RephraseOp (MCOp op) Source # |
Instance details Defined in Futhark.IR.MC.Op Methods rephraseInOp :: Monad m => Rephraser m from to -> MCOp op from -> m (MCOp op to) Source #
RephraseOp inner => RephraseOp (MemOp inner) Source # |
Instance details Defined in Futhark.IR.Mem Methods rephraseInOp :: Monad m => Rephraser m from to -> MemOp inner from -> m (MemOp inner to) Source #
RephraseOp (NoOp :: Type -> Type) Source # |
Instance details Defined in Futhark.IR.Rephrase Methods rephraseInOp :: Monad m => Rephraser m from to -> NoOp from -> m (NoOp to) Source #
RephraseOp (SegOp lvl) Source # |
Instance details Defined in Futhark.IR.SegOp Methods rephraseInOp :: Monad m => Rephraser m from to -> SegOp lvl from -> m (SegOp lvl to) Source #