aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/Sparc/SparcV8ISelSimple.cpp
diff options
context:
space:
mode:
authorBrian Gaeke <gaeke@uiuc.edu>2004-11-04 00:27:04 +0000
committerBrian Gaeke <gaeke@uiuc.edu>2004-11-04 00:27:04 +0000
commit6931fd61c0695ca8a1d1170562b47f852e9ea70c (patch)
tree468224408e1a28974af7582cdd067f8811cec29d /lib/Target/Sparc/SparcV8ISelSimple.cpp
parent38f024daea1f27b6a8b610e3f8d21596f3e928d8 (diff)
Handle "call" operands of type long/ulong passed in registers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17464 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Sparc/SparcV8ISelSimple.cpp')
-rw-r--r--lib/Target/Sparc/SparcV8ISelSimple.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/Target/Sparc/SparcV8ISelSimple.cpp b/lib/Target/Sparc/SparcV8ISelSimple.cpp
index 5117a75576..5a19ccb3d4 100644
--- a/lib/Target/Sparc/SparcV8ISelSimple.cpp
+++ b/lib/Target/Sparc/SparcV8ISelSimple.cpp
@@ -784,12 +784,13 @@ void V8ISel::visitCallInst(CallInst &I) {
// Deal with args
static const unsigned OutgoingArgRegs[] = { V8::O0, V8::O1, V8::O2, V8::O3,
V8::O4, V8::O5 };
+ const unsigned *OAR = &OutgoingArgRegs[0];
for (unsigned i = 1; i < I.getNumOperands (); ++i) {
unsigned ArgReg = getReg (I.getOperand (i));
if (i < 7) {
if (getClassB (I.getOperand (i)->getType ()) < cLong) {
// Schlep it over into the incoming arg register
- BuildMI (BB, V8::ORrr, 2, OutgoingArgRegs[i - 1]).addReg (V8::G0)
+ BuildMI (BB, V8::ORrr, 2, *OAR++).addReg (V8::G0)
.addReg (ArgReg);
} else if (getClassB (I.getOperand (i)->getType ()) == cFloat) {
// Single-fp args are passed in integer registers; go through
@@ -798,7 +799,7 @@ void V8ISel::visitCallInst(CallInst &I) {
int FI = F->getFrameInfo()->CreateStackObject(4, FltAlign);
BuildMI (BB, V8::STFri, 3).addFrameIndex (FI).addSImm (0)
.addReg (ArgReg);
- BuildMI (BB, V8::LD, 2, OutgoingArgRegs[i - 1]).addFrameIndex (FI)
+ BuildMI (BB, V8::LD, 2, *OAR++).addFrameIndex (FI)
.addSImm (0);
} else if (getClassB (I.getOperand (i)->getType ()) == cDouble) {
// Double-fp args are passed in pairs of integer registers; go through
@@ -808,12 +809,17 @@ void V8ISel::visitCallInst(CallInst &I) {
int FI = F->getFrameInfo()->CreateStackObject(8, DblAlign);
BuildMI (BB, V8::STDFri, 3).addFrameIndex (FI).addSImm (0)
.addReg (ArgReg);
- BuildMI (BB, V8::LD, 2, OutgoingArgRegs[i - 1]).addFrameIndex (FI)
+ BuildMI (BB, V8::LD, 2, *OAR++).addFrameIndex (FI)
.addSImm (0);
- BuildMI (BB, V8::LD, 2, OutgoingArgRegs[i]).addFrameIndex (FI)
+ BuildMI (BB, V8::LD, 2, *OAR++).addFrameIndex (FI)
.addSImm (4);
+ } else if (getClassB (I.getOperand (i)->getType ()) == cLong) {
+ BuildMI (BB, V8::ORrr, 2, *OAR++).addReg (V8::G0)
+ .addReg (ArgReg);
+ BuildMI (BB, V8::ORrr, 2, *OAR++).addReg (V8::G0)
+ .addReg (ArgReg+1);
} else {
- assert (0 && "64-bit (double, long, etc.) 'call' opnds not handled");
+ assert (0 && "Unknown class?!");
}
} else {
if (i == 7 && extraStack)