Abstract :
This paper presents tree register allocation, which maps the lifetimes of the variables in a program into a set of trees, colors each tree in a greedy style, which is optimal when there is no spilling, and connects dataflow between and within the trees afterward. This approach generalizes and subsumes as special cases SSA-based, linear scan, and local register allocation. It keeps their simplicity and low throughput cost, and exposes a wide solution space beyond them. Its flexibility enables control flow structure and/or profile information to be better reflected in the trees. This approach has been prototyped in the Phoenix production compiler framework. Preliminary experiments suggest this is a promising direction with great potential. Register allocation based on two special kinds of trees, extended basic blocks and the maximal spanning tree, are found to be competitive alternatives to SSA-based register allocation, and they all tend to generate better code than linear scan.
Keywords :
optimising compilers; trees (mathematics); Phoenix production compiler; SSA-based register allocation; flow structure; maximal spanning tree; tree register allocation; Computer languages; Costs; Interference; Optimizing compilers; Permission; Production; Prototypes; Registers; Throughput; Tree graphs; Chordal Graph; Register Allocation;