[llvm-commits] [llvm] r47863 - in /llvm/trunk: include/llvm/CodeGen/RegisterScavenging.h lib/Target/PowerPC/PPCInstrInfo.cpp lib/Target/PowerPC/PPCInstrInfo.td lib/Target/PowerPC/PPCMachineFunctionInfo.h lib/Target/PowerPC/PPCRegisterInfo.cpp lib

Bill Wendling isanbard at gmail.com
Mon Mar 3 15:19:03 PST 2008


On Mon, Mar 3, 2008 at 3:05 PM, Evan Cheng <evan.cheng at apple.com> wrote:
> Thanks. Some comments below.
>
>  > @@ -351,22 +353,30 @@
>  >     NewMIs.push_back(addFrameReference(BuildMI(TII.get(PPC::STFS))
>  >                                 .addReg(SrcReg, false, false,
>  > isKill), FrameIdx));
>  >   } else if (RC == PPC::CRRCRegisterClass) {
>  > -    // FIXME: We use R0 here, because it isn't available for RA.
>  > -    // We need to store the CR in the low 4-bits of the saved
>  > value.  First,
>  > -    // issue a MFCR to save all of the CRBits.
>  > -    NewMIs.push_back(BuildMI(TII.get(PPC::MFCR), PPC::R0));
>  > +    if (!isPPC64) {             // FIXME (64-bit): Enable
>  > +
>  > NewMIs.push_back(addFrameReference(BuildMI(TII.get(PPC::SPILL_CR))
>  > +                                         .addReg(SrcReg, false,
>  > false, isKill),
>  > +                                      FrameIdx));
>  > +      return true;
>  > +    } else {
>  > +      // FIXME: We use R0 here, because it isn't available for RA.
>  > We need to
>  > +      // store the CR in the low 4-bits of the saved value.  First,
>  > issue a MFCR
>  > +      // to save all of the CRBits.
>  > +      NewMIs.push_back(BuildMI(TII.get(PPC::MFCR), PPC::R0));
>
>  Is this right? I thought the whole point of using RS is so we don't
>  have to reserved R0?
>
This is part of a "FIXME". PPC64 can't handle the register scavenger
just yet. When it does, then this will be removed.

>  > +  // FIXME (64-bit): Use "findScratchRegister"
>  > +  unsigned Reg;
>  > +  if (!LP64)
>  > +    Reg = findScratchRegister(II, RS, RC, SPAdj);
>  > +  else
>  > +    Reg = PPC::R0;
>
>  Style police: unsigned Reg = ILP64 ? PPC:R0 : findScratchRegister()...
>
>  Perhaps an assertion if findScratchRegister fails to scavenge a
>  register?
>
Sure. :-)

-bw



More information about the llvm-commits mailing list