Hacker News new | ask | show | jobs
by erichocean 1114 days ago
Do you have any pointers to papers/books exploring peephole optimizers? I've read a few paper, but found them underwhelming…
1 comments

I don't have an academic background, and I'll agree that the majority of books I have picked up have covered the subject very well. It's a pretty common technique though, for assembly and for bytecode, so I've learned by reading implementations. `peephole.c` in CPython is particularly easy to read with a small understanding of the CPython API. It's a very limited implementation, but the idea goes far. Lots of things that you might expect the compiler to optimize in IR can be done directly from the bytecode instead.