SARA: combining stack allocation and register allocation

  • Authors:
  • V. Krishna Nandivada;Jens Palsberg

  • Affiliations:
  • UCLA University of California, Los Angeles;UCLA University of California, Los Angeles

  • Venue:
  • CC'06 Proceedings of the 15th international conference on Compiler Construction
  • Year:
  • 2006

Quantified Score

Hi-index 0.00

Visualization

Abstract

Commonly-used memory units enable a processor to load and store multiple registers in one instruction. We showed in 2003 how to extend gcc with a stack-location-allocation (SLA) phase that reduces memory traffic by rearranging the stack and replacing some load/store instructions with load/store-multiple instructions. While speeding up the target code, our technique leaves room for improvement because of the phase ordering of register allocation before SLA. In this paper we present SARA which combines SLA and register allocation into a single phase. SARA creates a synergy among register assignment, spill-code generation, and SLA that makes the combined phase generate faster code than a sequence of the individual phases. We specify SARA by an integer linear program generated from the program text. We have implemented SARA in gcc, replacing gcc's own implementation of register allocation. For our benchmarks, our results show that the target code is up to 16% faster than gcc with a separate SLA phase.