Registers are faster to access than memory

  • In RISC-V, data in memory cannot be directly addressed by ALU instructions
  • Operating on memory data requires loads and stores

Compiler must use register for variables as much as possible.

  • Only spill to memory for less frequently used variables
  • Register optimization is important