"compiler-rt" Runtime Library
The compiler-rt project is a simple library that provides an implementation of the low-level target-specific hooks required by code generation and other runtime components. For example, when compiling for a 32-bit target, converting a double to a 64-bit unsigned integer is compiling into a runtime call to the "__fixunsdfdi" function. The compiler-rt library provides optimized implementations of this and other low-level routines.
All of the code in the compiler-rt project is dual licensed under the MIT license and the UIUC License (a BSD-like license).
Clients
Currently compiler-rt is primarily used by the Clang and LLVM projects as the implementation for the runtime compiler support libraries. The library currently provides both the low-level target-specific hooks required by code generation, as well as additional modules for supporting the runtime requirements of features like code coverage, profiling, or address sanitizer (ASAN) instrumentation.
For more information on using compiler-rt with Clang, please see the Clang Getting Started page.
Goals
Different targets require different routines. The compiler-rt project aims to implement these routines in both target-independent C form as well as providing heavily optimized assembly versions of the routines in some cases. It should be very easy to bring compiler-rt to support a new target by adding the new routines needed by that target.
Where it make sense, the compiler-rt project aims to implement interfaces that are drop-in compatible with the libgcc interfaces.
Features
The current feature set of compiler-rt is:
- Full support for the libgcc interfaces on supported targets.
- High performance hand tuned implementations of commonly used functions like __floatundidf in assembly that are dramatically faster than the libgcc implementations.
- A target-independent implementation of the Apple "Blocks" runtime interfaces.
Platform Support
Compiler-RT is known to work on the following platforms:
- i386
- X86-64
- SPARC64
- ARM
- PowerPC
- PowerPC 64
OS | Arch |
---|---|
AuroraUX | All |
DragonFlyBSD | All |
FreeBSD | All |
NetBSD | All |
Linux | All |
Darwin | All |
Source Structure
A short explanation of the directory structure of compiler-rt:
For testing it is possible to build a generic library and an optimized library. The optimized library is formed by overlaying the optimized versions onto the generic library. Of course, some architectures have additional functions, so the optimized library may have functions not found in the generic version.
- lib/ Is a generic portable implementations.
- lib/(arch) has optimized version for the supported architectures.
Get it and get involved!
To check out the code, use:
- svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
- mkdir build
- cd build
- cmake ../compiler-rt
- make
To run the Compiler-RT Test Suit (recommended):
- ctest
To Install:
- make install
compiler-rt doesn't have its own mailing list, if you have questions please email the llvmdev mailing list. Commits to the compiler-rt SVN module are automatically sent to the llvm-commits mailing list.