寫在前面:LLVM是(Low Level Virtual Machine)的簡稱,官網(wǎng)為http://llvm.org/
LLVM隨著這個項目的不斷的發(fā)展兼犯,已經(jīng)無法完全的代表這個項目了,只是這種叫法一直延續(xù)下來杂曲。
LLVM是一個開源的項目。它最早的時候是Illinois的一個研究項目闯参,主要負責人是Chris Lattner拜姿,他現(xiàn)在就職于Apple. Apple 目前也是llvm項目的主要贊助者之一。
LLVM的主要作用是它可以作為多種語言的后端开仰,它可以提供可編程語言無關(guān)的優(yōu)化和針對很多種CPU的代碼生成功能。此外llvm目前已經(jīng)不僅僅是個編程框架薪铜,它目前還包含了很多的子項目众弓,比如最具盛名的clang.
LLVM這個框架目前已經(jīng)有基于這個框架的大量的工具可以使用。
本文只是翻譯LLVM官網(wǎng)的一小部分
The LLVM Complier Infrastructure
LLVM編譯環(huán)境基礎架構(gòu)
The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. Despite its name, LLVM has little to do with traditional virtual machines, though it does provide helpful libraries that can be used to build them. The name "LLVM" itself is not an acronym; it is the full name of the project.
LLVM項目是模塊化和復用編譯器和技術(shù)工具鏈的集合,雖然它可以提供有用的庫去構(gòu)建傳統(tǒng)虛擬機,但還是與傳統(tǒng)虛擬機有很大不同.LLVM并不是首字母的縮寫而是項目的全名
LLVM began as a research project at the University of Illinois, with the goal of providing a modern, SSA-based compilation strategy capable of supporting both static and dynamic compilation of arbitrary programming languages. Since then, LLVM has grown to be an umbrella project consisting of a number of subprojects, many of which are being used in production by a wide variety ofcommercial and open source projects as well as being widely used in academic research. Code in the LLVM project is licensed under the "UIUC" BSD-Style license.
LLVM 開始在伊利諾伊大學作為一個研究項目,目標是提供一個支持任意語言的靜態(tài)和動態(tài)編譯的現(xiàn)代的,基于SSA編譯戰(zhàn)略目標的語言集合.從那時起,LLVM現(xiàn)已發(fā)展成為由許多子項目,其中有許多是正在生產(chǎn)由各種各樣的使用的綜合項目的商業(yè)和開源項目以及被廣泛用于學術(shù)研究.LLVM項目遵循'UIUC'BSD風格的許可證
The primary sub-projects of LLVM are:
LLVM的子項目包括:
1.The LLVM Core libraries provide a modern source- and target-independent optimizer, along with code generation support for many popular CPUs (as well as some less common ones!) These libraries are built around a well specified code representation known as the LLVM intermediate representation ("LLVM IR"). The LLVM Core libraries are well documented, and it is particularly easy to invent your own language (or port an existing compiler) to use LLVM as an optimizer and code generator.
1.LLVM內(nèi)核提供一個現(xiàn)代化的源和目標無關(guān)的優(yōu)化,隨著許多CPU支持代碼生成,這些庫都是圍繞著建立明確的規(guī)定被稱為LLVM中間表示的代碼表示(LLVM IR),LLVM的核心庫是有據(jù)可查的,它使得你可以很輕松使用LLVM作為優(yōu)化器和代碼生成器構(gòu)建你自己的語言
2.Clang is an "LLVM native" C/C++/Objective-C compiler, which aims to deliver amazingly fast compiles (e.g. about 3x faster than GCC when compiling Objective-C code in a debug configuration), extremely useful error and warning messages and to provide a platform for building great source level tools. The Clang Static Analyzer is a tool that automatically finds bugs in your code, and is a great example of the sort of tool that can be built using the Clang frontend as a library to parse C/C++ code.
2.Clang 是一個LLVM原生 用于提供 極速 編譯的 C/C++/Objective-C 編譯器(是GCC的3倍速度),非常有用的錯誤和警告消息,并為構(gòu)建有效的源代碼工具提供一個平臺隔箍,該 鏘靜態(tài)分析是一種工具谓娃,自動查找代碼中的錯誤,而且是那種工具蜒滩,可以使用Clang前端作為一個庫來解析C / C ++代碼生成的一個很好的例子滨达。
3.dragonegg integrates the LLVM optimizers and code generator with the GCC parsers. This allows LLVM to compile Ada, Fortran, and other languages supported by the GCC compiler frontends, and access to C features not supported by Clang.
3.dragonegg 集成了GCC解析器和LLVM優(yōu)化程序和代碼生成器.這允許LLVM編譯 Ada, Fortran, 和其他CGG前端編譯器支持的語言以及訪問Clang不支持的C功能.
4.The LLDB project builds on libraries provided by LLVM and Clang to provide a great native debugger. It uses the Clang ASTs and expression parser, LLVM JIT, LLVM disassembler, etc so that it provides an experience that "just works". It is also blazing fast and much more memory efficient than GDB at loading symbols.
4.該LLDB項目建立在由LLVM和Clang提供的極大的調(diào)試庫,它使用Clang AST和表達式解析器,LLVM JIT,LLVM反匯編器等,以便于提供一個 “只工作”的經(jīng)驗俯艰。在加載符號時,它比GDB的速度更快,效率也更高捡遍。
In addition to official subprojects of LLVM, there are a broad variety of other projects that use components of LLVM for various tasks. Through these external projects you can use LLVM to compile Ruby, Python, Haskell, Java, D, PHP, Pure, Lua, and a number of other languages. A major strength of LLVM is its versatility, flexibility, and reusability, which is why it is being used for such a wide variety of different tasks: everything from doing light-weight JIT compiles of embedded languages like Lua to compiling Fortran code for massive super computers.
除了LLVM的官方子項目,還有各種各樣的其他項目使用LLVM的組件各項任務竹握。 您可以使用LLVM編譯Ruby画株,Python,Haskell啦辐,Java谓传,D,PHP芹关,Pure续挟,Lua和許多其他語言。LLVM的一個主要優(yōu)勢是其多功能性充边,靈活性和可重用性庸推,這就是為什么它被用于各種各樣的不同任務:從輕量級JIT編譯嵌入式語言如Lua到編譯Fortran代碼為大規(guī)模超級電腦常侦。