[llvm-commits] CVS: llvm/lib/Transforms/Utils/LowerInvoke.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Sep 5 10:48:21 PDT 2006



Changes in directory llvm/lib/Transforms/Utils:

LowerInvoke.cpp updated: 1.40 -> 1.41
---
Log message:

Fix Duraid's changes to work when TLI is null.  This fixes the failing 
lowerinvoke regtests.


---
Diffs of the changes:  (+7 -3)

 LowerInvoke.cpp |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)


Index: llvm/lib/Transforms/Utils/LowerInvoke.cpp
diff -u llvm/lib/Transforms/Utils/LowerInvoke.cpp:1.40 llvm/lib/Transforms/Utils/LowerInvoke.cpp:1.41
--- llvm/lib/Transforms/Utils/LowerInvoke.cpp:1.40	Mon Sep  4 01:21:35 2006
+++ llvm/lib/Transforms/Utils/LowerInvoke.cpp	Tue Sep  5 12:48:07 2006
@@ -113,7 +113,9 @@
   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 @@
 
     // 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 @@
     // 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));






More information about the llvm-commits mailing list