Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : ghc-7.2

http://hackage.haskell.org/trac/ghc/changeset/beefc60c26fbab7e721e29c5955c2adca51cc965

>---------------------------------------------------------------

commit beefc60c26fbab7e721e29c5955c2adca51cc965
Author: Max Bolingbroke <[email protected]>
Date:   Tue Jul 5 09:23:58 2011 +0100

    Refactoring: use a structured CmmStatics type rather than [CmmStatic]
    
    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.

 compiler/basicTypes/BasicTypes.lhs              |   12 +++
 compiler/cmm/Cmm.hs                             |    4 +-
 compiler/cmm/CmmBuildInfoTables.hs              |    4 +-
 compiler/cmm/CmmDecl.hs                         |    8 ++-
 compiler/cmm/CmmParse.y                         |   17 +++--
 compiler/cmm/OldCmm.hs                          |    8 +-
 compiler/cmm/PprC.hs                            |   16 +----
 compiler/cmm/PprCmmDecl.hs                      |   12 +++-
 compiler/codeGen/CgHpc.hs                       |    6 +-
 compiler/codeGen/CgMonad.lhs                    |    2 +-
 compiler/codeGen/CgUtils.hs                     |   14 ++--
 compiler/codeGen/CodeGen.lhs                    |    2 +-
 compiler/codeGen/StgCmm.hs                      |    2 +-
 compiler/codeGen/StgCmmHpc.hs                   |   11 ++--
 compiler/codeGen/StgCmmMonad.hs                 |    2 +-
 compiler/codeGen/StgCmmUtils.hs                 |   14 ++--
 compiler/llvmGen/LlvmCodeGen.hs                 |    2 +-
 compiler/llvmGen/LlvmCodeGen/Base.hs            |    2 +-
 compiler/llvmGen/LlvmCodeGen/Data.hs            |    6 +-
 compiler/llvmGen/LlvmCodeGen/Ppr.hs             |    4 +-
 compiler/nativeGen/AsmCodeGen.lhs               |   82 +++++++++++-----------
 compiler/nativeGen/Instruction.hs               |    6 +-
 compiler/nativeGen/PIC.hs                       |   11 ++--
 compiler/nativeGen/PPC/CodeGen.hs               |   19 +++---
 compiler/nativeGen/PPC/Instr.hs                 |    2 +-
 compiler/nativeGen/PPC/Ppr.hs                   |    8 ++-
 compiler/nativeGen/PPC/RegInfo.hs               |   22 ++++--
 compiler/nativeGen/RegAlloc/Graph/Coalesce.hs   |    6 +-
 compiler/nativeGen/RegAlloc/Graph/Main.hs       |   12 ++--
 compiler/nativeGen/RegAlloc/Graph/Spill.hs      |   12 ++--
 compiler/nativeGen/RegAlloc/Graph/SpillClean.hs |   10 ++--
 compiler/nativeGen/RegAlloc/Graph/SpillCost.hs  |    2 +-
 compiler/nativeGen/RegAlloc/Graph/Stats.hs      |   32 +++++-----
 compiler/nativeGen/RegAlloc/Linear/Main.hs      |    4 +-
 compiler/nativeGen/RegAlloc/Linear/Stats.hs     |    4 +-
 compiler/nativeGen/RegAlloc/Liveness.hs         |   36 +++++-----
 compiler/nativeGen/SPARC/CodeGen.hs             |    8 +-
 compiler/nativeGen/SPARC/CodeGen/Expand.hs      |    2 +-
 compiler/nativeGen/SPARC/CodeGen/Gen32.hs       |   10 +--
 compiler/nativeGen/SPARC/Instr.hs               |    2 +-
 compiler/nativeGen/SPARC/Ppr.hs                 |    7 ++-
 compiler/nativeGen/SPARC/ShortcutJump.hs        |   23 ++++--
 compiler/nativeGen/X86/CodeGen.hs               |   17 ++---
 compiler/nativeGen/X86/Instr.hs                 |   22 ++++--
 compiler/nativeGen/X86/Ppr.hs                   |    8 ++-
 45 files changed, 275 insertions(+), 240 deletions(-)


Diff suppressed because of size. To see it, use:

    git show beefc60c26fbab7e721e29c5955c2adca51cc965

_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to