1. <i>Getting Started with LLVM Core Libraries</i><p>It's a bit dated (covers DAGISel rather than GlobalISel) but it gives a thorough introduction.<p>2. LLVM Developer Meeting tutorials<p>These are <i>really</i> good although you'll have to put them in order yourself. They will be out of date, a little. LLVM is a moving target. Also, you don't have to go through every tutorial. For example, MLIR is not for me.<p>3. LLVM documentation<p>I spent less time reading this than going through the Developer Meeting tutorials. I generally use it as a reference.<p>4. Discord, LLVM email list, git blame, LLVM Weekly<p>... because you will have questions.<p>5. MyFirstTypoFix (in the docs)<p>... when it comes time to submit a patch.<p>6. Mips backend<p>If you're doing a backend, you will need a place to start. The LLVM documentation points you to the horribly out of date SPARC backend. Don't even touch that. AArch64 and x86 are very full featured and thus very complex (100 kloc+). Don't use those either. RISC-V is ok but concerns itself mostly with supporting new RISC-V features rather than keeping up to date with LLVM compiler services. Don't use that either although <i>definitely</i> work through Alex Bradbury's RISC-V backend tutorials. Read the Mips backend. It is actively maintained. It has good GlobalISel support almost on par with the flagship AArch64 and x86 backends.<p>BTW, Chris Lattner is a super nice guy.
I learned a lot about LLVM by looking at the compiler output from Clang:<p><pre><code> clang -emit-llvm -S sample.cpp
</code></pre>
The article mentions Clang's AST, which can also be emitted:<p><pre><code> clang -Xclang -ast-dump -fsyntax-only sample.cpp
</code></pre>
And for checking compiler outputs across lots of languages and implementations, there's always Matt Godbolt's Compiler Explorer:<p><pre><code> https://godbolt.org</code></pre>
I have to say personally I find general program analysis (e.g. for security) a much more interesting topic than most vanilla compiler courses. For example I recently came across this course by the maintainers of soot: <a href="https://youtube.com/playlist?list=PLamk8lFsMyPXrUIQm5naAQ08aK2ctv6gE" rel="nofollow">https://youtube.com/playlist?list=PLamk8lFsMyPXrUIQm5naAQ08a...</a><p>Any pointers to similar courses much appreciated!
More great things:<p>- <a href="https://c9x.me/compile/" rel="nofollow">https://c9x.me/compile/</a><p>- <a href="https://github.com/vnmakarov/mir" rel="nofollow">https://github.com/vnmakarov/mir</a>
since here's many compiler hackers then I'd want to ask question:<p>How do you distribute your frontend with LLVM?<p>Let's say that I have lexer, parser and emitter written in e.g Haskell (random example)<p>I emit LLVM IR and then I use LLVM to generate something other<p>but the problem is, that I need to have LLVM binaries and I'd rather avoid telling people that want to contribute to my OSS project to install LLVM because it's painful process as hell<p>So I thought about just adding "binaries" folder to my repo and put executables there, but the problem is that they're huge as hell! and also when you're on linux, then you don't need windows' binaries<p>Another problem is that LLVM installer doesnt include all LLVM components that I need (llc and wasm-ld), so I gotta compile it and tell cmake (iirc) to generate those<p>I thought about creating 2nd repo where there'd be all binaries compiles for all platforms: mac, linux, windows and after cloning my_repo1, then instruction would point to download specific binaries<p>How you people do it?