Add (a) CoreM monad, (b) new Annotations feature
authorsimonpj@microsoft.com <unknown>
Thu, 30 Oct 2008 12:51:08 +0000 (12:51 +0000)
committersimonpj@microsoft.com <unknown>
Thu, 30 Oct 2008 12:51:08 +0000 (12:51 +0000)
commit9bcd95bad83ee937c178970e8b729732e680fe1e
treee0cbcf15a961d05da7b12b45b9aaf0efb4672338
parentb1f3ff48870a3a4670cb41b890b78bbfffa8a32e
Add (a) CoreM monad, (b) new Annotations feature

This patch, written by Max Bolingbroke,  does two things

1.  It adds a new CoreM monad (defined in simplCore/CoreMonad),
    which is used as the top-level monad for all the Core-to-Core
    transformations (starting at SimplCore).  It supports
       * I/O (for debug printing)
       * Unique supply
       * Statistics gathering
       * Access to the HscEnv, RuleBase, Annotations, Module
    The patch therefore refactors the top "skin" of every Core-to-Core
    pass, but does not change their functionality.

2.  It adds a completely new facility to GHC: Core "annotations".
    The idea is that you can say
       {#- ANN foo (Just "Hello") #-}
    which adds the annotation (Just "Hello") to the top level function
    foo.  These annotations can be looked up in any Core-to-Core pass,
    and are persisted into interface files.  (Hence a Core-to-Core pass
    can also query the annotations of imported things.)  Furthermore,
    a Core-to-Core pass can add new annotations (eg strictness info)
    of its own, which can be queried by importing modules.

The design of the annotation system is somewhat in flux.  It's
designed to work with the (upcoming) dynamic plug-ins mechanism,
but is meanwhile independently useful.

Do not merge to 6.10!
52 files changed:
compiler/deSugar/Desugar.lhs
compiler/ghc.cabal.in
compiler/hsSyn/Convert.lhs
compiler/hsSyn/HsDecls.lhs
compiler/iface/BinIface.hs
compiler/iface/IfaceSyn.lhs
compiler/iface/LoadIface.lhs
compiler/iface/MkIface.lhs
compiler/iface/TcIface.lhs
compiler/iface/TcIface.lhs-boot
compiler/main/Annotations.lhs [new file with mode: 0644]
compiler/main/DynFlags.hs
compiler/main/GHC.hs
compiler/main/HscMain.lhs
compiler/main/HscTypes.lhs
compiler/main/HscTypes.lhs-boot [deleted file]
compiler/main/TidyPgm.lhs
compiler/parser/Lexer.x
compiler/parser/Parser.y.pp
compiler/parser/RdrHsSyn.lhs
compiler/prelude/PrelNames.lhs
compiler/rename/RnSource.lhs
compiler/simplCore/CSE.lhs
compiler/simplCore/CoreMonad.lhs [new file with mode: 0644]
compiler/simplCore/FloatIn.lhs
compiler/simplCore/FloatOut.lhs
compiler/simplCore/LiberateCase.lhs
compiler/simplCore/SAT.lhs
compiler/simplCore/SetLevels.lhs
compiler/simplCore/SimplCore.lhs
compiler/specialise/Rules.lhs
compiler/specialise/SpecConstr.lhs
compiler/specialise/Specialise.lhs
compiler/stranal/DmdAnal.lhs
compiler/stranal/StrictAnal.lhs
compiler/stranal/WorkWrap.lhs
compiler/typecheck/TcAnnotations.lhs [new file with mode: 0644]
compiler/typecheck/TcEnv.lhs
compiler/typecheck/TcExpr.lhs
compiler/typecheck/TcRnDriver.lhs
compiler/typecheck/TcRnMonad.lhs
compiler/typecheck/TcRnTypes.lhs
compiler/typecheck/TcSimplify.lhs
compiler/typecheck/TcSplice.lhs
compiler/typecheck/TcSplice.lhs-boot
compiler/utils/Binary.hs
compiler/utils/IOEnv.hs
compiler/utils/MonadUtils.hs
compiler/utils/Outputable.lhs
compiler/utils/Serialized.hs [new file with mode: 0644]
compiler/vectorise/Vectorise.hs
docs/users_guide/glasgow_exts.xml