Commit 5cf71826 authored by Simon Marlow's avatar Simon Marlow

Misc tidyup

parent 254f1a6c
......@@ -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
......
......@@ -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)
......@@ -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
......
......@@ -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
......
......@@ -3,7 +3,7 @@ module CmmSink (
cmmSink
) where
import StgCmmUtils (callerSaves)
import CodeGen.Platform (callerSaves)
import Cmm
import BlockId
......
......@@ -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)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment