Skip to Main Content
We aim at minimizing the spill costs. Spill cost minimization heuristics that have been researched sometimes work in unexpected ways due to the lack of precise knowledge of registers availability, which can be obtained only after register allocation is all finished. Different from previous techniques, our approach, called spill code motion, tries to eliminate redundancy among spill code. This works as a variation of commonly used code motion techniques. After Chaitin-style graph coloring with naive live range splitting, spill-in instructions are first hoisted as long as registers are available and until they reach spill-out instructions. Unnecessarily hoisted spill-in instructions are then sunk. The experimental results show our approach yields up to a 10% performance increase compared to the latest spill code minimization technique in the case of using small number of registers.