clash-lib-1.5.0: Clash: a functional hardware description language - As a library
Copyright(C) 2012-2016 University of Twente
2016-2017 Myrtle Software Ltd
2017-2018 Google Inc.
2021-2022 QBayLogic B.V.
LicenseBSD2 (see the file LICENSE)
MaintainerQBayLogic B.V. <devops@qbaylogic.com>
Safe HaskellNone
LanguageHaskell2010

Clash.Normalize.Transformations.Inline

Description

Transformations for inlining

Synopsis

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)

inlineBndrsCleanup Source #

Arguments

:: 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