Fixed missing '#include "HsVersions.h"'
[ghc-hetmet.git] / compiler / cmm / PprCmm.hs
index e8176ba..0c79f6f 100644 (file)
@@ -80,6 +80,9 @@ instance Outputable CmmExpr where
 instance Outputable CmmReg where
     ppr e = pprReg e
 
+instance Outputable LocalReg where
+    ppr e = pprLocalReg e
+
 instance Outputable GlobalReg where
     ppr e = pprGlobalReg e
 
@@ -96,7 +99,7 @@ pprCmm (Cmm tops) = vcat $ intersperse (text "") $ map pprTop tops
 pprTop :: CmmTop -> SDoc
 pprTop (CmmProc info lbl params blocks )
 
-  = vcat [ pprCLabel lbl <> parens (commafy $ map pprLocalReg params) <+> lbrace
+  = vcat [ pprCLabel lbl <> parens (commafy $ map ppr params) <+> lbrace
          , nest 8 $ pprInfo info lbl
          , nest 4 $ vcat (map ppr blocks)
          , rbrace ]
@@ -167,6 +170,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 +199,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 +209,22 @@ genJump expr actuals =
                 else case expr of
                     CmmLoad (CmmReg _) _ -> pprExpr expr 
                     _ -> parens (pprExpr expr)
-         , pprActuals actuals
+         , space
+         , 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