-pprLit lit
- = getPprStyle $ \ sty ->
- let
- code_style = codeStyle sty
- in
- case lit of
- MachChar ch | code_style -> hcat [ptext SLIT("(C_)"), text (show ch)]
- | otherwise -> pprHsChar ch
-
- MachStr s | code_style -> pprFSInCStyle s
- | otherwise -> pprHsString s
- -- Warning: printing MachStr in code_style assumes it contains
- -- only characters '\0'..'\xFF'!
-
- MachInt i | code_style && i == tARGET_MIN_INT -> parens (integer (i+1) <> text "-1")
- -- Avoid a problem whereby gcc interprets
- -- the constant minInt as unsigned.
- | otherwise -> pprIntVal i
-
- MachInt64 i | code_style -> pprIntVal i -- Same problem with gcc???
- | otherwise -> ptext SLIT("__int64") <+> integer i
-
- MachWord w | code_style -> pprHexVal w
- | otherwise -> ptext SLIT("__word") <+> integer w
-
- MachWord64 w | code_style -> pprHexVal w
- | otherwise -> ptext SLIT("__word64") <+> integer w
-
- MachFloat f | code_style -> ptext SLIT("(StgFloat)") <> code_rational f
- | otherwise -> ptext SLIT("__float") <+> rational f
-
- MachDouble d | code_style -> code_rational d
- | otherwise -> rational d
-
- MachAddr p | code_style -> ptext SLIT("(void*)") <> integer p
- | otherwise -> ptext SLIT("__addr") <+> integer p
-
- MachLabel l mb
- | code_style -> ptext SLIT("(&") <> ftext l <> char ')'
- | otherwise -> ptext SLIT("__label") <+>
- case mb of
- Nothing -> pprHsString l
- Just x -> doubleQuotes (text (unpackFS l ++ '@':show x))
-
- MachLitLit s ty | code_style -> ftext s
- | otherwise -> parens (hsep [ptext SLIT("__litlit"),
- pprHsString s,
- pprParendType ty])
-
--- negative floating literals in code style need parentheses to avoid
--- interacting with surrounding syntax.
-code_rational d | d < 0 = parens (rational d)
- | otherwise = rational d
+pprLit (MachChar ch) = pprHsChar ch
+pprLit (MachStr s) = pprHsString s
+pprLit (MachInt i) = pprIntVal i
+pprLit (MachInt64 i) = ptext SLIT("__int64") <+> integer i
+pprLit (MachWord w) = ptext SLIT("__word") <+> integer w
+pprLit (MachWord64 w) = ptext SLIT("__word64") <+> integer w
+pprLit (MachFloat f) = ptext SLIT("__float") <+> rational f
+pprLit (MachDouble d) = rational d
+pprLit (MachNullAddr) = ptext SLIT("__NULL")
+pprLit (MachLabel l mb) = ptext SLIT("__label") <+>
+ case mb of
+ Nothing -> pprHsString l
+ Just x -> doubleQuotes (text (unpackFS l ++ '@':show x))