Skip to content

Commit

Permalink
Inline let-binders called [ds<N> | N <- [1..]]
Browse files Browse the repository at this point in the history
They're usually binders auto-generated by GHC to represent
pattern-matched arguments; and we don't want them to end up in
the generated HDL.
  • Loading branch information
christiaanb committed Jan 14, 2020
1 parent 08d4ad0 commit ddbbb57
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion clash-ghc/src-ghc/Clash/GHC/GHC2Core.hs
Expand Up @@ -35,6 +35,7 @@ import Control.Lens ((^.), (%~), (&), (%=))
import Control.Monad.RWS.Strict (RWS)
import qualified Control.Monad.RWS.Strict as RWS
import qualified Data.ByteString.Char8 as Char8
import Data.Char (isDigit)
import Data.Hashable (Hashable (..))
import Data.HashMap.Strict (HashMap)
import qualified Data.HashMap.Strict as HashMap
Expand Down Expand Up @@ -851,7 +852,9 @@ coreToName toName toUnique toString v = do
ns <- toString (toName v)
let key = getKey (toUnique v)
locI = getSrcSpan (toName v)
sort | ns == "ds" || Text.isPrefixOf "$" ns
-- Is it one of [ds,ds1,ds2,..]
isDSX = maybe False (maybe True (isDigit . fst) . Text.uncons) . Text.stripPrefix "ds"
sort | isDSX ns || Text.isPrefixOf "$" ns
= C.System
| otherwise
= C.User
Expand Down

0 comments on commit ddbbb57

Please sign in to comment.