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

Futhark.Analysis.UsageTable

Description

A usage-table is sort of a bottom-up symbol table, describing how (and if) a variable is used.

Synopsis

Documentation

without :: UsageTable -> [VName] -> UsageTable Source #

Remove these entries from the usage table.

lookup :: VName -> UsageTable -> Maybe Usages Source #

Look up a variable in the usage table.

used :: VName -> UsageTable -> Bool Source #

Is the variable present in the usage table? That is, has it been used?

expand :: (VName -> Names) -> UsageTable -> UsageTable Source #

Expand the usage table based on aliasing information.

isConsumed :: VName -> UsageTable -> Bool Source #

Has the variable been consumed?

isInResult :: VName -> UsageTable -> Bool Source #

Has the variable been used in the Result of a body?

isUsedDirectly :: VName -> UsageTable -> Bool Source #

Has the given name been used directly (i.e. could we rename it or remove it without anyone noticing?)

isSize :: VName -> UsageTable -> Bool Source #

Is this name used as the size of something (array or memory block)?

usages :: Names -> UsageTable Source #

Construct a usage table reflecting that these variables have been used.

usage :: VName -> Usages -> UsageTable Source #

Construct a usage table where the given variable has been used in this specific way.

consumedUsage :: VName -> UsageTable Source #

Construct a usage table where the given variable has been consumed.

inResultUsage :: VName -> UsageTable Source #

Construct a usage table where the given variable has been used in the Result of a body.

sizeUsage :: VName -> UsageTable Source #

Construct a usage table where the given variable has been used as an array or memory size.

sizeUsages :: Names -> UsageTable Source #

Construct a usage table where the given names have been used as an array or memory size.

withoutU :: Usages -> Usages -> Usages Source #

x - y, but for Usages.

data Usages Source #

A description of how a single variable has been used.

Instances

Instances details
Monoid Usages Source # 
Instance details

Defined in Futhark.Analysis.UsageTable

Semigroup Usages Source # 
Instance details

Defined in Futhark.Analysis.UsageTable

Show Usages Source # 
Instance details

Defined in Futhark.Analysis.UsageTable

Eq Usages Source # 
Instance details

Defined in Futhark.Analysis.UsageTable

Methods

(==) :: Usages -> Usages -> Bool #

(/=) :: Usages -> Usages -> Bool #

Ord Usages Source # 
Instance details

Defined in Futhark.Analysis.UsageTable

consumedU :: Usages Source #

A kind of usage.

presentU :: Usages Source #

A kind of usage.

usageInStm :: Aliased rep => Stm rep -> UsageTable Source #

Produce a usage table reflecting the use of the free variables in a single statement.

usageInPat :: FreeIn t => Pat t -> UsageTable Source #

Usage table reflecting use in pattern. In particular, free variables in the decorations are considered used as sizes, even if they are also bound in this pattern.