Improvements to GHC's Code Generator

Improved code layout

In the current approach there is no way to incorporate additional control flow information

We improve on that by constructing a CFG, assigning weights to its edges via static analysis and finally using these weights for code layout.

A more detailed description is available on the wiki page of the GHC project. At the time of writing the write up is here.

Initially not viewed as a major task evaluating this change took up most of this Project.

Support for conditional move instructions

This has been partially implemented but requires further work before it can be used.

Add support for lookup tables

Dropped in favour of code layout work.

Invert FP comparisons such that the parity check can be eliminated

By selectively inverting comparisons we avoid an explicit parity check.



Andreas Klebinger


  • Joachim Breitner
  • José Calderón
  • Ben Gamari