by AlexDenisov on 11/4/21, 9:00 PM with 26 comments
by CalChris on 11/5/21, 3:16 PM
It's a bit dated (covers DAGISel rather than GlobalISel) but it gives a thorough introduction.
2. LLVM Developer Meeting tutorials
These are really 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.
3. LLVM documentation
I spent less time reading this than going through the Developer Meeting tutorials. I generally use it as a reference.
4. Discord, LLVM email list, git blame, LLVM Weekly
... because you will have questions.
5. MyFirstTypoFix (in the docs)
... when it comes time to submit a patch.
6. Mips backend
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 definitely 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.
BTW, Chris Lattner is a super nice guy.
by chrisaycock on 11/5/21, 11:36 AM
clang -emit-llvm -S sample.cpp
The article mentions Clang's AST, which can also be emitted: clang -Xclang -ast-dump -fsyntax-only sample.cpp
And for checking compiler outputs across lots of languages and implementations, there's always Matt Godbolt's Compiler Explorer: https://godbolt.org
by anonymousDan on 11/5/21, 2:12 PM
Any pointers to similar courses much appreciated!
by andrewchambers on 11/5/21, 10:39 AM
by tester34 on 11/5/21, 12:59 PM
How do you distribute your frontend with LLVM?
Let's say that I have lexer, parser and emitter written in e.g Haskell (random example)
I emit LLVM IR and then I use LLVM to generate something other
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
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
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
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
How you people do it?
by Lamad123 on 11/5/21, 11:13 PM