What Is Register Allocation?
Register allocation is the phase of code generation that assigns the many values a program uses to the small fixed set of CPU registers. When more values are live than there are registers, some are spilled to memory and reloaded later. Good allocation, often modeled as graph coloring, minimizes those costly spills.
Why it matters
Registers are far faster than memory, so how values are allocated directly shapes the speed of generated code. Excessive spilling is a common cause of slower-than-expected compiled output.
Related guides
What Is Instruction Scheduling?Instruction scheduling reorders machine instructions to keep the CPU pipeline busy and hide latencies, withou…
What Is Strength Reduction?Strength reduction replaces expensive operations with cheaper equivalent ones, such as turning a multiplicati…
What Is a Basic Block?A basic block is a straight-line sequence of instructions with one entry and one exit, used as the unit of an…