Copyright | (C) 2012-2016 University of Twente |
---|---|

License | BSD2 (see the file LICENSE) |

Maintainer | Christiaan Baaij <christiaan.baaij@gmail.com> |

Safe Haskell | None |

Language | Haskell2010 |

Utility functions used by the normalisation transformations

## Synopsis

- alreadyInlined :: TmOccName -> TmOccName -> NormalizeMonad (Maybe Int)
- addNewInline :: TmOccName -> TmOccName -> NormalizeMonad ()
- specializeNorm :: NormRewrite
- isClosed :: Fresh m => HashMap TyConOccName TyCon -> Term -> m Bool
- isConstant :: Term -> Bool
- isConstantNotClockReset :: Term -> NormalizeSession Bool
- isRecursiveBndr :: TmOccName -> NormalizeSession Bool
- type CallGraph = HashMap TmOccName (HashMap TmOccName Word)
- callGraph :: BindingMap -> TmOccName -> CallGraph
- classifyFunction :: Term -> TermClassification
- isCheapFunction :: Term -> Bool

# Documentation

:: TmOccName | Function we want to inline |

-> TmOccName | Function in which we want to perform the inlining |

-> NormalizeMonad (Maybe Int) |

Determine if a function is already inlined in the context of the `NetlistMonad`

:: TmOccName | Function we want to inline |

-> TmOccName | Function in which we want to perform the inlining |

-> NormalizeMonad () |

specializeNorm :: NormRewrite Source #

Specialize under the Normalization Monad

isClosed :: Fresh m => HashMap TyConOccName TyCon -> Term -> m Bool Source #

Determine if a term is closed

isConstant :: Term -> Bool Source #

Determine if a term represents a constant

isRecursiveBndr :: TmOccName -> NormalizeSession Bool Source #

Assert whether a name is a reference to a recursive binder.

type CallGraph = HashMap TmOccName (HashMap TmOccName Word) Source #

A call graph counts the number of occurrences that a functions `g`

is used
in `f`

.

callGraph :: BindingMap -> TmOccName -> CallGraph Source #

Create a call graph for a set of global binders, given a root

classifyFunction :: Term -> TermClassification Source #

Give a "performance/size" classification of a function in normal form.

isCheapFunction :: Term -> Bool Source #

Determine whether a function adds a lot of hardware or not.

It is considered expensive when it has 2 or more of the following components:

- functions
- primitives
- selections (multiplexers)