Lexicon Entry
Instruction Selection
The compiler backend phase that maps target-independent IR operations to actual machine instructions. LLVM uses SelectionDAG and GlobalISel for this stage.
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.
Compiler Code Generation: How LLVM Turns IR into x86-64 and ARM64 Assembly
Between the hardware-agnostic world of LLVM Intermediate Representation (IR) and the raw binary bytes your CPU executes lies the backend pipeline—the most platform-specific, meticulously engineered phase of the compiler. In our previous deep dive into LLVM IR, we explored how the compiler represents your logic using an infinite number of virtual registers and generic instructions.…
The Ultimate Guide to Compiler Optimization Passes: Boosting Performance with -O2
You’ve been there. You write a complex calculation in C, compile it, and it feels a bit sluggish. You open your `Makefile`, add `-O2` to your `CFLAGS`, recompile, and suddenly your program is executing three times faster. But what actually is the compiler doing under the hood? Is it magic? Is it just removing debug…
How a C Program Becomes Machine Code: The C Compilation Process Explained
Trace the complete C compilation process from source code to executable binary. See each stage — preprocessing, compilation, assembly, and linking — with real GCC and Clang output across x86-64 and ARM64.