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

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.

data Usages Source #

A description of how a single variable has been used.

Instances

Instances details
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

Show Usages Source # 
Instance details

Defined in Futhark.Analysis.UsageTable

Semigroup Usages Source # 
Instance details

Defined in Futhark.Analysis.UsageTable

Monoid Usages Source # 
Instance details

Defined in Futhark.Analysis.UsageTable

usageInStm :: (ASTLore lore, Aliased lore) => Stm lore -> UsageTable Source #

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