LLVM is a compiler and toolkit for building compilers that converts source code into machine-readable code. It started at the University of Illinois in 2000 and provides modular, reusable technologies. LLVM differs from GCC in that it is a framework for generating code from any source, rather than supporting specific languages. It works by using Clang to turn source into an intermediate representation, then optimizes and converts it to machine code. LLVM can optimize code aggressively during compilation and linking but does not handle language parsing or memory management itself.
BP PODDAR INSTITUTE OF MANAGEMENT AND TECHNOLOGY LLVM COMPILER
1. B.P. PODDAR INSTITUTE OF MANAGEMENT
AND TECHNOLOGY
BY--------
DEBANKA KHAN(9013)
CHAYAN PATHAK(9041)
DIGANTA GHOSH(9050)
DEBAJYOTI ROY CHOWDHURY (9032)
Topic:- LLVM Compiler
2. Contents
❖ What’s LLVM?
❖ History of LLVM
❖ How Is LLVM Different From GCC?
❖ How A LLVM Compiler Works?
❖ Automatic code optimization with LLVM
❖ Components
❖ What LLVM doesn’t do
3. What’s LLVM?
As per the official site(https://llvm.org/):
The LLVM Project is a collection of modular and reusable
compiler and toolchain technologies.The name "LLVM" itself is
not an acronym; it is the full name of the project.
LLVM is a compiler and a toolkit for building compilers,
which are programs that convert instructions into a form
that can be read and executed by a computer.
4. History of LLVM
The LLVM project started in 2000 at the
University of Illinois at Urbana–Champaign,
under the direction of Vikram Adve and Chris
Lattner. LLVM was originally developed as a
research infrastructure to investigate
dynamic compilation techniques for static
and dynamic programming languages.Now,
LLVM is a brand that applies to the LLVM
umbrella project, the LLVM intermediate
representation (IR), the LLVM debugger, the
LLVM implementation of the C++ Standard
Library etc. LLVM is written in C++.
The LLVM logo
5. How Is LLVM Different From GCC?
LLVM and the GNU Compiler Collection (GCC) are both compilers. The
difference is that GCC supports a number of programming languages while
LLVM isn’t a compiler for any given language. LLVM is a framework to
generate object code from any kind of source code.
6. How A LLVM Compiler Works?
LLVM can provide the middle layers of a complete compiler system, taking
intermediate representation (IR) code from a compiler and emitting an optimized
IR. On the front end, the LLVM compiler infrastructure uses clang — a compiler for
programming languages C, C++ and CUDA — to turn source code into an interim
format. Then the LLVM clang code generator on the back end turns the interim
format into final machine code.
7. Automatic code optimization with LLVM
LLVM doesn’t just compile the
IR to native machine code. You
can also programmatically
direct it to optimize the code
with a high degree of
granularity, all the way through
the linking process. The
optimizations can be quite
aggressive, including things like
inlining functions, eliminating
dead code (including unused
type declarations and function
arguments), and unrolling
loops.
9. What LLVM doesn’t do
❖ LLVM does not parse a language’s grammar. Many tools already do that
job, like lex/yacc, flex/bison, Lark, and ANTLR.
❖ there are still common parts of languages that LLVM doesn’t provide
primitives for. Many languages have some manner of garbage-collected
memory management, either as the main way to manage memory or as an
adjunct to strategies like RAII (which C++ and Rust use). LLVM doesn’t give
you a garbage-collector mechanism, but it does provide tools to implement
garbage collection
But now, LLVM is developing quickly, with a major release every six months
or so. And the pace of development is likely to only pick up