summaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/LowerInvoke.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-09-05 17:48:07 +0000
committerChris Lattner <sabre@nondot.org>2006-09-05 17:48:07 +0000
commit97d2dbd100129d5aa0ee214254a854a2997a032d (patch)
tree239f93b7f715706ffc80ef4dcf6127cc1ec739db /lib/Transforms/Utils/LowerInvoke.cpp
parent7acf5f39fea463df5ad196affbef0176f3b25e0f (diff)
downloadllvm-97d2dbd100129d5aa0ee214254a854a2997a032d.tar.gz
llvm-97d2dbd100129d5aa0ee214254a854a2997a032d.tar.bz2
llvm-97d2dbd100129d5aa0ee214254a854a2997a032d.tar.xz
Fix Duraid's changes to work when TLI is null. This fixes the failing
lowerinvoke regtests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30115 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/LowerInvoke.cpp')
-rw-r--r--lib/Transforms/Utils/LowerInvoke.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/Transforms/Utils/LowerInvoke.cpp b/lib/Transforms/Utils/LowerInvoke.cpp
index 73d703b738..918055722d 100644
--- a/lib/Transforms/Utils/LowerInvoke.cpp
+++ b/lib/Transforms/Utils/LowerInvoke.cpp
@@ -113,7 +113,9 @@ bool LowerInvoke::doInitialization(Module &M) {
AbortMessage = 0;
if (ExpensiveEHSupport) {
// Insert a type for the linked list of jump buffers.
- const Type *JmpBufTy = ArrayType::get(VoidPtrTy, TLI->getJumpBufSize());
+ unsigned JBSize = TLI ? TLI->getJumpBufSize() : 0;
+ JBSize = JBSize ? JBSize : 200;
+ const Type *JmpBufTy = ArrayType::get(VoidPtrTy, JBSize);
{ // The type is recursive, so use a type holder.
std::vector<const Type*> Elements;
@@ -130,11 +132,12 @@ bool LowerInvoke::doInitialization(Module &M) {
// Now that we've done that, insert the jmpbuf list head global, unless it
// already exists.
- if (!(JBListHead = M.getGlobalVariable("llvm.sjljeh.jblist", PtrJBList)))
+ if (!(JBListHead = M.getGlobalVariable("llvm.sjljeh.jblist", PtrJBList))) {
JBListHead = new GlobalVariable(PtrJBList, false,
GlobalValue::LinkOnceLinkage,
Constant::getNullValue(PtrJBList),
"llvm.sjljeh.jblist", &M);
+ }
SetJmpFn = M.getOrInsertFunction("llvm.setjmp", Type::IntTy,
PointerType::get(JmpBufTy), (Type *)0);
LongJmpFn = M.getOrInsertFunction("llvm.longjmp", Type::VoidTy,
@@ -452,8 +455,9 @@ bool LowerInvoke::insertExpensiveEHSupport(Function &F) {
// Create an alloca for the incoming jump buffer ptr and the new jump buffer
// that needs to be restored on all exits from the function. This is an
// alloca because the value needs to be live across invokes.
+ unsigned Align = TLI ? TLI->getJumpBufAlignment() : 0;
AllocaInst *JmpBuf =
- new AllocaInst(JBLinkTy, 0, TLI->getJumpBufAlignment(), "jblink", F.begin()->begin());
+ new AllocaInst(JBLinkTy, 0, Align, "jblink", F.begin()->begin());
std::vector<Value*> Idx;
Idx.push_back(Constant::getNullValue(Type::IntTy));