I keep hearing about LLVM all the time. It's in Perl, then it's in Haskell, then someone uses it in some other language? What is it?
相关问题
- CMakeList file to generate LLVM bitcode file from
- LLVM OPT not giving optimised file as output.
- Python numba / llvmlite on Debian 8 - i can't
- llvm::DIInstruction getFilename returns filename w
- Specifically what does a compiler do to aggressive
相关文章
- How to clone or create an AST Stmt node of clang?
- Libclang API to get function definitions defined i
- No format security warnings in Xcode 4.4
- LLVM retrieve name of AllocaInst
- In LLVM IR, I want to copy a set of Instructions a
- compiling with clang and plugin
- How to get the filename and directory from a LLVM
- At which level does one unit test lock-free code?
The Low Level Virtual Machine (LLVM) is a compiler infrastructure, written in C++, which is designed for compile-time, link-time, run-time, and "idle-time" optimization of programs written in arbitrary programming languages. Originally implemented for C/C++, the language-independent design (and the success) of LLVM has since spawned a wide variety of front-ends, including Objective C, Fortran, Ada, Haskell, Java bytecode, Python, Ruby, ActionScript, GLSL, and others.
Read this for more explanation
Also check out Unladen Swallow
The LLVM Compiler Infrastructure is particularly useful for performing optimizations and transformations on code. It also consists of a number of tools serving distinct usages. llvm-prof is a profiling tool that allows you to do profiling of execution in order to identify program hotspots. Opt is an optimization tool that offers various optimization passes (dead code elimination for instance).
Importantly LLVM provides you with the libraries, to write your own Passes. For instance if you require to add a range check on certain arguments that are passed into certain functions of a Program, writing a simple LLVM Pass would suffice.
For more information on writing your own Pass, check this http://llvm.org/docs/WritingAnLLVMPass.html
LLVM is a library that is used to construct, optimize and produce intermediate and/or binary machine code.
LLVM can be used as a compiler framework, where you provide the "front end" (parser and lexer) and the "back end" (code that converts LLVM's representation to actual machine code).
LLVM can also act as a JIT compiler - it has support for x86/x86_64 and PPC/PPC64 assembly generation with fast code optimizations aimed for compilation speed.
If you're interested, you can play with LLVM's machine code that is generated from C or C++ code in their demo page.
According to 'Getting Started With LLVM Core Libraries' book (c):
A good summary of LLVM is this:
At the frontend you have Perl, and many other high level languages. At the backend, you have the natives code that run directly on the machine.
At the centre is your intermediate code representation. If every high level languages can be represented in this LLVM IR format, then analysis tools based on this IR can be easily reused - that is the basic rational.
LLVM is basically a library used to build compilers and/or language oriented software. The basic gist is although you have gcc which is probably the most common suite of compilers , it is not built to be re-usable ie. it is difficult to take components from gcc and use it to build your own application . LLVM addresses this issue well by building a set of " modular and reusable compiler and toolchain technologies" which anyone could use to build compilers and language oriented software.