Wed Mar 18 03:59:11 PDT 2009  [email protected]
  * Add the notion of "constructor-like" Ids for rule-matching
  Ignore-this: 9249b00a2292563e68d5d715376b216c
  
  This patch adds an optional CONLIKE modifier to INLINE/NOINLINE pragmas, 
     {-# NOINLINE CONLIKE [1] f #-}
  The effect is to allow applications of 'f' to be expanded in a potential
  rule match.  Example
    {-# RULE "r/f" forall v. r (f v) = f (v+1) #-}
  
  Consider the term
       let x = f v in ..x...x...(r x)...
  Normally the (r x) would not match the rule, because GHC would be scared
  about duplicating the redex (f v). However the CONLIKE modifier says to
  treat 'f' like a constructor in this situation, and "look through" the
  unfolding for x.  So (r x) fires, yielding (f (v+1)).
  
  The main changes are:
    - Syntax
  
    - The inlinePragInfo field of an IdInfo has a RuleMatchInfo
      component, which records whether or not the Id is CONLIKE.
      Of course, this needs to be serialised in interface files too.
  
    - The occurrence analyser (OccAnal) and simplifier (Simplify) treat
      CONLIKE thing like constructors, by ANF-ing them
  
    - New function coreUtils.exprIsExpandable is like exprIsCheap, but
      additionally spots applications of CONLIKE functions
  
    - A CoreUnfolding has a field that caches exprIsExpandable
  
    - The rule matcher consults this field.  See 
      Note [Expanding variables] in Rules.lhs.
  
  On the way I fixed a lurking variable bug in the way variables are
  expanded.  See Note [Do not expand locally-bound variables] in
  Rule.lhs.  I also did a bit of reformatting and refactoring in
  Rules.lhs, so the module has more lines changed than are really
  different.
  

    M ./compiler/basicTypes/BasicTypes.lhs -13 +76
    M ./compiler/basicTypes/Id.lhs -5 +18
    M ./compiler/basicTypes/IdInfo.lhs -4 +4
    M ./compiler/coreSyn/CoreSyn.lhs -22 +28
    M ./compiler/coreSyn/CoreUnfold.lhs -8 +12
    M ./compiler/coreSyn/CoreUtils.lhs -69 +27
    M ./compiler/coreSyn/PprCore.lhs -1 +1
    M ./compiler/deSugar/DsBinds.lhs -5 +5
    M ./compiler/deSugar/DsForeign.lhs -1 +1
    M ./compiler/iface/BinIface.hs +18
    M ./compiler/iface/IfaceSyn.lhs -2 +2
    M ./compiler/iface/MkIface.lhs -5 +7
    M ./compiler/main/TidyPgm.lhs -1 +1
    M ./compiler/parser/Lexer.x +7
    M ./compiler/parser/Parser.y.pp -3 +7
    M ./compiler/parser/RdrHsSyn.lhs -5 +9
    M ./compiler/simplCore/CSE.lhs -3 +3
    M ./compiler/simplCore/OccurAnal.lhs -1 +1
    M ./compiler/simplCore/SimplEnv.lhs -2 +2
    M ./compiler/simplCore/SimplUtils.lhs -9 +9
    M ./compiler/simplCore/Simplify.lhs -2 +2
    M ./compiler/specialise/Rules.lhs -116 +172
    M ./compiler/specialise/Specialise.lhs -6 +7
    M ./compiler/stranal/DmdAnal.lhs -2 +2
    M ./compiler/stranal/WorkWrap.lhs -10 +12
    M ./compiler/typecheck/TcInstDcls.lhs -1 +1

View patch online:
http://darcs.haskell.org/ghc/_darcs/patches/20090318105911-1287e-ba41db03043c324c534f96d99258e1e23568efaa.gz

_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to