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

Safe Haskell | Safe-Inferred
Language | GHC2021

Futhark.IR.Prop.Aliases

Contents

- Consumption
- Extensibility

Description

The IR tracks aliases, mostly to ensure the soundness of in-place updates, but it can also be used for other things (such as memory optimisations). This module contains the raw building blocks for determining the aliases of the values produced by expressions. It also contains some building blocks for inspecting consumption.

One important caveat is that all aliases computed here are local. Thus, they do not take aliases-of-aliases into account. See Futhark.Analysis.Alias if this is not what you want.

Synopsis

- subExpAliases :: SubExp -> Names
- expAliases :: Aliased rep => [PatElem dec] -> Exp rep -> [Names]
- patAliases :: AliasesOf dec => Pat dec -> [Names]
- lookupAliases :: AliasesOf (LetDec rep) => VName -> Scope rep -> Names
- class (ASTRep rep, AliasedOp (OpC rep), AliasesOf (LetDec rep)) => Aliased rep where
  - bodyAliases :: Body rep -> [Names]
  - consumedInBody :: Body rep -> Names
- class AliasesOf a where
  - aliasesOf :: a -> Names
- consumedInStm :: Aliased rep => Stm rep -> Names
- consumedInExp :: Aliased rep => Exp rep -> Names
- consumedByLambda :: Aliased rep => Lambda rep -> Names
- type AliasTable = Map VName Names
- class IsOp op => AliasedOp op where
  - opAliases :: Aliased rep => op rep -> [Names]
  - consumedInOp :: Aliased rep => op rep -> Names

# Documentation

subExpAliases :: SubExp -> Names Source #

The aliases of a subexpression.

expAliases :: Aliased rep => [PatElem dec] -> Exp rep -> [Names] Source #

The aliases of an expression, one for each pattern element.

The pattern is important because some aliasing might be through variables that are no longer in scope (consider the aliases for a body that returns the same value multiple times).

patAliases :: AliasesOf dec => Pat dec -> [Names] Source #

The aliases of each pattern element.

lookupAliases :: AliasesOf (LetDec rep) => VName -> Scope rep -> Names Source #

Also includes the name itself.

class (ASTRep rep, AliasedOp (OpC rep), AliasesOf (LetDec rep)) => Aliased rep where Source #

The class of representations that contain aliasing information.

Methods

bodyAliases :: Body rep -> [Names] Source #

The aliases of the body results. Note that this includes names bound in the body!

consumedInBody :: Body rep -> Names Source #

The variables consumed in the body.

#### Instances

Instances details

(ASTRep rep, AliasedOp (OpC rep), ASTConstraints (OpC rep (Aliases rep))) => Aliased (Aliases rep) Source # |
Instance details Defined in Futhark.IR.Aliases Methods bodyAliases :: Body (Aliases rep) -> [Names] Source # consumedInBody :: Body (Aliases rep) -> Names Source #
Informing rep => Aliased (Wise rep) Source # |
Instance details Defined in Futhark.Optimise.Simplify.Rep Methods bodyAliases :: Body (Wise rep) -> [Names] Source # consumedInBody :: Body (Wise rep) -> Names Source #

class AliasesOf a where Source #

Something that contains alias information.

Methods

aliasesOf :: a -> Names Source #

The alias of the argument element.

#### Instances

Instances details

AliasesOf Names Source # |
Instance details Defined in Futhark.IR.Prop.Aliases Methods aliasesOf :: Names -> Names Source #
AliasesOf dec => AliasesOf (PatElem dec) Source # |
Instance details Defined in Futhark.IR.Prop.Aliases Methods aliasesOf :: PatElem dec -> Names Source #
AliasesOf (VarAliases, dec) Source # |
Instance details Defined in Futhark.IR.Aliases Methods aliasesOf :: (VarAliases, dec) -> Names Source #
AliasesOf (VarWisdom, dec) Source # |
Instance details Defined in Futhark.Optimise.Simplify.Rep Methods aliasesOf :: (VarWisdom, dec) -> Names Source #

# Consumption

consumedInStm :: Aliased rep => Stm rep -> Names Source #

The variables consumed in this statement.

consumedInExp :: Aliased rep => Exp rep -> Names Source #

The variables consumed in this expression.

consumedByLambda :: Aliased rep => Lambda rep -> Names Source #

The variables consumed by this lambda.

# Extensibility

type AliasTable = Map VName Names Source #

Pre-existing aliases for variables. Used to add transitive aliases.

class IsOp op => AliasedOp op where Source #

The class of operations that can produce aliasing and consumption information.

Methods

opAliases :: Aliased rep => op rep -> [Names] Source #

consumedInOp :: Aliased rep => op rep -> Names Source #

#### Instances

Instances details

AliasedOp SOAC Source # |
Instance details Defined in Futhark.IR.SOACS.SOAC Methods opAliases :: Aliased rep => SOAC rep -> [Names] Source # consumedInOp :: Aliased rep => SOAC rep -> Names Source #
AliasedOp op => AliasedOp (HostOp op) Source # |
Instance details Defined in Futhark.IR.GPU.Op Methods opAliases :: Aliased rep => HostOp op rep -> [Names] Source # consumedInOp :: Aliased rep => HostOp op rep -> Names Source #
AliasedOp op => AliasedOp (MCOp op) Source # |
Instance details Defined in Futhark.IR.MC.Op Methods opAliases :: Aliased rep => MCOp op rep -> [Names] Source # consumedInOp :: Aliased rep => MCOp op rep -> Names Source #
AliasedOp inner => AliasedOp (MemOp inner) Source # |
Instance details Defined in Futhark.IR.Mem Methods opAliases :: Aliased rep => MemOp inner rep -> [Names] Source # consumedInOp :: Aliased rep => MemOp inner rep -> Names Source #
AliasedOp (NoOp :: Type -> Type) Source # |
Instance details Defined in Futhark.IR.Prop.Aliases Methods opAliases :: Aliased rep => NoOp rep -> [Names] Source # consumedInOp :: Aliased rep => NoOp rep -> Names Source #
ASTConstraints lvl => AliasedOp (SegOp lvl) Source # |
Instance details Defined in Futhark.IR.SegOp Methods opAliases :: Aliased rep => SegOp lvl rep -> [Names] Source # consumedInOp :: Aliased rep => SegOp lvl rep -> Names Source #