• Peter Wortmann's avatar
    Add unwind information to Cmm · 711a51ad
    Peter Wortmann authored
    Unwind information allows the debugger to discover more information
    about a program state, by allowing it to "reconstruct" other states of
    the program. In practice, this means that we explain to the debugger
    how to unravel stack frames, which comes down mostly to explaining how
    to find their Sp and Ip register values.
    * We declare yet another new constructor for CmmNode - and this time
      there's actually little choice, as unwind information can and will
      change mid-block. We don't actually make use of these capabilities,
      and back-end support would be tricky (generate new labels?), but it
      feels like the right way to do it.
    * Even though we only use it for Sp so far, we allow CmmUnwind to specify
      unwind information for any register. This is pretty cheap and could
      come in useful in future.
    * We allow full CmmExpr expressions for specifying unwind values. The
      advantage here is that we don't have to make up new syntax, and can e.g.
      use the WDS macro directly. On the other hand, the back-end will now
      have to simplify the expression until it can sensibly be converted
      into DWARF byte code - a process which might fail, yielding NCG panics.
      On the other hand, when you're writing Cmm by hand you really ought to
      know what you're doing.
    (From Phabricator D169)
CmmCommonBlockElim.hs 9.39 KB