LLVM
LLVM IR
It is similar to assembly, but at a higher abstractions.
- There are unlimited register (e.g.
%2,%3, ...) - LLVM IR has a fully type system for describing data
- Register names must follow the SSA form
Types
There are various different types:
- Integers:
i8, ... - Floats:
- Vectors
- Structs
- Pointers
Examples #1
align x: the address has to be a multiple ofx- As a convention:
%idare usually used for types and registers,@idare used for global variables
Example #2
- there is no explicit stack. LLVM will take care of this when generating the code
Example #3 - Pointers
- To do any pointer arithmentic, one has to use the
getelementptrinstruction load i32**needs two*, since it loads the value of the pointer.