The LLVM Compiler Project is a collection of modular and reusable compiler and toolchain technologies. The primary sub projects are LLVM Core, Clang, and 11 more.
LLVM has three important elements: front end, optimizer, back end.
Front end can be any languages.
Optimizer is a target independent intermediate language.
Back end can be any target system architecture, like x86_64.
I came approach to this tutorial, step-by-step approach to implement a simple functional language Kaleidoscope showing how fun and easy of LLVM. By following tutorial we can learn how to build a lexer, parser / AST, code generation to LLVM IR, adding JIT and Optimizer support, extending language with conditional flow (SSA construction), extending language with user defined operators (very significant), mutable variables.
Because LLVM is target independent, meant, we can implement any source language as input, convert to LLVM IR, and then output to any target architecture like Windows/Linux 32/64 bit, makes our languages portable.
Other than these, some keywords scanned. SSA and CPS. SSA, Static Single Assignment Form is a property of an intermediate representation (IR), which requires that each variable is assigned exactly once, and every variable is defined before it is used. In the other hand, CPS, Continuation-passing style is a style of programming in functional language by explicitly passing control in the form of continuation. But need to be careful as using CPS without tail call optimization will result call stack being grown and leaked. Tail Call Optimization is a compiler specific action to optimize tail call structure, which tail call is a subroutine can be performed as the final action of procedure. The procedure said to be tail-recursive when the subroutine call itself at the end, recursive function. Refer to Tail recursive in Erlang in my previous post.
I forced myself to read every single piece of information of this tutorial although it seem quite hard but yet valuable for knowledge.
10 August 2014 12:17pm, LLVM Publication, A Compilation framework for lifelong program analysis & Transformation. < http://llvm.org/pubs/2004-01-30-CGO-LLVM.pdf>