From: Norman Ramsey Date: Sat, 15 Sep 2007 20:13:55 +0000 (+0000) Subject: add map_blocks to ZipCfg X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=f74d318db9db0b95eb4f41e29a3bea43097ae9d5 add map_blocks to ZipCfg --- diff --git a/compiler/cmm/ZipCfg.hs b/compiler/cmm/ZipCfg.hs index 5d8fdb7..ec2368f 100644 --- a/compiler/cmm/ZipCfg.hs +++ b/compiler/cmm/ZipCfg.hs @@ -267,6 +267,8 @@ fold_blocks :: (Block m l -> a -> a) -> a -> LGraph m l -> a map_nodes :: (BlockId -> BlockId) -> (m -> m') -> (l -> l') -> LGraph m l -> LGraph m' l' -- mapping includes the entry id! +map_blocks :: (Block m l -> Block m' l') -> LGraph m' l' -> LGraph m' l' + -- | These translation functions are speculative. I hope eventually -- they will be used in the native-code back ends ---NR translate :: (m -> UniqSM (LGraph m' l')) -> @@ -499,6 +501,8 @@ fold_layout f z g@(LGraph eid _) = fold (postorder_dfs g) z -- | The rest of the traversals are straightforward +map_blocks f (LGraph eid blocks) = LGraph eid (mapUFM f blocks) + map_nodes idm middle last (LGraph eid blocks) = LGraph (idm eid) (mapUFM block blocks) where block (Block id t) = Block (idm id) (tail t) tail (ZTail m t) = ZTail (middle m) (tail t)