[llvm-commits] CVS: llvm/lib/Target/Sparc/SparcInstrSelection.cpp
Misha Brukman
brukman at cs.uiuc.edu
Thu Aug 7 10:44:00 PDT 2003
Changes in directory llvm/lib/Target/Sparc:
SparcInstrSelection.cpp updated: 1.113 -> 1.114
---
Log message:
Implement LLVM intrinsics `llvm.setjmp' and `llvm.longjmp' as follows:
* setjmp() simply returns 0
* longjmp() simply calls abort()
---
Diffs of the changes:
Index: llvm/lib/Target/Sparc/SparcInstrSelection.cpp
diff -u llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.113 llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.114
--- llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.113 Thu Aug 7 10:01:26 2003
+++ llvm/lib/Target/Sparc/SparcInstrSelection.cpp Thu Aug 7 10:43:46 2003
@@ -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"
@@ -1434,6 +1432,22 @@
addReg(callInstr.getOperand(2)).
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;
More information about the llvm-commits
mailing list