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

Safe Haskell | None
Language | GHC2021

Futhark.Transform.Substitute

Description

This module contains facilities for replacing variable names in syntactic constructs.

Synopsis

- type Substitutions = Map VName VName
- class Substitute a where
  - substituteNames :: Map VName VName -> a -> a
- type Substitutable rep = (RepTypes rep, Substitute (ExpDec rep), Substitute (BodyDec rep), Substitute (LetDec rep), Substitute (FParamInfo rep), Substitute (LParamInfo rep), Substitute (RetType rep), Substitute (BranchType rep), Substitute (Op rep))

# Documentation

type Substitutions = Map VName VName Source #

The substitutions to be made are given by a mapping from names to names.

class Substitute a where Source #

A type that is an instance of this class supports substitution of any names contained within.

Methods

substituteNames :: Map VName VName -> a -> a Source #

`substituteNames m e` replaces the variable names in `e` with new names, based on the mapping in `m`. It is assumed that all names in `e` are unique, i.e. there is no shadowing.

#### Instances

Instances details

Substitute Adj Source # |
Instance details Defined in Futhark.AD.Rev.Monad Methods substituteNames :: Map VName VName -> Adj -> Adj Source #
Substitute ArrayTransform Source # |
Instance details Defined in Futhark.Analysis.HORep.SOAC Methods substituteNames :: Map VName VName -> ArrayTransform -> ArrayTransform Source #
Substitute ArrayTransforms Source # |
Instance details Defined in Futhark.Analysis.HORep.SOAC Methods substituteNames :: Map VName VName -> ArrayTransforms -> ArrayTransforms Source #
Substitute Input Source # |
Instance details Defined in Futhark.Analysis.HORep.SOAC Methods substituteNames :: Map VName VName -> Input -> Input Source #
Substitute AliasDec Source # |
Instance details Defined in Futhark.IR.Aliases Methods substituteNames :: Map VName VName -> AliasDec -> AliasDec Source #
Substitute KernelGrid Source # |
Instance details Defined in Futhark.IR.GPU.Op Methods substituteNames :: Map VName VName -> KernelGrid -> KernelGrid Source #
Substitute SegLevel Source # |
Instance details Defined in Futhark.IR.GPU.Op Methods substituteNames :: Map VName VName -> SegLevel -> SegLevel Source #
Substitute SizeOp Source # |
Instance details Defined in Futhark.IR.GPU.Op Methods substituteNames :: Map VName VName -> SizeOp -> SizeOp Source #
Substitute MemBind Source # |
Instance details Defined in Futhark.IR.Mem Methods substituteNames :: Map VName VName -> MemBind -> MemBind Source #
Substitute MemReturn Source # |
Instance details Defined in Futhark.IR.Mem Methods substituteNames :: Map VName VName -> MemReturn -> MemReturn Source #
Substitute FV Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> FV -> FV Source #
Substitute Names Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> Names -> Names Source #
Substitute KernelResult Source # |
Instance details Defined in Futhark.IR.SegOp Methods substituteNames :: Map VName VName -> KernelResult -> KernelResult Source #
Substitute SubExpRes Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> SubExpRes -> SubExpRes Source #
Substitute Attrs Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> Attrs -> Attrs Source #
Substitute Certs Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> Certs -> Certs Source #
Substitute Ident Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> Ident -> Ident Source #
Substitute Rank Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> Rank -> Rank Source #
Substitute SubExp Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> SubExp -> SubExp Source #
Substitute ExpWisdom Source # |
Instance details Defined in Futhark.Optimise.Simplify.Rep Methods substituteNames :: Map VName VName -> ExpWisdom -> ExpWisdom Source #
Substitute VarWisdom Source # |
Instance details Defined in Futhark.Optimise.Simplify.Rep Methods substituteNames :: Map VName VName -> VarWisdom -> VarWisdom Source #
Substitute VName Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> VName -> VName Source #
Substitute PrimType Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> PrimType -> PrimType Source #
Substitute () Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> () -> () Source #
Substitute Bool Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> Bool -> Bool Source #
Substitute v => Substitute (PrimExp v) Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> PrimExp v -> PrimExp v Source #
Substitute num => Substitute (LMAD num) Source # |
Instance details Defined in Futhark.IR.Mem.LMAD Methods substituteNames :: Map VName VName -> LMAD num -> LMAD num Source #
Substitutable rep => Substitute (NameInfo rep) Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> NameInfo rep -> NameInfo rep Source #
ASTRep rep => Substitute (SOAC rep) Source # |
Instance details Defined in Futhark.IR.SOACS.SOAC Methods substituteNames :: Map VName VName -> SOAC rep -> SOAC rep Source #
ASTRep rep => Substitute (KernelBody rep) Source # |
Instance details Defined in Futhark.IR.SegOp Methods substituteNames :: Map VName VName -> KernelBody rep -> KernelBody rep Source #
Substitutable rep => Substitute (Body rep) Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> Body rep -> Body rep Source #
Substitutable rep => Substitute (Exp rep) Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> Exp rep -> Exp rep Source #
Substitutable rep => Substitute (Lambda rep) Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> Lambda rep -> Lambda rep Source #
Substitute d => Substitute (NewShape d) Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> NewShape d -> NewShape d Source #
Substitute dec => Substitute (Pat dec) Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> Pat dec -> Pat dec Source #
Substitutable rep => Substitute (Stm rep) Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> Stm rep -> Stm rep Source #
Substitute dec => Substitute (StmAux dec) Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> StmAux dec -> StmAux dec Source #
Substitute (Stm rep) => Substitute (Stms rep) Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> Stms rep -> Stms rep Source #
Substitute d => Substitute (DimIndex d) Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> DimIndex d -> DimIndex d Source #
Substitute d => Substitute (Ext d) Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> Ext d -> Ext d Source #
Substitute d => Substitute (FlatDimIndex d) Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> FlatDimIndex d -> FlatDimIndex d Source #
Substitute d => Substitute (FlatSlice d) Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> FlatSlice d -> FlatSlice d Source #
Substitute dec => Substitute (Param dec) Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> Param dec -> Param dec Source #
Substitute dec => Substitute (PatElem dec) Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> PatElem dec -> PatElem dec Source #
Substitute d => Substitute (ShapeBase d) Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> ShapeBase d -> ShapeBase d Source #
Substitute d => Substitute (Slice d) Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> Slice d -> Slice d Source #
Substitute a => Substitute (Maybe a) Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> Maybe a -> Maybe a Source #
Substitute a => Substitute [a] Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> [a] -> [a] Source #
(ASTRep rep, Substitute (op rep)) => Substitute (HostOp op rep) Source # |
Instance details Defined in Futhark.IR.GPU.Op Methods substituteNames :: Map VName VName -> HostOp op rep -> HostOp op rep Source #
(ASTRep rep, Substitute (op rep)) => Substitute (MCOp op rep) Source # |
Instance details Defined in Futhark.IR.MC.Op Methods substituteNames :: Map VName VName -> MCOp op rep -> MCOp op rep Source #
Substitute (inner rep) => Substitute (MemOp inner rep) Source # |
Instance details Defined in Futhark.IR.Mem Methods substituteNames :: Map VName VName -> MemOp inner rep -> MemOp inner rep Source #
Substitute (NoOp rep) Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> NoOp rep -> NoOp rep Source #
(ASTRep rep, Substitute lvl) => Substitute (SegOp lvl rep) Source # |
Instance details Defined in Futhark.IR.SegOp Methods substituteNames :: Map VName VName -> SegOp lvl rep -> SegOp lvl rep Source #
Substitute shape => Substitute (TypeBase shape u) Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> TypeBase shape u -> TypeBase shape u Source #
(Substitute a, Substitute b) => Substitute (a, b) Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> (a, b) -> (a, b) Source #
Substitute v => Substitute (TPrimExp t v) Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> TPrimExp t v -> TPrimExp t v Source #
Substitute e => Substitute (Count u e) Source # |
Instance details Defined in Futhark.IR.GPU.Sizes Methods substituteNames :: Map VName VName -> Count u e -> Count u e Source #
(Substitute d, Substitute ret) => Substitute (MemInfo d u ret) Source # |
Instance details Defined in Futhark.IR.Mem Methods substituteNames :: Map VName VName -> MemInfo d u ret -> MemInfo d u ret Source #
(Substitute a, Substitute b, Substitute c) => Substitute (a, b, c) Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> (a, b, c) -> (a, b, c) Source #
(Substitute a, Substitute b, Substitute c, Substitute d) => Substitute (a, b, c, d) Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> (a, b, c, d) -> (a, b, c, d) Source #

type Substitutable rep = (RepTypes rep, Substitute (ExpDec rep), Substitute (BodyDec rep), Substitute (LetDec rep), Substitute (FParamInfo rep), Substitute (LParamInfo rep), Substitute (RetType rep), Substitute (BranchType rep), Substitute (Op rep)) Source #

Representations in which all annotations support name substitution.