Skip to content
  • Peter Wortmann's avatar
    Source notes (CorePrep and Stg support) · 4cdbf802
    Peter Wortmann authored
    This is basically just about continuing maintaining source notes after
    the Core stage. Unfortunately, this is more involved as it might seem,
    as there are more restrictions on where ticks are allowed to show up.
    
    Notes:
    
    * We replace the StgTick / StgSCC constructors with a unified StgTick
      that can carry any tickish.
    
    * For handling constructor or lambda applications, we generally float
      ticks out.
    
    * Note that thanks to the NonLam placement, we know that source notes
      can never appear on lambdas. This means that as long as we are
      careful to always use mkTick, we will never violate CorePrep
      invariants.
    
    * This is however not automatically true for eta expansion, which
      needs to somewhat awkwardly strip, then re-tick the expression in
      question.
    
    * Where CorePrep floats out lets, we make sure to wrap them in the
      same spirit as FloatOut.
    
    * Detecting selector thunks becomes a bit more involved, as we can run
      into ticks at multiple points.
    
    (From Phabricator D169)
    4cdbf802