summaryrefslogtreecommitdiff
path: root/compiler/cmm/ZipCfg.hs
diff options
context:
space:
mode:
authorNorman Ramsey <nr@eecs.harvard.edu>2007-09-15 20:13:55 +0000
committerNorman Ramsey <nr@eecs.harvard.edu>2007-09-15 20:13:55 +0000
commitf74d318db9db0b95eb4f41e29a3bea43097ae9d5 (patch)
tree790930bb67b7830cf2be4dc37c4287de61dee9aa /compiler/cmm/ZipCfg.hs
parent09a416591da9ad89e0e6ca85e5093b6eb629a98e (diff)
downloadhaskell-f74d318db9db0b95eb4f41e29a3bea43097ae9d5.tar.gz
add map_blocks to ZipCfg
Diffstat (limited to 'compiler/cmm/ZipCfg.hs')
-rw-r--r--compiler/cmm/ZipCfg.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/cmm/ZipCfg.hs b/compiler/cmm/ZipCfg.hs
index 5d8fdb7973..ec2368fb57 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)