diff options
author | Andrew Lenharth <andrewl@lenharth.org> | 2005-06-22 21:04:42 +0000 |
---|---|---|
committer | Andrew Lenharth <andrewl@lenharth.org> | 2005-06-22 21:04:42 +0000 |
commit | 213e557cef3e653e2d3a00b07b137c143128430a (patch) | |
tree | 2b864d830fba118c8d2fa07144629603caf85214 /lib/Target | |
parent | d0a4c62a031ea9f0e2be2fe1f16af2209602ed94 (diff) | |
download | external_llvm-213e557cef3e653e2d3a00b07b137c143128430a.zip external_llvm-213e557cef3e653e2d3a00b07b137c143128430a.tar.gz external_llvm-213e557cef3e653e2d3a00b07b137c143128430a.tar.bz2 |
If we support structs as va_list, we must pass pointers to them to va_copy
See last commit for LangRef, this implements it on all targets.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22273 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r-- | lib/Target/CBackend/CBackend.cpp | 2 | ||||
-rw-r--r-- | lib/Target/CBackend/Writer.cpp | 2 | ||||
-rw-r--r-- | lib/Target/IA64/IA64ISelPattern.cpp | 13 | ||||
-rw-r--r-- | lib/Target/PowerPC/PPC64ISelPattern.cpp | 14 | ||||
-rw-r--r-- | lib/Target/SparcV9/SparcV9BurgISel.cpp | 17 | ||||
-rw-r--r-- | lib/Target/X86/X86ISelPattern.cpp | 13 |
6 files changed, 14 insertions, 47 deletions
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index 6597993..c30b306 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -1495,7 +1495,7 @@ void CWriter::visitCallInst(CallInst &I) { Out << "0; "; Out << "va_copy(*(va_list*)"; writeOperand(I.getOperand(1)); - Out << ", *(va_list*)&"; + Out << ", *(va_list*)"; writeOperand(I.getOperand(2)); Out << ')'; return; diff --git a/lib/Target/CBackend/Writer.cpp b/lib/Target/CBackend/Writer.cpp index 6597993..c30b306 100644 --- a/lib/Target/CBackend/Writer.cpp +++ b/lib/Target/CBackend/Writer.cpp @@ -1495,7 +1495,7 @@ void CWriter::visitCallInst(CallInst &I) { Out << "0; "; Out << "va_copy(*(va_list*)"; writeOperand(I.getOperand(1)); - Out << ", *(va_list*)&"; + Out << ", *(va_list*)"; writeOperand(I.getOperand(2)); Out << ')'; return; diff --git a/lib/Target/IA64/IA64ISelPattern.cpp b/lib/Target/IA64/IA64ISelPattern.cpp index 0830468..804ad99 100644 --- a/lib/Target/IA64/IA64ISelPattern.cpp +++ b/lib/Target/IA64/IA64ISelPattern.cpp @@ -120,10 +120,6 @@ namespace { LowerVAArgNext(SDOperand Chain, SDOperand VAList, const Type *ArgTy, SelectionDAG &DAG); - virtual std::pair<SDOperand,SDOperand> - LowerVACopy(SDOperand Chain, SDOperand Src, SDOperand Dest, - SelectionDAG &DAG); - virtual std::pair<SDOperand, SDOperand> LowerFrameReturnAddress(bool isFrameAddr, SDOperand Chain, unsigned Depth, SelectionDAG &DAG); @@ -413,15 +409,6 @@ LowerVAArgNext(SDOperand Chain, SDOperand VAList, return std::make_pair(Result, Chain); } -std::pair<SDOperand,SDOperand> -IA64TargetLowering::LowerVACopy(SDOperand Chain, SDOperand Src, - SDOperand Dest, SelectionDAG &DAG) -{ - SDOperand Result = DAG.getNode(ISD::STORE, MVT::Other, Chain, - Src, Dest, DAG.getSrcValue(NULL)); - return std::make_pair(Result, Result); -} - std::pair<SDOperand, SDOperand> IA64TargetLowering:: LowerFrameReturnAddress(bool isFrameAddress, SDOperand Chain, unsigned Depth, SelectionDAG &DAG) { diff --git a/lib/Target/PowerPC/PPC64ISelPattern.cpp b/lib/Target/PowerPC/PPC64ISelPattern.cpp index 20fd724..6761ab1 100644 --- a/lib/Target/PowerPC/PPC64ISelPattern.cpp +++ b/lib/Target/PowerPC/PPC64ISelPattern.cpp @@ -104,10 +104,6 @@ namespace { LowerVAArgNext(SDOperand Chain, SDOperand VAList, const Type *ArgTy, SelectionDAG &DAG); - virtual std::pair<SDOperand,SDOperand> - LowerVACopy(SDOperand Chain, SDOperand Src, SDOperand Dest, - SelectionDAG &DAG); - virtual std::pair<SDOperand, SDOperand> LowerFrameReturnAddress(bool isFrameAddr, SDOperand Chain, unsigned Depth, SelectionDAG &DAG); @@ -390,16 +386,6 @@ LowerVAArgNext(SDOperand Chain, SDOperand VAList, return std::make_pair(Result, Chain); } -std::pair<SDOperand,SDOperand> -PPC64TargetLowering::LowerVACopy(SDOperand Chain, SDOperand Src, - SDOperand Dest, SelectionDAG &DAG) -{ - SDOperand Result = DAG.getNode(ISD::STORE, MVT::Other, Chain, - Src, Dest, DAG.getSrcValue(NULL)); - return std::make_pair(Result, Result); -} - - std::pair<SDOperand, SDOperand> PPC64TargetLowering:: LowerFrameReturnAddress(bool isFrameAddress, SDOperand Chain, unsigned Depth, SelectionDAG &DAG) { diff --git a/lib/Target/SparcV9/SparcV9BurgISel.cpp b/lib/Target/SparcV9/SparcV9BurgISel.cpp index cc2c81f..a6722b1 100644 --- a/lib/Target/SparcV9/SparcV9BurgISel.cpp +++ b/lib/Target/SparcV9/SparcV9BurgISel.cpp @@ -2881,11 +2881,18 @@ static bool CodeGenIntrinsic(Intrinsic::ID iid, CallInst &callInstr, return true; // no-op on SparcV9 case Intrinsic::vacopy: - // Simple store of current va_list (arg2) to new va_list (arg1) - mvec.push_back(BuildMI(V9::STXi, 3). - addReg(callInstr.getOperand(2)). - addReg(callInstr.getOperand(1)).addSImm(0)); - return true; + { + MachineCodeForInstruction& m1 = MachineCodeForInstruction::get(&callInstr); + TmpInstruction* VReg = + new TmpInstruction(m1, callInstr.getOperand(1)->getType()); + + // Simple store of current va_list (arg2) to new va_list (arg1) + mvec.push_back(BuildMI(V9::LDXi, 3). + addReg(callInstr.getOperand(2)).addSImm(0).addRegDef(VReg)); + mvec.push_back(BuildMI(V9::STXi, 3). + addReg(VReg).addReg(callInstr.getOperand(1)).addSImm(0)); + return true; + } } } diff --git a/lib/Target/X86/X86ISelPattern.cpp b/lib/Target/X86/X86ISelPattern.cpp index d28de28..e858c4c 100644 --- a/lib/Target/X86/X86ISelPattern.cpp +++ b/lib/Target/X86/X86ISelPattern.cpp @@ -182,10 +182,6 @@ namespace { LowerVAArgNext(SDOperand Chain, SDOperand VAList, const Type *ArgTy, SelectionDAG &DAG); - virtual std::pair<SDOperand,SDOperand> - LowerVACopy(SDOperand Chain, SDOperand Src, SDOperand Dest, - SelectionDAG &DAG); - virtual std::pair<SDOperand, SDOperand> LowerFrameReturnAddress(bool isFrameAddr, SDOperand Chain, unsigned Depth, SelectionDAG &DAG); @@ -475,15 +471,6 @@ X86TargetLowering::LowerVAArgNext(SDOperand Chain, SDOperand VAList, return std::make_pair(Result, Chain); } -std::pair<SDOperand,SDOperand> -X86TargetLowering::LowerVACopy(SDOperand Chain, SDOperand Src, - SDOperand Dest, SelectionDAG &DAG) -{ - SDOperand Result = DAG.getNode(ISD::STORE, MVT::Other, Chain, - Src, Dest, DAG.getSrcValue(NULL)); - return std::make_pair(Result, Result); -} - //===----------------------------------------------------------------------===// // Fast Calling Convention implementation //===----------------------------------------------------------------------===// |