
LLVM Tutorial - ColinWright
http://llvm.org/docs/tutorial/LangImpl1.html#tutorial-introduction
======
spacemanaki
If writing compilers in C++ sounds like a pain, there's also an OCaml version
of this tutorial:
[http://llvm.org/docs/tutorial/OCamlLangImpl1.html](http://llvm.org/docs/tutorial/OCamlLangImpl1.html)

~~~
carterschonwald
Or check out the world class really nice llvm bindings in Haskell that were
recently released: haskell.org/package/llvm-general

They're already in use to provide an llvm backend for the idris compiler, and
ill be using them myself soon too.

One of the notable novelties about llvm general Is that you can manipulate the
llvm AST as a normal Haskell data type. It also has really nice hooks for
using most of the well maintained llvm Apis.

~~~
oconnor0
The URL for the llvm-general bindings is
[http://hackage.haskell.org/package/llvm-
general](http://hackage.haskell.org/package/llvm-general)

------
arh68
I had trouble understanding this tutorial head-on, but it's much more
digestible after some intro reading material ([2] will make a lot more sense
after understanding Forth [3]).

[1]
[http://www.aosabook.org/en/llvm.html](http://www.aosabook.org/en/llvm.html)

[2]
[http://www.cs.ucla.edu/classes/spring08/cs259/llvm-2.2/docs/...](http://www.cs.ucla.edu/classes/spring08/cs259/llvm-2.2/docs/Stacker.html)

[3] [http://www.forth.com/starting-
forth/sf1/sf1.html](http://www.forth.com/starting-forth/sf1/sf1.html)

------
munin
I gave an LLVM tutorial at PLDI2013, the slides are here:
[https://bitbucket.org/munin/llvm_tutorial/src/61f6300f76b8f0...](https://bitbucket.org/munin/llvm_tutorial/src/61f6300f76b8f092ba85bac34b404d348b2f7e04/slides/LLVM_Tutorial.pdf?at=master)

I tried to be more introductory and hopefully the slides stand a little on
their own...

~~~
tjaerv
Excellent slides. thank you. Is the recording perchance available somewhere?

~~~
munin
don't think PLDI records tutorials (it was 3h long)

------
altschuler
I can highly recommend going through this tutorial if you're interested in
LLVM or just compilers in general. While it lacks some polish here and there,
it's still quite easy to follow and what you end up with is some actually
"useable".

It's also rather easy to extend upon what is made, adding your own features.

~~~
TheLegace
I'm very curious if I can compile static Python code with LLVM and use it on
Cortex-M4 microcontrollers.

I have seen some code which compiles Clang to STM32F4 microcontrollers and I
have found py2llvm can compile Python into LLVM IR.

I am wondering if it is even worth it, (but according to py2llvm you can get
almost C like performance).

