Developer(s) | Fabrice Bellard |
---|---|
Stable release |
0.9.26 / February 15, 2013
|
Repository | repo |
Written in | C and Assembly |
Operating system | Linux, Unix, Windows |
Type | C compiler |
License | GNU Lesser General Public License |
Website | bellard |
The Tiny C Compiler (a.k.a. TCC, tCc, or TinyCC) is an x86 and ARM processor C compiler created by Fabrice Bellard. It is designed to work for slow computers with little disk space (e.g. on rescue disks). Windows operating system support was added in version 0.9.23 (17 Jun 2005). TCC is distributed under the GNU Lesser General Public License (LGPL).
TCC claims to implement all of ANSI C (C89/C90), much of the C99 ISO standard, and many GNU C extensions including inline assembly.
TCC has a number of features which differentiate it from other current C compilers:
Although the TCC compiler itself is exceptionally fast, there is an inherent trade off between this size of the compiler and the performance of the code which TCC produces.
TCC does perform a few optimizations, such as constant propagation for all operations, multiplications and divisions are optimized to shifts when appropriate, and comparison operators are specially optimized (by maintaining a special cache for the processor flags). It also does some simple register allocation, which prevents many extraneous save/load pairs inside a single statement.
But in general, TCC's implementation emphasizes smallness instead of optimally-performing results. TCC generates code in a single pass, and does not perform most of the optimizations performed by other compilers such as GCC. TCC compiles every statement on its own, and at the end of each statement register values are written back to the stack and must be re-read even if the next line uses the values in registers (creating extraneous save/load pairs between statements). TCC uses only some of the available registers (e.g., on x86 it never uses ebx, esi, or edi because they need to be preserved across function calls).