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

On branch  : ghc-7.2

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

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

commit edbc9f564c19273d8bc4647ebbc389c7330ee851
Author: Ian Lynagh <[email protected]>
Date:   Fri Jul 15 13:16:50 2011 +0100

    Remove some defaultTargetPlatform's
    
    We now pass the correct platform in instead

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

 compiler/nativeGen/AsmCodeGen.lhs                  |    2 +-
 compiler/nativeGen/RegAlloc/Graph/Main.hs          |    4 +-
 compiler/nativeGen/RegAlloc/Graph/Stats.hs         |    4 +-
 compiler/nativeGen/RegAlloc/Graph/TrivColorable.hs |   23 ++++++++-----------
 4 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/compiler/nativeGen/AsmCodeGen.lhs 
b/compiler/nativeGen/AsmCodeGen.lhs
index 0e497fe..9941546 100644
--- a/compiler/nativeGen/AsmCodeGen.lhs
+++ b/compiler/nativeGen/AsmCodeGen.lhs
@@ -245,7 +245,7 @@ nativeCodeGen' dflags ncgImpl h us cmms
                        Opt_D_dump_asm_conflicts "Register conflict graph"
                        $ Color.dotGraph 
                                targetRegDotColor 
-                               (Color.trivColorable 
+                               (Color.trivColorable (targetPlatform dflags)
                                        targetVirtualRegSqueeze 
                                        targetRealRegSqueeze)
                        $ graphGlobal)
diff --git a/compiler/nativeGen/RegAlloc/Graph/Main.hs 
b/compiler/nativeGen/RegAlloc/Graph/Main.hs
index 9e8c25e..1b3ecd1 100644
--- a/compiler/nativeGen/RegAlloc/Graph/Main.hs
+++ b/compiler/nativeGen/RegAlloc/Graph/Main.hs
@@ -59,7 +59,7 @@ regAlloc dflags regsFree slotsFree code
        -- TODO: the regClass function is currently hard coded to the default 
target
        --       architecture. Would prefer to determine this from dflags.
        --       There are other uses of targetRegClass later in this module.
-       let triv = trivColorable 
+       let triv = trivColorable (targetPlatform dflags)
                        targetVirtualRegSqueeze
                        targetRealRegSqueeze
 
@@ -348,7 +348,7 @@ patchRegsFromGraph platform graph code
                        $$ pprPlatform platform code
                        $$ Color.dotGraph 
                                (\_ -> text "white") 
-                               (trivColorable 
+                               (trivColorable platform
                                        targetVirtualRegSqueeze
                                        targetRealRegSqueeze)
                                graph)
diff --git a/compiler/nativeGen/RegAlloc/Graph/Stats.hs 
b/compiler/nativeGen/RegAlloc/Graph/Stats.hs
index c4a3c90..4b10e9f 100644
--- a/compiler/nativeGen/RegAlloc/Graph/Stats.hs
+++ b/compiler/nativeGen/RegAlloc/Graph/Stats.hs
@@ -75,7 +75,7 @@ instance (Outputable statics, PlatformOutputable instr) => 
PlatformOutputable (R
        $$ text "#  Initial register conflict graph."
        $$ Color.dotGraph 
                targetRegDotColor
-               (trivColorable 
+               (trivColorable platform
                        targetVirtualRegSqueeze
                        targetRealRegSqueeze)
                (raGraph s)
@@ -112,7 +112,7 @@ instance (Outputable statics, PlatformOutputable instr) => 
PlatformOutputable (R
        $$ text "#  Register conflict graph (colored)."
        $$ Color.dotGraph 
                targetRegDotColor
-               (trivColorable 
+               (trivColorable platform
                        targetVirtualRegSqueeze
                        targetRealRegSqueeze)
                (raGraphColored s)
diff --git a/compiler/nativeGen/RegAlloc/Graph/TrivColorable.hs 
b/compiler/nativeGen/RegAlloc/Graph/TrivColorable.hs
index 802f847..e62b4a9 100644
--- a/compiler/nativeGen/RegAlloc/Graph/TrivColorable.hs
+++ b/compiler/nativeGen/RegAlloc/Graph/TrivColorable.hs
@@ -98,18 +98,15 @@ the most efficient variant tried. Benchmark compiling 
10-times SHA1.lhs follows.
                                  100.00%   166.23%   94.18%    100.95%
 -}
 
--- TODO: We shouldn't be using defaultTargetPlatform here.
---       We should be passing DynFlags in instead, and looking at
---       its targetPlatform.
-
 trivColorable
-        :: (RegClass -> VirtualReg -> FastInt)
+        :: Platform
+        -> (RegClass -> VirtualReg -> FastInt)
         -> (RegClass -> RealReg    -> FastInt)
         -> Triv VirtualReg RegClass RealReg
 
-trivColorable virtualRegSqueeze realRegSqueeze RcInteger conflicts exclusions
+trivColorable platform virtualRegSqueeze realRegSqueeze RcInteger conflicts 
exclusions
         | let !cALLOCATABLE_REGS_INTEGER
-                  = iUnbox (case platformArch defaultTargetPlatform of
+                  = iUnbox (case platformArch platform of
                             ArchX86     -> 3
                             ArchX86_64  -> 5
                             ArchPPC     -> 16
@@ -127,9 +124,9 @@ trivColorable virtualRegSqueeze realRegSqueeze RcInteger 
conflicts exclusions
 
         = count3 <# cALLOCATABLE_REGS_INTEGER
 
-trivColorable virtualRegSqueeze realRegSqueeze RcFloat conflicts exclusions
+trivColorable platform virtualRegSqueeze realRegSqueeze RcFloat conflicts 
exclusions
         | let !cALLOCATABLE_REGS_FLOAT
-                  = iUnbox (case platformArch defaultTargetPlatform of
+                  = iUnbox (case platformArch platform of
                             ArchX86     -> 0
                             ArchX86_64  -> 0
                             ArchPPC     -> 0
@@ -147,9 +144,9 @@ trivColorable virtualRegSqueeze realRegSqueeze RcFloat 
conflicts exclusions
 
         = count3 <# cALLOCATABLE_REGS_FLOAT
 
-trivColorable virtualRegSqueeze realRegSqueeze RcDouble conflicts exclusions
+trivColorable platform virtualRegSqueeze realRegSqueeze RcDouble conflicts 
exclusions
         | let !cALLOCATABLE_REGS_DOUBLE
-                  = iUnbox (case platformArch defaultTargetPlatform of
+                  = iUnbox (case platformArch platform of
                             ArchX86     -> 6
                             ArchX86_64  -> 0
                             ArchPPC     -> 26
@@ -167,9 +164,9 @@ trivColorable virtualRegSqueeze realRegSqueeze RcDouble 
conflicts exclusions
 
         = count3 <# cALLOCATABLE_REGS_DOUBLE
 
-trivColorable virtualRegSqueeze realRegSqueeze RcDoubleSSE conflicts exclusions
+trivColorable platform virtualRegSqueeze realRegSqueeze RcDoubleSSE conflicts 
exclusions
         | let !cALLOCATABLE_REGS_SSE
-                  = iUnbox (case platformArch defaultTargetPlatform of
+                  = iUnbox (case platformArch platform of
                             ArchX86     -> 8
                             ArchX86_64  -> 10
                             ArchPPC     -> 0



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

Reply via email to