[commit: ghc] master: Misc tidyup (5cf7182)

Simon Marlow <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/5cf718261506cfc25c089e57c4d5c46111dbe6a1

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

commit 5cf718261506cfc25c089e57c4d5c46111dbe6a1
Author: Simon Marlow <[email protected]>
Date:   Mon Sep 24 11:12:35 2012 +0100

    Misc tidyup

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

 compiler/cmm/CmmBuildInfoTables.hs    |   15 +++++++--------
 compiler/cmm/CmmInfo.hs               |    7 +++++++
 compiler/cmm/CmmLayoutStack.hs        |    6 +++---
 compiler/cmm/CmmRewriteAssignments.hs |    3 ++-
 compiler/cmm/CmmSink.hs               |    2 +-
 compiler/codeGen/StgCmmUtils.hs       |    7 +------
 6 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/compiler/cmm/CmmBuildInfoTables.hs b/compiler/cmm/CmmBuildInfoTables.hs
index d587d60..54edb73 100644
--- a/compiler/cmm/CmmBuildInfoTables.hs
+++ b/compiler/cmm/CmmBuildInfoTables.hs
@@ -19,19 +19,15 @@ where
 
 #include "HsVersions.h"
 
--- These should not be imported here!
-import StgCmmUtils
 import Hoopl
-
 import Digraph
-import qualified Prelude as P
-import Prelude hiding (succ)
-
 import BlockId
 import Bitmap
 import CLabel
+import PprCmmDecl ()
 import Cmm
 import CmmUtils
+import CmmInfo
 import Data.List
 import DynFlags
 import Maybes
@@ -47,6 +43,9 @@ import Data.Set (Set)
 import qualified Data.Set as Set
 import Control.Monad
 
+import qualified Prelude as P
+import Prelude hiding (succ)
+
 foldSet :: (a -> b -> b) -> b -> Set a -> b
 foldSet = Set.foldr
 
@@ -228,7 +227,7 @@ maxBmpSize dflags = widthInBits (wordWidth dflags) `div` 2
 -- Adapted from codeGen/StgCmmUtils, which converts from SRT to C_SRT.
 to_SRT :: DynFlags -> CLabel -> Int -> Int -> Bitmap -> UniqSM (Maybe CmmDecl, C_SRT)
 to_SRT dflags top_srt off len bmp
-  | len > maxBmpSize dflags || bmp == [toStgWord dflags (fromStgHalfWord (srt_escape dflags))]
+  | len > maxBmpSize dflags || bmp == [toStgWord dflags (fromStgHalfWord (srtEscape dflags))]
   = do id <- getUniqueM
        let srt_desc_lbl = mkLargeSRTLabel id
            tbl = CmmData RelocatableReadOnlyData $
@@ -236,7 +235,7 @@ to_SRT dflags top_srt off len bmp
                      ( cmmLabelOffW dflags top_srt off
                      : mkWordCLit dflags (toStgWord dflags (fromIntegral len))
                      : map (mkWordCLit dflags) bmp)
-       return (Just tbl, C_SRT srt_desc_lbl 0 (srt_escape dflags))
+       return (Just tbl, C_SRT srt_desc_lbl 0 (srtEscape dflags))
   | otherwise
   = return (Nothing, C_SRT top_srt off (toStgHalfWord dflags (fromStgWord (head bmp))))
 	-- The fromIntegral converts to StgHalfWord
diff --git a/compiler/cmm/CmmInfo.hs b/compiler/cmm/CmmInfo.hs
index 9d335c6..6aa4d6c 100644
--- a/compiler/cmm/CmmInfo.hs
+++ b/compiler/cmm/CmmInfo.hs
@@ -9,6 +9,7 @@ module CmmInfo (
   mkEmptyContInfoTable,
   cmmToRawCmm,
   mkInfoTable,
+  srtEscape
 ) where
 
 #include "HsVersions.h"
@@ -384,3 +385,9 @@ newStringLit bytes
   = do { uniq <- getUniqueUs
        ; return (mkByteStringCLit uniq bytes) }
 
+
+-- Misc utils
+
+-- | Value of the srt field of an info table when using an StgLargeSRT
+srtEscape :: DynFlags -> StgHalfWord
+srtEscape dflags = toStgHalfWord dflags (-1)
diff --git a/compiler/cmm/CmmLayoutStack.hs b/compiler/cmm/CmmLayoutStack.hs
index b4ca273..6f75f54 100644
--- a/compiler/cmm/CmmLayoutStack.hs
+++ b/compiler/cmm/CmmLayoutStack.hs
@@ -3,9 +3,9 @@ module CmmLayoutStack (
        cmmLayoutStack, setInfoTableStackMap
   ) where
 
-import StgCmmUtils      ( callerSaveVolatileRegs ) -- XXX
-import StgCmmForeign    ( saveThreadState, loadThreadState ) -- XXX
-import StgCmmLayout     ( entryCode ) -- XXX
+import StgCmmUtils      ( callerSaveVolatileRegs ) -- XXX layering violation
+import StgCmmForeign    ( saveThreadState, loadThreadState ) -- XXX layering violation
+import StgCmmLayout     ( entryCode ) -- XXX layering violation
 
 import Cmm
 import BlockId
diff --git a/compiler/cmm/CmmRewriteAssignments.hs b/compiler/cmm/CmmRewriteAssignments.hs
index 585d78e..0f2aeaa 100644
--- a/compiler/cmm/CmmRewriteAssignments.hs
+++ b/compiler/cmm/CmmRewriteAssignments.hs
@@ -15,10 +15,11 @@ module CmmRewriteAssignments
   ( rewriteAssignments
   ) where
 
+import StgCmmUtils -- XXX layering violation
+
 import Cmm
 import CmmUtils
 import CmmOpt
-import StgCmmUtils
 
 import DynFlags
 import UniqSupply
diff --git a/compiler/cmm/CmmSink.hs b/compiler/cmm/CmmSink.hs
index 28e3b77..7acc4dd 100644
--- a/compiler/cmm/CmmSink.hs
+++ b/compiler/cmm/CmmSink.hs
@@ -3,7 +3,7 @@ module CmmSink (
      cmmSink
   ) where
 
-import StgCmmUtils (callerSaves)
+import CodeGen.Platform (callerSaves)
 
 import Cmm
 import BlockId
diff --git a/compiler/codeGen/StgCmmUtils.hs b/compiler/codeGen/StgCmmUtils.hs
index f5dc2b6..386e7f4 100644
--- a/compiler/codeGen/StgCmmUtils.hs
+++ b/compiler/codeGen/StgCmmUtils.hs
@@ -37,9 +37,7 @@ module StgCmmUtils (
         mkWordCLit,
         newStringCLit, newByteStringCLit,
         packHalfWordsCLit,
-        blankWord,
-
-        srt_escape
+        blankWord
   ) where
 
 #include "HsVersions.h"
@@ -719,6 +717,3 @@ assignTemp' e
        let reg = CmmLocal lreg
        emitAssign reg e
        return (CmmReg reg)
-
-srt_escape :: DynFlags -> StgHalfWord
-srt_escape dflags = toStgHalfWord dflags (-1)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.