[project @ 2003-12-06 18:27:37 by panne]
[ghc-hetmet.git] / ghc / compiler / basicTypes / Literal.lhs
index d71bedf..3781abe 100644 (file)
@@ -30,16 +30,13 @@ import TysPrim              ( charPrimTy, addrPrimTy, floatPrimTy, doublePrimTy,
                          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 Util            ( thenCmp )
 
 import Ratio           ( numerator )
 import FastString      ( uniqueOfFS, lengthFS )
@@ -288,10 +285,12 @@ litIsDupable other         = True
 
 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
+       -- [Sept03: make literal strings a bit bigger to avoid fruitless 
+       --  duplication of little strings]
 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
-                                               | otherwise                    = GT
+                                               | otherwise                  = GT
 
 litTag (MachChar      _)   = _ILIT(1)
 litTag (MachStr       _)   = _ILIT(2)