• batterseapower's avatar
    Refactoring: use a structured CmmStatics type rather than [CmmStatic] · 54843b5b
    batterseapower authored
    I observed that the [CmmStatics] within CmmData uses the list in a very stylised way.
    The first item in the list is almost invariably a CmmDataLabel. Many parts of the
    compiler pattern match on this list and fail if this is not true.
    
    This patch makes the invariant explicit by introducing a structured type CmmStatics
    that holds the label and the list of remaining [CmmStatic].
    
    There is one wrinkle: the x86 backend sometimes wants to output an alignment directive just
    before the label. However, this can be easily fixed up by parameterising the native codegen
    over the type of CmmStatics (though the GenCmmTop parameterisation) and using a pair
    (Alignment, CmmStatics) there instead.
    
    As a result, I think we will be able to remove CmmAlign and CmmDataLabel from the CmmStatic
    data type, thus nuking a lot of code and failing pattern matches. This change will come as part
    of my next patch.
    54843b5b
SpillClean.hs 15.8 KB