[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelLowering.cpp
Chris Lattner
lattner at cs.uiuc.edu
Tue May 16 11:52:05 PDT 2006
Changes in directory llvm/lib/Target/PowerPC:
PPCISelLowering.cpp updated: 1.172 -> 1.173
---
Log message:
Vector args passed in registers don't reserve stack space.
---
Diffs of the changes: (+26 -11)
PPCISelLowering.cpp | 37 ++++++++++++++++++++++++++-----------
1 files changed, 26 insertions(+), 11 deletions(-)
Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp
diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.172 llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.173
--- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.172 Tue May 16 13:18:50 2006
+++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp Tue May 16 13:51:52 2006
@@ -765,20 +765,43 @@
MVT::ValueType ObjectVT = Op.getValue(ArgNo).getValueType();
unsigned ObjSize = MVT::getSizeInBits(ObjectVT)/8;
+ unsigned CurArgOffset = ArgOffset;
+
switch (ObjectVT) {
default: assert(0 && "Unhandled argument type!");
case MVT::i32:
- if (!ArgLive) break;
+ // All int arguments reserve stack space.
+ ArgOffset += 4;
+
+ if (!ArgLive) {
+ if (GPR_remaining > 0) {
+ --GPR_remaining;
+ ++GPR_idx;
+ }
+ break;
+ }
if (GPR_remaining > 0) {
unsigned VReg = RegMap->createVirtualRegister(&PPC::GPRCRegClass);
MF.addLiveIn(GPR[GPR_idx], VReg);
ArgVal = DAG.getCopyFromReg(Root, VReg, MVT::i32);
+ --GPR_remaining;
+ ++GPR_idx;
} else {
needsLoad = true;
}
break;
case MVT::f32:
case MVT::f64:
+ // All FP arguments reserve stack space.
+ ArgOffset += ObjSize;
+
+ // Every 4 bytes of argument space consumes one of the GPRs available for
+ // argument passing.
+ if (GPR_remaining > 0) {
+ unsigned delta = (GPR_remaining > 1 && ObjSize == 8) ? 2 : 1;
+ GPR_remaining -= delta;
+ GPR_idx += delta;
+ }
if (!ArgLive) {
if (FPR_remaining > 0) {
--FPR_remaining;
@@ -804,6 +827,7 @@
case MVT::v4i32:
case MVT::v8i16:
case MVT::v16i8:
+ // Note that vector arguments in registers don't reserve stack space.
if (!ArgLive) {
if (VR_remaining > 0) {
--VR_remaining;
@@ -829,21 +853,12 @@
// We need to load the argument to a virtual register if we determined above
// that we ran out of physical registers of the appropriate type
if (needsLoad) {
- int FI = MFI->CreateFixedObject(ObjSize, ArgOffset);
+ int FI = MFI->CreateFixedObject(ObjSize, CurArgOffset);
SDOperand FIN = DAG.getFrameIndex(FI, MVT::i32);
ArgVal = DAG.getLoad(ObjectVT, Root, FIN,
DAG.getSrcValue(NULL));
}
- // Every 4 bytes of argument space consumes one of the GPRs available for
- // argument passing.
- if (GPR_remaining > 0) {
- unsigned delta = (GPR_remaining > 1 && ObjSize == 8) ? 2 : 1;
- GPR_remaining -= delta;
- GPR_idx += delta;
- }
- ArgOffset += ObjSize;
-
if (ArgVal.Val == 0)
ArgVal = DAG.getNode(ISD::UNDEF, ObjectVT);
ArgValues.push_back(ArgVal);
More information about the llvm-commits
mailing list