... | @@ -148,48 +148,3 @@ actually necessary and useful. |
... | @@ -148,48 +148,3 @@ actually necessary and useful. |
|
- Simon doesn't like the `joinInFacts` function, which is only called to possibly produce some debugging output from the join function.
|
|
- Simon doesn't like the `joinInFacts` function, which is only called to possibly produce some debugging output from the join function.
|
|
|
|
|
|
- Jan doesn't like mess in Hoopl repo. There are unused modules (`Compiler.Hoopl.OldDataflow`, `Compiler.Hoopl.DataflowFold`), older versions of some modules (in `prototypes/` directory) or private correspondence with paper reviewers and between authors. |
|
- Jan doesn't like mess in Hoopl repo. There are unused modules (`Compiler.Hoopl.OldDataflow`, `Compiler.Hoopl.DataflowFold`), older versions of some modules (in `prototypes/` directory) or private correspondence with paper reviewers and between authors. |
|
|
|
|
|
## A personal note by Jan Stolarek
|
|
|
|
|
|
|
|
|
|
|
|
(I think this may be subsumed by the above.)
|
|
|
|
|
|
|
|
|
|
|
|
On my first contact with Hoopl I was very confused by some of its behaviour. Here's [ a question I mailed to ghc-devs on 13th July 2013](http://www.haskell.org/pipermail/ghc-devs/2013-July/001757.html):
|
|
|
|
|
|
|
|
*In my algorithm I need to initialize all of the blocks in a graph with bottom element of a lattice, except for the entry block, which needs some other initial values. I've written something like this:*
|
|
|
|
|
|
|
|
```wiki
|
|
|
|
cmmCopyPropagation dflags graph = do
|
|
|
|
let entry_blk = g_entry graph
|
|
|
|
g' <- dataflowPassFwd graph [(entry_blk, (Top , Top))] $
|
|
|
|
analRewFwd cpLattice cpTransfer cpRewrite
|
|
|
|
return . fst $ g'
|
|
|
|
|
|
|
|
cpLattice = DataflowLattice "copy propagation" (Bottom, Bottom) cpJoin
|
|
|
|
```
|
|
|
|
|
|
|
|
*However, it seems that Bottom values passed to cpLattice are ignored - I could replace them with `undefined` and the code would still run without causing an error. Is there something obviously wrong in the way I pass initial fact values to dataflowPassFwd, or should I look for the problem in other parts of my code?*
|
|
|
|
|
|
|
|
|
|
|
|
I think this question resulted from Hoopl's current behaviour where it sometimes ignores bottom passed in by the user and sometimes does not.
|
|
|
|
|
|
|
|
|
|
|
|
When I did copy propagation pass I had data type that looked like this:
|
|
|
|
|
|
|
|
```wiki
|
|
|
|
data Facts = Bottom | Const (M.Map a CPFact)
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
and I wrote `join` function which analyzed all four possible cases of joining facts:
|
|
|
|
|
|
|
|
```wiki
|
|
|
|
join (Const f) (Const f) = ...
|
|
|
|
join (Const f) Bottom = ...
|
|
|
|
join Bottom (Const f) = ...
|
|
|
|
join Bottom Bottom = ...
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
But only one of them was ever used actually. While I expected this for the last two ones and replaced them with compiler panic, I certainly did not expect that `join (Const f) Bottom` will not be used. Only after some tiresome debugging and analyzing the source code did I realize that Hoopl optimizes away this kind of join. I think that being explicit about the redundance of bottom in forward analysis will make Hoopl easier to use for newcommers. (Note: if I were doing backward analysis I would still need to analyze all four cases). |
|
|