Safe Haskell | Trustworthy |
---|---|
Language | Haskell2010 |
Abstract Syntax Tree metrics. This is used in the futhark test
program, for the structure
stanzas.
Synopsis
- newtype AstMetrics = AstMetrics (Map Text Int)
- progMetrics :: OpMetrics (Op lore) => Prog lore -> AstMetrics
- class OpMetrics op where
- seen :: Text -> MetricsM ()
- inside :: Text -> MetricsM () -> MetricsM ()
- data MetricsM a
- stmMetrics :: OpMetrics (Op lore) => Stm lore -> MetricsM ()
- lambdaMetrics :: OpMetrics (Op lore) => Lambda lore -> MetricsM ()
Documentation
newtype AstMetrics Source #
AST metrics are simply a collection from identifiable node names to the number of times that node appears.
AstMetrics (Map Text Int) |
Instances
Read AstMetrics Source # | |
Defined in Futhark.Analysis.Metrics.Type readsPrec :: Int -> ReadS AstMetrics # readList :: ReadS [AstMetrics] # readPrec :: ReadPrec AstMetrics # readListPrec :: ReadPrec [AstMetrics] # | |
Show AstMetrics Source # | |
Defined in Futhark.Analysis.Metrics.Type showsPrec :: Int -> AstMetrics -> ShowS # show :: AstMetrics -> String # showList :: [AstMetrics] -> ShowS # |
progMetrics :: OpMetrics (Op lore) => Prog lore -> AstMetrics Source #
Compute the metrics for a program.
Extensibility
class OpMetrics op where Source #
Compute the metrics for some operation.
Instances
OpMetrics () Source # | |
Defined in Futhark.Analysis.Metrics | |
OpMetrics SizeOp Source # | |
OpMetrics a => OpMetrics (Maybe a) Source # | |
OpMetrics (Op lore) => OpMetrics (SOAC lore) Source # | |
OpMetrics inner => OpMetrics (MemOp inner) Source # | |
OpMetrics (Op lore) => OpMetrics (SegOp lvl lore) Source # | |
(OpMetrics (Op lore), OpMetrics op) => OpMetrics (MCOp lore op) Source # | |
(OpMetrics (Op lore), OpMetrics op) => OpMetrics (HostOp lore op) Source # | |
inside :: Text -> MetricsM () -> MetricsM () Source #
Enclose a metrics counting operation. Most importantly, this prefixes the name of the context to all the metrics computed in the enclosed operation.
This monad is used for computing metrics. It internally keeps
track of what we've seen so far. Use seen
to add more stuff.