[llvm-commits] [llvm] r107847 - in /llvm/trunk: include/llvm/CodeGen/RegisterScavenging.h lib/CodeGen/PrologEpilogInserter.cpp lib/CodeGen/RegisterScavenging.cpp

Jim Grosbach grosbach at apple.com
Thu Jul 8 09:10:53 PDT 2010


On Jul 8, 2010, at 9:03 AM, Jakob Stoklund Olesen wrote:

> 
> On Jul 8, 2010, at 8:47 AM, Jim Grosbach wrote:
>>>> It's close, but not quite. scavengeRegister() will find the register of the indicated register class that's used furthest away. It considers all registers of the register class as candidates, however, not just the available ones. Essentially, it's almost assuming that a spill will be required, but does have an early exit if for some reason it's called and finds a register that is available. That could just as easily be an assert, really.
>>>> 
>>>> Previously, we looked for an available register, taking the first one we noticed if one or more exists; otherwise, we called scavengeRegister() to find a reasonable choice to spill and free up a register to use. Now, we apply the same heuristic for "reasonable to use" to selecting amongst the available registers, not just when spilling.
>>> 
>>> Does it make sense to move the code into RS?
>> 
>> I think so, yes. I've been pondering whether it makes more sense to add a new method or to modify scavengeRegister() such that it'll incorporate this use-case directly. I'm leaning towards the latter, since as Jakob correctly points out, they're so similar already.
> 
> It should be as simple as:
> 
> if ((Candidates & RegsAvailable).any())
>  Candidates &= RegsAvailable:
> 
> in the right place.
> 
> 

Well, almost. scavengeRegister() still needs to handle the fall-back of considering all registers, not just the available ones. In any case, I do think that's the way to go, so I'll take care of it in a few.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20100708/a5cb6811/attachment.html>


More information about the llvm-commits mailing list