summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMisha Brukman <brukman+llvm@gmail.com>2003-08-07 15:43:46 +0000
committerMisha Brukman <brukman+llvm@gmail.com>2003-08-07 15:43:46 +0000
commitb8db66eb17ede06548515e59b9ddd88d0967878b (patch)
treed639f3f658aecefcbc1ae8aa6018ed32b0c8b1b6
parent2010f7baec18914b8a5d1b2b4c3c21511fa6e25d (diff)
downloadllvm-b8db66eb17ede06548515e59b9ddd88d0967878b.tar.gz
llvm-b8db66eb17ede06548515e59b9ddd88d0967878b.tar.bz2
llvm-b8db66eb17ede06548515e59b9ddd88d0967878b.tar.xz
Implement LLVM intrinsics `llvm.setjmp' and `llvm.longjmp' as follows:
* setjmp() simply returns 0 * longjmp() simply calls abort() git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7676 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/SparcV9/SparcV9InstrSelection.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/lib/Target/SparcV9/SparcV9InstrSelection.cpp b/lib/Target/SparcV9/SparcV9InstrSelection.cpp
index 1654c5592c..e35024b45d 100644
--- a/lib/Target/SparcV9/SparcV9InstrSelection.cpp
+++ b/lib/Target/SparcV9/SparcV9InstrSelection.cpp
@@ -16,10 +16,8 @@
#include "llvm/CodeGen/MachineFunctionInfo.h"
#include "llvm/CodeGen/MachineCodeForInstruction.h"
#include "llvm/DerivedTypes.h"
-#include "llvm/iTerminators.h"
-#include "llvm/iMemory.h"
-#include "llvm/iOther.h"
-#include "llvm/Function.h"
+#include "llvm/Instructions.h"
+#include "llvm/Module.h"
#include "llvm/Constants.h"
#include "llvm/ConstantHandling.h"
#include "llvm/Intrinsics.h"
@@ -1435,6 +1433,22 @@ bool CodeGenIntrinsic(LLVMIntrinsic::ID iid, CallInst &callInstr,
addReg(callInstr.getOperand(1)));
return true;
+ case LLVMIntrinsic::setjmp: {
+ // act as if we return 0
+ unsigned g0 = target.getRegInfo().getZeroRegNum();
+ mvec.push_back(BuildMI(V9::ORr,3).addMReg(g0).addMReg(g0)
+ .addReg(&callInstr, MOTy::Def));
+ return true;
+ }
+
+ 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));
+ return true;
+ }
+
default:
return false;
}