StgLint

ghc-8.6.3: The GHC API

Safe Haskell | None
Language | Haskell2010

StgLint

Description

(c) The GRASP/AQUA Project, Glasgow University, 1993-1998

A lint pass to check basic STG invariants:

- Variables should be defined before used.
- Let bindings should not have unboxed types (unboxed bindings should only appear in case), except when they're join points (see Note [CoreSyn let/app invariant] and #14117).
- If linting after unarisation, invariants listed in Note [Post-unarisation invariants].

Because we don't have types and coercions in STG we can't really check types here.

Some history:

StgLint used to check types, but it never worked and so it was disabled in 2000 with this note:

WARNING: ~~~~~~~~

This module has suffered bit-rot; it is likely to yield lint errors for Stg code that is currently perfectly acceptable for code generation. Solution: don't use it! (KSW 2000-05).

Since then there were some attempts at enabling it again, as summarised in #14787. It's finally decided that we remove all type checking and only look for basic properties listed above.

# Documentation

lintStgTopBindings #

Arguments

:: DynFlags |
-> Bool | have we run Unarise yet?
-> String | who produced the STG?
-> [StgTopBinding] |
-> IO () |