3 ms·
At the compiler’s course in my university we just had the option to use either LLVM text format as the target, or assembly (for bonus points). Frankly, I don’t
by cube2222 2y ago
At the compiler’s course in my university we just had the option to use either LLVM text format as the target, or assembly (for bonus points).
Frankly, I don’t see much point in a “special IR for teaching” because llvm text format is just really straightforward, and at the same time teaches the “real deal” (sure, normally you’d likely use bindings, but still).
You can still have your students reimplement optimizations that llvm would normally do by themselves (like inductive variable elimination, const propagation, dataflow analysis, using phi instead of alloc etc.).
At least I was really happy I could play with llvm for a university project.
- mananaysiempre 2y agoIt sounds like you didn’t write optimizations operating on that format, though. This seems to have been a large part of the course TFA describes.
- saagarjha 2y agoWhat’s wrong with it? If you’re the one generating it LLVM IR isn’t that bad
- o11c 2y agoLLVM IR is a bit too low-level, so a lot of optimizations aren't really possible anymore, particularly around allocation and logical purity.
- cube2222 2y agoYeah that’s fair, you only target it, but would have an ad-hoc internal IR of your own making for optimizations.
- PartiallyTyped 2y agoWhile life has gotten in the way of me going through this course, the way the IR is defined makes it super easy to just define some schemas and automatically have everything parsed and loaded in whatever language you comfortable in. Personally, I just wrote the types, and then used serde.