summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2009-05-12 23:59:14 +0000
committerJim Grosbach <grosbach@apple.com>2009-05-12 23:59:14 +0000
commitaeca45dd6f169a0cd7ca4bf012c26fbc0483f36b (patch)
tree62d60013bb864e868c6d5af3512a3b25a7493527 /llvm/lib/CodeGen
parent85cca64dd759a1225544d58b54d612f99940b998 (diff)
downloadbcm5719-llvm-aeca45dd6f169a0cd7ca4bf012c26fbc0483f36b.tar.gz
bcm5719-llvm-aeca45dd6f169a0cd7ca4bf012c26fbc0483f36b.zip
Add support for GCC compatible builtin setjmp and longjmp intrinsics. This is
a supporting preliminary patch for GCC-compatible SjLJ exception handling. Note that these intrinsics are not designed to be invoked directly by the user, but rather used by the front-end as target hooks for exception handling. llvm-svn: 71610
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/MachineFunction.cpp1
-rw-r--r--llvm/lib/CodeGen/PrologEpilogInserter.cpp2
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp6
3 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp
index 5135308e980..cb19bec0896 100644
--- a/llvm/lib/CodeGen/MachineFunction.cpp
+++ b/llvm/lib/CodeGen/MachineFunction.cpp
@@ -121,6 +121,7 @@ MachineFunction::MachineFunction(const Function *F,
MachineRegisterInfo(*TM.getRegisterInfo());
else
RegInfo = 0;
+ HasBuiltinSetjmp = false;
MFInfo = 0;
FrameInfo = new (Allocator.Allocate<MachineFrameInfo>())
MachineFrameInfo(*TM.getFrameInfo());
diff --git a/llvm/lib/CodeGen/PrologEpilogInserter.cpp b/llvm/lib/CodeGen/PrologEpilogInserter.cpp
index 6f95d1c3cfe..d9665ccc15e 100644
--- a/llvm/lib/CodeGen/PrologEpilogInserter.cpp
+++ b/llvm/lib/CodeGen/PrologEpilogInserter.cpp
@@ -180,7 +180,7 @@ void PEI::calculateCalleeSavedRegisters(MachineFunction &Fn) {
std::vector<CalleeSavedInfo> CSI;
for (unsigned i = 0; CSRegs[i]; ++i) {
unsigned Reg = CSRegs[i];
- if (Fn.getRegInfo().isPhysRegUsed(Reg)) {
+ if (Fn.getRegInfo().isPhysRegUsed(Reg) || Fn.doesHaveBuiltinSetjmp()) {
// If the reg is modified, save it!
CSI.push_back(CalleeSavedInfo(Reg, CSRegClasses[i]));
} else {
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
index b340d0c971b..cecd529707c 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
@@ -3849,6 +3849,12 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
case Intrinsic::longjmp:
return "_longjmp"+!TLI.usesUnderscoreLongJmp();
break;
+ case Intrinsic::builtinsetjmp:
+ // Mark this function has using builtin_setjmp so context gets preserved
+ DAG.getMachineFunction().setHasBuiltinSetjmp(true);
+ // Turn it into a target intrinsic node for the codegen
+ visitTargetIntrinsic(I, Intrinsic);
+ return 0;
case Intrinsic::memcpy: {
SDValue Op1 = getValue(I.getOperand(1));
SDValue Op2 = getValue(I.getOperand(2));
OpenPOWER on IntegriCloud