[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelLowering.cpp
Jim Laskey
jlaskey at apple.com
Tue Nov 28 06:54:07 PST 2006
Changes in directory llvm/lib/Target/PowerPC:
PPCISelLowering.cpp updated: 1.233 -> 1.234
---
Log message:
32-bit int space was not accounted for properly in lowerCall.
---
Diffs of the changes: (+8 -3)
PPCISelLowering.cpp | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp
diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.233 llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.234
--- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.233 Mon Nov 27 17:37:22 2006
+++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp Tue Nov 28 08:53:52 2006
@@ -1086,6 +1086,7 @@
MVT::ValueType PtrVT = DAG.getTargetLoweringInfo().getPointerTy();
bool isPPC64 = PtrVT == MVT::i64;
+ unsigned PtrByteSize = isPPC64 ? 8 : 4;
unsigned ArgOffset = PPCFrameInfo::getLinkageSize(isPPC64);
@@ -1128,7 +1129,7 @@
default: assert(0 && "Unhandled argument type!");
case MVT::i32:
// All int arguments reserve stack space.
- ArgOffset += isPPC64 ? 8 : 4;
+ ArgOffset += PtrByteSize;
if (GPR_idx != Num_GPR_Regs) {
unsigned VReg = RegMap->createVirtualRegister(&PPC::GPRCRegClass);
@@ -1266,6 +1267,7 @@
return DAG.getConstant((int)C->getValue() >> 2, MVT::i32).Val;
}
+#include <iostream>
static SDOperand LowerCALL(SDOperand Op, SelectionDAG &DAG) {
SDOperand Chain = Op.getOperand(0);
@@ -1287,8 +1289,11 @@
unsigned NumBytes = PPCFrameInfo::getLinkageSize(isPPC64);
// Add up all the space actually used.
- for (unsigned i = 0; i != NumOps; ++i)
- NumBytes += MVT::getSizeInBits(Op.getOperand(5+2*i).getValueType())/8;
+ for (unsigned i = 0; i != NumOps; ++i) {
+ unsigned ArgSize =MVT::getSizeInBits(Op.getOperand(5+2*i).getValueType())/8;
+ ArgSize = std::max(ArgSize, PtrByteSize);
+ NumBytes += ArgSize;
+ }
// The prolog code of the callee may store up to 8 GPR argument registers to
// the stack, allowing va_start to index over them in memory if its varargs.
More information about the llvm-commits
mailing list