Add {-# OPTIONS_GHC -w #-} and some blurb to all compiler modules
[ghc-hetmet.git] / compiler / cmm / CmmCPSGen.hs
index 3b93b09..47d5c38 100644 (file)
@@ -1,3 +1,10 @@
+{-# OPTIONS_GHC -w #-}
+-- The above warning supression flag is a temporary kludge.
+-- While working on this module you are encouraged to remove it and fix
+-- any warnings in the module. See
+--     http://hackage.haskell.org/trac/ghc/wiki/WorkingConventions#Warnings
+-- for details
+
 module CmmCPSGen (
   -- | Converts continuations into full proceedures.
   -- The main work of the CPS transform that everything else is setting-up.
@@ -15,9 +22,9 @@ import MachOp
 import CmmUtils
 import CmmCallConv
 
-import CgProf (curCCS, curCCSAddr)
-import CgUtils (cmmOffsetW)
-import CgInfoTbls (entryCode)
+import CgProf
+import CgUtils
+import CgInfoTbls
 import SMRep
 import ForeignCall
 
@@ -29,12 +36,6 @@ import List
 
 import Panic
 
-import MachRegs (callerSaveVolatileRegs)
-  -- HACK: this is part of the NCG so we shouldn't use this, but we need
-  -- it for now to eliminate the need for saved regs to be in CmmCall.
-  -- The long term solution is to factor callerSaveVolatileRegs
-  -- from nativeGen into CPS
-
 -- The format for the call to a continuation
 -- The fst is the arguments that must be passed to the continuation
 -- by the continuation's caller.
@@ -199,8 +200,8 @@ continuationToProc (max_stack, update_frame_size, formats) stack_use uniques
                             tail_call curr_stack target arguments
 
                         -- A regular Cmm function call
-                        FinalCall next (CmmForeignCall target CmmCallConv)
-                            results arguments _ _ ->
+                        FinalCall next (CmmCallee target CmmCallConv)
+                            results arguments _ _ _ ->
                                 pack_continuation curr_format cont_format ++
                                 tail_call (curr_stack - cont_stack)
                                               target arguments
@@ -210,10 +211,10 @@ continuationToProc (max_stack, update_frame_size, formats) stack_use uniques
                               cont_stack = continuation_frame_size cont_format
 
                         -- A safe foreign call
-                        FinalCall next (CmmForeignCall target conv)
-                            results arguments _ _ ->
+                        FinalCall next (CmmCallee target conv)
+                            results arguments _ _ _ ->
                                 target_stmts ++
-                                foreignCall call_uniques' (CmmForeignCall new_target conv)
+                                foreignCall call_uniques' (CmmCallee new_target conv)
                                             results arguments
                             where
                               (call_uniques', target_stmts, new_target) =
@@ -221,7 +222,7 @@ continuationToProc (max_stack, update_frame_size, formats) stack_use uniques
 
                         -- A safe prim call
                         FinalCall next (CmmPrim target)
-                            results arguments _ _ ->
+                            results arguments _ _ _ ->
                                 foreignCall call_uniques (CmmPrim target)
                                             results arguments
 
@@ -232,15 +233,17 @@ foreignCall uniques call results arguments =
     arg_stmts ++
     saveThreadState ++
     caller_save ++
-    [CmmCall (CmmForeignCall suspendThread CCallConv)
+    [CmmCall (CmmCallee suspendThread CCallConv)
                 [ (id,PtrHint) ]
                 [ (CmmReg (CmmGlobal BaseReg), PtrHint) ]
-                CmmUnsafe,
-     CmmCall call results new_args CmmUnsafe,
-     CmmCall (CmmForeignCall resumeThread CCallConv)
+                CmmUnsafe
+                 CmmMayReturn,
+     CmmCall call results new_args CmmUnsafe CmmMayReturn,
+     CmmCall (CmmCallee resumeThread CCallConv)
                  [ (new_base, PtrHint) ]
                 [ (CmmReg (CmmLocal id), PtrHint) ]
-                CmmUnsafe,
+                CmmUnsafe
+                 CmmMayReturn,
      -- Assign the result to BaseReg: we
      -- might now have a different Capability!
      CmmAssign (CmmGlobal BaseReg) (CmmReg (CmmLocal new_base))] ++