Thanks for all the hints Jakob, I've added the following piece of code after the spill code handling inside selectOrSplit() (ignoring some control logic):<br><br> for (LiveIntervals::const_iterator I = LIS->begin(), E = LIS->end(); I != E;<br>
++I)<br> {<br> unsigned VirtReg = I->first;<br> if ((TargetRegisterInfo::isVirtualRegister(VirtReg))<br> && (VRM->getPhys(VirtReg) == REG_Y))<br> {<br> LiveInterval &LI = LIS->getInterval(VirtReg);<br>
unassign(LI, REG_Y);<br> enqueue(&LI);<br> }<br> }<br>RegClassInfo.runOnMachineFunction(VRM->getMachineFunction()); // update reserve reglist<br><br>So similar to what's done in LRE_WillShrinkVirtReg(), it searches for live intervals where REG_Y is allocated and evicts them for reallocation. I don't know if there's a faster way of doing this but it's working :)<br>
About your first question: the register has to be reserved throughout the whole function.<br><br>Thanks for the help<br>