Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Register renaming
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Data hazards == {{main|Data hazard}} When more than one instruction references a particular location as an operand, either by reading it (as an input) or by writing to it (as an output), executing those instructions in an order different from the original program order can lead to three kinds of data hazards: ; Read-after-write (RAW) : a read from a register or memory location must return the value placed there by the last write in program order, not some other write. This is referred to as a ''true dependency'' or ''flow dependency'', and requires the instructions to execute in program order. ; Write-after-write (WAW) : successive writes to a particular register or memory location must leave that location containing the result of the second write. This can be resolved by ''squashing'' (also known as cancelling, annulling, or mooting) the first write if necessary. WAW dependencies are also known as ''output dependencies''. ; Write-after-read (WAR) : a read from a register or memory location must return the last prior value written to that location, and not one written programmatically after the read. This is a sort of ''false dependency'' that can be resolved by renaming. WAR dependencies are also known as ''anti-dependencies''. Instead of delaying the write until all reads are completed, two copies of the location can be maintained, the old value and the new value. Reads that precede, in program order, the write of the new value can be provided with the old value, even while other reads that follow the write are provided with the new value. The false dependency is broken and additional opportunities for out-of-order execution are created. When all reads that need the old value have been satisfied, it can be discarded. This is the essential concept behind register renaming. Anything that is read and written can be renamed. While the general-purpose and floating-point registers are discussed the most, flag and status registers or even individual status bits are commonly renamed as well. Memory locations can also be renamed, although it is not commonly done to the extent practiced in register renaming. The [[Transmeta Crusoe]] processor's gated store buffer is a form of memory renaming. If programs refrained from reusing registers immediately, there would be no need for register renaming. Some instruction sets (e.g., [[IA-64]]) specify very large numbers of registers for specifically this reason. However, there are limitations to this approach: * It is very difficult for the compiler to avoid reusing registers without large code size increases. In loops, for instance, successive iterations would have to use different registers, which requires replicating the code in a process called [[loop unrolling]], or utilising [[self-modifying code]] to change the operand targets in each iteration. * Large numbers of registers require more bits for specifying a register as an operand in an instruction, resulting in increased code size. * Many instruction sets historically specified smaller numbers of registers and cannot be changed while still retaining backwards compatibility. Code size increases are important because when the program code is larger, the instruction cache misses more often and the processor stalls waiting for new instructions.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)