X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Fcmm%2FDataflow.hs;h=fc1b5769f6df500eb48d651882e904722dd4106c;hp=9295b41cef5f2acedd6ede2f6b673801441222b7;hb=f1a90f54590e5a7a32a9c3ef2950740922b1f425;hpb=dd1dfdbf94caedd277bea1c76ec18095561afc9a diff --git a/compiler/cmm/Dataflow.hs b/compiler/cmm/Dataflow.hs index 9295b41..fc1b576 100644 --- a/compiler/cmm/Dataflow.hs +++ b/compiler/cmm/Dataflow.hs @@ -1,3 +1,5 @@ +{-# OPTIONS -Wall -fno-warn-name-shadowing #-} + module Dataflow ( fixedpoint ) where @@ -5,7 +7,7 @@ module Dataflow ( ----------------------------------------------------------------------------- -- | Solve the fixed-point of a dataflow problem. -- --- Complexity: O(N+H*E) calls to 'update' where +-- 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. @@ -22,10 +24,10 @@ module Dataflow ( -- 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 + (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 + -- Given the node which needs to be -- updated, and which node caused that node -- to need to be updated, update the state. -- @@ -35,13 +37,13 @@ fixedpoint :: -- Must return 'Nothing' if no change, -- otherwise returrn 'Just' of the new state. - -> [node] -- ^ Nodes that should initially be updated + -> [node] -- Nodes that should initially be updated - -> s -- ^ Initial state + -> s -- Initial state -- (usually a map from node to -- the value for that node) - -> s -- ^ Final state + -> 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.