X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fcmm%2FCmmProcPointZ.hs;h=13f6421d08b1701b468ce1ef7453be8fe273bd51;hb=f4b727487a65e6b611bbaafbd2207bd63a8df706;hp=b477f4c2336071341fe51b4835df5639ad0da982;hpb=d436c70d43fb905c63220040168295e473f4b90a;p=ghc-hetmet.git diff --git a/compiler/cmm/CmmProcPointZ.hs b/compiler/cmm/CmmProcPointZ.hs index b477f4c..13f6421 100644 --- a/compiler/cmm/CmmProcPointZ.hs +++ b/compiler/cmm/CmmProcPointZ.hs @@ -11,19 +11,17 @@ import BlockId import CLabel import Cmm hiding (blockId) import CmmContFlowOpt -import CmmExpr import CmmInfo import CmmLiveZ import CmmTx import DFMonad import FiniteMap -import List (sortBy) +import Data.List (sortBy) import Maybes import MkZipCfg import MkZipCfgCmm hiding (CmmBlock, CmmGraph, CmmTopZ) -import Monad +import Control.Monad import Outputable -import Panic import UniqSet import UniqSupply import ZipCfg @@ -129,18 +127,21 @@ forward = ForwardTransfers first middle last exit -- those that are induced by calls in the original graph -- and those that are introduced because they're reachable from multiple proc points. callProcPoints :: CmmGraph -> ProcPointSet -minimalProcPointSet :: ProcPointSet -> CmmGraph -> FuelMonad ProcPointSet - callProcPoints g = fold_blocks add (unitBlockSet (lg_entry g)) g where add b set = case last $ unzip b of LastOther (LastCall _ (Just k) _ _ _) -> extendBlockSet set k _ -> set +minimalProcPointSet :: ProcPointSet -> CmmGraph -> FuelMonad ProcPointSet +-- Given the set of successors of calls (which must be proc-points) +-- figure ou the minimal set of necessary proc-points minimalProcPointSet callProcPoints g = extendPPSet g (postorder_dfs g) callProcPoints type PPFix = FuelMonad (ForwardFixedPoint Middle Last Status ()) procPointAnalysis :: ProcPointSet -> CmmGraph -> FuelMonad (BlockEnv Status) +-- Once you know what the proc-points are, figure out +-- what proc-points each block is reachable from procPointAnalysis procPoints g = let addPP env id = extendBlockEnv env id ProcPoint initProcPoints = foldl addPP emptyBlockEnv (blockSetToList procPoints)