incomplete start on set of intervals for stack model
[ghc-hetmet.git] / compiler / cmm / CmmCPSZ.hs
index afa1533..4dff9bc 100644 (file)
@@ -1,4 +1,3 @@
-{-# OPTIONS -Wall -fno-warn-name-shadowing #-}
 
 module CmmCPSZ (
   -- | Converts C-- with full proceedures and parameters
@@ -19,7 +18,7 @@ import Outputable
 import PprCmmZ()
 import UniqSupply
 import ZipCfg hiding (zip, unzip)
-import ZipCfgCmm
+import ZipCfgCmmRep
 import ZipDataflow
 
 -----------------------------------------------------------------------------
@@ -44,8 +43,12 @@ cpsTop (CmmProc h l args g) =
     let procPoints = minimalProcPointSet (runTx cmmCfgOptsZ g)
         g' = addProcPointProtocols procPoints args g
         g'' = map_nodes id NotSpillOrReload id g'
-    in do us <- getUs
-          let g = runDFM us dualLiveLattice $ b_rewrite dualLivenessWithInsertion g''
-        --  let igraph = buildIGraph
-          return $ do g' <- g >>= return . map_nodes id spillAndReloadComments id
-                      return $ CmmProc h l args g'
+    in do g <- dual_rewrite dualLivenessWithInsertion g''
+          g <- return (g >>= insertLateReloads)
+          u <- getUs
+          let g' = g >>= (initUs_ u . dual_rewrite removeDeadAssignmentsAndReloads)
+          return $ do g <- g' >>= return . map_nodes id spillAndReloadComments id
+                      return $ CmmProc h l args g
+  where dual_rewrite pass g =
+            do us <- getUs
+               return $ runDFM us dualLiveLattice $ b_rewrite pass g