←back to thread

170 points signa11 | 1 comments | | HN request time: 0.203s | source
Show context
cube2222 ◴[] No.41086752[source]
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.

replies(2): >>41086848 #>>41088898 #
1. PartiallyTyped ◴[] No.41088898[source]
While 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.