Skip to content
  • Peter Wortmann's avatar
    Source notes (Core support) · 993975d3
    Peter Wortmann authored
    This patch introduces "SourceNote" tickishs that link Core to the
    source code that generated it. The idea is to retain these source code
    links throughout code transformations so we can eventually relate
    object code all the way back to the original source (which we can,
    say, encode as DWARF information to allow debugging).  We generate
    these SourceNotes like other tickshs in the desugaring phase. The
    activating command line flag is "-g", consistent with the flag other
    compilers use to decide DWARF generation.
    
    Keeping ticks from getting into the way of Core transformations is
    tricky, but doable. The changes in this patch produce identical Core
    in all cases I tested -- which at this point is GHC, all libraries and
    nofib. Also note that this pass creates *lots* of tick nodes, which we
    reduce somewhat by removing duplicated and overlapping source
    ticks. This will still cause significant Tick "clumps" - a possible
    future optimization could be to make Tick carry a list of Tickishs
    instead of one at a time.
    
    (From Phabricator D169)
    993975d3