[project @ 1999-05-11 16:37:29 by keithw]
authorkeithw <unknown>
Tue, 11 May 1999 16:38:04 +0000 (16:38 +0000)
committerkeithw <unknown>
Tue, 11 May 1999 16:38:04 +0000 (16:38 +0000)
commitd133b73a4d4717892ced072d05e039a54ede0ceb
tree5f6816748e45949f918f1be0a02dce76ee5ca18f
parentf83ad713ad73e583fd138bb17e7341041b36a416
[project @ 1999-05-11 16:37:29 by keithw]
(this is number 4 of 9 commits to be applied together)

  The major purpose of this commit is to introduce usage information
  and usage analysis into the compiler, per the paper _Once Upon a
  Polymorphic Type_ (Keith Wansbrough and Simon Peyton Jones, POPL'99,
  and Glasgow TR-1998-19).

  Usage information has been added to types, in the form of a new kind
  of NoteTy: (UsgNote UsageAnn(UsOnce|UsMany|UsVar UVar)).  Usages
  print as __o (once), __m (many, usually omitted), or (not in
  interface files) __uvxxxx.  Usage annotations should only appear at
  certain places in a type (see the paper).  The `default' annotation
  is __m, and so an omitted annotation implies __m.  Utility functions
  for handling usage annotations are provided in Type.

  If the compiler is built with -DUSMANY (a flag intended for use in
  debugging by KSW only), __m are *required* and may not be omitted.

  The major constraint is that type arguments (eg to mkAppTy) must be
  unannotated on top.  To maintain this invariant, many functions
  required the insertion of Type.unUsgTy (removing annot from top of a
  type) or UsageSPUtils.unannotTy (removing all annotations from a
  type).  A function returning usage-annotated types for primops has
  been added to PrimOp.

  A new kind of Note, (TermUsg UsageAnn), has been added to annotate
  Terms.  This note is *not* printed in interface files, and for the
  present does not escape the internals of the usage inference engine.
33 files changed:
ghc/compiler/Makefile
ghc/compiler/basicTypes/MkId.lhs
ghc/compiler/basicTypes/UniqSupply.lhs
ghc/compiler/basicTypes/Var.lhs
ghc/compiler/basicTypes/VarEnv.lhs
ghc/compiler/coreSyn/CoreSyn.lhs
ghc/compiler/coreSyn/CoreUtils.lhs
ghc/compiler/coreSyn/PprCore.lhs
ghc/compiler/deSugar/DsExpr.lhs
ghc/compiler/deSugar/DsMonad.lhs
ghc/compiler/deSugar/DsUtils.lhs
ghc/compiler/hsSyn/HsTypes.lhs
ghc/compiler/prelude/PrelInfo.lhs
ghc/compiler/prelude/PrelVals.lhs
ghc/compiler/prelude/PrimOp.lhs
ghc/compiler/reader/Lex.lhs
ghc/compiler/reader/RdrHsSyn.lhs
ghc/compiler/rename/ParseIface.y
ghc/compiler/rename/RnSource.lhs
ghc/compiler/simplCore/FloatIn.lhs
ghc/compiler/simplCore/SetLevels.lhs
ghc/compiler/simplCore/SimplCore.lhs
ghc/compiler/specialise/Specialise.lhs
ghc/compiler/stranal/WorkWrap.lhs
ghc/compiler/typecheck/TcClassDcl.lhs
ghc/compiler/typecheck/TcEnv.lhs
ghc/compiler/typecheck/TcExpr.lhs
ghc/compiler/typecheck/TcInstDcls.lhs
ghc/compiler/typecheck/TcMonad.lhs
ghc/compiler/typecheck/TcMonoType.lhs
ghc/compiler/typecheck/TcType.lhs
ghc/compiler/typecheck/TcUnify.lhs
ghc/compiler/types/Type.lhs