Copyright | (C) 2012-2016 University of Twente 2016-2017 Myrtle Software Ltd 2017-2022 Google Inc. 2021-2022 QBayLogic B.V. |
---|---|
License | BSD2 (see the file LICENSE) |
Maintainer | QBayLogic B.V. <devops@qbaylogic.com> |
Safe Haskell | None |
Language | Haskell2010 |
Transformations for inlining
Synopsis
- bindConstantVar :: HasCallStack => NormRewrite
- inlineBndrsCleanup :: HasCallStack => InScopeSet -> VarEnv ((Id, Term), VarEnv Int) -> VarEnv ((Id, Term), VarEnv Int, Mark) -> [((Id, Term), VarEnv Int)] -> [(Id, Term)]
- inlineCast :: HasCallStack => NormRewrite
- inlineCleanup :: HasCallStack => NormRewrite
- collapseRHSNoops :: HasCallStack => NormRewrite
- inlineNonRep :: HasCallStack => NormRewrite
- inlineOrLiftNonRep :: HasCallStack => NormRewrite
- inlineSimIO :: HasCallStack => NormRewrite
- inlineSmall :: HasCallStack => NormRewrite
- inlineWorkFree :: HasCallStack => NormRewrite
Documentation
bindConstantVar :: HasCallStack => NormRewrite Source #
Inline let-bindings when the RHS is either a local variable reference or is constant (except clock or reset generators)
:: HasCallStack | |
=> InScopeSet | Current InScopeSet |
-> VarEnv ((Id, Term), VarEnv Int) | Original let-binders with their free variables (+ #occurrences), that we want to inline |
-> VarEnv ((Id, Term), VarEnv Int, Mark) | Processed let-binders with their free variables and a tag to mark the progress: * Temp: Will eventually form a recursive cycle * Done: Processed, non-recursive * Rec: Processed, recursive |
-> [((Id, Term), VarEnv Int)] | The let-binders with their free variables (+ #occurrences), that we want to keep |
-> [(Id, Term)] |
Used by inlineCleanup
to inline binders that we want to inline into the
binders that we want to keep.
inlineCast :: HasCallStack => NormRewrite Source #
Only inline casts that just contain a Var
, because these are guaranteed work-free.
These are the result of the splitCastWork
transformation.
inlineCleanup :: HasCallStack => NormRewrite Source #
Given a function in the desired normal form, inline all the following let-bindings:
Let-bindings with an internal name that is only used once, where it binds: * a primitive that will be translated to an HDL expression (as opposed to a HDL declaration) * a projection case-expression (1 alternative) * a data constructor * I/O actions
collapseRHSNoops :: HasCallStack => NormRewrite Source #
Takes a binding and collapses its term if it is a noop
inlineNonRep :: HasCallStack => NormRewrite Source #
Inline function with a non-representable result if it's the subject
of a Case-decomposition. It's a custom topdown traversal that -for efficiency
reasons- does not explore alternative of cases whose subject triggered an
inlineNonRepWorker
.
inlineSimIO :: HasCallStack => NormRewrite Source #
Inline anything of type SimIO
: IO actions cannot be shared
inlineSmall :: HasCallStack => NormRewrite Source #
Inline small functions
inlineWorkFree :: HasCallStack => NormRewrite Source #
Inline work-free functions, i.e. fully applied functions that evaluate to a constant