[LLVMdev] Register allocation in two passes
Borja Ferrer
borja.ferav at gmail.com
Wed Nov 30 12:17:24 PST 2011
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):
for (LiveIntervals::const_iterator I = LIS->begin(), E = LIS->end(); I !=
E;
++I)
{
unsigned VirtReg = I->first;
if ((TargetRegisterInfo::isVirtualRegister(VirtReg))
&& (VRM->getPhys(VirtReg) == REG_Y))
{
LiveInterval &LI = LIS->getInterval(VirtReg);
unassign(LI, REG_Y);
enqueue(&LI);
}
}
RegClassInfo.runOnMachineFunction(VRM->getMachineFunction()); // update
reserve reglist
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 :)
About your first question: the register has to be reserved throughout the
whole function.
Thanks for the help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111130/e510ab4e/attachment.html>
More information about the llvm-dev
mailing list