Section: New Results
Optimized Coalescing for Out-of-ssa Conversion
The ssa form (Static Single Assignment) is an intermediate representation in which multiplexers (called functions) are used to merge values at a ``join'' point in the control graph. The ssa form has very interesting properties that make optimizations like partial redundancy elimination straightforward and efficient. Unfortunately, the ssa form is not machine code and functions have to be replaced, at the end of the process, by register-to-register copy instructions on control flow edges. In practice, naive methods for translating out of ssa generate many useless copies (live-range splitting) and additional goto instructions (edge splitting).
Adding copies roughly corresponds to split the live ranges of variables. The reverse transformation is called variable coalescing: coalescing different variables into a common representative variable constrains those variables to be allocated to the same register. Hence, coalescing constrains register allocation and splitting may relax it: in practice, the reduction of register-to-register copies is performed during the register allocation phase. However, we are convinced that coalescing should be performed during the out-of-ssa translation: many more copies can be removed this way with lower complexity; we can keep track of coalesced variables and un-coalesce them when necessary during the register allocator phase.
Coalescing during the out-of-ssa translation has been studied in different contexts. Rastello et al.  (PINNING ) studied the problem for programs represented as native machine instructions, including the use of machine dedicated registers: the heuristic is sophisticated and coalesces variables very aggressively without splitting edges. Budimlić et al.  (D-FOREST ) studied the problem in the context of just in time (JIT) compilers: their ``algorithm'' is very fast but requires edge splitting; also the coalescing is not very aggressive; finally, their work suffers from a lack of a clean formalization. These two heuristics use a common approach in the sense that they both perform a non-conservative coalescing followed by a repairing phase. Sreedhar et al.  (C ssa ) provided another interesting approach without the above constraints: it is a conservative approach in one pass with basic but efficient ideas that do not require edge splitting. The context of our work is the same as for D-FOREST . We have designed a linear heuristic and proved its correctness that aggressively coalesces without splitting edges. For that purpose, we generalized ideas used in all three approaches and developed a new formalization of the problem. Our solution remains to be implemented in the LAO code assembly optimizer from stm icroelectronics and compared with other possible approaches.
This work is part of the contract (see Section 7.2 ) with the cec team at stm icroelectronics.