[llvm-commits] [llvm] r107847 - in /llvm/trunk: include/llvm/CodeGen/RegisterScavenging.h lib/CodeGen/PrologEpilogInserter.cpp lib/CodeGen/RegisterScavenging.cpp
Jakob Stoklund Olesen
stoklund at 2pi.dk
Wed Jul 7 18:23:16 PDT 2010
On Jul 7, 2010, at 5:38 PM, Jim Grosbach wrote:
> Modified: llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp?rev=107847&r1=107846&r2=107847&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp (original)
> +++ llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Wed Jul 7 19:38:54 2010
> @@ -885,10 +885,20 @@
> // Scavenge a new scratch register
> CurrentVirtReg = Reg;
> const TargetRegisterClass *RC = Fn.getRegInfo().getRegClass(Reg);
> - CurrentScratchReg = RS->FindUnusedReg(RC);
> - if (CurrentScratchReg == 0)
> + const TargetRegisterInfo *TRI = Fn.getTarget().getRegisterInfo();
> + BitVector Candidates(TRI->getNumRegs());
> + RS->getRegsAvailable(RC, Candidates);
> +
> + // If there are any registers available, use the one that's
> + // unused for the longest after this instruction. That increases
> + // the ability to reuse the value.
> + if (Candidates.any()) {
> + MachineBasicBlock::iterator UMI;
> + CurrentScratchReg = RS->findSurvivorReg(I, Candidates, 25, UMI);
> + } else {
> // No register is "free". Scavenge a register.
> CurrentScratchReg = RS->scavengeRegister(RC, I, SPAdj);
> + }
>
> PrevValue = Value;
> }
This looks like a method that escaped from RegScavenger. Isn't RegScavenger::scavengeRegister already doing this?
I think
CurrentScratchReg = RS->scavengeRegister(RC, I, SPAdj);
is all you need.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1929 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20100707/28e49e73/attachment.bin>
More information about the llvm-commits
mailing list