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

Copyright | (C) 2015-2016 University of Twente 2021-2022 QBayLogic B.V. 2022 LumiGuide Fietsdetectie B.V.
License | BSD2 (see the file LICENSE)
Maintainer | QBayLogic B.V. <devops@qbaylogic.com>
Safe Haskell | Safe-Inferred
Language | Haskell2010

Clash.Normalize.Transformations.DEC

Description

The `disjointExpressionConsolidation` transformation lifts applications of global binders out of alternatives of case-statements.

e.g. It converts:

    case x of
      A -> f 3 y
      B -> f x x
      C -> h x

into:

    let f_arg0 = case x of {A -> 3; B -> x}
        f_arg1 = case x of {A -> y; B -> x}
        f_out  = f f_arg0 f_arg1
    in  case x of
          A -> f_out
          B -> f_out
          C -> h x

Synopsis

- disjointExpressionConsolidation :: HasCallStack => NormRewrite

# Documentation

disjointExpressionConsolidation :: HasCallStack => NormRewrite Source #

This transformation lifts applications of global binders out of alternatives of case-statements.

e.g. It converts:

    case x of
      A -> f 3 y
      B -> f x x
      C -> h x

into:

    let f_arg0 = case x of {A -> 3; B -> x}
        f_arg1 = case x of {A -> y; B -> x}
        f_out  = f f_arg0 f_arg1
    in  case x of
          A -> f_out
          B -> f_out
          C -> h x