We are currently in the process of converting the website to the new design. Some pages, like this one, are still broken. We appreciate your patience.
1 posts
Custom Backend
Hi there,

I stumbled upon Odin earlier this week and watched some of the videos.

Kudos on the great work so far.

You mention getting rid of LLVM and using a custom backend eventually, and just wanted to mention a backend called QBE (Quarrelsome Backend) that I stumbled upon not too long ago.

From the creator:

QBE aims to be a pure C embeddable backend that provides 70% of the performance of advanced compilers in 10% of the code. Its small size serves both its aspirations of correctness and our ability to understand, fix, and improve it. It also serves its users by providing trivial integration and great flexibility.

Some features:

  • Very good compatibility with C code.
  • IEEE floating points support.
  • SSA-based intermediate language.
  • Copy elimination.
  • Sparse conditional constant propagation.
  • Dead instructions elimination.
  • Registerization of small stack slots.
  • Split spiller and register allocator thanks to SSA form. (Simpler and faster than graph coloring.)
  • Smart spilling heuristic based on loop analysis.
  • Linear register allocator with hinting.
  • Recognizes and uses x64 addressing modes.
  • Uniform and simple IL syntax.

I'm just learning about compiler construction so some of these bullets don't mean much to me right now, but maybe they do to you.

The website: https://c9x.me/compile/

And comparison of QBE with LLVM: https://c9x.me/compile/doc/llvm.html

Best of luck!

Ginger Bill
222 posts / 3 projects
I am ginger thus have no soul.
Custom Backend
Welcome to the forums, Cloutiy.

I have considered QBE, however my biggest complaint with it is the lack of Windows support. Otherwise, I think I would give it a go.

I am currently making a custom SSA backend as I also want the ability to interpret that intermediate language for the metaprogramming stage. With that requirement in mind, there doesn't seem to be any available option that I can find.

A custom backend does have the advantage that it understands the type system of the language and allowing for things that are specific for this language: e.g. such as reserving a register for a particular use, continuous copying stack frames, etc.

Thank you for your interest in Odin,