3 Updates to Hoopl in the last week
4 =================================
9 The type of AGraph is now abstract.
10 It is now recommended to create AGraphs with just three functions:
13 |*><*| splicing at a closed point
14 addBlocks add C/C blocks out of line
16 There are new utility functions in modules Util and XUtil, all
17 exported by Compiler.Hoopl. Here's a selection:
19 -- | A utility function so that a transfer function for a first
20 -- node can be given just a fact; we handle the lookup. This
21 -- function is planned to be made obsolete by changes in the dataflow
23 firstXfer :: Edges n => (n C O -> f -> f) -> (n C O -> FactBase f -> f)
24 firstXfer xfer n fb = xfer n $ fromJust $ lookupFact fb $ entryLabel n
26 -- | This utility function handles a common case in which a transfer function
27 -- produces a single fact out of a last node, which is then distributed
28 -- over the outgoing edges.
29 distributeXfer :: Edges n => (n O C -> f -> f) -> (n O C -> f -> FactBase f)
30 distributeXfer xfer n f = mkFactBase [ (l, xfer n f) | l <- successors n ]
32 -- | This utility function handles a common case in which a transfer function
33 -- for a last node takes the incoming fact unchanged and simply distributes
34 -- that fact over the outgoing edges.
35 distributeFact :: Edges n => n O C -> f -> FactBase f
37 -- | Function 'graphMapBlocks' enables a change of representation of blocks,
38 -- nodes, or both. It lifts a polymorphic block transform into a polymorphic
39 -- graph transform. When the block representation stabilizes, a similar
40 -- function should be provided for blocks.
41 graphMapBlocks :: forall block n block' n' e x .
42 (forall e x . block n e x -> block' n' e x)
43 -> (Graph' block n e x -> Graph' block' n' e x)
45 postorder_dfs :: Edges (block n) => Graph' block n O x -> [block n C C]
47 There are quite a few other variations related to depth-first traversal.
50 There is a new module Compiler.Hoopl.Pointed, which uses GADTs to
51 enable you to add a Top or Bot element to a lattice, or both, all
52 using the same type. (Types 'WithBot' and 'WithTop' in XUtil,
53 exported by Compiler.Hoopl, do similar jobs, but I think they are
54 inferior. Your opinion is solicited.)
56 I added a function showGraph to print Graphs. Right now it requires a
57 polymorphic node-showing function as argument. When we change the
58 Block representation we may get enough static type information that we
59 can simply have an instance declaration for
61 instance (Show n C O, Show n O O, Show n O C) => Show (Graph n e x)
63 At present, I don't see how to achieve such a declaration.
66 John added new functions 'debugFwdJoins' and 'debugBwdJoins' to extend
67 passes with debugging information.
69 We added primed versions of the analyzeAndRewrite functions, which
70 operate on Graph, not Body. Recommended, at least for first-timers.
72 Not all maps keyed by Label are FactBases, so there is now a new set
73 of names of functions to manipulate LabelMaps that do not contain
78 Implementation changes
79 ----------------------
80 Split pass and rewrite-function combinators into Compiler.Hoopl.Combinators.
82 Changed order of blocks for forward and backward analysis.
83 These changes have not been tested, because we don't have a true
86 Graph and Body types now have more polymorphic variants Graph' and Body'.
88 Lots of experiments with zippers.
94 ForwardTransfer will become an abstract type, and clients will have
95 two ways to create ForwardTransfers: as now, with a single,
96 polymorphic transfer function; or with a triple of monomorphic
97 transfer functions. The implementation will use monomorphic
98 functions, which will enable more useful combinators on passes,
99 including adding more debugging information and enabling us to combine
102 Perhaps we should provide splicing and 'addBlocks' on Graph?
104 Change of block representation to have three monomorphic unit
105 constructors and one polymorphic concatenation constructor.
107 Graph body to be represented by a finite map; add functions to check
108 for duplicate labels.
112 - Added a bunch of zipper experiments.
113 - Existing clients should not be affected.
118 - More expressive debugging support
119 - retract arfGraph and normalization; export analyzeAndRewriterFwd'
123 - Expose arfGraph and normalization functions
131 - Rationalized AGraph splicing functions.
135 - Restrict clients so they see much less, including hiding
136 the value constructors for Body.