В последнее время все
чаще и чаще в новостях встречается
аббревиатура LLVM, хотя проекту, стоящему
за этими буквами уже больше 10 лет. Что
же такого особенного в, казалось бы, еще
одном компиляторе?
LLVM is an umbrella project that
hosts and develops a set of close-knit, low-level toolchain
components (assemblers, compilers, debuggers, etc.), which are
designed to be compatible with existing tools typically used on UNIX
systems. The name "LLVM" was once an acronym, but is now
just a brand for the umbrella project. While LLVM provides some
unique capabilities and is known for some of its widely used tools
(the Clang compiler, a C/C++/Objective-C compiler that provides a
number of benefits over the GCC compiler), the main thing that sets
LLVM apart from other compilers is its internal architecture.
…
The most popular design for a
traditional static compiler (like most C compilers) is the three
phase design whose major components are the front end, the optimizer,
and the back end
…
While the benefits of a three-phase
design are compelling and well-documented in compiler textbooks, in
practice, it is almost never fully realized
…
let's dive into LLVM: The most
important aspect of its design is the LLVM Intermediate
Representation (IR), which is the form it uses to represent code in
the compiler. LLVM IR is designed to host mid-level analyses and
transformations that you find in the optimizer section of a compiler.
It was designed with many specific goals in mind, including
supporting lightweight runtime optimizations,
cross-function/interprocedural optimizations, whole program analysis,
and aggressive restructuring transformations, etc. The most important
aspect of it, though, is that it is itself defined as a first class
language with well-defined semantics.
...
After all, the goal isn't to be
perfect, it is to keep getting better over time.
Очень хорошо, доступно
и внятно написанная статья. Весьма
поучительно.
Комментариев нет:
Отправить комментарий