Question bank — Register renaming
This page is a misconception hunter. Every item below targets a place where students think they understand Register renaming but hold a subtly wrong picture. Read the prompt, say your answer out loud with a reason, then reveal. If your justification is different from the given one — even if your yes/no matches — you found a gap worth closing.
Before we start, four words we lean on constantly, restated in plain English so nothing is assumed:
- Architectural register — a name the programmer/compiler writes (like
R1). It is a label, not a storage box. - Physical register — an actual storage box in hardware (like
P0). This is where a number really lives. - RAT (Register Alias Table) — the little lookup table that says "right now, the label
R1means boxP2." Renaming is nothing more than editing this table as instructions decode. - ROB (Reorder Buffer) — a queue that remembers every instruction still "in flight" (decoded but not yet finalized), in program order. It stores each instruction's old register mapping so it can undo mistakes and finalize ("commit") results in the right order. Full detail lives in Reorder Buffer (ROB).
A picture of the three bookkeepers
Everything on this page comes down to three little structures passing physical boxes around. The figure below shows their jobs and how a box moves between them — glance at it before answering, and return to it whenever an item mentions the RAT, the free list, or the ROB.
Notice the arrows of ownership: a box leaves the free list when a destination is allocated (orange), the RAT points to it while it is the current value of a label (blue), the ROB holds the previous box until commit, and at commit the old box is pushed back to the free list (green). Every physical box is always in exactly one of these homes.
The R1 → P0 → P2 story, step by step
The single example the parent note keeps returning to is three instructions that all write R1. Watch which box the label R1 points to as we decode them — this one figure is the intuition behind half the reveals below.
The punchline: R1 the label is one thing, but over three instructions it means three different physical boxes (P10 → P0 → P2). The reader that needed the old R1 (the MUL) keeps reading P0; the later writer scribbles into P2. Different boxes, zero conflict — that is the whole trick.
When each thing happens
Several "ordering trap" items depend on when in an instruction's life the source-read, the rename, the execute, and the commit occur. The timeline below fixes that order once so you can reason about the traps.
Read it left to right: sources are read from the RAT and the destination renamed at decode (in program order), execution may happen out of order and much later, but the free of the old box waits all the way until commit (back in program order). Keep this strip in mind for every edge case.
True or false — justify
Register renaming removes RAW (true) dependencies too.
If two instructions write the same architectural register, one of the writes is wasted work the hardware could skip.
After renaming, the WAR hazard on R1 between MUL R4,R1,R5 and ADD R1,R6,R7 still physically exists, we just hide it.
P0 and the ADD writes a brand-new box P2 (see figure s02). Two distinct boxes cannot conflict — there is nothing left to hide.The RAT stores the values of registers.
A physical register can be freed the instant the instruction that wrote it finishes executing.
Renaming requires out-of-order execution to be useful.
With enough architectural registers, a smart compiler makes renaming unnecessary.
Every physical register is, at any instant, in exactly one of: the free list, mapped by the RAT, or held as an old mapping in the ROB.
Renaming changes the results a program computes.
Spot the error
"We read the sources from the free list to find their current values."
"At commit we push the new physical register back to the free list."
"Because P0 and P2 are different boxes, I2 (which reads P0) and I3 (which writes P2) have a RAW dependency."
"We allocate the destination box before reading the sources, so the destination is fresh."
R1 = R1 + R2), reading after updating would grab the wrong box."The minimum physical register count is just the ROB size."
"Register pressure means the physical register file is physically overheating."
"Renaming eliminates hazards, so the Reorder Buffer (ROB) is no longer needed for precise exceptions."
Why questions
Why do we record the old mapping in the ROB rather than just overwriting the RAT and forgetting it?
Why can't we free the old physical register at execute-time instead of commit-time?
Why does WAW block execution without renaming, even though only the last write "matters"?
Why is the RAT read and written for a single instruction?
Why do physical register counts tend to be powers of two (e.g. 256)?
Why does renaming help Superscalar Execution specifically?
Edge cases
Instruction R1 = R1 + R1 — same register as both sources and destination. What happens?
The free list is empty when a new instruction wants a destination box.
A register is written but never read again before the program ends.
An instruction is renamed but then a branch mispredict kills it before commit.
A load and store to the same memory address — does renaming resolve their ordering?
Two independent instructions both write different architectural registers — is any renaming interaction needed?
An instruction reads an architectural register that no earlier in-flight instruction has written.
Recall Fast self-test
The single most-missed idea on this page ::: ==Old boxes are freed at commit, not at execute==, because precise exceptions may still need the old value (timeline s03). The second most-missed idea ::: Sources are read from the RAT and destinations pulled from the free list — two different structures with two different jobs (figure s01).
Related deep material: Tomasulo's Algorithm (renaming via reservation stations), Scoreboarding (an earlier scheme that stalls on false hazards instead of renaming them away), and the parent Register renaming.