summaryrefslogtreecommitdiff
path: root/compiler/cmm/CmmCommonBlockElim.hs
diff options
context:
space:
mode:
authorMichal Terepeta <michal.terepeta@gmail.com>2016-12-08 16:34:10 -0500
committerBen Gamari <ben@smart-cactus.org>2016-12-08 18:44:55 -0500
commit2bb099e5ccd7255f9742cb8bc5d512cd92d035b6 (patch)
treebf4bf1fbff529c082e55f9a2b85cb55e1e9722a3 /compiler/cmm/CmmCommonBlockElim.hs
parent55361b381d14d8752f00d90868fcbe82f86c6b2d (diff)
downloadhaskell-2bb099e5ccd7255f9742cb8bc5d512cd92d035b6.tar.gz
BlockId: remove BlockMap and BlockSet synonyms
This continues removal of `BlockId` module in favor of Hoopl's `Label`. Most of the changes here are mechanical, apart from the orphan `Outputable` instances for `LabelMap` and `LabelSet`. For now I've moved them to `cmm/Hoopl`, since it's already trying to manage all imports from Hoopl (to avoid any collisions). Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com> Test Plan: validate Reviewers: bgamari, austin, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2800
Diffstat (limited to 'compiler/cmm/CmmCommonBlockElim.hs')
-rw-r--r--compiler/cmm/CmmCommonBlockElim.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/cmm/CmmCommonBlockElim.hs b/compiler/cmm/CmmCommonBlockElim.hs
index 80acae11d4..989eb2fb18 100644
--- a/compiler/cmm/CmmCommonBlockElim.hs
+++ b/compiler/cmm/CmmCommonBlockElim.hs
@@ -66,7 +66,7 @@ elimCommonBlocks g = replaceLabels env $ copyTicks env g
-- (so avoid comparing them again)
type DistinctBlocks = [CmmBlock]
type Key = [Label]
-type Subst = BlockEnv BlockId
+type Subst = LabelMap BlockId
-- The outer list groups by hash. We retain this grouping throughout.
iterate :: Subst -> [[(Key, DistinctBlocks)]] -> Subst
@@ -186,9 +186,9 @@ dont_care _other = False
-- Utilities: equality and substitution on the graph.
-- Given a map ``subst'' from BlockID -> BlockID, we define equality.
-eqBid :: BlockEnv BlockId -> BlockId -> BlockId -> Bool
+eqBid :: LabelMap BlockId -> BlockId -> BlockId -> Bool
eqBid subst bid bid' = lookupBid subst bid == lookupBid subst bid'
-lookupBid :: BlockEnv BlockId -> BlockId -> BlockId
+lookupBid :: LabelMap BlockId -> BlockId -> BlockId
lookupBid subst bid = case mapLookup bid subst of
Just bid -> lookupBid subst bid
Nothing -> bid
@@ -266,7 +266,7 @@ eqMaybeWith _ _ _ = False
-- the same ticks as the respective "source" blocks. This not only
-- means copying ticks, but also adjusting tick scopes where
-- necessary.
-copyTicks :: BlockEnv BlockId -> CmmGraph -> CmmGraph
+copyTicks :: LabelMap BlockId -> CmmGraph -> CmmGraph
copyTicks env g
| mapNull env = g
| otherwise = ofBlockMap (g_entry g) $ mapMap copyTo blockMap