5 questions to test your understanding
Two variables x and y both appear in the same function. Variable x holds the result of a computation that is only used at line 5, and y is first assigned at line 8. Can they safely share a register?
The graph coloring heuristic for register allocation works by repeatedly removing nodes with fewer than k neighbors. Why does this guarantee those nodes can always be colored at assignment time?
Spilling a variable that is used inside a deeply nested loop is more expensive than spilling a variable used once outside any loop.
Two variables that are seldom simultaneously live can still interfere and is expected to be given different registers if they are both used in the same basic block.
Why is live variable analysis a required prerequisite for register allocation, and what would go wrong if you tried to allocate registers without it?