summaryrefslogtreecommitdiff
path: root/compiler/nativeGen/AsmCodeGen.hs
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2017-04-04 21:47:29 -0400
committerBen Gamari <ben@smart-cactus.org>2017-04-04 21:47:51 -0400
commit1831aed16d9883b2845fa6997e38b9ac3d72f191 (patch)
tree5f18307cfda76206dc74f15f0678039e667d2427 /compiler/nativeGen/AsmCodeGen.hs
parent5315223683b64c665959781112f8206fb8230a54 (diff)
downloadhaskell-1831aed16d9883b2845fa6997e38b9ac3d72f191.tar.gz
Replace Digraph's Node type synonym with a data type
This refactoring makes it more obvious when we are constructing a Node for the digraph rather than a less useful 3-tuple. Reviewers: austin, goldfire, bgamari, simonmar, dfeuer Reviewed By: dfeuer Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3414
Diffstat (limited to 'compiler/nativeGen/AsmCodeGen.hs')
-rw-r--r--compiler/nativeGen/AsmCodeGen.hs14
1 files changed, 6 insertions, 8 deletions
diff --git a/compiler/nativeGen/AsmCodeGen.hs b/compiler/nativeGen/AsmCodeGen.hs
index b4752cce0c..b4cfd8e310 100644
--- a/compiler/nativeGen/AsmCodeGen.hs
+++ b/compiler/nativeGen/AsmCodeGen.hs
@@ -848,9 +848,7 @@ sequenceBlocks infos (entry:blocks) =
sccBlocks
:: Instruction instr
=> [NatBasicBlock instr]
- -> [SCC ( NatBasicBlock instr
- , BlockId
- , [BlockId])]
+ -> [SCC (Node BlockId (NatBasicBlock instr))]
sccBlocks blocks = stronglyConnCompFromEdgedVerticesUniqR (map mkNode blocks)
@@ -867,10 +865,10 @@ getOutEdges instrs
mkNode :: (Instruction t)
=> GenBasicBlock t
- -> (GenBasicBlock t, BlockId, [BlockId])
-mkNode block@(BasicBlock id instrs) = (block, id, getOutEdges instrs)
+ -> Node BlockId (GenBasicBlock t)
+mkNode block@(BasicBlock id instrs) = DigraphNode block id (getOutEdges instrs)
-seqBlocks :: LabelMap i -> [(GenBasicBlock t1, BlockId, [BlockId])]
+seqBlocks :: LabelMap i -> [Node BlockId (GenBasicBlock t1)]
-> [GenBasicBlock t1]
seqBlocks infos blocks = placeNext pullable0 todo0
where
@@ -879,8 +877,8 @@ seqBlocks infos blocks = placeNext pullable0 todo0
-- reason not to;
-- may include blocks that have already been placed, but then
-- these are not in pullable
- pullable0 = listToUFM [ (i,(b,n)) | (b,i,n) <- blocks ]
- todo0 = [i | (_,i,_) <- blocks ]
+ pullable0 = listToUFM [ (i,(b,n)) | DigraphNode b i n <- blocks ]
+ todo0 = map node_key blocks
placeNext _ [] = []
placeNext pullable (i:rest)