Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
A usage-table is sort of a bottom-up symbol table, describing how (and if) a variable is used.
Synopsis
- data UsageTable
- without :: UsageTable -> [VName] -> UsageTable
- lookup :: VName -> UsageTable -> Maybe Usages
- used :: VName -> UsageTable -> Bool
- expand :: (VName -> Names) -> UsageTable -> UsageTable
- isConsumed :: VName -> UsageTable -> Bool
- isInResult :: VName -> UsageTable -> Bool
- isUsedDirectly :: VName -> UsageTable -> Bool
- isSize :: VName -> UsageTable -> Bool
- usages :: Names -> UsageTable
- usage :: VName -> Usages -> UsageTable
- consumedUsage :: VName -> UsageTable
- inResultUsage :: VName -> UsageTable
- sizeUsage :: VName -> UsageTable
- sizeUsages :: Names -> UsageTable
- withoutU :: Usages -> Usages -> Usages
- data Usages
- consumedU :: Usages
- presentU :: Usages
- usageInStm :: Aliased rep => Stm rep -> UsageTable
- usageInPat :: FreeIn t => Pat t -> UsageTable
Documentation
data UsageTable Source #
A usage table.
Instances
Monoid UsageTable Source # | |
Defined in Futhark.Analysis.UsageTable mempty :: UsageTable # mappend :: UsageTable -> UsageTable -> UsageTable # mconcat :: [UsageTable] -> UsageTable # | |
Semigroup UsageTable Source # | |
Defined in Futhark.Analysis.UsageTable (<>) :: UsageTable -> UsageTable -> UsageTable # sconcat :: NonEmpty UsageTable -> UsageTable # stimes :: Integral b => b -> UsageTable -> UsageTable # | |
Show UsageTable Source # | |
Defined in Futhark.Analysis.UsageTable showsPrec :: Int -> UsageTable -> ShowS # show :: UsageTable -> String # showList :: [UsageTable] -> ShowS # | |
Eq UsageTable Source # | |
Defined in Futhark.Analysis.UsageTable (==) :: UsageTable -> UsageTable -> Bool # (/=) :: UsageTable -> UsageTable -> Bool # |
without :: UsageTable -> [VName] -> UsageTable Source #
Remove these entries from 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.
A description of how a single variable has been used.
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.