• Peter Wortmann's avatar
    Debug data extraction (NCG support) · f46aa733
    Peter Wortmann authored
    The purpose of the Debug module is to collect all required information
    to generate debug information (DWARF etc.) in the back-ends. Our main
    data structure is the "debug block", which carries all information we have
    about a block of code that is going to get produced.
    * Debug blocks are arranged into a tree according to tick scopes. This
      makes it easier to reason about inheritance rules. Note however that
      tick scopes are not guaranteed to form a tree, which requires us to
      "copy" ticks to not lose them.
    * This is also where we decide what source location we regard as
      representing a code block the "best". The heuristic is basically that
      we want the most specific source reference that comes from the same file
      we are currently compiling. This seems to be the most useful choice in
      my experience.
    * We are careful to not be too lazy so we don't end up breaking streaming.
      Debug data will be kept alive until the end of codegen, after all.
    * We change native assembler dumps to happen right away for every Cmm group.
      This simplifies the code somewhat and is consistent with how pretty much
      all of GHC handles dumps with respect to streamed code.
    (From Phabricator D169)
AsmCodeGen.hs 42.9 KB