🌘 在 LLVM ORC 中使用 TPDE Codegen 後端
➤ 整合 TPDE 以加速 LLVM JIT 編譯流程
✤
https://weliveindetail.github.io/blog/post/2025/09/30/tpde-in-llvm-orc.html這篇文章深入探討如何在 LLVM 的 On-Request Compilation (ORC) 框架中整合 TPDE 編譯器後端,一個專為低延遲程式碼生成而設計的單一回合編譯器。作者逐步演示瞭如何修改 LLJITBuilder 以替換預設的編譯功能,並提供了一個名為 TPDECompiler 的 C++ 包裝類別。文中詳述了 TPDECompiler 的建構子和編譯函式的實作細節,包括如何處理目標三元組、使用 TPDE 的 `compile_to_elf` 方法,以及將編譯結果封裝成 LLVM 的 MemoryBuffer。此外,文章還討論了 LLJITBuilder 的一個潛在依賴問題,以及如何透過實作 LLVM Fallback 機制來處理 T
#LLVM #ORC #TPDE #編譯器後端 #JIT編譯
Using the TPDE Codegen Backend in LLVM ORC
TPDE is the perfect fit for a baseline JIT compiler, let's see how to wire it up in ORC JIT!
🤹♂️ Oh joy, yet another riveting tale of compiler backend wizardry 🤓—because who doesn't love integrating
#TPDE into custom
#Clang and
#Flang builds? 🛠️ So cozy up with your
#LLVM 19/20 manuals, because nothing says "wild Friday night" like low-latency JIT compilers! 🎉
https://weliveindetail.github.io/blog/post/2025/09/30/tpde-in-llvm-orc.html #compilerbackend #lowlatencyJIT #HackerNews #ngated
Using the TPDE Codegen Backend in LLVM ORC
TPDE is the perfect fit for a baseline JIT compiler, let's see how to wire it up in ORC JIT!

Using the TPDE Codegen Backend in LLVM ORC
TPDE is the perfect fit for a baseline JIT compiler, let's see how to wire it up in ORC JIT!
Drei Forscher von der TU München haben mit TPDE ein eigenes Compiler Back-End Framework vorgestellt, das deutlich schneller arbeiten soll als LLVM. Der Quellcode steht jetzt unter einer Open-Source-Lizenz auf GitHub.
#CompilerFramework #LLVM #TPDECompiler Back-End Framework TPDE arbeitet schneller als LLVM - LinuxCommunity
Compiler Back-End Framework TPDE arbeitet schneller als LLVM - LinuxCommunity
Drei Forscher von der TU München haben mit TPDE ein eigenes Compiler Back-End Framework vorgestellt, das deutlich schneller arbeiten soll als LLVM. Der Quellcode steht jetzt unter einer Open-Source-Lizenz auf GitHub. Ziel der Forscher war eine möglichst schnelle Übersetzung. Die dazu verwendeten Techniken erläutern die Forscher in einem entsprechenden Paper. Der zugehörige Quellcode steht unter einer Apache 2.0-Lizenz mit LLVM Ecxeption. Das eigentliche Compiler Framework enthält mit TPDE-LLVM ein Backend für LLVM-IR. Das wiederum soll bis zu 20-fach schneller compilieren als LLVM mit abgeschalteten Optimierungen (Option „-O0“). Die fertigen Programme bieten dabei eine ähnliche Ausführungsgeschwindigkeit wie die von LLVM erzeugten Fassungen. Als Beleg liefern die Forscher im LLVM Discourse-Forum mithilfe des Benchmarks SPEC CPU 2017 durchgeführte Messergebnisse. Nutzen lässt sich TPDE-LLVM als Bibliothek, via „tpde-llc“ als Tool oder dank entsprechender Patchtes direkt in Clang beziehungsweise Flang. Es gibt allerdings noch zwei Wermutstropfen: Zum einen kennt TPDE derzeit ausschließlich das Binärformat ELF für Systeme mit x86-64 und AArch64-Architektur, zum anderen unterstützt das Compiler Framework nur einen Teil der LLVM-IR.
LinuxCommunity
TPDE: A Fast Adaptable Compiler Back-End Framework
Fast machine code generation is especially important for fast start-up just-in-time compilation, where the compilation time is part of the end-to-end latency. However, widely used compiler frameworks like LLVM do not prioritize fast compilation and require an extra IR translation step increasing latency even further; and rolling a custom code generator is a substantial engineering effort, especially when targeting multiple architectures.
Therefore, in this paper, we present TPDE, a compiler back-end framework that adapts to existing code representations in SSA form. Using an IR-specific adapter providing canonical access to IR data structures and a specification of the IR semantics, the framework performs one analysis pass and then performs the compilation in just a single pass, combining instruction selection, register allocation, and instruction encoding. The generated target instructions are primarily derived code written in high-level language through LLVM's Machine IR, easing portability to different architectures while enabling optimizations during code generation.
To show the generality of our framework, we build a new back-end for LLVM from scratch targeting x86-64 and AArch64. Performance results on SPECint 2017 show that we can compile LLVM-IR 8--24x faster than LLVM -O0 while being on-par in terms of run-time performance. We also demonstrate the benefits of adapting to domain-specific IRs in JIT contexts, particularly WebAssembly and database query compilation, where avoiding the extra IR translation further reduces compilation latency.
arXiv.org