<story><title>How to learn compilers: LLVM Edition</title><url>https://lowlevelbits.org/how-to-learn-compilers-llvm-edition/</url></story><parent_chain></parent_chain><comment><author>CalChris</author><text>1. &lt;i&gt;Getting Started with LLVM Core Libraries&lt;/i&gt;&lt;p&gt;It&amp;#x27;s a bit dated (covers DAGISel rather than GlobalISel) but it gives a thorough introduction.&lt;p&gt;2. LLVM Developer Meeting tutorials&lt;p&gt;These are &lt;i&gt;really&lt;/i&gt; good although you&amp;#x27;ll have to put them in order yourself. They will be out of date, a little. LLVM is a moving target. Also, you don&amp;#x27;t have to go through every tutorial. For example, MLIR is not for me.&lt;p&gt;3. LLVM documentation&lt;p&gt;I spent less time reading this than going through the Developer Meeting tutorials. I generally use it as a reference.&lt;p&gt;4. Discord, LLVM email list, git blame, LLVM Weekly&lt;p&gt;... because you will have questions.&lt;p&gt;5. MyFirstTypoFix (in the docs)&lt;p&gt;... when it comes time to submit a patch.&lt;p&gt;6. Mips backend&lt;p&gt;If you&amp;#x27;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&amp;#x27;t even touch that. AArch64 and x86 are very full featured and thus very complex (100 kloc+). Don&amp;#x27;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&amp;#x27;t use that either although &lt;i&gt;definitely&lt;/i&gt; work through Alex Bradbury&amp;#x27;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.&lt;p&gt;BTW, Chris Lattner is a super nice guy.</text></comment>
<story><title>How to learn compilers: LLVM Edition</title><url>https://lowlevelbits.org/how-to-learn-compilers-llvm-edition/</url></story><parent_chain></parent_chain><comment><author>chrisaycock</author><text>I learned a lot about LLVM by looking at the compiler output from Clang:&lt;p&gt;&lt;pre&gt;&lt;code&gt;  clang -emit-llvm -S sample.cpp
&lt;/code&gt;&lt;/pre&gt;
The article mentions Clang&amp;#x27;s AST, which can also be emitted:&lt;p&gt;&lt;pre&gt;&lt;code&gt;  clang -Xclang -ast-dump -fsyntax-only sample.cpp
&lt;/code&gt;&lt;/pre&gt;
And for checking compiler outputs across lots of languages and implementations, there&amp;#x27;s always Matt Godbolt&amp;#x27;s Compiler Explorer:&lt;p&gt;&lt;pre&gt;&lt;code&gt;  https:&amp;#x2F;&amp;#x2F;godbolt.org&lt;/code&gt;&lt;/pre&gt;</text></comment>