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

Jakob Stoklund Olesen stoklund at 2pi.dk
Thu Aug 6 13:41:21 PDT 2009


On 06/08/2009, at 21.44, John Mosby wrote:

> Hey Jakob,
>
> Thanks for the reviews:
>
> >>I was just about to remove RegScavenger::backward(). Will you be
> >>needing it?
>
> No, go ahead and kill it (if nobody else needs it).

OK, thanks.

> >>Perhaps CalleeSavedRegs could be renamed to UsedCalleeSavedRegs or
> >>something along those lines? Just so it is clear it doesn't  
> correspond
> >>to TRI->getCalleeSavedRegs().
>
> I just used what was there. You're right, UsedCalleeSavedRegs is  
> what I it should be. I'll change the name.
>
> >>Please check the assert condition - it doesn't do what the comment  
> says.
>
> Thanks, I'll fix it.
>
> >>Have you considered simply marking the free CSRs as used in
> >>initRegState? Then you wouldn't have to disable check for these  
> registers.
>
> If a CSR isn't used in a function, it doesn't need to be spilled on  
> entry/restored on return, so it should be usable by RS, hence must  
> not be taken out of RegsAvailable. Perhaps I'm not following you  
> here(?)

The RS can get you a register in two ways:

1. FindUnusedReg() tries to find a register that is currently not  
being used, and so can be used _for free_.
2. scavengeRegister() will create a free register by saving it to the  
emergency spill slot.

FindUnusedReg() must not return a CSR that has not been spilled yet -  
it won't be spilled at all if that happens. It will simply be clobbered.

scavengeRegister() is free to use any CSR because it will save it first.

/jakob





More information about the llvm-commits mailing list