[LLVMdev] Trouble with virtual registers

Jakob Stoklund Olesen stoklund at 2pi.dk
Tue Jan 25 13:23:12 PST 2011


On Jan 25, 2011, at 3:09 AM, Per Fagrell wrote:

> I'm having trouble with virtual registers/register allocation in my back-end. Basically the FastRegAlloc pass is generating calls to storeToStackSlot and loadFromStackSlot, in which we build new machine instructions, which are then _not_ processed by the reg allocator. I understand that BuildMI is changing the list of MachInst. that the allocator is iterating over, but we need to have a new virtual register as part of the stack store process since we don't have indirect adressing. Should we be creating a physical register directly somehow, or can we perhaps signal to the allocator that the basic block's contents are updated? 

The fast allocator could be spilling because it has run out of registers, so that is a really bad time to be creating new virtual registers.

You have two options:

1. Reserve a scratch register for use in spill code, or

2. Emit a pseudo-instruction for the spill, and get a register from the register scavenger during eliminateFrameIndex().

Look at the Blackfin and ARM targets for how to use the register scavenger.

/jakob

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110125/e5160336/attachment.html>


More information about the llvm-dev mailing list