• Jan Stolarek's avatar
    Improve sinking pass · ad15c2b4
    Jan Stolarek authored
    This commit does two things:
      * Allows duplicating of global registers and literals by inlining
        them. Previously we would only inline global register or literal
        if it was used only once.
      * Changes method of determining conflicts between a node and an
        assignment. New method has two advantages. It relies on
        DefinerOfRegs and UserOfRegs typeclasses, so if a set of registers
        defined or used by a node should ever change, `conflicts` function
        will use the changed definition. This definition also catches
        more cases than the previous one (namely CmmCall and CmmForeignCall)
        which is a step towards making it possible to run sinking pass
        before stack layout (currently this doesn't work).
    This patch also adds a lot of comments that are result of about two-week
    long investigation of how sinking pass works and why it does what it does.
CmmSink.hs 25.5 KB