- 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
+ in do { u1 <- getUs; u2 <- getUs; u3 <- getUs
+ ; entry <- getUniqueUs >>= return . BlockId
+ ; return $
+ do { g <- return g''
+ ; g <- dual_rewrite u1 dualLivenessWithInsertion g
+ ; g <- insertLateReloads' u2 (extend g)
+ ; g <- dual_rewrite u3 removeDeadAssignmentsAndReloads (trim entry g)
+ ; return $ CmmProc h l args $ map_nodes id spillAndReloadComments id g
+ }
+ }
+ where dual_rewrite u pass g = runDFM u dualLiveLattice $ b_rewrite pass g
+ extend (LGraph eid blocks) = Graph (ZLast $ mkBranchNode eid) blocks
+ trim _ (Graph (ZLast (LastOther (LastBranch id))) blocks) = LGraph id blocks
+ trim e (Graph tail blocks) = LGraph e (insertBlock (Block e tail) blocks)