aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/Sparc/SparcV8ISelSimple.cpp
diff options
context:
space:
mode:
authorBrian Gaeke <gaeke@uiuc.edu>2004-04-06 22:09:23 +0000
committerBrian Gaeke <gaeke@uiuc.edu>2004-04-06 22:09:23 +0000
commitea8494bb89f5170b62e492585588fdb5f1ba64be (patch)
tree225cfcad5354edf857cfe7a7805bbb564803aa01 /lib/Target/Sparc/SparcV8ISelSimple.cpp
parent94f0c5286bad92bb373d44517ab70aa9694e745b (diff)
downloadexternal_llvm-ea8494bb89f5170b62e492585588fdb5f1ba64be.zip
external_llvm-ea8494bb89f5170b62e492585588fdb5f1ba64be.tar.gz
external_llvm-ea8494bb89f5170b62e492585588fdb5f1ba64be.tar.bz2
Deal with call return values.
Don't put NOPs in delay slots at all. We'll have a fix-up pass later. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12725 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Sparc/SparcV8ISelSimple.cpp')
-rw-r--r--lib/Target/Sparc/SparcV8ISelSimple.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/Target/Sparc/SparcV8ISelSimple.cpp b/lib/Target/Sparc/SparcV8ISelSimple.cpp
index 05a1920..8ae5a0c 100644
--- a/lib/Target/Sparc/SparcV8ISelSimple.cpp
+++ b/lib/Target/Sparc/SparcV8ISelSimple.cpp
@@ -229,8 +229,22 @@ bool V8ISel::runOnFunction(Function &Fn) {
void V8ISel::visitCallInst(CallInst &I) {
assert (I.getNumOperands () == 1 && "Can't handle call args yet");
+ unsigned DestReg = getReg (I);
BuildMI (BB, V8::CALL, 1).addPCDisp (I.getOperand (0));
- BuildMI (BB, V8::NOP, 0); // NOP in delay slot
+ if (I.getType ()->getPrimitiveID () == Type::VoidTyID)
+ return;
+ // Deal w/ return value
+ switch (getClass (I.getType ())) {
+ case cByte:
+ case cShort:
+ case cInt:
+ // Schlep it over into the destination register
+ BuildMI (BB, V8::ORrr, 2, DestReg).addReg(V8::G0).addReg(V8::O0);
+ break;
+ default:
+ visitInstruction (I);
+ return;
+ }
}
void V8ISel::visitReturnInst(ReturnInst &I) {