[llvm-commits] [llvm] r49922 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Dan Gohman
gohman at apple.com
Fri Apr 18 13:55:41 PDT 2008
Author: djg
Date: Fri Apr 18 15:55:41 2008
New Revision: 49922
URL: http://llvm.org/viewvc/llvm-project?rev=49922&view=rev
Log:
Fix the handling of va_copy on x86-64. As of llvm-gcc r49920
llvm-gcc is now lowering va_copy on x86-64, so this completes
the fix for PR2230.
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=49922&r1=49921&r2=49922&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Apr 18 15:55:41 2008
@@ -4954,26 +4954,16 @@
SDOperand X86TargetLowering::LowerVACOPY(SDOperand Op, SelectionDAG &DAG) {
// X86-64 va_list is a struct { i32, i32, i8*, i8* }.
+ assert(Subtarget->is64Bit() && "This code only handles 64-bit va_copy!");
SDOperand Chain = Op.getOperand(0);
SDOperand DstPtr = Op.getOperand(1);
SDOperand SrcPtr = Op.getOperand(2);
const Value *DstSV = cast<SrcValueSDNode>(Op.getOperand(3))->getValue();
const Value *SrcSV = cast<SrcValueSDNode>(Op.getOperand(4))->getValue();
- SrcPtr = DAG.getLoad(getPointerTy(), Chain, SrcPtr, SrcSV, 0);
- Chain = SrcPtr.getValue(1);
- for (unsigned i = 0; i < 3; ++i) {
- SDOperand Val = DAG.getLoad(MVT::i64, Chain, SrcPtr, SrcSV, 0);
- Chain = Val.getValue(1);
- Chain = DAG.getStore(Chain, Val, DstPtr, DstSV, 0);
- if (i == 2)
- break;
- SrcPtr = DAG.getNode(ISD::ADD, getPointerTy(), SrcPtr,
- DAG.getIntPtrConstant(8));
- DstPtr = DAG.getNode(ISD::ADD, getPointerTy(), DstPtr,
- DAG.getIntPtrConstant(8));
- }
- return Chain;
+ return DAG.getMemcpy(Chain, DstPtr, SrcPtr,
+ DAG.getIntPtrConstant(24), 8, false,
+ DstSV, 0, SrcSV, 0);
}
SDOperand
More information about the llvm-commits
mailing list