This paper presents a fast new algorithm for modeling and reasoning about interferences for variables in a program without constructing an interference graph. It then describes how to use this information to minimize copy insertion for &fgr;-node instantiation during the conversion of the static single assignment (SSA) form into the control-flow graph (CFG), effectively yielding a new, very fast copy coalescing and live-range identification algorithm.This paper proves some properties of the SSA form that enable construction of data structures to compute interference information for variables that are considered for folding. The asymptotic complexity of our SSA-to-CFG conversion algorithm is where-is the number of instructions in the program.Performing copy folding during the SSA-to-CFG conversion eliminates the need for a separate coalescing phase while simplifying the intermediate code. This may make graph-coloring register allocation more practical in just in time (JIT) and other time-critical compilers For example, Sun's Hotspot Server Compiler already employs a graph-coloring register allocator[10].This paper also presents an improvement to the classical interference-graph based coalescing optimization that shows adecrease in memory usage of up to three orders of magnitude and a decrease of a factor of two in compilation time, while providing the exact same results.We present experimental results that demonstrate that our algorithm is almost as precise (within one percent on average) as the improved interference-graph-based coalescing algorithm, while requiring three times less compilation time.
[1]
Robert E. Tarjan.
Testing flow graph reducibility
,
1973,
STOC '73.
[2]
Sun Microsystems.
The Java HotSpot TM Virtual Machine Technical White Paper
,
.
[3]
Zoran Budimlic,et al.
Compiling java for high performance and the internet
,
2001
.
[4]
John Cocke,et al.
Register Allocation Via Coloring
,
1981,
Comput. Lang..
[5]
Keith D. Cooper,et al.
How to build an interference graph
,
1998
.
[6]
Keith D. Cooper,et al.
Practical improvements to the construction and destruction of static single assignment form
,
1998,
Softw. Pract. Exp..
[7]
Timothy J. Harvey,et al.
Practical improvements to the construction and destruction of static single assignment form
,
1998
.
[8]
Mark N. Wegman,et al.
Efficiently computing static single assignment form and the control dependence graph
,
1991,
TOPL.
[9]
Preston Briggs,et al.
Register allocation via graph coloring
,
1992
.
[10]
John Cocke,et al.
A methodology for the real world
,
1981
.
[11]
Gregory J. Chaitin,et al.
Register allocation and spilling via graph coloring
,
2004,
SIGP.
[12]
Michael A. Malcolm,et al.
Computer methods for mathematical computations
,
1977
.