Admin message

Due to a large amount of spam we do not allow new users to create repositories, they are "external" users. If you are a new user and want to create a repository, for example for forking GHC, open a new issue on ghc/ghc using the "get-verified" issue template

Cmm dataflow analysis can't be used on the results of code generation
## Motivation Function `Cmm.Dataflow.analyzeCmmFwd` works only on a `CmmGraph`, not on a more general `GenCmmGraph node`. But a more general analysis is needed in order to support the Asterius back end, which generates WebAssembly. This back end needs to take a `NatCmmDecl` from `cmmTopCodeGen` and convert it to structured control flow. The conversion requires a dominator analysis, which is most sensibly done using `Cmm.Dataflow` (aka Hoopl). ## Proposal This issue could be resolved by parameterizing the interface over the type of node found in a graph. To preserve backward compatibility, this could be done by introducing primed types similar to those found in `GHC.Cmm.Dataflow.Graph`. For example, ``` type TransferFun' node f = Block node C C -> FactBase f -> FactBase f ``` The types (but not the names) of the analysis functions would also change: ``` analyzeCmmBwd, analyzeCmmFwd :: DataflowLattice f -> TransferFun' node f -> GenCmmGraph node -> FactBase f -> FactBase f ``` ## Potential concerns Could this change slow down compilation? Would any potential slowdown be appropriately mitigated using the SPECIALIZE pragma? Are there any CI tests for compile-time performance?
issue