diff options
author | Simon Marlow <marlowsd@gmail.com> | 2012-02-13 21:19:21 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2012-02-13 21:19:21 +0000 |
commit | ec2184eded032ec3305cc40c61149c4f8408ce49 (patch) | |
tree | 9cbe1184a655a4afa5bebe20c0187b4eca3df7dc /compiler/cmm/OldPprCmm.hs | |
parent | 3a47819657f6b8542107d14cbd883d93f6fbf442 (diff) | |
parent | 4a0973bb25f8d328f1a41d43d9f45c374178113c (diff) | |
download | haskell-ec2184eded032ec3305cc40c61149c4f8408ce49.tar.gz |
Merge remote-tracking branch 'origin/master' into newcg
Conflicts:
compiler/cmm/CmmLint.hs
compiler/cmm/OldCmm.hs
compiler/codeGen/CgMonad.lhs
compiler/main/CodeOutput.lhs
Diffstat (limited to 'compiler/cmm/OldPprCmm.hs')
-rw-r--r-- | compiler/cmm/OldPprCmm.hs | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/compiler/cmm/OldPprCmm.hs b/compiler/cmm/OldPprCmm.hs index 6a8fab48e8..d0fd0cb3e4 100644 --- a/compiler/cmm/OldPprCmm.hs +++ b/compiler/cmm/OldPprCmm.hs @@ -32,12 +32,11 @@ -- A useful example pass over Cmm is in nativeGen/MachCodeGen.hs -- -module OldPprCmm - ( pprStmt - , module PprCmmDecl - , module PprCmmExpr - ) -where +module OldPprCmm ( + pprStmt, + module PprCmmDecl, + module PprCmmExpr + ) where import BlockId import CLabel @@ -46,7 +45,6 @@ import OldCmm import PprCmmDecl import PprCmmExpr - import BasicTypes import ForeignCall import Outputable @@ -90,7 +88,7 @@ pprStmt platform stmt = case stmt of -- ; CmmNop -> semi - -- // text + -- // text CmmComment s -> text "//" <+> ftext s -- reg = expr; @@ -134,8 +132,8 @@ pprStmt platform stmt = case stmt of CmmBranch ident -> genBranch ident CmmCondBranch expr ident -> genCondBranch platform expr ident - CmmJump expr params -> genJump platform expr params - CmmReturn params -> genReturn platform params + CmmJump expr live -> genJump platform expr live + CmmReturn -> genReturn platform CmmSwitch arg ids -> genSwitch platform arg ids -- Just look like a tuple, since it was a tuple before @@ -157,7 +155,6 @@ pprUpdateFrame platform (UpdateFrame expr args) = , space , parens ( commafy $ map (pprPlatform platform) args ) ] - -- -------------------------------------------------------------------------- -- goto local label. [1], section 6.6 -- @@ -184,31 +181,26 @@ genCondBranch platform expr ident = -- -- jump foo(a, b, c); -- -genJump :: Platform -> CmmExpr -> [CmmHinted CmmExpr] -> SDoc -genJump platform expr args = +genJump :: Platform -> CmmExpr -> Maybe [GlobalReg] -> SDoc +genJump platform expr live = hcat [ ptext (sLit "jump") , space , if isTrivialCmmExpr expr then pprExpr platform expr else case expr of CmmLoad (CmmReg _) _ -> pprExpr platform expr - _ -> parens (pprExpr platform expr) - , space - , parens ( commafy $ map (pprPlatform platform) args ) - , semi ] - + _ -> parens (pprExpr platform expr) + , semi <+> ptext (sLit "// ") + , maybe empty ppr live] -- -------------------------------------------------------------------------- -- Return from a function. [1], Section 6.8.2 of version 1.128 -- -- return (a, b, c); -- -genReturn :: Platform -> [CmmHinted CmmExpr] -> SDoc -genReturn platform args = - hcat [ ptext (sLit "return") - , space - , parens ( commafy $ map (pprPlatform platform) args ) - , semi ] +genReturn :: Platform -> SDoc +genReturn _ = + hcat [ ptext (sLit "return") , semi ] -- -------------------------------------------------------------------------- -- Tabled jump to local label @@ -250,3 +242,4 @@ genSwitch platform expr maybe_ids commafy :: [SDoc] -> SDoc commafy xs = fsep $ punctuate comma xs + |