[project @ 2005-08-03 15:16:14 by simonmar]
[ghc-hetmet.git] / ghc / compiler / cmm / PprC.hs
index 72a3cb1..8bcfd0c 100644 (file)
@@ -69,8 +69,7 @@ pprCs dflags cmms
 
 writeCs :: DynFlags -> Handle -> [Cmm] -> IO ()
 writeCs dflags handle cmms 
-  = printForUser handle alwaysQualify (pprCs dflags cmms)
-       -- ToDo: should be printForC
+  = printForC handle (pprCs dflags cmms)
 
 -- --------------------------------------------------------------------------
 -- Now do some real work
@@ -992,11 +991,16 @@ pprHexVal w rep
   | otherwise = ptext SLIT("0x") <> go w <> repsuffix rep
   where
        -- type suffix for literals:
-       -- on 32-bit platforms, add "LL" to 64-bit literals
-      repsuffix I64 | wORD_SIZE == 4 = ptext SLIT("LL")
+       -- Integer literals are unsigned in Cmm/C.  We explicitly cast to
+       -- signed values for doing signed operations, but at all other
+       -- times values are unsigned.  This also helps eliminate occasional
+       -- warnings about integer overflow from gcc.
+
+       -- on 32-bit platforms, add "ULL" to 64-bit literals
+      repsuffix I64 | wORD_SIZE == 4 = ptext SLIT("ULL")
        -- on 64-bit platforms with 32-bit int, add "L" to 64-bit literals
-      repsuffix I64 | cINT_SIZE == 4 = ptext SLIT("L")
-      repsuffix _ = empty
+      repsuffix I64 | cINT_SIZE == 4 = ptext SLIT("UL")
+      repsuffix _ = char 'U'
       
       go 0 = empty
       go w' = go q <> dig