diff options
author | simonpj@microsoft.com <unknown> | 2009-10-29 12:01:55 +0000 |
---|---|---|
committer | simonpj@microsoft.com <unknown> | 2009-10-29 12:01:55 +0000 |
commit | f96194794bf099020706c3816d1a5678b40addbb (patch) | |
tree | 7290d705708527865d9d69056d40096e2389db45 /compiler/cmm | |
parent | 016f155090557cd63f377b3ced95453bffd87d60 (diff) | |
download | haskell-f96194794bf099020706c3816d1a5678b40addbb.tar.gz |
Add Outputable.blankLine and use it
Diffstat (limited to 'compiler/cmm')
-rw-r--r-- | compiler/cmm/PprC.hs | 4 | ||||
-rw-r--r-- | compiler/cmm/PprCmm.hs | 7 | ||||
-rw-r--r-- | compiler/cmm/ZipCfgCmmRep.hs | 7 |
3 files changed, 8 insertions, 10 deletions
diff --git a/compiler/cmm/PprC.hs b/compiler/cmm/PprC.hs index 1be886213e..9f284c8926 100644 --- a/compiler/cmm/PprC.hs +++ b/compiler/cmm/PprC.hs @@ -92,7 +92,7 @@ writeCs dflags handle cmms -- pprC :: RawCmm -> SDoc -pprC (Cmm tops) = vcat $ intersperse (text "") $ map pprTop tops +pprC (Cmm tops) = vcat $ intersperse blankLine $ map pprTop tops -- -- top level procs @@ -107,7 +107,7 @@ pprTop (CmmProc info clbl _params (ListGraph blocks)) = [] -> empty -- the first block doesn't get a label: (BasicBlock _ stmts : rest) -> vcat [ - text "", + blankLine, extern_decls, (if (externallyVisibleCLabel clbl) then mkFN_ else mkIF_) (pprCLabel clbl) <+> lbrace, diff --git a/compiler/cmm/PprCmm.hs b/compiler/cmm/PprCmm.hs index 9f622c0a64..d8d34c32c2 100644 --- a/compiler/cmm/PprCmm.hs +++ b/compiler/cmm/PprCmm.hs @@ -115,7 +115,7 @@ instance Outputable CmmInfo where ----------------------------------------------------------------------------- pprCmm :: (Outputable d, Outputable info, Outputable g) => GenCmm d info g -> SDoc -pprCmm (Cmm tops) = vcat $ intersperse (text "") $ map pprTop tops +pprCmm (Cmm tops) = vcat $ intersperse blankLine $ map pprTop tops -- -------------------------------------------------------------------------- -- Top level `procedure' blocks. @@ -506,9 +506,8 @@ pprLit :: CmmLit -> SDoc pprLit lit = case lit of CmmInt i rep -> hcat [ (if i < 0 then parens else id)(integer i) - , (if rep == wordWidth - then empty - else space <> dcolon <+> ppr rep) ] + , ppUnless (rep == wordWidth) $ + space <> dcolon <+> ppr rep ] CmmFloat f rep -> hsep [ rational f, dcolon, ppr rep ] CmmLabel clbl -> pprCLabel clbl diff --git a/compiler/cmm/ZipCfgCmmRep.hs b/compiler/cmm/ZipCfgCmmRep.hs index d83e7e2926..451450e6f0 100644 --- a/compiler/cmm/ZipCfgCmmRep.hs +++ b/compiler/cmm/ZipCfgCmmRep.hs @@ -459,10 +459,9 @@ pprMiddle stmt = pp_stmt <+> pp_debug -- call "ccall" foo(x, y)[r1, r2]; -- ToDo ppr volatile MidForeignCall safety target results args -> - hsep [ if null results - then empty - else parens (commafy $ map ppr results) <+> equals, - ppr_safety safety, + hsep [ ppUnless (null results) $ + parens (commafy $ map ppr results) <+> equals, + ppr_safety safety, ptext $ sLit "call", ppr_call_target target <> parens (commafy $ map ppr args) <> semi] |