rewire-frontend-2.8: A Haskell-to-Verilog/VHDL compiler, front end (GHC driver, Eidos, Synolon)
Safe HaskellSafe
LanguageHaskell2010

ReWire.Eidos.Naming

Description

The shared naming and ordering conventions for compiler-minted definitions and machine-level labels: one function per naming decision, so independently-minted artifacts that must correspond (purify's block labels; the join continuations the machine fold lifts) agree by construction, and regenerated goldens drift minimally.

Names are occurrence-stable: derived from the enclosing definition's display name, the bound occurrence's display name, and a deterministic per-name ordinal — never from a global fresh counter, which renumbers wholesale on any upstream change.

Synopsis

Documentation

liftedJoinName :: Text -> Text -> Int -> Text Source #

The top-level name for a join continuation lifted out of a definition: $LL.<defn>.<join><ordinal>. The $LL. prefix marks the definition as compiler-lifted; it is display-only (the machine fold strips it via defnBase when naming the Hyle definition).

blockLabel :: Text -> Int -> Text Source #

The label for a purify-minted block: $L.<source> for a source name's first block, $L.<source><ordinal> from the second on. The ordinal is per source name, so an upstream edit renumbers only that name's later blocks, never the whole process. (The machine fold derives the blocks' Hyle definition names from these via labelBase, disambiguating collisions there; dispatch order and tag values key on the label's unique, not its text.)

labelBase :: Text -> Text Source #

The display base of a machine-label occurrence, for naming the block's Hyle definition: label prefixes and qualification stripped, the per-name ordinal kept ($L.Main.getIns2 -> getIns2, $L.arm -> arm, $L.$ds -> $ds — compiler-marked binders stay marked).

defnBase :: Text -> Text Source #

The display base of a top-level definition's occurrence for its Hyle global name: the $LL. lifted-definition marker stripped ($LL.Main.foo.j1 -> Main.foo.j1), other occurrences unchanged.

originTag :: [Text] -> Text Source #

A short display tag for an instantiation, from the pre-rendered argument texts: sanitized to identifier characters (separators collapse to _) and $-joined when short — Vec 8 Bool becomes Vec_8_Bool — otherwise a stable 32-bit FNV-1a hash of the full rendering. Stability across platforms and compiler versions is the point: instance names derived from these must not churn between compiles (which is why this is not hash).