summaryrefslogtreecommitdiff
path: root/compiler/cmm/PprCmm.hs
diff options
context:
space:
mode:
authorMichael D. Adams <t-madams@microsoft.com>2007-05-16 15:53:37 +0000
committerMichael D. Adams <t-madams@microsoft.com>2007-05-16 15:53:37 +0000
commitf2cc8b5bc34519a65581dc40b7bfebac97bffd73 (patch)
treeb7dbe962fb8791331cbd4ce7a934d0ebaf0fcd06 /compiler/cmm/PprCmm.hs
parent7c085edd732bd1fd52e758017da9eac583bfba1a (diff)
downloadhaskell-f2cc8b5bc34519a65581dc40b7bfebac97bffd73.tar.gz
Added 'return' to C--, and made arguments to 'jump' into CmmExpr
Diffstat (limited to 'compiler/cmm/PprCmm.hs')
-rw-r--r--compiler/cmm/PprCmm.hs22
1 files changed, 16 insertions, 6 deletions
diff --git a/compiler/cmm/PprCmm.hs b/compiler/cmm/PprCmm.hs
index e8176bae60..b718ec9f40 100644
--- a/compiler/cmm/PprCmm.hs
+++ b/compiler/cmm/PprCmm.hs
@@ -167,6 +167,7 @@ pprStmt stmt = case stmt of
CmmBranch ident -> genBranch ident
CmmCondBranch expr ident -> genCondBranch expr ident
CmmJump expr params -> genJump expr params
+ CmmReturn params -> genReturn params
CmmSwitch arg ids -> genSwitch arg ids
-- --------------------------------------------------------------------------
@@ -195,8 +196,8 @@ genCondBranch expr ident =
--
-- jump foo(a, b, c);
--
-genJump :: CmmExpr -> [LocalReg] -> SDoc
-genJump expr actuals =
+genJump :: CmmExpr -> [(CmmExpr, MachHint)] -> SDoc
+genJump expr args =
hcat [ ptext SLIT("jump")
, space
@@ -205,12 +206,21 @@ genJump expr actuals =
else case expr of
CmmLoad (CmmReg _) _ -> pprExpr expr
_ -> parens (pprExpr expr)
- , pprActuals actuals
+ , parens ( commafy $ map ppr args )
, semi ]
- where
- pprActuals [] = empty
- pprActuals as = parens ( commafy $ map pprLocalReg as )
+-- --------------------------------------------------------------------------
+-- Return from a function. [1], Section 6.8.2 of version 1.128
+--
+-- return (a, b, c);
+--
+genReturn :: [(CmmExpr, MachHint)] -> SDoc
+genReturn args =
+
+ hcat [ ptext SLIT("return")
+ , space
+ , parens ( commafy $ map ppr args )
+ , semi ]
-- --------------------------------------------------------------------------
-- Tabled jump to local label