From b1eb987ccd86e58d81dde75424d37369785910d7 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 18 Nov 2006 01:57:19 +0000 Subject: [PATCH] on ppc64, float arguments take 8-byte stack slots not 4-byte stack slots. Also, valist should create a pointer RC reg class value, not a GPRC value. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31840 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/PowerPC/PPCISelLowering.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/Target/PowerPC/PPCISelLowering.cpp b/lib/Target/PowerPC/PPCISelLowering.cpp index e96550085a1..f85033dadad 100644 --- a/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/lib/Target/PowerPC/PPCISelLowering.cpp @@ -1155,13 +1155,13 @@ static SDOperand LowerFORMAL_ARGUMENTS(SDOperand Op, SelectionDAG &DAG, case MVT::f32: case MVT::f64: // All FP arguments reserve stack space. - ArgOffset += ObjSize; + ArgOffset += isPPC64 ? 8 : ObjSize; // Every 4 bytes of argument space consumes one of the GPRs available for // argument passing. if (GPR_idx != Num_GPR_Regs) { ++GPR_idx; - if (ObjSize == 8 && GPR_idx != Num_GPR_Regs) + if (ObjSize == 8 && GPR_idx != Num_GPR_Regs && !isPPC64) ++GPR_idx; } if (FPR_idx != Num_FPR_Regs) { @@ -1226,7 +1226,12 @@ static SDOperand LowerFORMAL_ARGUMENTS(SDOperand Op, SelectionDAG &DAG, // result of va_next. SmallVector MemOps; for (; GPR_idx != Num_GPR_Regs; ++GPR_idx) { - unsigned VReg = RegMap->createVirtualRegister(&PPC::GPRCRegClass); + unsigned VReg; + if (isPPC64) + VReg = RegMap->createVirtualRegister(&PPC::G8RCRegClass); + else + VReg = RegMap->createVirtualRegister(&PPC::GPRCRegClass); + MF.addLiveIn(GPR[GPR_idx], VReg); SDOperand Val = DAG.getCopyFromReg(Root, VReg, PtrVT); SDOperand Store = DAG.getStore(Val.getValue(1), Val, FIN, NULL, 0); -- 2.34.1