[llvm-commits] [PATCH] No need to check SRetReturnReg again

Zhongxing Xu xuzhongxing at gmail.com
Mon May 24 19:46:12 PDT 2010


ping?

The reason of this change is that in LowerFormalArguments() we have:

if (Is64Bit && MF.getFunction()->hasStructRetAttr()) {
    X86MachineFunctionInfo *FuncInfo = MF.getInfo<X86MachineFunctionInfo>();
    unsigned Reg = FuncInfo->getSRetReturnReg();
    if (!Reg) {
      Reg = MF.getRegInfo().createVirtualRegister(getRegClassFor(MVT::i64));
      FuncInfo->setSRetReturnReg(Reg);
    }
    SDValue Copy = DAG.getCopyToReg(DAG.getEntryNode(), dl, Reg, InVals[0]);
    Chain = DAG.getNode(ISD::TokenFactor, dl, MVT::Other, Copy, Chain);
  }

On Fri, May 21, 2010 at 3:45 PM, Zhongxing Xu <xuzhongxing at gmail.com> wrote:

> Index: lib/Target/X86/X86ISelLowering.cpp
> ===================================================================
> --- lib/Target/X86/X86ISelLowering.cpp    (版本 104313)
> +++ lib/Target/X86/X86ISelLowering.cpp    (工作副本)
> @@ -1256,10 +1256,8 @@
>      MachineFunction &MF = DAG.getMachineFunction();
>      X86MachineFunctionInfo *FuncInfo =
> MF.getInfo<X86MachineFunctionInfo>();
>      unsigned Reg = FuncInfo->getSRetReturnReg();
> -    if (!Reg) {
> -      Reg = MRI.createVirtualRegister(getRegClassFor(MVT::i64));
> -      FuncInfo->setSRetReturnReg(Reg);
> -    }
> +    assert(Reg &&
> +           "SRetReturnReg should have been set in
> LowerFormalArguments().");
>      SDValue Val = DAG.getCopyFromReg(Chain, dl, Reg, getPointerTy());
>
>      Chain = DAG.getCopyToReg(Chain, dl, X86::RAX, Val, Flag);
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20100525/bbe64cc3/attachment.html>


More information about the llvm-commits mailing list