+ dump Opt_D_dump_cmmz "after manifestSP" g
+ -- UGH... manifestSP can require updates to the procPointMap.
+ -- We can probably do something quicker here for the update...
+ procPointMap <- run $ procPointAnalysis procPoints g
+ gs <- pprTrace "procPointMap" (ppr procPointMap) $
+ run $ splitAtProcPoints l callPPs procPoints procPointMap areaMap
+ (CmmProc h l args g)
+ mapM (dump Opt_D_dump_cmmz "after splitting") gs
+ let localCAFs = catMaybes $ map (localCAFInfo cafEnv) gs
+ mbpprTrace "localCAFs" (ppr localCAFs) $ return ()
+ gs <- liftM concat $ run $ foldM (lowerSafeForeignCalls procPoints) [] gs
+ mapM (dump Opt_D_dump_cmmz "after lowerSafeForeignCalls") gs
+
+ -- NO MORE GRAPH TRANSFORMATION AFTER HERE -- JUST MAKING INFOTABLES
+ let gs' = map (setInfoTableStackMap slotEnv areaMap) gs
+ mapM (dump Opt_D_dump_cmmz "after setInfoTableStackMap") gs'
+ -- Return: (a) CAFs used by this proc (b) a closure that will compute
+ -- a new SRT for the procedure.
+ let toTops topCAFEnv (topSRT, tops) =
+ do let setSRT (topSRT, rst) g =
+ do (topSRT, gs) <- setInfoTableSRT cafEnv topCAFEnv topSRT g
+ return (topSRT, gs : rst)
+ (topSRT, gs') <- run $ foldM setSRT (topSRT, []) gs'
+ gs' <- mapM finishInfoTables (concat gs')
+ pprTrace "localCAFs" (ppr localCAFs <+> ppr topSRT) $
+ return (topSRT, concat gs' : tops)
+ return (localCAFs, toTops)