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

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 alises of a subexpression.

expAliases :: Aliased lore => Exp lore -> [Names] Source #

The aliases of an expression, one per non-context value returned.

patternAliases :: AliasesOf dec => PatternT dec -> [Names] Source #

The aliases of each pattern element (including the context).

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

Also includes the name itself.

class (Decorations lore, AliasedOp (Op lore), AliasesOf (LetDec lore)) => Aliased lore where Source #

The class of lores that contain aliasing information.

Methods

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

The aliases of the body results.

consumedInBody :: Body lore -> Names Source #

The variables consumed in the body.

Instances

Instances details
(ASTLore lore, CanBeAliased (Op lore)) => Aliased (Aliases lore) Source # 
Instance details

Defined in Futhark.IR.Aliases

(ASTLore lore, CanBeWise (Op lore)) => Aliased (Wise lore) Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Lore

Methods

bodyAliases :: Body (Wise lore) -> [Names] Source #

consumedInBody :: Body (Wise lore) -> 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

AliasesOf dec => AliasesOf (PatElemT dec) Source # 
Instance details

Defined in Futhark.IR.Prop.Aliases

Methods

aliasesOf :: PatElemT 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.Lore

Methods

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

Consumption

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

The variables consumed in this statement.

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

The variables consumed in this expression.

consumedByLambda :: Aliased lore => Lambda lore -> 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 () Source # 
Instance details

Defined in Futhark.IR.Prop.Aliases

Methods

opAliases :: () -> [Names] Source #

consumedInOp :: () -> Names Source #

AliasedOp SizeOp Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

(ASTLore lore, Aliased lore) => AliasedOp (SOAC lore) Source # 
Instance details

Defined in Futhark.IR.SOACS.SOAC

Methods

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

consumedInOp :: SOAC lore -> Names Source #

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

Defined in Futhark.IR.Mem

Methods

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

consumedInOp :: MemOp inner -> Names Source #

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

Defined in Futhark.IR.SegOp

Methods

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

consumedInOp :: SegOp lvl lore -> Names Source #

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

Defined in Futhark.IR.MC.Op

Methods

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

consumedInOp :: MCOp lore op -> Names Source #

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

Defined in Futhark.IR.Kernels.Kernel

Methods

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

consumedInOp :: HostOp lore op -> Names Source #

class AliasedOp (OpWithAliases op) => CanBeAliased op where Source #

The class of operations that can be given aliasing information. This is a somewhat subtle concept that is only used in the simplifier and when using "lore adapters".

Associated Types

type OpWithAliases op :: Type Source #

The op that results when we add aliases to this op.

Methods

removeOpAliases :: OpWithAliases op -> op Source #

Remove aliases from this op.

addOpAliases :: AliasTable -> op -> OpWithAliases op Source #

Add aliases to this op.

Instances

Instances details
CanBeAliased () Source # 
Instance details

Defined in Futhark.IR.Prop.Aliases

Associated Types

type OpWithAliases () Source #

(ASTLore lore, ASTLore (Aliases lore), CanBeAliased (Op lore)) => CanBeAliased (SOAC lore) Source # 
Instance details

Defined in Futhark.IR.SOACS.SOAC

Associated Types

type OpWithAliases (SOAC lore) Source #

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

Defined in Futhark.IR.Mem

Associated Types

type OpWithAliases (MemOp inner) Source #

(ASTLore lore, ASTLore (Aliases lore), CanBeAliased (Op lore), ASTConstraints lvl) => CanBeAliased (SegOp lvl lore) Source # 
Instance details

Defined in Futhark.IR.SegOp

Associated Types

type OpWithAliases (SegOp lvl lore) Source #

Methods

removeOpAliases :: OpWithAliases (SegOp lvl lore) -> SegOp lvl lore Source #

addOpAliases :: AliasTable -> SegOp lvl lore -> OpWithAliases (SegOp lvl lore) Source #

(CanBeAliased (Op lore), CanBeAliased op, ASTLore lore) => CanBeAliased (MCOp lore op) Source # 
Instance details

Defined in Futhark.IR.MC.Op

Associated Types

type OpWithAliases (MCOp lore op) Source #

Methods

removeOpAliases :: OpWithAliases (MCOp lore op) -> MCOp lore op Source #

addOpAliases :: AliasTable -> MCOp lore op -> OpWithAliases (MCOp lore op) Source #

(CanBeAliased (Op lore), CanBeAliased op, ASTLore lore) => CanBeAliased (HostOp lore op) Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Associated Types

type OpWithAliases (HostOp lore op) Source #

Methods

removeOpAliases :: OpWithAliases (HostOp lore op) -> HostOp lore op Source #

addOpAliases :: AliasTable -> HostOp lore op -> OpWithAliases (HostOp lore op) Source #