Install

The passes

Each pass is a rewrite over the instruction stream that leaves every address where it was.

The passes

PassWhat it rewrites
Branch and call threadingA jump or call to a thunk goes straight to the thunk's target.
Identity bypassRuns of instructions that leave every register as it was are stepped over.
Stack load forwardingA value just stored to the stack is used directly instead of loaded back.
Constant branchesA branch whose outcome is fixed becomes a jump or falls through.
Strength reductionAn arithmetic instruction becomes a cheaper one with the same result.
Unreachable codeBlocks and functions no root can reach are neutralized.

Roots

The entrypoint, every direct call target and every relocation target are roots. Indirect calls keep every target they could reach.

Counters

optimization.json holds one counter per pass, the program counters that were modified, the count of relocation sites preserved, and the SHA-256 of the program before and after.