projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[project @ 2003-11-13 15:02:25 by simonpj]
[ghc-hetmet.git]
/
ghc
/
compiler
/
basicTypes
/
Literal.lhs
diff --git
a/ghc/compiler/basicTypes/Literal.lhs
b/ghc/compiler/basicTypes/Literal.lhs
index
d71bedf
..
3781abe
100644
(file)
--- a/
ghc/compiler/basicTypes/Literal.lhs
+++ b/
ghc/compiler/basicTypes/Literal.lhs
@@
-30,16
+30,13
@@
import TysPrim ( charPrimTy, addrPrimTy, floatPrimTy, doublePrimTy,
intPrimTy, wordPrimTy, int64PrimTy, word64PrimTy
)
import PrimRep ( PrimRep(..) )
intPrimTy, wordPrimTy, int64PrimTy, word64PrimTy
)
import PrimRep ( PrimRep(..) )
-import TcType ( Type, tcCmpType )
-import Type ( typePrimRep )
-import PprType ( pprParendType )
+import Type ( Type )
import CStrings ( pprFSInCStyle )
import Outputable
import FastTypes
import FastString
import Binary
import CStrings ( pprFSInCStyle )
import Outputable
import FastTypes
import FastString
import Binary
-import Util ( thenCmp )
import Ratio ( numerator )
import FastString ( uniqueOfFS, lengthFS )
import Ratio ( numerator )
import FastString ( uniqueOfFS, lengthFS )
@@
-288,10
+285,12
@@
litIsDupable other = True
litSize :: Literal -> Int
-- Used by CoreUnfold.sizeExpr
litSize :: Literal -> Int
-- Used by CoreUnfold.sizeExpr
-litSize (MachStr str) = 1 + (lengthFS str `div` 4)
+litSize (MachStr str) = 1 + ((lengthFS str + 3) `div` 4)
-- Every literal has size at least 1, otherwise
-- f "x"
-- might be too small
-- Every literal has size at least 1, otherwise
-- f "x"
-- might be too small
+ -- [Sept03: make literal strings a bit bigger to avoid fruitless
+ -- duplication of little strings]
litSize _other = 1
\end{code}
litSize _other = 1
\end{code}
@@
-341,7
+340,7
@@
cmpLit (MachFloat a) (MachFloat b) = a `compare` b
cmpLit (MachDouble a) (MachDouble b) = a `compare` b
cmpLit (MachLabel a _) (MachLabel b _) = a `compare` b
cmpLit lit1 lit2 | litTag lit1 <# litTag lit2 = LT
cmpLit (MachDouble a) (MachDouble b) = a `compare` b
cmpLit (MachLabel a _) (MachLabel b _) = a `compare` b
cmpLit lit1 lit2 | litTag lit1 <# litTag lit2 = LT
- | otherwise = GT
+ | otherwise = GT
litTag (MachChar _) = _ILIT(1)
litTag (MachStr _) = _ILIT(2)
litTag (MachChar _) = _ILIT(1)
litTag (MachStr _) = _ILIT(2)