Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
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 rep) => Prog rep -> AstMetrics
- class OpMetrics op where
- seen :: Text -> MetricsM ()
- inside :: Text -> MetricsM () -> MetricsM ()
- data MetricsM a
- stmMetrics :: OpMetrics (Op rep) => Stm rep -> MetricsM ()
- lambdaMetrics :: OpMetrics (Op rep) => Lambda rep -> MetricsM ()
- bodyMetrics :: OpMetrics (Op rep) => Body rep -> 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 rep) => Prog rep -> AstMetrics Source #
Compute the metrics for a program.
Extensibility
class OpMetrics op where Source #
Compute the metrics for some operation.
Instances
OpMetrics SizeOp Source # | |
OpMetrics (Op rep) => OpMetrics (SOAC rep) Source # | |
OpMetrics a => OpMetrics (Maybe a) Source # | |
(OpMetrics (Op rep), OpMetrics (op rep)) => OpMetrics (HostOp op rep) Source # | |
(OpMetrics (Op rep), OpMetrics (op rep)) => OpMetrics (MCOp op rep) Source # | |
OpMetrics (inner rep) => OpMetrics (MemOp inner rep) Source # | |
OpMetrics (NoOp rep) Source # | |
OpMetrics (Op rep) => OpMetrics (SegOp lvl rep) 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.
stmMetrics :: OpMetrics (Op rep) => Stm rep -> MetricsM () Source #
Compute metrics for this statement.