projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use unsafeDupableInterleaveIO in UniqSupply
[ghc-hetmet.git]
/
compiler
/
basicTypes
/
Literal.lhs
diff --git
a/compiler/basicTypes/Literal.lhs
b/compiler/basicTypes/Literal.lhs
index
e83ea9d
..
a5c413a
100644
(file)
--- a/
compiler/basicTypes/Literal.lhs
+++ b/
compiler/basicTypes/Literal.lhs
@@
-1,4
+1,5
@@
%
%
+% (c) The University of Glasgow 2006
% (c) The GRASP/AQUA Project, Glasgow University, 1998
%
\section[Literal]{@Literal@: Machine literals (unboxed, of course)}
% (c) The GRASP/AQUA Project, Glasgow University, 1998
%
\section[Literal]{@Literal@: Machine literals (unboxed, of course)}
@@
-15,6
+16,7
@@
module Literal
, inIntRange, inWordRange, tARGET_MAX_INT, inCharRange
, isZeroLit
, inIntRange, inWordRange, tARGET_MAX_INT, inCharRange
, isZeroLit
+ , litFitsInChar
, word2IntLit, int2WordLit
, narrow8IntLit, narrow16IntLit, narrow32IntLit
, word2IntLit, int2WordLit
, narrow8IntLit, narrow16IntLit, narrow32IntLit
@@
-26,24
+28,20
@@
module Literal
#include "HsVersions.h"
#include "HsVersions.h"
-import TysPrim ( charPrimTy, addrPrimTy, floatPrimTy, doublePrimTy,
- intPrimTy, wordPrimTy, int64PrimTy, word64PrimTy
- )
-import Type ( Type )
+import TysPrim
+import Type
import Outputable
import FastTypes
import FastString
import Binary
import Outputable
import FastTypes
import FastString
import Binary
+import Ratio
-import Ratio ( numerator )
-import FastString ( uniqueOfFS, lengthFS )
-import DATA_INT ( Int8, Int16, Int32 )
-import DATA_WORD ( Word8, Word16, Word32 )
-import Char ( ord, chr )
+import Data.Int
+import Data.Word
+import Data.Char
\end{code}
\end{code}
-
%************************************************************************
%* *
\subsection{Sizes}
%************************************************************************
%* *
\subsection{Sizes}
@@
-287,6
+285,12
@@
litIsDupable :: Literal -> Bool
litIsDupable (MachStr _) = False
litIsDupable other = True
litIsDupable (MachStr _) = False
litIsDupable other = True
+litFitsInChar :: Literal -> Bool
+litFitsInChar (MachInt i)
+ = fromInteger i <= ord minBound
+ && fromInteger i >= ord maxBound
+litFitsInChar _ = False
+
litSize :: Literal -> Int
-- Used by CoreUnfold.sizeExpr
litSize (MachStr str) = 1 + ((lengthFS str + 3) `div` 4)
litSize :: Literal -> Int
-- Used by CoreUnfold.sizeExpr
litSize (MachStr str) = 1 + ((lengthFS str + 3) `div` 4)