Code Generator
This page describes code generator ("codegen") in GHC. It is meant to reflect current state of the implementation. If you notice any inaccuracies please update the page (if you know how) or complain on ghc-devs.
- Overview of the code generator
- Data types and modules for the code generator
- The STG language and how to execute it
- The Cmm language syntax
- List of code-gen stupidities (some, but not all, fixed).
- Clean-up ideas once the new codegen is in place (i.e. now); not all done.
- Loopification i.e. turn tail calls into loops
- LLVM back end
- Hoopl/Cleanup
- Planned Backend Optimizations
- Details about how we place basic blocks
A brief history of code generator
You might occasionally hear about "old" and "new" code generator. GHC 7.6 and earlier used the old code generator. New code generator was being developed since 2007 and it was enabled by default on 31 August 2012 after the release of GHC 7.6.1. The first stable GHC to use the new code generator is 7.8.1 released in early 2014.
Various historical pages, with still-useful info:
-
Status page on the "new code generator" (now the current one)
-
IntegratedCodeGen One plan is to expand the capability of the pipeline so that it does native code generation too so that existing backends can be discarded.
Tickets
See the code generation label.