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

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/0176c3f297e58080ae1c308453cf5233f60f1f21

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

commit 0176c3f297e58080ae1c308453cf5233f60f1f21
Author: Ian Lynagh <[email protected]>
Date:   Tue Sep 18 23:35:34 2012 +0100

    Remove a little more CPP

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

 compiler/cmm/CmmUtils.hs         |    4 ++--
 compiler/cmm/SMRep.lhs           |   17 ++++-------------
 compiler/codeGen/CgInfoTbls.hs   |    4 ++--
 compiler/codeGen/CgUtils.hs      |    2 +-
 compiler/codeGen/StgCmmLayout.hs |    4 ++--
 5 files changed, 11 insertions(+), 20 deletions(-)

diff --git a/compiler/cmm/CmmUtils.hs b/compiler/cmm/CmmUtils.hs
index cde5bd1..bf93a2f 100644
--- a/compiler/cmm/CmmUtils.hs
+++ b/compiler/cmm/CmmUtils.hs
@@ -166,8 +166,8 @@ packHalfWordsCLit :: DynFlags -> StgHalfWord -> StgHalfWord 
-> CmmLit
 --       but be careful: that's vulnerable when reversed
 packHalfWordsCLit dflags lower_half_word upper_half_word
    = if wORDS_BIGENDIAN dflags
-     then mkWordCLit dflags ((l `shiftL` hALF_WORD_SIZE_IN_BITS) .|. u)
-     else mkWordCLit dflags (l .|. (u `shiftL` hALF_WORD_SIZE_IN_BITS))
+     then mkWordCLit dflags ((l `shiftL` hALF_WORD_SIZE_IN_BITS dflags) .|. u)
+     else mkWordCLit dflags (l .|. (u `shiftL` hALF_WORD_SIZE_IN_BITS dflags))
     where l = toStgWord dflags (fromStgHalfWord lower_half_word)
           u = toStgWord dflags (fromStgHalfWord upper_half_word)
 
diff --git a/compiler/cmm/SMRep.lhs b/compiler/cmm/SMRep.lhs
index bf30374..53110cf 100644
--- a/compiler/cmm/SMRep.lhs
+++ b/compiler/cmm/SMRep.lhs
@@ -118,19 +118,10 @@ toStgHalfWord dflags i
 instance Outputable StgHalfWord where
     ppr (StgHalfWord i) = integer i
 
-#if SIZEOF_HSWORD == 4
-hALF_WORD_SIZE :: ByteOff
-hALF_WORD_SIZE = 2
-hALF_WORD_SIZE_IN_BITS :: Int
-hALF_WORD_SIZE_IN_BITS = 16
-#elif SIZEOF_HSWORD == 8
-hALF_WORD_SIZE :: ByteOff
-hALF_WORD_SIZE = 4
-hALF_WORD_SIZE_IN_BITS :: Int
-hALF_WORD_SIZE_IN_BITS = 32
-#else
-#error unknown SIZEOF_HSWORD
-#endif
+hALF_WORD_SIZE :: DynFlags -> ByteOff
+hALF_WORD_SIZE dflags = platformWordSize (targetPlatform dflags) `shiftR` 1
+hALF_WORD_SIZE_IN_BITS :: DynFlags -> Int
+hALF_WORD_SIZE_IN_BITS dflags = platformWordSize (targetPlatform dflags) 
`shiftL` 2
 \end{code}
 
 
diff --git a/compiler/codeGen/CgInfoTbls.hs b/compiler/codeGen/CgInfoTbls.hs
index e2a3aa2..94301af 100644
--- a/compiler/codeGen/CgInfoTbls.hs
+++ b/compiler/codeGen/CgInfoTbls.hs
@@ -263,7 +263,7 @@ stdInfoTableSizeB dflags = stdInfoTableSizeW dflags * 
wORD_SIZE dflags
 stdSrtBitmapOffset :: DynFlags -> ByteOff
 -- Byte offset of the SRT bitmap half-word which is 
 -- in the *higher-addressed* part of the type_lit
-stdSrtBitmapOffset dflags = stdInfoTableSizeB dflags - hALF_WORD_SIZE
+stdSrtBitmapOffset dflags = stdInfoTableSizeB dflags - hALF_WORD_SIZE dflags
 
 stdClosureTypeOffset :: DynFlags -> ByteOff
 -- Byte offset of the closure type half-word 
@@ -271,7 +271,7 @@ stdClosureTypeOffset dflags = stdInfoTableSizeB dflags - 
wORD_SIZE dflags
 
 stdPtrsOffset, stdNonPtrsOffset :: DynFlags -> ByteOff
 stdPtrsOffset    dflags = stdInfoTableSizeB dflags - 2 * wORD_SIZE dflags
-stdNonPtrsOffset dflags = stdInfoTableSizeB dflags - 2 * wORD_SIZE dflags + 
hALF_WORD_SIZE
+stdNonPtrsOffset dflags = stdInfoTableSizeB dflags - 2 * wORD_SIZE dflags + 
hALF_WORD_SIZE dflags
 
 -------------------------------------------------------------------------
 --
diff --git a/compiler/codeGen/CgUtils.hs b/compiler/codeGen/CgUtils.hs
index aee4c7b..3a106ab 100644
--- a/compiler/codeGen/CgUtils.hs
+++ b/compiler/codeGen/CgUtils.hs
@@ -795,7 +795,7 @@ getSRTInfo = do
     NoSRT -> return NoC_SRT
     SRTEntries {} -> panic "getSRTInfo: SRTEntries.  Perhaps you forgot to run 
SimplStg?"
     SRT off len bmp
-      | len > hALF_WORD_SIZE_IN_BITS || bmp == [toStgWord dflags 
(fromStgHalfWord (srt_escape dflags))]
+      | len > hALF_WORD_SIZE_IN_BITS dflags || bmp == [toStgWord dflags 
(fromStgHalfWord (srt_escape dflags))]
       -> do id <- newUnique
             let srt_desc_lbl = mkLargeSRTLabel id
             emitRODataLits "getSRTInfo" srt_desc_lbl
diff --git a/compiler/codeGen/StgCmmLayout.hs b/compiler/codeGen/StgCmmLayout.hs
index df4cef4..69a0d1a 100644
--- a/compiler/codeGen/StgCmmLayout.hs
+++ b/compiler/codeGen/StgCmmLayout.hs
@@ -579,7 +579,7 @@ stdInfoTableSizeB dflags = stdInfoTableSizeW dflags * 
wORD_SIZE dflags
 stdSrtBitmapOffset :: DynFlags -> ByteOff
 -- Byte offset of the SRT bitmap half-word which is 
 -- in the *higher-addressed* part of the type_lit
-stdSrtBitmapOffset dflags = stdInfoTableSizeB dflags - hALF_WORD_SIZE
+stdSrtBitmapOffset dflags = stdInfoTableSizeB dflags - hALF_WORD_SIZE dflags
 
 stdClosureTypeOffset :: DynFlags -> ByteOff
 -- Byte offset of the closure type half-word 
@@ -587,7 +587,7 @@ stdClosureTypeOffset dflags = stdInfoTableSizeB dflags - 
wORD_SIZE dflags
 
 stdPtrsOffset, stdNonPtrsOffset :: DynFlags -> ByteOff
 stdPtrsOffset    dflags = stdInfoTableSizeB dflags - 2 * wORD_SIZE dflags
-stdNonPtrsOffset dflags = stdInfoTableSizeB dflags - 2 * wORD_SIZE dflags + 
hALF_WORD_SIZE
+stdNonPtrsOffset dflags = stdInfoTableSizeB dflags - 2 * wORD_SIZE dflags + 
hALF_WORD_SIZE dflags
 
 -------------------------------------------------------------------------
 --



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

Reply via email to