ghc-9.2.2: The GHC API
Safe HaskellSafe-Inferred
LanguageHaskell2010

GHC.Stg.Lint

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 [Core 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 Source #

Arguments

:: forall a. (OutputablePass a, BinderP a ~ Id) 
=> Logger 
-> DynFlags 
-> InteractiveContext 
-> Module

module being compiled

-> Bool

have we run Unarise yet?

-> String

who produced the STG?

-> [GenStgTopBinding a] 
-> IO ()