mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-21 06:30:16 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49922 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7e03280b53
commit
28269139ee
@ -4954,26 +4954,16 @@ SDOperand X86TargetLowering::LowerVASTART(SDOperand Op, SelectionDAG &DAG) {
|
|||||||
|
|
||||||
SDOperand X86TargetLowering::LowerVACOPY(SDOperand Op, SelectionDAG &DAG) {
|
SDOperand X86TargetLowering::LowerVACOPY(SDOperand Op, SelectionDAG &DAG) {
|
||||||
// X86-64 va_list is a struct { i32, i32, i8*, i8* }.
|
// 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 Chain = Op.getOperand(0);
|
||||||
SDOperand DstPtr = Op.getOperand(1);
|
SDOperand DstPtr = Op.getOperand(1);
|
||||||
SDOperand SrcPtr = Op.getOperand(2);
|
SDOperand SrcPtr = Op.getOperand(2);
|
||||||
const Value *DstSV = cast<SrcValueSDNode>(Op.getOperand(3))->getValue();
|
const Value *DstSV = cast<SrcValueSDNode>(Op.getOperand(3))->getValue();
|
||||||
const Value *SrcSV = cast<SrcValueSDNode>(Op.getOperand(4))->getValue();
|
const Value *SrcSV = cast<SrcValueSDNode>(Op.getOperand(4))->getValue();
|
||||||
|
|
||||||
SrcPtr = DAG.getLoad(getPointerTy(), Chain, SrcPtr, SrcSV, 0);
|
return DAG.getMemcpy(Chain, DstPtr, SrcPtr,
|
||||||
Chain = SrcPtr.getValue(1);
|
DAG.getIntPtrConstant(24), 8, false,
|
||||||
for (unsigned i = 0; i < 3; ++i) {
|
DstSV, 0, SrcSV, 0);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SDOperand
|
SDOperand
|
||||||
|
Loading…
x
Reference in New Issue
Block a user