[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 10:23:13 PDT 2009


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

> Author: jdm
> Date: Thu Aug  6 11:32:47 2009
> New Revision: 78318
>
> URL: http://llvm.org/viewvc/llvm-project?rev=78318&view=rev
> Log:
> Reg Scavenging generalization (Thumb support):
> - start support for new PEI w/reg alloc, allow running RS from  
> emit{Pro,Epi}logue() target hooks.
> - fix minor issue with recursion detection.

I was just about to remove RegScavenger::backward(). Will you be  
needing it?

> void RegScavenger::enterBasicBlock(MachineBasicBlock *mbb) {
>   MachineFunction &MF = *mbb->getParent();
>   const TargetMachine &TM = MF.getTarget();
> @@ -94,6 +117,7 @@
>   assert((NumPhysRegs == 0 || NumPhysRegs == TRI->getNumRegs()) &&
>          "Target changed?");
>
> +  // Self-initialize.
>   if (!MBB) {
>     NumPhysRegs = TRI->getNumRegs();
>     RegsAvailable.resize(NumPhysRegs);
> @@ -104,29 +128,23 @@
>     // Create callee-saved registers bitvector.
>     CalleeSavedRegs.resize(NumPhysRegs);
>     const unsigned *CSRegs = TRI->getCalleeSavedRegs();
> -    if (CSRegs != NULL)
> -      for (unsigned i = 0; CSRegs[i]; ++i)
> -        CalleeSavedRegs.set(CSRegs[i]);
> -  }

Perhaps CalleeSavedRegs could be renamed to UsedCalleeSavedRegs or  
something along those lines? Just so it is clear it doesn't correspond  
to TRI->getCalleeSavedRegs().

> -    assert(isUsed(Reg) && "Using an undefined register!");
> +    // Allow free CSRs to be processed as uses.
> +    assert((isUsed(Reg) || !CalleeSavedRegs[Reg]) &&
> +           "Using an undefined register!");

Please check the assert condition - it doesn't do what the comment says.

Have you considered simply marking the free CSRs as used in  
initRegState? Then you wouldn't have to disable check for these  
registers.





More information about the llvm-commits mailing list