Commit f74d318d authored by nr@eecs.harvard.edu's avatar nr@eecs.harvard.edu

add map_blocks to ZipCfg

parent 09a41659
...@@ -267,6 +267,8 @@ fold_blocks :: (Block m l -> a -> a) -> a -> LGraph m l -> a ...@@ -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' map_nodes :: (BlockId -> BlockId) -> (m -> m') -> (l -> l') -> LGraph m l -> LGraph m' l'
-- mapping includes the entry id! -- 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 -- | These translation functions are speculative. I hope eventually
-- they will be used in the native-code back ends ---NR -- they will be used in the native-code back ends ---NR
translate :: (m -> UniqSM (LGraph m' l')) -> translate :: (m -> UniqSM (LGraph m' l')) ->
...@@ -499,6 +501,8 @@ fold_layout f z g@(LGraph eid _) = fold (postorder_dfs g) z ...@@ -499,6 +501,8 @@ fold_layout f z g@(LGraph eid _) = fold (postorder_dfs g) z
-- | The rest of the traversals are straightforward -- | 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) map_nodes idm middle last (LGraph eid blocks) = LGraph (idm eid) (mapUFM block blocks)
where block (Block id t) = Block (idm id) (tail t) where block (Block id t) = Block (idm id) (tail t)
tail (ZTail m t) = ZTail (middle m) (tail t) tail (ZTail m t) = ZTail (middle m) (tail t)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment