diff options
author | Simon Marlow <marlowsd@gmail.com> | 2011-01-24 12:16:50 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2011-01-24 12:16:50 +0000 |
commit | 889c084e943779e76d19f2ef5e970ff655f511eb (patch) | |
tree | 56bba8db5c08c72dc1a85ecb2987e6c16c0fd635 /compiler/cmm/Dataflow.hs | |
parent | f1a90f54590e5a7a32a9c3ef2950740922b1f425 (diff) | |
download | haskell-889c084e943779e76d19f2ef5e970ff655f511eb.tar.gz |
Merge in new code generator branch.
This changes the new code generator to make use of the Hoopl package
for dataflow analysis. Hoopl is a new boot package, and is maintained
in a separate upstream git repository (as usual, GHC has its own
lagging darcs mirror in http://darcs.haskell.org/packages/hoopl).
During this merge I squashed recent history into one patch. I tried
to rebase, but the history had some internal conflicts of its own
which made rebase extremely confusing, so I gave up. The history I
squashed was:
- Update new codegen to work with latest Hoopl
- Add some notes on new code gen to cmm-notes
- Enable Hoopl lag package.
- Add SPJ note to cmm-notes
- Improve GC calls on new code generator.
Work in this branch was done by:
- Milan Straka <fox@ucw.cz>
- John Dias <dias@cs.tufts.edu>
- David Terei <davidterei@gmail.com>
Edward Z. Yang <ezyang@mit.edu> merged in further changes from GHC HEAD
and fixed a few bugs.
Diffstat (limited to 'compiler/cmm/Dataflow.hs')
-rw-r--r-- | compiler/cmm/Dataflow.hs | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/compiler/cmm/Dataflow.hs b/compiler/cmm/Dataflow.hs deleted file mode 100644 index fc1b5769f6..0000000000 --- a/compiler/cmm/Dataflow.hs +++ /dev/null @@ -1,55 +0,0 @@ -{-# OPTIONS -Wall -fno-warn-name-shadowing #-} - -module Dataflow ( - fixedpoint - ) where - ------------------------------------------------------------------------------ --- | Solve the fixed-point of a dataflow problem. --- --- Complexity: O(N+H*E) calls to the update function where: --- N = number of nodes, --- E = number of edges, --- H = maximum height of the lattice for any particular node. --- --- Sketch for proof of complexity: --- Note that the state is threaded through the entire execution. --- Also note that the height of the latice at any particular node --- is the number of times 'update' can return non-Nothing for a --- particular node. Every call (except for the top level one) --- must be caused by a non-Nothing result and each non-Nothing --- result causes as many calls as it has out-going edges. --- Thus any particular node, n, may cause in total at --- most H*out(n) further calls. When summed over all nodes, --- that is H*E. The N term of the complexity is from the initial call --- when 'update' will be passed 'Nothing'. -fixedpoint :: - (node -> [node]) -- map from nodes to those who's - -- value depend on the argument node - -> (node -> Maybe node -> s -> Maybe s) - -- Given the node which needs to be - -- updated, and which node caused that node - -- to need to be updated, update the state. - -- - -- The causing node will be 'Nothing' if - -- this is the initial/bootstrapping update. - -- - -- Must return 'Nothing' if no change, - -- otherwise returrn 'Just' of the new state. - - -> [node] -- Nodes that should initially be updated - - -> s -- Initial state - -- (usually a map from node to - -- the value for that node) - - -> s -- Final state -fixedpoint dependants update nodes state = - foldr (fixedpoint' Nothing) state nodes where - -- Use a depth first traversal of nodes based on the update graph. - -- Terminate the traversal when the update doesn't change anything. - fixedpoint' cause node state = - case update node cause state of - Nothing -> state - Just state' -> - foldr (fixedpoint' (Just node)) state' (dependants node) |