X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Fcmm%2FCmmZipUtil.hs;h=9f0993dc49e8aa07c6a0f89d57c205487fd5ec4d;hp=f9705478228d4ba10ce8db847ef1edf4ba7b2aa2;hb=176fa33f17dd78355cc572e006d2ab26898e2c69;hpb=742809424904edbefc39dca8233356b25e546b56 diff --git a/compiler/cmm/CmmZipUtil.hs b/compiler/cmm/CmmZipUtil.hs index f970547..9f0993d 100644 --- a/compiler/cmm/CmmZipUtil.hs +++ b/compiler/cmm/CmmZipUtil.hs @@ -4,16 +4,17 @@ module CmmZipUtil , givesUniquePredecessorTo ) where +import BlockId import Prelude hiding (last, unzip) import ZipCfg import Maybes import UniqSet --- | Compute the predecessors of each *reachable* block +-- | Compute the predecessors of each /reachable/ block zipPreds :: LastNode l => LGraph m l -> BlockEnv BlockSet zipPreds g = foldl add emptyBlockEnv (postorder_dfs g) - where add env block@(Block id _) = + where add env block@(Block id _ _) = foldl (\env sid -> let preds = lookupBlockEnv env sid `orElse` emptyBlockSet in extendBlockEnv env sid (extendBlockSet preds id)) @@ -24,7 +25,7 @@ zipPreds g = foldl add emptyBlockEnv (postorder_dfs g) givesUniquePredecessorTo :: LastNode l => LGraph m l -> BlockId -> Bool givesUniquePredecessorTo g = \id -> elemBlockSet id singlePreds - -- | accumulates a pair of sets: the set of all blocks containing a single + -- accumulates a pair of sets: the set of all blocks containing a single -- predecessor, and the set of all blocks containing at least two predecessors where (singlePreds, _) = fold_blocks add (emptyBlockSet, emptyBlockSet) g add b (single, multi) = foldl add_pred (single, multi) (succs b)