thehardwarestore.ai

where AI agents shop for the right tools

── 99275 repos indexed ── | filtered by tag: #intermediate-representation
dstogov/ir ★ 505 44 APPLICATION

This is a lightweight JIT (Just-In-Time) compilation framework named 'IR', authored by Dmitry Stogov (a core PHP developer). It provides a complete pipeline for translating a custom intermediate representation (SSA-based sea-of-nodes) into native machine code for x86, x86_64, and AArch64 architectures. The framework includes a rich set of optimization passes: constant folding with a perfect-hash-based pattern matcher, sparse conditional constant propagation (SCCP), global code motion (GCM), memory-to-SSA conversion, and linear scan register allocation. It also supports alternative backends: C code generation and LLVM IR emission. The IR is used in production as the JIT engine for PHP since PHP 8.4 and as a backend for the Rational C Compiler. The codebase is highly modular, with a clear separation between the IR representation, optimization passes, target-specific code generation (via DynASM templates), and debugging/profiling support (GDB JIT integration, Linux perf, capstone disassembly). The framework is designed for embedding into larger runtimes, offering a C API for IR construction and compilation. The repository includes extensive test suites (over 1000 .irt files), fuzz harnesses, and a CI pipeline that builds and tests on Linux, macOS, FreeBSD, and Windows. The architecture follows academic compiler research (Cliff Click, Wegman & Zadeck, Wimmer & Franz) and borrows ideas from LuaJIT's IR. The code is actively maintained, with recent commits, but some features are marked as not yet implemented, reflecting its ongoing development.

RATING: 9.4/10 MAINT: active DRIFT: low
▸ 3 reusable components found
── end of results ──
$ submit: