Back to browse
GitHub Repository

An LLVM backend implementation targeting the Zilog Z80 processor

38 starsC++

LLVM-Z80 - I wrote a complete LLVM backend with AI

by zlfn·Mar 15, 2026·1 point·0 comments

AI Analysis

●●●BangerWizardryBig BrainNiche Gem

Complete LLVM backend for Z80 outperforms SDCC, unlocks Rust on Game Boy.

Strengths
  • GlobalISel pipeline with IEEE 754 floating-point on 8-bit target
  • Compiles Rust core library, enabling systems programming on retro hardware
  • Dual toolchain path supports both ELF and SDCC linking workflows
Weaknesses
  • Experimental status with latent bugs limits production deployment
  • Binary sizes exceed SDCC output despite performance gains
Target Audience

Retro developers, compiler engineers, Game Boy hobbyists

Similar To

SDCC · LLVM-CBE · gbdk

Post Description

Two years ago, I started a project called Rust-GB to compile Rust for the Game Boy.

At the time, no stable LLVM backend supported the Game Boy’s CPU.

I had to use a complex workaround: transpiling Rust to C via LLVM-CBE and then compiling that C code using SDCC.

Back then, building a native LLVM backend was a dream, but I lacked the time to do it alone.

Fast forward two years, and things have changed.

With the help of LLMs, I have successfully implemented a complete LLVM-Z80 backend, including subtarget support for the Game Boy's SM83.

In terms of performance, it generally outperforms SDCC, though it currently produces larger binary sizes.

While there are still some latent bugs and upstream LLVM core issues to address, I’ve successfully compiled most C programs and the entire Rust core library.

I’d love to hear your feedback or any questions regarding the backend!

- LLVM-Z80: https://github.com/llvm-z80/llvm-z80 / Rust-Z80: https://github.com/llvm-z80/rust-z80

Similar Projects

Open Source●●Solid

PowerBasilisk: Open x64 PowerBASIC in Rust generates LLVM

Turning an old PowerBASIC toolchain into plain-text LLVM IR is a clever, low-friction modernization strategy — the frontend avoids LLVM bindings entirely and emits readable IR you can inspect before invoking clang. Including a Rust-based interpreter (pbinterp) for unit testing and choosing to wrap rather than rewrite a massive codebase like Wall Street Raider shows practical engineering judgment and real technical muscle.

WizardryNiche Gem
benstopics
353mo ago