clash-lib-1.8.4: Clash: a functional hardware description language - As a library

Copyright | (C) 2012-2016 University of Twente 2017 Google Inc. 2022 QBayLogic B.V.
License | BSD2 (see the file LICENSE)
Maintainer | QBayLogic B.V. <devops@qbaylogic.com>
Safe Haskell | None
Language | Haskell2010

Clash.Normalize.Types

Description

Types used in Normalize modules

Synopsis

- data NormalizeState = NormalizeState {
  - _normalized :: BindingMap
  - _specialisationCache :: Map (Id, Int, Either Term Type) Id
  - _specialisationHistory :: VarEnv Int
  - _inlineHistory :: VarEnv (VarEnv Int)
  - _primitiveArgs :: Map Text (Set Int)
  - _recursiveComponents :: VarEnv Bool
  }
- inlineHistory :: Lens' NormalizeState (VarEnv (VarEnv Int))
- normalized :: Lens' NormalizeState BindingMap
- primitiveArgs :: Lens' NormalizeState (Map Text (Set Int))
- recursiveComponents :: Lens' NormalizeState (VarEnv Bool)
- specialisationCache :: Lens' NormalizeState (Map (Id, Int, Either Term Type) Id)
- specialisationHistory :: Lens' NormalizeState (VarEnv Int)
- type NormalizeMonad = State NormalizeState
- type NormalizeSession = RewriteMonad NormalizeState
- type NormRewrite = Rewrite NormalizeState
- data TermClassification = TermClassification {
  - _function :: !Int
  - _primitive :: !Int
  - _selection :: !Int
  }
- function :: Lens' TermClassification Int
- primitive :: Lens' TermClassification Int
- selection :: Lens' TermClassification Int

# Documentation

data NormalizeState Source #

State of the `NormalizeMonad`

Constructors

NormalizeState |

Fields

- _normalized :: BindingMap

  Global binders

- _specialisationCache :: Map (Id, Int, Either Term Type) Id

  Cache of previously specialized functions:

  - Key: (name of the original function, argument position, specialized term/type)
  - Elem: (name of specialized function,type of specialized function)
- _specialisationHistory :: VarEnv Int

  Cache of how many times a function was specialized

- _inlineHistory :: VarEnv (VarEnv Int)

  Cache of function where inlining took place:

  - Key: function where inlining took place
  - Elem: (functions which were inlined, number of times inlined)
- _primitiveArgs :: Map Text (Set Int)

  Cache for looking up constantness of blackbox arguments

- _recursiveComponents :: VarEnv Bool

  Map telling whether a components is recursively defined.

  NB: there are only no mutually-recursive component, only self-recursive ones.

inlineHistory :: Lens' NormalizeState (VarEnv (VarEnv Int)) Source #

normalized :: Lens' NormalizeState BindingMap Source #

primitiveArgs :: Lens' NormalizeState (Map Text (Set Int)) Source #

recursiveComponents :: Lens' NormalizeState (VarEnv Bool) Source #

specialisationCache :: Lens' NormalizeState (Map (Id, Int, Either Term Type) Id) Source #

specialisationHistory :: Lens' NormalizeState (VarEnv Int) Source #

type NormalizeMonad = State NormalizeState Source #

State monad that stores specialisation and inlining information

type NormalizeSession = RewriteMonad NormalizeState Source #

RewriteSession with extra Normalisation information

type NormRewrite = Rewrite NormalizeState Source #

A `Transform` action in the context of the `RewriteMonad` and `NormalizeMonad`

data TermClassification Source #

Description of a `Term` in terms of the type "components" the `Term` has.

Is used as a performance/size metric.

Constructors

TermClassification |

Fields

- _function :: !Int

  Number of functions

- _primitive :: !Int

  Number of primitives

- _selection :: !Int

  Number of selections/multiplexers

#### Instances

Instances details

Show TermClassification Source # |
Instance details Defined in Clash.Normalize.Types Methods showsPrec :: Int -> TermClassification -> ShowS Source # show :: TermClassification -> String Source # showList :: [TermClassification] -> ShowS Source #

function :: Lens' TermClassification Int Source #

primitive :: Lens' TermClassification Int Source #

selection :: Lens' TermClassification Int Source #