How to create a C compiler for custom CPU?

Quick overview/tutorial on writing a LLVM backend.

This document describes techniques for writing backends for LLVM which convert the LLVM representation to machine assembly code or other languages.

[ . . . ]

To create a static compiler (one that emits text assembly), you need to implement the following:

  • Describe the register set.
  • Describe the instruction set.
  • Describe the target machine.
  • Implement the assembly printer for the architecture.
  • Implement an instruction selector for the architecture.

Leave a Comment