WIP: JS: add simple optimizer

Open Luite Stegeman requested to merge luite/ghc:js-opt into master

This is an attempt at bringing back an optimizer for the JS backend to make code sizes more manageable. The goal is to get code size similar or better than what GHCJS used to produce, without the performance hit and complexity of the GHCJS optimizer. It's a non-iterative analysis that is tuned towards optimizing common patterns produced by the JS code generator. Better code size should also reduce memory consumption when linking, thanks to smaller object files.

An initial version reduced code size of a "hello world" program by 26.9%, having only local variable renaming and dead/trivial assignment elimination. Additional functionality should improve this.

Still in progress:

  • combining stack pointer operations
Edited by Luite Stegeman

Merge request reports