* Refactor CLabel.RtsLabel to CLabel.CmmLabel
[ghc-hetmet.git] / compiler / cmm / CmmBuildInfoTables.hs
index fa2c009..5b6625a 100644 (file)
@@ -18,24 +18,23 @@ import BlockId
 import Bitmap
 import CLabel
 import Cmm hiding (blockId)
-import CmmExpr
 import CmmInfo
 import CmmProcPointZ
 import CmmStackLayout
 import CmmTx
 import DFMonad
+import Module
 import FastString
 import FiniteMap
 import ForeignCall
 import IdInfo
-import List (sortBy)
+import Data.List
 import Maybes
 import MkZipCfg
 import MkZipCfgCmm hiding (CmmAGraph, CmmBlock, CmmTopZ, CmmZ, CmmGraph)
-import Monad
+import Control.Monad
 import Name
 import Outputable
-import Panic
 import SMRep
 import StgCmmClosure
 import StgCmmForeign
@@ -165,15 +164,15 @@ cafLattice = DataflowLattice "live cafs" emptyFM add False
 
 cafTransfers :: BackwardTransfers Middle Last CAFSet
 cafTransfers = BackwardTransfers first middle last
-    where first  _ live = live
-          middle m live = foldExpDeepMiddle addCaf m live
-          last   l env  = foldExpDeepLast   addCaf l (joinOuts cafLattice env l)
-          addCaf e set = case e of
-                 CmmLit (CmmLabel c)              -> add c set
-                 CmmLit (CmmLabelOff c _)         -> add c set
-                 CmmLit (CmmLabelDiffOff c1 c2 _) -> add c1 $ add c2 set
-                 _ -> set
-          add l s = if hasCAF l then addToFM s (cvtToClosureLbl l) () else s
+  where first  _ live = live
+        middle m live = foldExpDeepMiddle addCaf m live
+        last   l env  = foldExpDeepLast   addCaf l (joinOuts cafLattice env l)
+        addCaf e set = case e of
+               CmmLit (CmmLabel c)              -> add c set
+               CmmLit (CmmLabelOff c _)         -> add c set
+               CmmLit (CmmLabelDiffOff c1 c2 _) -> add c1 $ add c2 set
+               _ -> set
+        add l s = if hasCAF l then addToFM s (cvtToClosureLbl l) () else s
 
 type CafFix a = FuelMonad (BackwardFixedPoint Middle Last CAFSet a)
 cafAnal :: LGraph Middle Last -> FuelMonad CAFEnv
@@ -520,8 +519,8 @@ lowerSafeForeignCall state m@(MidForeignCall (Safe infotable _) _ _ _) tail = do
     new_base <- newTemp (cmmRegType (CmmGlobal BaseReg))
     let (caller_save, caller_load) = callerSaveVolatileRegs 
     load_tso <- newTemp gcWord -- TODO FIXME NOW
-    let suspendThread = CmmLit (CmmLabel (mkRtsCodeLabel (sLit "suspendThread")))
-        resumeThread  = CmmLit (CmmLabel (mkRtsCodeLabel (sLit "resumeThread")))
+    let suspendThread = CmmLit (CmmLabel (mkCmmCodeLabel rtsPackageId (fsLit "suspendThread")))
+        resumeThread  = CmmLit (CmmLabel (mkCmmCodeLabel rtsPackageId (fsLit "resumeThread")))
         suspend = mkStore (CmmReg spReg) (CmmLit (CmmBlock infotable)) <*>
                   saveThreadState <*>
                   caller_save <*>