Register Spilling and Live-Range Splitting for SSA-Form Programs

  • Authors:
  • Matthias Braun;Sebastian Hack

  • Affiliations:
  • Institut für Programmstrukturen und Datenorganisation, Universität Karlsruhe (TH),;Computer Science Department, Saarland University,

  • Venue:
  • CC '09 Proceedings of the 18th International Conference on Compiler Construction: Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2009
  • Year:
  • 2009

Quantified Score

Hi-index 0.00

Visualization

Abstract

Register allocation decides which parts of a variable's live range are held in registers and which in memory. The compiler inserts spill code to move the values of variables between registers and memory. Since fetching data from memory is much slower than reading directly from a register, careful spill code insertion is critical for the performance of the compiled program. In this paper, we present a spilling algorithm for programs in SSA form. Our algorithm generalizes the well-known furthest-first algorithm, which is known to work well on straight-line code, to control-flow graphs. We evaluate our technique by counting the executed spilling instructions in the CINT2000 benchmark on an x86 machine. The number of executed load (store) instructions was reduced by 54.5% (61.5%) compared to a state-of-the-art linear scan allocator and reduced by 58.2% (41.9%) compared to a standard graph-coloring allocator. The runtime of our algorithm is competitive with standard linear-scan allocators.