Hacker News new | ask | show | jobs
by eatonphil 1741 days ago
I had a not terrible time emitting LLVM IR text directly as part of an exploration of language backends.

Here are the three parts:

  * Introduction: https://notes.eatonphil.com/compiler-basics-llvm.html
  * Conditionals: https://notes.eatonphil.com/compiler-basics-llvm-conditionals.html
  * And system calls: https://notes.eatonphil.com/compiler-basics-llvm-system-calls.html
The hardest part I can remember is figuring out how LLVM IR's embedded assembly works since it's not exactly like Clang or GCC's IIRC. And the documentation was definitely confusing.

I think the libraries wrapping LLVM IR are frankly harder to figure out than emitting the IR text directly.