summaryrefslogtreecommitdiff
path: root/compiler/cmm/SMRep.lhs
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2012-02-14 11:46:02 +0000
committerSimon Marlow <marlowsd@gmail.com>2012-02-14 11:46:02 +0000
commit6b57d3915097f47089f5d5235feac5dd4d7bb3f2 (patch)
treed5c8e8f84144ec4d87bafc866613be57ed88cfc4 /compiler/cmm/SMRep.lhs
parentd4befa38cc2e08b496394179950bbc42807dc640 (diff)
downloadhaskell-6b57d3915097f47089f5d5235feac5dd4d7bb3f2.tar.gz
Eliminate some redundant stack assignments and empty stack checks
Diffstat (limited to 'compiler/cmm/SMRep.lhs')
-rw-r--r--compiler/cmm/SMRep.lhs6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/cmm/SMRep.lhs b/compiler/cmm/SMRep.lhs
index ce30799bf6..8b3308ef97 100644
--- a/compiler/cmm/SMRep.lhs
+++ b/compiler/cmm/SMRep.lhs
@@ -21,6 +21,7 @@ module SMRep (
StgWord, StgHalfWord,
hALF_WORD_SIZE, hALF_WORD_SIZE_IN_BITS,
WordOff, ByteOff,
+ roundUpToWords,
-- * Closure repesentation
SMRep(..), -- CmmInfo sees the rep; no one else does
@@ -57,6 +58,7 @@ import FastString
import Data.Char( ord )
import Data.Word
+import Data.Bits
\end{code}
@@ -69,6 +71,9 @@ import Data.Word
\begin{code}
type WordOff = Int -- Word offset, or word count
type ByteOff = Int -- Byte offset, or byte count
+
+roundUpToWords :: ByteOff -> ByteOff
+roundUpToWords n = (n + (wORD_SIZE - 1)) .&. (complement (wORD_SIZE - 1))
\end{code}
StgWord is a type representing an StgWord on the target platform.
@@ -93,6 +98,7 @@ hALF_WORD_SIZE_IN_BITS = 32
#endif
\end{code}
+
%************************************************************************
%* *
\subsubsection[SMRep-datatype]{@SMRep@---storage manager representation}