Lexicon Entry
Code Generation
Code generation is the final phase of compilation where an intermediate representation (like LLVM IR) is translated into the specific machine code or assembly language for a target architecture.
Related Knowledge & Cross-References
Write a Compiler from Scratch in C: Build a Working Toy Compiler
Learn how to write a compiler from scratch in C. Build a complete toy compiler with a hand-written lexer, recursive descent parser, and code generator targeting x86-64 and ARM64 assembly.
Register Allocation in Compilers: How Variables Fit into CPU Registers
Discover how compilers solve register allocation — mapping thousands of virtual registers to 16 (x86-64) or 31 (ARM64) physical ones. See graph coloring, spilling, and rematerialization with real Godbolt examples.
Compiler Code Generation: How LLVM Turns IR into x86-64 and ARM64 Assembly
Between the hardware-agnostic world of Intermediate Representation and the raw binary bytes your CPU executes lies the backend pipeline. Learn how the compiler turns abstract logic into platform-specific machine code.