diff options
author | Simon Marlow <marlowsd@gmail.com> | 2013-09-14 19:52:36 +0100 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2013-09-14 19:53:06 +0100 |
commit | 81610b0ecbd718590b7b9afa749fc8b81633d6fc (patch) | |
tree | 3723ec78a365a12f9820889793b278a506a63b23 /compiler/cmm | |
parent | bf582957ce1dcd18e273b11eb2b99c5ff32923ee (diff) | |
download | haskell-81610b0ecbd718590b7b9afa749fc8b81633d6fc.tar.gz |
80 columns
Diffstat (limited to 'compiler/cmm')
-rw-r--r-- | compiler/cmm/CmmSink.hs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/compiler/cmm/CmmSink.hs b/compiler/cmm/CmmSink.hs index 7b5aaa6aff..616d4da8c3 100644 --- a/compiler/cmm/CmmSink.hs +++ b/compiler/cmm/CmmSink.hs @@ -305,7 +305,8 @@ walk dflags nodes assigs = go nodes emptyBlock assigs where go [] block as = (block, as) go ((live,node):ns) block as - | shouldDiscard node live = go ns block as -- discard dead assignment + | shouldDiscard node live = go ns block as + -- discard dead assignment | Just a <- shouldSink dflags node2 = go ns block (a : as1) | otherwise = go ns block' as' where @@ -410,12 +411,13 @@ tryToInline dflags live node assigs = go usages node [] assigs inline_and_discard = go usages' inl_node skipped rest where usages' = foldLocalRegsUsed dflags addUsage usages rhs - dont_inline = keep node -- don't inline the assignment, keep it - inline_and_keep = keep inl_node -- inline the assignment, keep it + dont_inline = keep node -- don't inline the assignment, keep it + inline_and_keep = keep inl_node -- inline the assignment, keep it keep node' = (final_node, a : rest') where (final_node, rest') = go usages' node' (l:skipped) rest - usages' = foldLocalRegsUsed dflags (\m r -> addToUFM m r 2) usages rhs + usages' = foldLocalRegsUsed dflags (\m r -> addToUFM m r 2) + usages rhs -- we must not inline anything that is mentioned in the RHS -- of a binding that we have already skipped, so we set the -- usages of the regs on the RHS to 2. @@ -427,7 +429,8 @@ tryToInline dflags live node assigs = go usages node [] assigs occurs_once = not (l `elemRegSet` live) && lookupUFM usages l == Just 1 - inl_node = mapExpDeep inline node -- mapExpDeep is where the inlining actually takes place! + inl_node = mapExpDeep inline node + -- mapExpDeep is where the inlining actually takes place! where inline (CmmReg (CmmLocal l')) | l == l' = rhs inline (CmmRegOff (CmmLocal l') off) | l == l' = cmmOffset dflags rhs off |