summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVikram S. Adve <vadve@cs.uiuc.edu>2003-09-16 05:56:22 +0000
committerVikram S. Adve <vadve@cs.uiuc.edu>2003-09-16 05:56:22 +0000
commit256fc40375ef9d409aced3297130fab61f8e4e9e (patch)
tree46de696518009f47c461dc0e0319010e37179e41
parent8579a9a38cd77f2296b9875dd655d09dfca4dd26 (diff)
downloadbcm5719-llvm-256fc40375ef9d409aced3297130fab61f8e4e9e.tar.gz
bcm5719-llvm-256fc40375ef9d409aced3297130fab61f8e4e9e.zip
Fix longjmp case so that, along with the call to abort(), we also
generate the appropriate CallArgsDescriptor and tmp. virtual regs. llvm-svn: 8554
-rw-r--r--llvm/lib/Target/Sparc/SparcInstrSelection.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/llvm/lib/Target/Sparc/SparcInstrSelection.cpp b/llvm/lib/Target/Sparc/SparcInstrSelection.cpp
index ee243334951..b5a6fe0c4c9 100644
--- a/llvm/lib/Target/Sparc/SparcInstrSelection.cpp
+++ b/llvm/lib/Target/Sparc/SparcInstrSelection.cpp
@@ -1446,8 +1446,28 @@ bool CodeGenIntrinsic(LLVMIntrinsic::ID iid, CallInst &callInstr,
case LLVMIntrinsic::longjmp: {
// call abort()
Module* M = callInstr.getParent()->getParent()->getParent();
- Function *F = M->getNamedFunction("abort");
- mvec.push_back(BuildMI(V9::CALL, 1).addReg(F));
+ const FunctionType *voidvoidFuncTy =
+ FunctionType::get(Type::VoidTy, std::vector<const Type*>(), false);
+ Function *F = M->getOrInsertFunction("abort", voidvoidFuncTy);
+ assert(F && "Unable to get or create `abort' function declaration");
+
+ // Create hidden virtual register for return address with type void*
+ TmpInstruction* retAddrReg =
+ new TmpInstruction(MachineCodeForInstruction::get(&callInstr),
+ PointerType::get(Type::VoidTy), &callInstr);
+
+ // Use a descriptor to pass information about call arguments
+ // to the register allocator. This descriptor will be "owned"
+ // and freed automatically when the MachineCodeForInstruction
+ // object for the callInstr goes away.
+ CallArgsDescriptor* argDesc =
+ new CallArgsDescriptor(&callInstr, retAddrReg, false, false);
+
+ MachineInstr* callMI = BuildMI(V9::CALL, 1).addPCDisp(F);
+ callMI->addImplicitRef(retAddrReg, /*isDef*/ true);
+
+ mvec.push_back(callMI);
+ mvec.push_back(BuildMI(V9::NOP, 0));
return true;
}
OpenPOWER on IntegriCloud