Beginner Compilers & Programming Language Theory
Q11 / 100

What is register allocation in code generation?

Correct! Well done.

Incorrect.

The correct answer is B) Assigning program variables to a limited set of CPU registers, spilling to memory when registers are exhausted

B

Correct Answer

Assigning program variables to a limited set of CPU registers, spilling to memory when registers are exhausted

Explanation

Register allocation: choose which variables live in registers (fast) vs. memory (slow). Graph coloring-based allocation: interference graph colors = registers. Spilling: variable that doesn't fit goes to stack.

Progress
11/100