summaryrefslogtreecommitdiff
path: root/compiler/nativeGen
diff options
context:
space:
mode:
authorMichal Terepeta <michal.terepeta@gmail.com>2018-02-01 00:30:22 -0500
committerBen Gamari <ben@smart-cactus.org>2018-02-02 10:18:36 -0500
commit2974b2b873b4bad007c619c6e32706123a612428 (patch)
tree691578289347fb01c9f504ac1653b32955aace05 /compiler/nativeGen
parente31b41bd6abbf08b1463f4ea08c50e8059f06263 (diff)
downloadhaskell-2974b2b873b4bad007c619c6e32706123a612428.tar.gz
Hoopl.Collections: change right folds to strict left folds
It seems that most uses of these folds should be strict left folds (I could only find a single place that benefits from a right fold). So this removes the existing `setFold`/`mapFold`/`mapFoldWihKey` replaces them with: - `setFoldl`/`mapFoldl`/`mapFoldlWithKey` (strict left folds) - `setFoldr`/`mapFoldr` (for the less common case where a right fold actually makes sense, e.g., `CmmProcPoint`) Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com> Test Plan: ./validate Reviewers: bgamari, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie, carter, kavon Differential Revision: https://phabricator.haskell.org/D4356
Diffstat (limited to 'compiler/nativeGen')
-rw-r--r--compiler/nativeGen/RegAlloc/Graph/Spill.hs9
1 files changed, 4 insertions, 5 deletions
diff --git a/compiler/nativeGen/RegAlloc/Graph/Spill.hs b/compiler/nativeGen/RegAlloc/Graph/Spill.hs
index 02da824cfe..bce24bdd3c 100644
--- a/compiler/nativeGen/RegAlloc/Graph/Spill.hs
+++ b/compiler/nativeGen/RegAlloc/Graph/Spill.hs
@@ -113,8 +113,8 @@ regSpill_top platform regSlotMap cmm
-- after we've done a successful allocation.
let liveSlotsOnEntry' :: BlockMap IntSet
liveSlotsOnEntry'
- = mapFoldWithKey patchLiveSlot
- liveSlotsOnEntry liveVRegsOnEntry
+ = mapFoldlWithKey patchLiveSlot
+ liveSlotsOnEntry liveVRegsOnEntry
let info'
= LiveInfo static firstId
@@ -131,10 +131,9 @@ regSpill_top platform regSlotMap cmm
-- then record the fact that these slots are now live in those blocks
-- in the given slotmap.
patchLiveSlot
- :: BlockId -> RegSet
- -> BlockMap IntSet -> BlockMap IntSet
+ :: BlockMap IntSet -> BlockId -> RegSet -> BlockMap IntSet
- patchLiveSlot blockId regsLive slotMap
+ patchLiveSlot slotMap blockId regsLive
= let
-- Slots that are already recorded as being live.
curSlotsLive = fromMaybe IntSet.empty