wiki:Commentary/Compiler/CodeGen

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.

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:

Tickets

Use Keyword = CodeGen to ensure that a ticket ends up on these lists.

Open Tickets:

#2725
Remove Hack in compiler/nativeGen/X86/CodeGen.hs
#2731
Avoid unnecessary evaluation when unpacking constructors
#4121
Refactor the plumbing of CafInfo to make it more robust
#8871
No-op assignment I64[BaseReg + 784] = I64[BaseReg + 784]; is generated into optimized Cmm
#8887
Double double assignment in optimized Cmm on SPARC
#8903
Add dead store elimination
#8905
Function arguments are always spilled/reloaded if scrutinee is already in WHNF
#9718
Avoid TidyPgm predicting what CorePrep will do
#10012
Cheap-to-compute values aren't pushed into case branches inducing unnecessary register pressure
#10074
Implement the 'Improved LLVM Backend' proposal
#13861
Take more advantage of STG representation invariance (follows up #9291)
#14226
Common Block Elimination pass doesn't eliminate common blocks
#14372
CMM contains a bunch of tail-merging opportunities
#14373
Introduce PTR-tagging for big constructor families
#14461
Reuse free variable lists through nested closures
#14626
No need to enter a scrutinised value
#14672
Make likelyhood of branches/conditions available throughout the compiler.
#14677
Code generator does not correctly tag a pointer
#14791
Move stack checks out of code paths that don't use the stack.
#14830
Use test instead of cmp for comparison against zero.
#14914
Only turn suitable targets into a fallthrough in CmmContFlowOpt.
#14971
Use appropriatly sized comparison instruction for small values.
#15124
Improve block layout for the NCG
#15126
Opportunity to compress common info table representation.
#15148
Allow setting of custom alignments
#15155
How untagged pointers sneak into banged fields
#15258
Implement CMOV support.
#15580
Specialize min/max functions for GHC provided instances.

Closed Tickets:

#7571
LLVM codegen does not handle integer literals in branch conditionals.
#7574
Register allocator chokes on certain branches with literals
#7575
LLVM backend does not properly widen certain literal types in call expressions
#8585
Loopification should omit stack check
#9157
cmm common block not eliminated
#9159
cmm case, binary search instead of jump table
#11372
Loopification does not trigger for IO even if it could
#12095
GHC and LLVM don't agree on what to do with byteSwap16#
#13904
LLVM does not need to trash caller-saved registers.
#14644
Improve cmm/assembly for pattern matches with two constants.
#14666
Improve assembly for dense jump tables.
#14989
CBE pass 2 invalidates proc points
#15103
Speed optimizations for elimCommonBlocks
#15104
Update JMP_TBL targets during shortcutting for x86 codegen.
#15188
Catch cases where both branches of an if jump to the same block.
#15196
Invert floating point comparisons such that no extra parity check is required.

Last modified 5 months ago Last modified on May 19, 2018 7:49:15 PM