TCC has a number of features that differentiate it from other current C compilers:
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. 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).4
TCC performs 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.
Here are two benchmark examples:
The results were: Running cc1 (the GCC C compiler) on itself required 518 seconds when compiled using GCC 3.4.2, 545 seconds using Microsoft C compiler, and 1145 seconds using TCC. To create these compilers in the first place, GCC (3.4.2) took 744 seconds to compile the GCC compiler, whereas TCC took only 73 seconds. The level of optimization in each compiler was -O1 or similar.
TCC has its origins in the Obfuscated Tiny C Compiler (OTCC),15 a program Bellard wrote to win the International Obfuscated C Code Contest (IOCCC) in 2001. After that time, Bellard expanded and deobfuscated the program to produce tcc.16
At some time prior to 4 February 2012 Fabrice Bellard updated the project's official web page to report that he was no longer working on TCC.17
Since Bellard's departure from the project, various people and groups have distributed patches or maintained forks of TCC to build upon or fix issues with TCC. This includes Dave Dodge's collection of unofficial tcc patches,18 Debian and kfreebsd downstream patches,19 and grischka's gcc patches.20 Grischka also set up a public Git repository for the project21 that contains a mob branch22 where numerous contributions, including a shared build, cross-compilers, and SELinux compatibility were added. Grischka's GIT repository later became the official TCC repository (linked to by Fabrice Bellard's Savannah project page 23).
As of December 2017 both the official TCC mailing list24 and the official Git repository (as linked to by Fabrice Bellard's Savannah project page25) show active discussion and development by many developers and interested users. In December 2017, grischka announced on the mailing list that TCC version 0.9.27 was released.26
Tiny C Compiler Reference Documentation accessed on 2008-08-07 https://bellard.org/tcc/tcc-doc.html#SEC6 ↩
According to the project's TODO list complex types are the only missing C99 feature. Variable Length Arrays have been added in TCC 0.9.26 https://repo.or.cz/w/tinycc.git/blob/HEAD:/TODO ↩
"TCC : Tiny C Compiler". bellard.org. Retrieved 27 March 2023. https://bellard.org/tcc/ ↩
Glöckner, Daniel. Re: Tinycc-devel (no subject), 8 September 2006. https://lists.gnu.org/archive/html/tinycc-devel/2006-09/msg00028.html ↩
grischka, GCC by TCC (some fixes), 29 September 2005 https://lists.gnu.org/archive/html/tinycc-devel/2005-09/msg00054.html ↩
"TCCBOOT: TinyCC Boot Loader". bellard.org. Retrieved 27 March 2023. https://bellard.org/tcc/tccboot.html ↩
"tinycc-devel (thread)". lists.gnu.org. Retrieved 27 March 2023. https://lists.gnu.org/archive/html/tinycc-devel/2005-09/threads.html ↩
Wheeler, David A. Countering Trusting Trust through Diverse Double-Compiling. ACSAC. https://www.dwheeler.com/trusting-trust ↩
"Guix Further Reduces Bootstrap Seed to 25% — 2020 — Blog — GNU Guix". https://guix.gnu.org/en/blog/2020/guix-further-reduces-bootstrap-seed-to-25/ ↩
"Bootstrappable builds". bootstrappable.org. Retrieved 29 March 2023. https://bootstrappable.org/ ↩
"Cinpy". Archived from the original on 20 November 2008. Retrieved 27 March 2023. https://web.archive.org/web/20081120164629/http://www.cs.tut.fi/~ask/cinpy/ ↩
"JSLinux". bellard.org. Retrieved 27 March 2023. https://bellard.org/jslinux/ ↩
"Super Micro Chess". SourceForge. 18 April 2016. Retrieved 27 March 2023. https://sourceforge.net/projects/smmax/ ↩
"C compiler". Bun. Retrieved 22 November 2024. https://bun.sh/docs/api/cc ↩
Bellard, Fabrice. Obfuscated Tiny C Compiler, winning entry of IOCCC 2001. https://bellard.org/otcc/ and at the Internet Archive at https://web.archive.org/web/20130721162702/http://www.ioccc.org/2001/ https://bellard.org/otcc/ ↩
"TCC : Tiny C Compiler". 4 February 2012. Archived from the original on 4 February 2012. Retrieved 27 March 2023. https://web.archive.org/web/20120204081201/http://bellard.org/tcc/ ↩
"Unofficial tcc Patches". www.dododge.net. Archived from the original on 31 March 2007. Retrieved 27 March 2023. https://web.archive.org/web/20070331221112/http://www.dododge.net/tcc/patches.html ↩
"Debian -- Details of package tcc in sid". packages.debian.org. Retrieved 27 March 2023. https://packages.debian.org/unstable/devel/tcc ↩
grischka, Public Git Hosting for tcc https://repo.or.cz/w/tinycc.git ↩
grischka, mob branch for tcc https://repo.or.cz/w/tinycc.git/shortlog/refs/heads/mob ↩
"Tiny C Compiler - Summary [Savannah]". savannah.nongnu.org. Retrieved 27 March 2023. https://savannah.nongnu.org/projects/tinycc ↩
"tinycc-devel Archives". lists.gnu.org. Retrieved 27 March 2023. https://lists.gnu.org/archive/html/tinycc-devel/ ↩
"Public Git Hosting - tinycc.git/summary". repo.or.cz. Retrieved 27 March 2023. https://repo.or.cz/w/tinycc.git/ ↩
"[Tinycc-devel] TCC version 0.9.27 is out". lists.nongnu.org. Retrieved 27 March 2023. https://lists.nongnu.org/archive/html/tinycc-devel/2017-12/msg00015.html ↩