Recall & Review
beginner
What is register allocation in compiler design?
Register allocation is the process of assigning a large number of target program variables onto a small number of CPU registers to optimize performance.
Click to reveal answer
beginner
Why is register allocation important?
Because CPU registers are faster than memory, allocating variables to registers speeds up program execution by reducing slow memory access.
Click to reveal answer
intermediate
What is the difference between register allocation and register assignment?
Register allocation decides which variables go into registers, while register assignment decides exactly which register each variable uses.
Click to reveal answer
intermediate
What happens if there are more variables than available registers?
Some variables are stored in memory instead of registers, a process called spilling, which can slow down the program.
Click to reveal answer
advanced
Name a common technique used for register allocation.
Graph coloring is a common technique where variables are nodes, edges show conflicts, and colors represent registers to avoid conflicts.
Click to reveal answer
What is the main goal of register allocation?
✗ Incorrect
Register allocation aims to assign variables to the limited CPU registers to improve speed.
What is spilling in register allocation?
✗ Incorrect
Spilling means storing variables in memory because there are not enough registers.
Which technique is commonly used for register allocation?
✗ Incorrect
Graph coloring helps assign registers without conflicts by modeling variables as nodes.
Register assignment is:
✗ Incorrect
Register assignment picks the specific register for each variable after allocation.
Why are CPU registers preferred over memory for variable storage?
✗ Incorrect
Registers are very fast and located inside the CPU, making access quicker than memory.
Explain in your own words what register allocation is and why it matters in program execution.
Think about how using CPU registers instead of memory affects speed.
You got /4 concepts.
Describe what happens when there are more variables than registers available and how the compiler handles this.
Consider what the compiler does when registers run out.
You got /4 concepts.