Registers have small storage for temporary results. They are memory locations directly connected to CPU.
How do they work?
Consider the following ARM Assembly code:
This adds r1
and r3
and stores results in r2
.
Who figures this out?
If we are writing assembly by hand we have to know which registers exist and what they are used for, and how to use them correctly. In higher-level languages like C it is the compiler’s job.