[llvm-commits] [llvm] r47870 - in /llvm/trunk/lib/CodeGen: MachineInstr.cpp PrologEpilogInserter.cpp

Evan Cheng evan.cheng at apple.com
Mon Mar 3 16:39:46 PST 2008


On Mar 3, 2008, at 3:57 PM, Bill Wendling wrote:

>
> +
> +      if (RegInfo->isSubRegister(IncomingReg, Reg) && MO.isKill()) {
> +	if (MO.isImplicit()) {
> +	  // Remove this implicit use that marks the sub-register
> +	  // "kill". Let the super-register take care of this
> +	  // information.
> +	  RemoveOperand(i);
> +	  e = getNumOperands();

--e is sufficient.

Evan

>
> +	  continue;
> +	} else {
> +	  // The super-register is going to take care of this kill
> +	  // information.
> +	  MO.setIsKill(false);
> +        }
>       }
>     }
> +
> +    ++i;
>   }
>
>   // If the register already exists, then make sure it or its super- 
> register is
> @@ -725,13 +728,14 @@
>       if (Reg == IncomingReg) {
>         MO.setIsKill();
>         return true;
> -      } else if (TargetRegisterInfo::isPhysicalRegister(Reg) &&
> -                  
> TargetRegisterInfo::isPhysicalRegister(IncomingReg) &&
> -                 RegInfo->isSuperRegister(IncomingReg, Reg) &&
> -                 MO.isKill()) {
> +      }
> +
> +      if (TargetRegisterInfo::isPhysicalRegister(Reg) &&
> +	  TargetRegisterInfo::isPhysicalRegister(IncomingReg) &&
> +	  RegInfo->isSuperRegister(IncomingReg, Reg) &&
> +	  MO.isKill())
>         // A super-register kill already exists.
>         return true;
> -      }
>     }
>   }
>
>
> Modified: llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp?rev=47870&r1=47869&r2=47870&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp (original)
> +++ llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Mon Mar  3  
> 17:57:28 2008
> @@ -517,53 +517,63 @@
>     for (MachineBasicBlock::iterator I = BB->begin(); I != BB- 
> >end(); ) {
>       MachineInstr *MI = I;
>
> -      if (I->getOpcode() == FrameSetupOpcode ||
> -          I->getOpcode() == FrameDestroyOpcode) {
> -        // Remember how much SP has been adjustment to create the  
> call frame.
> -        int Size = I->getOperand(0).getImm();
> -        if ((!StackGrowsDown && I->getOpcode() == FrameSetupOpcode)  
> ||
> -            (StackGrowsDown && I->getOpcode() == FrameDestroyOpcode))
> -          Size = -Size;
> -        SPAdj += Size;
> -        MachineBasicBlock::iterator PrevI = prior(I);
> -        TRI.eliminateCallFramePseudoInstr(Fn, *BB, I);
> -        // Visit the instructions created by  
> eliminateCallFramePseudoInstr().
> -        I = next(PrevI);
> -        MI = NULL;
> -      } else if (I->getOpcode() == TargetInstrInfo::DECLARE) {
> +      if (I->getOpcode() == TargetInstrInfo::DECLARE) {
>         // Ignore it.
>         ++I;
> -      } else {
> -        bool DoIncr = true;
> -
> -        for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i)
> -          if (MI->getOperand(i).isFrameIndex()) {
> -            // Some instructions (e.g. inline asm instructions) can  
> have
> -            // multiple frame indices and/or cause  
> eliminateFrameIndex to insert
> -            // more than one instruction. We need the register  
> scavenger to go
> -            // through all of these instructions so that it can  
> update its
> -            // register information. We keep the iterator at the  
> point before
> -            // insertion so that we can revisit them in full.
> -            bool AtBeginning = (I == BB->begin());
> -            if (!AtBeginning) --I;
> -
> -            // If this instruction has a FrameIndex operand, we  
> need to use that
> -            // target machine register info object to eliminate it.
> -            TRI.eliminateFrameIndex(MI, SPAdj, RS);
> -
> -            // Reset the iterator if we were at the beginning of  
> the BB.
> -            if (AtBeginning) {
> -              I = BB->begin();
> -              DoIncr = false;
> -            }
> -
> -            MI = 0;
> -            break;
> -          }
> +	continue;
> +      }
>
> -        if (DoIncr) ++I;
> +      if (I->getOpcode() == FrameSetupOpcode ||
> +          I->getOpcode() == FrameDestroyOpcode) {
> +        // Remember how much SP has been adjusted to create the call
> +        // frame.
> +	int Size = I->getOperand(0).getImm();
> +
> +	if ((!StackGrowsDown && I->getOpcode() == FrameSetupOpcode) ||
> +	    (StackGrowsDown && I->getOpcode() == FrameDestroyOpcode))
> +	  Size = -Size;
> +
> +	SPAdj += Size;
> +
> +	MachineBasicBlock::iterator PrevI = prior(I);
> +	TRI.eliminateCallFramePseudoInstr(Fn, *BB, I);
> +
> +	// Visit the instructions created by  
> eliminateCallFramePseudoInstr().
> +	I = next(PrevI);
> +	continue;
>       }
>
> +      bool DoIncr = true;
> +
> +      for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i)
> +	if (MI->getOperand(i).isFrameIndex()) {
> +	  // Some instructions (e.g. inline asm instructions) can have
> +	  // multiple frame indices and/or cause eliminateFrameIndex
> +	  // to insert more than one instruction. We need the register
> +	  // scavenger to go through all of these instructions so that
> +	  // it can update its register information. We keep the
> +	  // iterator at the point before insertion so that we can
> +	  // revisit them in full.
> +	  bool AtBeginning = (I == BB->begin());
> +	  if (!AtBeginning) --I;
> +
> +	  // If this instruction has a FrameIndex operand, we need to
> +	  // use that target machine register info object to eliminate
> +	  // it.
> +	  TRI.eliminateFrameIndex(MI, SPAdj, RS);
> +
> +	  // Reset the iterator if we were at the beginning of the BB.
> +	  if (AtBeginning) {
> +	    I = BB->begin();
> +	    DoIncr = false;
> +	  }
> +
> +	  MI = 0;
> +	  break;
> +	}
> +
> +      if (DoIncr) ++I;
> +
>       // Update register states.
>       if (RS && MI) RS->forward(MI);
>     }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list