What is LLVM and Why is it Useful?
Multiple mini-projects work under the LLVM umbrella. The mini-projects mainly deal with compiler technologies. There seems to be some confusion regarding the LLVM naming. People mistakenly assume it is related to virtual machines. There is no connection. The term LLVM doesn’t stand for anything. It is just a name that was used at the beginning of the project.
The LLVM project is operated under the “UIUC” BSD-Style license. The project originated in the University of Illinois. Since then it has gained popularity and it has been used for a large variety of projects. It’s especially popular in the academic circles. The main objective of the project to provide SSA-based static and dynamic compilation of various programming languages.
Here are the mini-project of LLVM:
- LLVM Core: The core libraries provide optimizer and code generation support for CPUs. LLVM IR(Intermediate Representation) provides the foundation for the libraries. The community has done a good job of documenting the LLVM Core. So you can easily use these libraries to create your new programming language or create a port of an existing compiler. If you are looking to venture into these territories, LLVM Core is a good place to start.
- Clang: It is a compiler that is three times faster than GCC. It targets C, C++, and Objective-C. The Clang errors and warnings are easier to understand. It also has a static analyzer tool. The static analyzer tool itself is built using the Clang compiler.
- LLDB: It is a debugger. It is faster and more efficient than GDB. The debugger is built using Clang and LLVM Core.
- libc++ and libc++ ABI: Better implementation of C++ STD.
- compiler-rt: It provides supports for low-level code. It also has run-times libraries for dynamic testing.
- OpenMP: Open Multi-Processing (OpenMP) is an API to help with multithreading. This project supports the native runtime for OpenMP to be used with Clang.
- Polly: In the LLVM world, it is a high-level loop and data-locality optimizer. It optimizes memory access patterns of programs.
- libclc: A library for OpenCL.
- klee: It is a symbolic virtual machine. You can use klee to traverse all the dynamic paths in a program to find problems. The machine can produce automated test cases.
- SAFECODE: It is a compiler for C/C++ to guarantee memory safety. It is a great tool for cybersecurity experts to explore. It can help with detecting memory safety errors.
- lld: It is building a linker to work with Clang and LLVM.
The LLVM has a reputation for creating cleaner binaries than GCC. Also, LLVM has external projects which can be used to compile Python, Haskell, PHP, LUA, Ruby and other languages. LLVM is considered a versatile, flexible and reusable solution. So it is gaining popularity in the development community. It is used as JIT compilers for embedded languages. LLVM is also being used for supercomputers. The broad support from the developer community is making it a robust tool.
Further Study:
- http://www.drdobbs.com/architecture-and-design/the-design-of-llvm/240001128
- https://llvm.org/docs/tutorial/
- http://clang.llvm.org/
- http://lldb.llvm.org/
- http://libcxx.llvm.org/
- http://libcxxabi.llvm.org/
- http://compiler-rt.llvm.org/
- http://openmp.llvm.org/
- http://polly.llvm.org/
- http://libclc.llvm.org/
- http://klee.github.io/
- http://safecode.cs.illinois.edu/
- http://lld.llvm.org/