Researchers from the Technical University of Munich have published the TPDE toolkit and its LLVM-based backend, TPDE-LLVM, which generates machine code for x86-64 and AArch64 architectures based on the LLVM-IR intermediate representation. During testing, TPDE-LLVM proved to be 10-20 times faster than the LLVM -O0 backend (code generator without optimizations) while maintaining the same level of performance for the resulting machine code, with an increase in size of 10-30%. The project developments are released under the Apache 2.0 license.
TPDE-LLVM is initially aimed at providing compilation with minimal latency and a quality level corresponding to the unoptimized build mode ("-O0"). The project offers a utility for standalone execution of tpde-llc, a library for integration into applications (e.g., to implement JIT compiler functionality), and patches for integration with Clang and Flang.

The project can be used as a basic compiling component for JIT or for creating unoptimized builds. TPDE-LLVM is focused solely on compilation speed and does not attempt to compete with the optimizing backends of LLVM, which operate significantly slower than TPDE-LLVM but allow for generating faster and more compact machine code (approximately twice as fast and half the size).
TPDE-LLVM employs three stages for code generation:
- Cleaning and preparing the LLVM intermediate representation;
- Analyzing information about loops and variable usage;
- Generating machine code.

It is noted that optimizations added by the TPDE authors to LLVM branches 19 and 20 have already improved the stock LLVM backend's performance by 18% on the x86-64 platform and by 13% on the ARM64 platform. According to the TPDE authors, in the future, it may be possible to accelerate the LLVM backend by another 10-20% with minor effort, but further performance improvements will require significant changes. Even with substantial reworking, it is unlikely that the existing LLVM backend can be made ten times faster.
At the current stage of development, the goals of the TPDE project include providing support for the LLVM intermediate representation generated by the Clang frontend in the optimization modes of '-O0' and '-O1'. Support for processing the intermediate representation created in '-O2' mode is not yet guaranteed due to the lack of vector operation support in TPDE. Partial support for intermediate code from Flang and the Rust compiler is available.
Source: opennet.ru
