UsageMap : Type Maping from a pairing of closed terms together with
their size (for efficiency) to the number of
occurences in toplevel definitions and flag for
whether it was encountered in delayed subexpression.
Visibility: public exportdata Count : Type Number of appearances of a closed expression.
`Once` : The expression occurs exactly once.
`Many` : The expression occurs more than once.
`C n` : The expression has been counted `n` times
but we will have to compare this value
with the number of occurences of its parent
expression to decide whether it occured
only once or several times.
Totality: total
Visibility: public export
Constructors:
Once : Count Many : Count C : Integer -> Count
Hint: Show Count
ReplaceMap : Type After common subexpression analysis we get a mapping
from `Name`s to the closed expressions they replace.
We use this mapping for substituting the names back
to the corresponding expressions, if the expression
appears only in one place or is a subexpression of
some delayed expression.
Visibility: public exportanalyze : Ref Sts St => CExp ns -> Core (Integer, CExp ns)- Visibility: export
cse : Ref Ctxt Defs => List Name -> CExp ns -> Core (List (Name, (FC, CDef)), CExp ns) Runs the CSE alorithm on all provided names and
the given main expression.
Visibility: export