[llvm-commits] [llvm] r47978 - /llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp

Dale Johannesen dalej at apple.com
Wed Mar 5 15:31:27 PST 2008


Author: johannes
Date: Wed Mar  5 17:31:27 2008
New Revision: 47978

URL: http://llvm.org/viewvc/llvm-project?rev=47978&view=rev
Log:
Next bit of PPC ByVal handling; call-site code seems
correct now.


Modified:
    llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp

Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=47978&r1=47977&r2=47978&view=diff

==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Wed Mar  5 17:31:27 2008
@@ -1583,7 +1583,7 @@
     ((Flags & ISD::ParamFlags::ByValAlign) >> ISD::ParamFlags::ByValAlignOffs);
   SDOperand AlignNode    = DAG.getConstant(Align, MVT::i32);
   SDOperand SizeNode     = DAG.getConstant(Size, MVT::i32);
-  SDOperand AlwaysInline = DAG.getConstant(1, MVT::i32);
+  SDOperand AlwaysInline = DAG.getConstant(0, MVT::i32);
   return DAG.getMemcpy(Chain, Dst, Src, SizeNode, AlignNode, AlwaysInline);
 }
 
@@ -1633,6 +1633,7 @@
   // These operations are automatically eliminated by the prolog/epilog pass
   Chain = DAG.getCALLSEQ_START(Chain,
                                DAG.getConstant(NumBytes, PtrVT));
+  SDOperand CallSeqStart = Chain;
   
   // Set up a copy of the stack pointer for use loading and storing any
   // arguments that may not fit in the registers available for argument
@@ -1713,13 +1714,20 @@
         SDOperand AddArg = DAG.getNode(ISD::ADD, PtrVT, Arg, Const);
         if (GPR_idx != NumGPRs) {
           SDOperand Load = DAG.getLoad(PtrVT, Chain, AddArg, NULL, 0);
+          MemOpChains.push_back(Load.getValue(1));
           RegsToPass.push_back(std::make_pair(GPR[GPR_idx++], Load));
           if (isMachoABI)
             ArgOffset += PtrByteSize;
         } else {
           SDOperand AddPtr = DAG.getNode(ISD::ADD, PtrVT, PtrOff, Const);
-          MemOpChains.push_back(CreateCopyOfByValArgument(AddArg, AddPtr,
-                                Chain, Flags, DAG, Size - j));
+          SDOperand MemcpyCall = CreateCopyOfByValArgument(AddArg, AddPtr,
+                                CallSeqStart.Val->getOperand(0), 
+                                Flags, DAG, Size - j);
+          // This must go outside the CALLSEQ_START..END.
+          SDOperand NewCallSeqStart = DAG.getCALLSEQ_START(MemcpyCall,
+                               CallSeqStart.Val->getOperand(1));
+          DAG.ReplaceAllUsesWith(CallSeqStart.Val, NewCallSeqStart.Val);
+          CallSeqStart = NewCallSeqStart;
           ArgOffset += ((Size - j + 3)/4)*4;
         }
       }





More information about the llvm-commits mailing list