Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
LLVM
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Features== LLVM can provide the middle layers of a complete compiler system, taking [[intermediate representation]] (IR) code from a [[compiler]] and emitting an optimized IR. This new IR can then be converted and linked into machine-dependent [[assembly language]] code for a target platform. LLVM can accept the IR from the [[GNU Compiler Collection]] (GCC) [[toolchain]], allowing it to be used with a wide array of extant compiler front-ends written for that project. LLVM can also be built with gcc after version 7.5.<ref>{{Cite web |title=β D156286 [docs] Bump minimum GCC version to 7.5 |url=https://reviews.llvm.org/D156286 |access-date=2023-07-28 |website=reviews.llvm.org}}</ref> LLVM can also generate [[Relocation (computing)|relocatable machine code]] at compile-time or link-time or even binary machine code at runtime. LLVM supports a language-independent [[instruction set]] and [[type system]].<ref name="langref"/> Each instruction is in [[static single assignment form]] (SSA), meaning that each [[variable (programming)|variable]] (called a typed register) is assigned once and then frozen. This helps simplify the analysis of dependencies among variables. LLVM allows code to be compiled statically, as it is under the traditional GCC system, or left for late-compiling from the IR to machine code via [[just-in-time compilation]] (JIT), similar to [[Java (programming language)|Java]]. The type system consists of basic types such as [[integer (computer science)|integer]] or [[floating-point arithmetic|floating-point]] numbers and five [[Composite data type|derived types]]: [[pointer (computer programming)|pointers]], [[array data structure|arrays]], [[array data type|vectors]], [[record (computer science)|structures]], and [[function (programming)|functions]]. A type construct in a concrete language can be represented by combining these basic types in LLVM. For example, a class in C++ can be represented by a mix of structures, functions and arrays of [[function pointer]]s. The LLVM JIT compiler can optimize unneeded static branches out of a program at runtime, and thus is useful for [[partial evaluation]] in cases where a program has many options, most of which can easily be determined unneeded in a specific environment. This feature is used in the [[OpenGL]] pipeline of [[Mac OS X Leopard]] (v10.5) to provide support for missing hardware features.<ref>{{cite mailing list | last = Lattner |first = Chris |author-link=Chris Lattner | date = August 15, 2006 | url = http://lists.llvm.org/pipermail/llvm-dev/2006-August/006497.html | title = A cool use of LLVM at Apple: the OpenGL stack | mailing-list = llvm-dev | access-date = March 1, 2016}}</ref> Graphics code within the OpenGL stack can be left in intermediate representation and then compiled when run on the target machine. On systems with high-end [[graphics processing unit]]s (GPUs), the resulting code remains quite thin, passing the instructions on to the GPU with minimal changes. On systems with low-end GPUs, LLVM will compile optional procedures that run on the local [[central processing unit]] (CPU) that emulate instructions that the GPU cannot run internally. LLVM improved performance on low-end machines using [[Intel GMA]] chipsets. A similar system was developed under the [[Gallium3D]] LLVMpipe, and incorporated into the [[GNOME]] shell to allow it to run without a proper 3D hardware driver loaded.<ref>Michael Larabel, [https://www.phoronix.com/scan.php?page=news_item&px=MTAxMjI "GNOME Shell Works Without GPU Driver Support"], ''phoronix'', November 6, 2011</ref> In 2011, programs compiled by GCC outperformed those from LLVM by 10%, on average.<ref>{{cite web | last = Makarov |first = V. | url = http://vmakarov.fedorapeople.org/spec/2011/llvmgcc32.html | title = SPEC2000: Comparison of LLVM-2.9 and GCC4.6.1 on x86 | access-date = October 3, 2011}}</ref><ref>{{cite web | last = Makarov |first = V. | url = http://vmakarov.fedorapeople.org/spec/2011/llvmgcc64.html | title = SPEC2000: Comparison of LLVM-2.9 and GCC4.6.1 on x86_64 | access-date = October 3, 2011}}</ref> In 2013, [[Phoronix Test Suite#Phoronix website|phoronix]] reported that LLVM had caught up with GCC, compiling binaries of approximately equal performance.<ref>{{cite web | last = Larabel |first = Michael | date = December 27, 2012 | url = https://www.phoronix.com/scan.php?page=article&item=llvm_clang32_final | title = LLVM/Clang 3.2 Compiler Competing With GCC | access-date = March 31, 2013}}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)