Re:How to Write Your Own Compiler (2009)
by bollu on Friday August 25, 2017 @10:52AM
(#15098850)
Shameless plug: I've been writing a series that's WIP about writing a tiny optimising compiler - https://github.com/bollu/tiny-optimising-compiler. It tries to model as much as possible, and the aim is to show off the power that modern compiler ideas bring: SSA and polyhedral compilation.
[ Parent
| on HN ]
This looks cool, thanks for pointing it out.
I'm somewhat familiar witih SSA, but I don't know anything about polyhedral compilation. What does it buy you? Is there a concise intro you could point to?
(I thought I had heard someone say it makes your compiler slower for marginal benefit, but they/I could be wrong about that.)
FWIW I found this introduction to the new Go SSA back end pretty useful as an overview:
https://www.youtube.com/watch?v=uTMvKVma5ms
One thing that was interesting is that they seemed to have an LLVM TableGen-like "rules" DSL for both architecture-independent and -dependent optimizations / code gen.
I don't think polyhedral compilation was mentioned and I don't think they use it.
In fact, LLVM does use polyhedral compilation :) it's just disabled by default. There's a module called Polly in LLVM which performs polyhedral optimisations!
Yep, tableGen is nice but would be overkill for this tutorial project.