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

Futhark.IR.Prop.Aliases

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

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 (Op 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 (Aliases rep))) => Aliased (Aliases rep) Source # 
Instance details

Defined in Futhark.IR.Aliases

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

Defined in Futhark.Optimise.Simplify.Rep

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

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 :: op -> [Names] Source #

consumedInOp :: op -> Names Source #

Instances

Instances details
AliasedOp SizeOp Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Aliased rep => AliasedOp (SOAC rep) Source # 
Instance details

Defined in Futhark.IR.SOACS.SOAC

Methods

opAliases :: SOAC rep -> [Names] Source #

consumedInOp :: SOAC rep -> Names Source #

(Aliased rep, AliasedOp (op rep)) => AliasedOp (HostOp op rep) Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

opAliases :: HostOp op rep -> [Names] Source #

consumedInOp :: HostOp op rep -> Names Source #

(Aliased rep, AliasedOp (op rep)) => AliasedOp (MCOp op rep) Source # 
Instance details

Defined in Futhark.IR.MC.Op

Methods

opAliases :: MCOp op rep -> [Names] Source #

consumedInOp :: MCOp op rep -> Names Source #

AliasedOp (inner rep) => AliasedOp (MemOp inner rep) Source # 
Instance details

Defined in Futhark.IR.Mem

Methods

opAliases :: MemOp inner rep -> [Names] Source #

consumedInOp :: MemOp inner rep -> Names Source #

AliasedOp (NoOp rep) Source # 
Instance details

Defined in Futhark.IR.Prop.Aliases

Methods

opAliases :: NoOp rep -> [Names] Source #

consumedInOp :: NoOp rep -> Names Source #

(ASTConstraints lvl, Aliased rep) => AliasedOp (SegOp lvl rep) Source # 
Instance details

Defined in Futhark.IR.SegOp

Methods

opAliases :: SegOp lvl rep -> [Names] Source #

consumedInOp :: SegOp lvl rep -> Names Source #