WIP: Wip/bmaurer/asm ssa
This MR implements "(Pseudo-)SSA in NCG" #19453
Most of the implementation is located in SSA.hs in GHC.CmmToAsm.SSA
The rational and design is explained in the ticket and in the Note [ASM-SSA construction].
It's still a work-in-progress with following known TODOs/Issues:
- Add statistics about unique vregs before & after
- Refactor: Copied some util functions from other modules
- Document command line flags (
-fssa-transform
,-ddump-asm-ssa
,-ddump-asm-out-of-ssa
) -
reachingDefOrDefault
is currently unused, but I didn't want to delete it - Test cases: I have not added any, yet
- Benchmarks:
- I ran nofib, but not with a fully optimized build yet.
- Manually checked spills/loads (-ddump-asm-stats) for 3 programs, but I want something systematic.
- Benchmark compile times.
My first test showed that an unoptimized build (flavour="quick") is extremely slow, but optimizations make it bearable1.
I did some profiling and the renameVars
function seems to be quite hot. It's also not tail recursive... I'm happy about any optimization and improvement suggestions, as I'm not very experienced in tuning Haskell. For algorithmic improvement ideas, please see the ticket #19453
-
For nofib/spectral/simple with 'flavour="default+profiled_ghc+no_dynamic_ghc"':
time ghc -O2 -fssa-transform
- real: 0m7,588s;time ghc -O2
- real: 0m7,182s
with 'flavour="quick"':time ghc -O2 -fssa-transform
- real 1m23,667s;time ghc -O2
- real 0m19,268s↩