Combined code motion and register allocation using the value state dependence graph

  • Authors:
  • Neil Johnson;Alan Mycroft

  • Affiliations:
  • Computer Laboratory, University of Cambridge, Cambridge, UK;Computer Laboratory, University of Cambridge, Cambridge, UK

  • Venue:
  • CC'03 Proceedings of the 12th international conference on Compiler construction
  • Year:
  • 2003

Quantified Score

Hi-index 0.00

Visualization

Abstract

We define the Value State Dependence Graph (VSDG). The VSDG is a form of the Value Dependence Graph (VDG) extended by the addition of state dependence edges to model sequentialised computation. These express store dependencies and loop termination dependencies of the original program. We also exploit them to express the additional serialization inherent in producing final object code. The central idea is that this latter serialization can be done incrementally so that we have a class of algorithms which effectively interleave register allocation and code motion, thereby avoiding a well-known phase-order problem in compilers. This class operates by first normalizing the VSDG during construction, to remove all duplicated computation, and then repeatedly choosing between: (i) allocating a value to a register, (ii) spilling a value to memory, (iii) moving a loop-invariant computation within a loop to avoid register spillage, and (iv) statically duplicating a computation to avoid register spillage. We show that the classical two-phase approach (code motion then register allocation in both Chow and Chaitin forms) are examples of this class, and propose a new algorithm based on depth-first cuts of the VSDG.