<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jan 25, 2011, at 3:09 AM, Per Fagrell wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">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? <br></blockquote><div><br></div><div>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.</div><div><br></div><div>You have two options:</div><div><br></div><div>1. Reserve a scratch register for use in spill code, or</div><div><br></div><div>2. Emit a pseudo-instruction for the spill, and get a register from the register scavenger during eliminateFrameIndex().</div><div><br></div><div>Look at the Blackfin and ARM targets for how to use the register scavenger.</div><div><br></div><div>/jakob</div><div><br></div></div></body></html>