diff options
| author | Michal Terepeta <michal.terepeta@gmail.com> | 2018-03-19 12:03:20 -0400 | 
|---|---|---|
| committer | Ben Gamari <ben@smart-cactus.org> | 2018-03-19 12:05:12 -0400 | 
| commit | 256577fbde836f13c744418d38d18c17a369f7e9 (patch) | |
| tree | 3bce5b87c24e6832e1c659a3d737768dad130822 /compiler/cmm/CmmUtils.hs | |
| parent | 20cbb0165e4d18df510e707791e761942d3c10f0 (diff) | |
| download | haskell-256577fbde836f13c744418d38d18c17a369f7e9.tar.gz | |
CmmUtils: get rid of insertBlock
`Hoopl.Graph` has almost exactly the same function, so let's use that.
Also, use `IntMap.alter` to make it more efficient.
Also switch `Hoopl` to use strict maps.
Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>
Test Plan: ./validate
Reviewers: bgamari, simonmar
Reviewed By: bgamari
Subscribers: dfeuer, rwbarton, thomie, carter
Differential Revision: https://phabricator.haskell.org/D4493
Diffstat (limited to 'compiler/cmm/CmmUtils.hs')
| -rw-r--r-- | compiler/cmm/CmmUtils.hs | 14 | 
1 files changed, 2 insertions, 12 deletions
diff --git a/compiler/cmm/CmmUtils.hs b/compiler/cmm/CmmUtils.hs index aff16b3a19..53dbcddfbb 100644 --- a/compiler/cmm/CmmUtils.hs +++ b/compiler/cmm/CmmUtils.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE CPP, GADTs, RankNTypes #-} +{-# LANGUAGE GADTs, RankNTypes #-}  -----------------------------------------------------------------------------  -- @@ -56,7 +56,7 @@ module CmmUtils(          -- * Operations that probably don't belong here          modifyGraph, -        ofBlockMap, toBlockMap, insertBlock, +        ofBlockMap, toBlockMap,          ofBlockList, toBlockList, bodyToBlockList,          toBlockListEntryFirst, toBlockListEntryFirstFalseFallthrough,          foldlGraphBlocks, mapGraphNodes, revPostorder, mapGraphNodes1, @@ -65,8 +65,6 @@ module CmmUtils(          blockTicks    ) where -#include "HsVersions.h" -  import GhcPrelude  import TyCon    ( PrimRep(..), PrimElemRep(..) ) @@ -78,11 +76,9 @@ import BlockId  import CLabel  import Outputable  import DynFlags -import Util  import CodeGen.Platform  import Data.Word -import Data.Maybe  import Data.Bits  import Hoopl.Graph  import Hoopl.Label @@ -495,12 +491,6 @@ toBlockMap (CmmGraph {g_graph=GMany NothingO body NothingO}) = body  ofBlockMap :: BlockId -> LabelMap CmmBlock -> CmmGraph  ofBlockMap entry bodyMap = CmmGraph {g_entry=entry, g_graph=GMany NothingO bodyMap NothingO} -insertBlock :: CmmBlock -> LabelMap CmmBlock -> LabelMap CmmBlock -insertBlock block map = -  ASSERT(isNothing $ mapLookup id map) -  mapInsert id block map -  where id = entryLabel block -  toBlockList :: CmmGraph -> [CmmBlock]  toBlockList g = mapElems $ toBlockMap g  | 
