Clarify the logic: the flag is renamed to `deleteFn' to signify it will delete
[oota-llvm.git] / lib / Transforms / Utils / LowerInvoke.cpp
index 24033f4876aee67eafb19a5e98f0ab825b2b197a..c486633a75a79ed97eaf21df488e224e5b1a5173 100644 (file)
 // used for a subset of the programs, it must be specifically enabled by an
 // option.
 //
+// Note that after this pass runs the CFG is not entirely accurate (exceptional
+// control flow edges are not correct anymore) so only very simple things should
+// be done after the lowerinvoke pass has run (like generation of native code).
+// This should not be used as a general purpose "my LLVM-to-LLVM pass doesn't
+// support the invoke instruction yet" lowering pass.
+//
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Transforms/Scalar.h"
@@ -271,14 +277,14 @@ bool LowerInvoke::insertExpensiveEHSupport(Function &F) {
       // Store this old value as our 'next' field, and store our alloca as the
       // current jblist.
       std::vector<Value*> Idx;
-      Idx.push_back(Constant::getNullValue(Type::LongTy));
-      Idx.push_back(ConstantUInt::get(Type::UByteTy, 0));
+      Idx.push_back(Constant::getNullValue(Type::IntTy));
+      Idx.push_back(ConstantUInt::get(Type::UIntTy, 0));
       Value *NextFieldPtr = new GetElementPtrInst(JmpBuf, Idx, "NextField", II);
       new StoreInst(OldEntry, NextFieldPtr, II);
       new StoreInst(JmpBuf, JBListHead, II);
       
       // Call setjmp, passing in the address of the jmpbuffer.
-      Idx[1] = ConstantUInt::get(Type::UByteTy, 1);
+      Idx[1] = ConstantUInt::get(Type::UIntTy, 1);
       Value *JmpBufPtr = new GetElementPtrInst(JmpBuf, Idx, "TheJmpBuf", II);
       Value *SJRet = new CallInst(SetJmpFn, JmpBufPtr, "sjret", II);
 
@@ -363,14 +369,14 @@ bool LowerInvoke::insertExpensiveEHSupport(Function &F) {
     // JBList.
     std::vector<Value*> Idx;
     Idx.push_back(Constant::getNullValue(Type::LongTy));
-    Idx.push_back(ConstantUInt::get(Type::UByteTy, 0));
+    Idx.push_back(ConstantUInt::get(Type::UIntTy, 0));
     Value *NextFieldPtr = new GetElementPtrInst(RecPtr, Idx, "NextField", RI);
     Value *NextRec = new LoadInst(NextFieldPtr, "NextRecord", RI);
     new StoreInst(NextRec, JBListHead, RI);
 
     // Now that we popped the top of the JBList, get a pointer to the jmpbuf and
     // longjmp.
-    Idx[1] = ConstantUInt::get(Type::UByteTy, 1);
+    Idx[1] = ConstantUInt::get(Type::UIntTy, 1);
     Idx[0] = new GetElementPtrInst(RecPtr, Idx, "JmpBuf", RI);
     Idx[1] = ConstantInt::get(Type::IntTy, 1);
     new CallInst(LongJmpFn, Idx, "", RI);