<div dir="ltr"><div><div><div><div><div><div><div><div><div><div><div><div>Hi all,</div><div><br></div><div>I was looking at removing the `BlockId` type synonym in favor of</div><div>Hoopl's `Label` (there was already a TODO and it is a bit confusing).</div><div>But once I've started making the changes, I've realized that in a</div><div>bunch of places this makes the code *less* readable. Mostly because of</div><div>`CLabel` (sounds similar but is something quite different and having</div><div>to rename local variables from `label` to `clabel` is not great).</div><div><br></div><div>I started to look at alternatives and noticed that in general the</div><div>interface between GHC and Hoopl is quite noisy and confusing:</div><div>- Hoopl has `Label` which is GHC's `BlockId` but different than</div><div>  GHC's `CLabel`</div><div>- Hoopl has `Unique` which is different than GHC's `Unique`</div><div>- Hoopl has `Unique{Map,Set}` which are different than GHC's</div><div>  `Uniq{FM,Set}`</div><div>- GHC has its own specialized copy of `Dataflow`, so `cmm/Hoopl` is</div><div>  needed just to filter the exposed functions (filter out some of the</div><div>  Hoopl's and add the GHC ones).</div><div>- Working in `cmm/` requires constant switching between GHC code and</div><div>  Hoopl (`CmmNode`/`CmmGraph`/`CmmBlock` and dataflow stuff is in GHC,</div><div>  the actual implementation of `Block`/`Graph` are defined in Hoopl,</div><div>  etc.)</div><div><br></div><div>GHC is actually using only a small subset of Hoopl (e.g., the fixpoint</div><div>computation is copied/specialized: `cmm/Hoopl/Dataflow`). So I was</div><div>wondering - maybe it's worth to simply drop the dependency on Hoopl?</div><div>(and copy the code that is actually necessary in GHC)</div><div>I've done an experiment in [1] (to see how much we'd need to actually</div><div>copy) and I really like the result:</div><div>- We can remove one external dependency and git submodule at the</div><div>  cost of only 5 new modules in `cmm/Hoopl` (net gain of only 4</div><div>  modules: we add 5 new but can remove `cmm/Hoopl`, which is no longer</div><div>  needed)</div><div>- We should be able to fix all of the above issues and make the code</div><div>  easier to understand (less code, everything in one repo, fewer</div><div>  concepts).</div><div>- It's going to be easier to change things since we don't need to</div><div>  worry about changing the public interface of Hoopl (it's a</div><div>  standalone package on Hackage and other people already depend on the</div><div>  current behavior).</div><div><br></div><div>What do you think? Does anyone think we shouldn't do this?</div><div><br></div><div>Thanks,</div><div>Michal</div><div><br></div><div>[1] Branch: <a href="https://github.com/michalt/ghc/tree/hoopl/no-hoopl">https://github.com/michalt/ghc/tree/hoopl/no-hoopl</a></div><div>    Diff: <a href="https://github.com/ghc/ghc/compare/master...michalt:hoopl/no-hoopl">https://github.com/ghc/ghc/compare/master...michalt:hoopl/no-hoopl</a></div><div>    For now I just copied the code/updated imports and didn't do any</div><div>    cleanups, but I'd be happy to do them in subsequent PRs</div></div></div></div></div></div></div></div></div></div></div></div><div><br></div></div>